Fungible Token (CW20) integration for wallet
It is recommend to use Horoscope, the interchain indexer for querying CW20 data on Aura Network. Other interaction with the CW20 contract can be executed by sending corresponding CosmWasm transaction to the network.
1. Querying CW20
List all CW20 asset of one address
Input:
- Selected chain: xstaxy/euphoria/serenity
- Owner address
- Limit, offset It can be retrieved from the Horoscope like shown below:
- euphoria
- xstaxy
- serenity
curl -L -X POST 'https://indexer-v2.staging.aurascan.io/api/v2/graphql' \
-H 'Content-Type: application/json' \
--data-raw '{
"operationName": "CW20",
"query": "query CW20($offset: Int = null, $limit: Int = 10, $address: String = null) { euphoria { cw20_holder(limit: $limit, offset: $offset, where: {address: {_eq: $address}}) { id address amount cw20_contract { marketing_info smart_contract { address } symbol } } } }",
"variables": {
"address": "aura1trqfuz89vxe745lmn2yfedt7d4xnpcpvltc86e",
"offset": null,
"limit": 10
}
}'
curl -L -X POST 'https://horoscope.aura.network/api/v2/graphql' \
-H 'Content-Type: application/json' \
--data-raw '{
"operationName": "CW20",
"query": "query CW20($offset: Int = null, $limit: Int = 10, $address: String = null) { xstaxy { cw20_holder(limit: $limit, offset: $offset, where: {address: {_eq: $address}}) { id address amount cw20_contract { marketing_info smart_contract { address } symbol } } } }",
"variables": {
"address": "aura1trqfuz89vxe745lmn2yfedt7d4xnpcpvltc86e",
"offset": null,
"limit": 10
}
}'
curl -L -X POST 'https://indexer-v2.dev.aurascan.io/api/v2/graphql' \
-H 'Content-Type: application/json' \
--data-raw '{
"operationName": "CW20",
"query": "query CW20($offset: Int = null, $limit: Int = 10, $address: String = null) { serenity { cw20_holder(limit: $limit, offset: $offset, where: {address: {_eq: $address}}) { id address amount cw20_contract { marketing_info smart_contract { address } symbol } } } }",
"variables": {
"address": "aura1trqfuz89vxe745lmn2yfedt7d4xnpcpvltc86e",
"offset": null,
"limit": 10
}
}'
Parse output
This is an output of get detail CW20:
{
"code": 200,
"message": "Successful",
"data": {
"euphoria": {
"cw20_holder": [
{
"id": 468,
"address": "aura1trqfuz89vxe745lmn2yfedt7d4xnpcpvltc86e",
"amount": 1e+21,
"cw20_contract": {
"marketing_info": {
"logo": null,
"project": null,
"marketing": null,
"description": null
},
"smart_contract": {
"address": "aura14ezx5er4hd2yr87etadq2zuyqyqqfy82t84wlj8cz2sl4mmnh04sj9rhfk"
},
"symbol": "C98"
}
},
{
"id": 476,
"address": "aura1trqfuz89vxe745lmn2yfedt7d4xnpcpvltc86e",
"amount": 1e+21,
"cw20_contract": {
"marketing_info": {
"logo": null,
"project": null,
"marketing": null,
"description": null
},
"smart_contract": {
"address": "aura1vfy9ythluhumtltwra8yu4gwywp75j3mftzxjfh6l2yn3rnew3js6z26jg"
},
"symbol": "MSTR"
}
}
]
}
}
}