CAIPs
CAIPs copied to clipboard
CAIP-19: add supports for assets on Solana
On solana, all contracts are stateless and state is instead represented using "accounts". More specifically, all fungible and non-fungible tokens are using the same instance of token contracts and for each token:
- 1 single global "mint" account instance is used for the global data like "total supply"
- each token account represent an account balance belong to a certain address
And the difference between fungible token and non-fungible token is that non-fungible token mint has a total supply of 1 and zero decimal place. So maybe we could use mint address and account address for solana here. Based on CAIP-19 and CAIP-30
note Solana support semi-fungible token where 1 mints have multiple token account As a reference OpenSea beta is also using mint as "token ID" : https://opensea.io/assets/solana/3Fif3sYuL7vfVifb3gDYQym8THCfaU3DQo1ctuXMu7dz
eg.
# CryptoKitties Collectible ID
eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769
# One Solana Mainnet NFT
solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-mint:{the-token-mint-address}/{the-token-account-address}
Very interested! Could I ask you to check out namespaces/template and caip104 and open a PR to fit the model of: namespaces/solana/caip19.md ? Ping me if you have any questions!
https://github.com/ChainAgnostic/namespaces/pull/25 @bumblefudge something like this? Or do I need to open a PR in /CAIPs repo?
well-done, this is perfect!
I think it should be the mint address only to specify the asset for fungible token
I would pick spl-token as it is the way Solana called tokens:
so
Solana USDC token example
solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
@antoineherzog agree that we could consider using "spl-token" as the namespace here. Just tht spl-token-mint
might be more explicit.
But mint address can be used to identify the asset type for both fungible token and non-fungible token. Could you elaborate on why "only to specify fungible token" ?
@antoineherzog @bumblefudge actually spl-token
is better since it's also shorter. let's go with
solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
@antoineherzog how about just token
because in CAIP-19 draft:
The method specific identifier is simply a [CAIP-19 Asset ID](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-19.md) where all / characters are replaced by _, in order to comply with the DID spec.
solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ_spl-token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
using both '_' and '-' makes it kinda confusing
Yes token
or mint
could be fine!
https://github.com/ChainAgnostic/namespaces/pull/25 is merged. So this is resolved.