-
Two questions:
|
Beta Was this translation helpful? Give feedback.
Answered by
banool
Mar 7, 2024
Replies: 1 comment 2 replies
-
Aptos has support for view functions. This is a view function in the
From here. You can query it like this with the Python SDK: client = RestClient("https://api.mainnet.aptoslabs.com/v1")
func = "0x1::coin::balance"
type_arguments = ["0x1::aptos_coin::AptosCoin"]
arguments = ["0x123"]
await client.view(func, type_arguments, arguments) Here is how you do it with the TS SDK: const config = new AptosConfig({ network: Network.MAINNET });
const aptos = Aptos(config);
const result = await aptos.view({
payload: {
function: "0x1::coin::balance",
typeArguments: ["0x1::aptos_coin::AptosCoin]",
functionArguments: ["0x123"],
},
}); Here is how you do it with the CLI: aptos move view --url https://api.mainnet.aptoslabs.com --function-id 0x1::coin::balance --type-args '0x1::aptos_coin::AptosCoin' --args address:0x123 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
0x-j
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aptos has support for view functions. This is a view function in the
coin
module in the framework:From here.
You can query it like this with the Python SDK:
Here is ho…