Relayer Fees
await api.query.getRelayerFees(avnRelayerAddress);
The will return an object detailing the default fees a particular relayer charges, in AVT, for a set of executable transactions.
Example
const AVN_API = require("avn-api");
//Replace the endpoint_url with the url received from Aventus.
const AVN_GATEWAY_URL = "<endpoint_url>";
const API = new AVN_API(AVN_GATEWAY_URL);
//replace with the relayer address or public key received from Aventus
const AVN_RELAYER = "5DA...gxV";
async function main() {
await API.init();
const fees = await API.query.getRelayerFees(AVN_RELAYER);
console.log(fees);
}
(async () => {
await main();
})();
Example Result
Below is an example of a returned object showing the transaction types supported by the relayer and what it charges for each transaction type.
{
proxyAvtTransfer: '7000000000000000',
proxyTokenTransfer: '7000000000000000',
proxyConfirmTokenLift: '7000000000000000',
proxyTokenLower: '7000000000000000',
proxyMintSingleNft: '7000000000000000',
proxyListNftOpenForSale: '7000000000000000',
proxyTransferFiatNft: '7000000000000000',
proxyCancelListFiatNft: '7000000000000000',
proxyBond: '7000000000000000',
proxyNominate: '7000000000000000',
proxyIncreaseStake: '7000000000000000',
proxyUnstake: '7000000000000000',
proxyWithdrawUnlocked: '7000000000000000',
proxyPayoutStakers: '7000000000000000'
}
JSON-RPC
Returns fees for a particular relayer, optionally by user and/or transaction type
REQUEST
POST https://AVN-API-URL/query
HEADERS
Content-Type: application/json Authorization': bearer <awtToken>
REQUEST PARAMS
relayer
[required] - a string representing the relayer's public key or SS58 address.user
[optional] - a string representing the user's public key or SS58 address.transactionType
[optional] - a string representing the transaction type.
Possible Transaction Types
"proxyAvtTransfer"
"proxyTokenTransfer"
"proxyConfirmTokenLift"
"proxyTokenLower"
"proxyMintSingleNft"
"proxyListNftOpenForSale"
"proxyTransferFiatNft"
"proxyCancelListFiatNft"
"proxyBond"
"proxyNominate"
"proxyIncreaseStake"
"proxyUnstake"
"proxyWithdrawUnlocked"
"proxyPayoutStakers"
JSON-RPC Example
curl https://AVN-API-URL/query \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"getRelayerFees", "params":{"relayer":"5FbUQ2kJWLoqHuSTSNNqBwKwdQnBVe4HF3TeGyu6UoZaryTh", "user":"5GnPqcyiruWxK5HWVZSdvZk25y2kZjmeaSBaTvpygyLcDTCg", "transactionType":"proxyTokenTransfer"}, "id":1}'
Possible Results
- result - string integer value of the current relayer fee for user and type OR
- object - object representing fees for relayer (generic or filtered for user if passed)
Example Output
{
"jsonrpc": "2.0",
"id": 1,
"result": "5000000000000000"
}
OR
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"proxyAvtTransfer": "7000000000000000",
"proxyTokenTransfer": "7000000000000000",
"proxyConfirmTokenLift": "7000000000000000",
"proxyTokenLower": "7000000000000000",
"proxyMintSingleNft": "7000000000000000",
"proxyListNftOpenForSale": "7000000000000000",
"proxyTransferFiatNft": "7000000000000000",
"proxyCancelListFiatNft": "7000000000000000"
}
}