How to get metadata of a coin from the sui::coin::Coin object

I’m trying to add coin medata (name, symbol) to another object field in sui move. how do i go about that?

3 Likes

I think you can emit event to let front-end catch the object id of metadata, or… just write down the object id.
I have no idea for the third way.

1 Like

Hey teepy, lmk if this addresses your questions:

For some object, the associated coin metadata can be fetched with an RPC call:
curl -X POST [https://fullnode.mainnet.sui.io:443](https://fullnode.mainnet.sui.io/) \ -H 'Content-Type: application/json' \ -d '{"jsonrpc": "2.0", "id": 1, "method": "suix_getCoinMetadata", "params": ["0x2::sui::SUI"]}' {"jsonrpc":"2.0","result":{"decimals":9,"name":"Sui","symbol":"SUI","description":"","iconUrl":null,"id":"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3"},"id":1}%

If you’re trying to add CoinMetadata, I believe you should be able to add it as you would any other field to an object. I could be wrong here though

1 Like