Aptos — Transactions, View (3/3)
API reference for Aptos. All methods ->
Estimate gas price
GET
https://rpc.ankr.com/premium-http/aptos/YOUR_ANKR_API_KEY/v1/estimate_gas_price
Currently, the gas estimation is handled by taking the median of the last 100,000 transactions If a user wants to prioritize their transaction and is willing to pay, they can pay more than the gas price. If they're willing to wait longer, they can pay less. Note that the gas price moves with the fee market, and should only increase when demand outweighs supply.
If there have been no transactions in the last 100,000 transactions, the price will be 1.
Parameters
None.
Request example
curl -X GET https://rpc.ankr.com/premium-http/aptos/YOUR_ANKR_API_KEY/v1/estimate_gas_price \
-H 'Content-Type: application/json'
Response example
{
"deprioritized_gas_estimate": 0,
"gas_estimate": 0,
"prioritized_gas_estimate": 0
}
View
Execute view function of a module
POST
https://rpc.ankr.com/premium-http/aptos/YOUR_ANKR_API_KEY/v1/view
Executes the Move function with the given parameters and return its execution result.
The Aptos nodes prune account state history, via a configurable time window. If the requested ledger version has been pruned, the server responds with a 410.
Parameters
ledger_version(string; uint64; query): a ledger version to get state of account. If not provided, it will be the latest version.
Example:32425224034
Body
The Move view function request body contains the following parameters:
function(string; required): an entry function ID is a string representation of an entry function defined on-chain.
Format:{address}::{module name}::{function name}
Both the module name and function name are case-sensitive.
Example:0x1::aptos_coin::transfertype_arguments(array[string]; required): type arguments of the function.arguments(array; required): arguments of the function.
Request example
curl -X POST https://rpc.ankr.com/premium/YOUR_ANKR_API_KEY-http/aptos/YOUR_ANKR_API_KEY/v1/view \
-H 'Content-Type: application/json' \
-d '{
"function": "0x1::aptos_coin::transfer",
"type_arguments": [
"string"
],
"arguments": [
null
]
}'
Response example
[
0
]