Skip to content

Instantly share code, notes, and snippets.

@levicook
Created September 9, 2021 13:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save levicook/cb7245be2eb9ed4f7010a37483380be8 to your computer and use it in GitHub Desktop.
Save levicook/cb7245be2eb9ed4f7010a37483380be8 to your computer and use it in GitHub Desktop.
token accounts for a specific mint
curl http://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
{
"encoding": "jsonParsed",
"filters": [
{
"dataSize": 165
},
{
"memcmp": {
"offset": 0,
"bytes": "6QtTzANFq51mu57vyVQZmz6TL1qcQdZGdQcvHrX94b1c"
}
}
]
}
]
}
' --silent | jq .
{
"jsonrpc": "2.0",
"result": [
{
"account": {
"data": {
"parsed": {
"info": {
"isNative": false,
"mint": "6QtTzANFq51mu57vyVQZmz6TL1qcQdZGdQcvHrX94b1c",
"owner": "JUskoxS2PTiaBpxfGaAPgf3cUNhdeYFGMKdL6mZKKfR",
"state": "initialized",
"tokenAmount": {
"amount": "1",
"decimals": 0,
"uiAmount": 1,
"uiAmountString": "1"
}
},
"type": "account"
},
"program": "spl-token",
"space": 165
},
"executable": false,
"lamports": 2039280,
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"rentEpoch": 220
},
"pubkey": "FuZ1SaXdEX4WGDA2qpva1rtfkgQ6hmxir9e3PR8XGdZE"
}
],
"id": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment