getViewFunction
Returns a specific view of on-chain data. This endpoint requires an rpcX package that implements the view function interface to be published.
Parameters
Package <string>
- Identifier of the rpcX package that contains the view function.
Function <string>
- Identifier of the view function.
Params <string>
- Any additional params that must be passed to the view function.
Result
The result will be an RpcResponse JSON object with the value
field set to the output of the rpcX package's view function.
Code sample
curl "https://testnet.atlas.xyz" -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": "5fe31e89-98c0-4563-9900-81035e79ff6c",
"method": "getViewFunction",
"params": [
"std-view-function",
{
"command": "view-token-account",
"params": "436uiYnRENKqrf97Zp8HYw47aSorsjYDBZpuAK2uazbs"
}
]
}
'
Response
{
"jsonrpc": "2.0",
"id": "5fe31e89-98c0-4563-9900-81035e79ff6c",
"result": {
"context": {
"slot": 1440143
},
"value": {
"amount": "20000000000",
"decimals": 9,
"delegate": null,
"key": "436uiYnRENKqrf97Zp8HYw47aSorsjYDBZpuAK2uazbs",
"mint": "BYubjL36JcKitTsNyvDeXF5wvn2w17nLa2vjWaMMmYKW",
"owner": "859NNrYstC3C4YY4jjZEm5sigXdjqiMdSCVvTEnK8JLc",
"ui_amount": "20.000000000"
}
}
}