Closed nicbus closed 5 months ago
Well, this is correct amount, just encoded with the same encoding we use in invoices (non-human readable - base32, only letters, no numbers). Why? Since at this level we do not use interface and thus know nothing about contract precision (and it can be not even a RGB20 contract). Thus, the only way to check the owned amount in meaningful way is to interface contract through one of RGB20 interfaces - and this should be working
the only way to check the owned amount in meaningful way is to interface contract through one of RGB20 interfaces
I don't see a way to do this via CLI (rgb-wallet
) at the moment.
I was able to have the human-readable amount displayed by modifying the state
command to return allocation.state.value()
instead of allocation.state
as the value
field. I think this makes sense, as that's already happening only for fungible contracts. I can open a PR with this tiny change if you agree.
the only way to check the owned amount in meaningful way is to interface contract through one of RGB20 interfaces
This has to be added as a dedicated command.
I was able to have the human-readable amount displayed by modifying the state command to return allocation.state.value() instead of allocation.state as the value field. I think this makes sense, as that's already happening only for fungible contracts. I can open a PR with this tiny change if you agree.
I am fine with that. I am still a little confused why do we need to display something of no meaning - and asset value has no meaning unless it is equipped with precision information coming from RGB20 interfaces
This has to be added as a dedicated command.
I think the state
command is still a good place to report this info, as it's showing the global state (which includes the precision) and the allocations. It just currently shows a value that the user cannot interpret.
I am fine with that. I am still a little confused why do we need to display something of no meaning - and asset value has no meaning unless it is equipped with precision information coming from RGB20 interfaces
IMO rgb-wallet's CLI needs to give users a way to interact with contracts, amounts included. Having the amount as an integer looks ok to me and it would also stay in sync with the invoice command, which also takes the amount as an integer.
I see the point in having the precision information as well, but I think having it displayed as part of the "Global" section is enough.
After all, the CLI is not providing a full-fledged interface to RGB and all its features, bells and whistles. Rather, if I understood it correctly, it's trying to give a simple and easy to use interface that also tries to remain quite agnostic towards RGB internals. For these reasons I'm not worried about having a fractional amount that includes the precision and would just restore the basic CLI functionality with the suggested change.
Ok, argument that precision is in the global state makes sense, so I do agree. I can do the change - or do you want to do it?
It's a simple (one line) change I already have tested locally, so I'll take care of opening a PR for this.
I have updated
rgb-sandbox
to the0.11.0-beta.6
version ofrgb-wallet
andrgb-schemata
.The run proceeds up to the issuance, which completes with success, but then the contract state doesn't show the correct owned amount.
This is the used contract yaml:
This is the issuance command:
This is the contract state after issuance:
These are the unspents after the issuance:
This is the data directory for wallet 0: wallet_0.tar.gz