Relayer Fees
- Generic
- For Specific Users
- For Specific Transaction Types
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.
You can get the AVN_GATEWAY_URL and AVN_RELAYER here.
Example
const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "https://gateway.testnet.aventus.network/";
const singleUserOptions = {
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24", // this is from the generated example account
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};
const avnSdk = new AvnApi(AVN_GATEWAY_URL, singleUserOptions);
//replace with the relayer address or public key received from Aventus
const AVN_RELAYER = "5DA...gxV";
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
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: '23800000000000000',
proxyTokenTransfer: '23800000000000000',
proxyConfirmTokenLift: '23800000000000000',
proxyTokenLower: '23800000000000000',
proxyCreateNftBatch: '23800000000000000',
proxyMintSingleNft: '23800000000000000',
proxyMintBatchNft: '23800000000000000',
proxyListNftOpenForSale: '23800000000000000',
proxyListNftBatchForSale: '23800000000000000',
proxyTransferFiatNft: '23800000000000000',
proxyCancelListFiatNft: '23800000000000000',
proxyEndNftBatchSale: '23800000000000000',
proxyStakeAvt: '23800000000000000',
proxyIncreaseStake: '23800000000000000',
proxyUnstake: '23800000000000000',
proxyWithdrawUnlocked: '23800000000000000',
proxyScheduleLeaveNominators: '23800000000000000',
proxyExecuteLeaveNominators: '23800000000000000'
}
await api.query.getRelayerFees(avnRelayerAddress, user);
The will return an object detailing the default fees a particular relayer charges, in AVT, to execute transactions for a particular user account.
You can get the AVN_GATEWAY_URL and AVN_RELAYER here.
Example
const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "https://gateway.testnet.aventus.network/";
const singleUserOptions = {
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24", // this is from the generated example account
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};
const avnSdk = new AvnApi(AVN_GATEWAY_URL, singleUserOptions);
//replace with the relayer address for this network, found in the set up section of this docs.
const AVN_RELAYER = "5DA...gxV";
//replace with your address on the Aventus network.
const USER = "5DA...gxV";
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
let fees = await api.query.getRelayerFees(AVN_RELAYER, USER);
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 for a specific user.
{
proxyAvtTransfer: "7000000000000000",
proxyTokenTransfer: "7000000000000000",
proxyConfirmTokenLift: "7000000000000000",
proxyTokenLower: "7000000000000000",
proxyCreateNftBatch: "7000000000000000",
proxyMintSingleNft: "7000000000000000",
proxyMintBatchNft: "7000000000000000",
proxyListNftOpenForSale: "7000000000000000",
proxyListNftBatchForSale: "7000000000000000",
proxyTransferFiatNft: "7000000000000000",
proxyCancelListFiatNft: "7000000000000000",
proxyEndNftBatchSale: "7000000000000000",
proxyBond: "7000000000000000",
proxyNominate: "7000000000000000",
proxyIncreaseStake: "7000000000000000",
proxyUnstake: "7000000000000000",
proxyWithdrawUnlocked: "7000000000000000",
}
await api.query.getRelayerFees(AVN_RELAYER, user, transaction_type);
The will return an object detailing the default fees a particular relayer charges, in AVT, to execute a specific transaction for a particular user account.
You can get the AVN_GATEWAY_URL and AVN_RELAYER here.
Example
const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "https://gateway.testnet.aventus.network/";
const singleUserOptions = {
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24", // this is from the generated example account
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};
const avnSdk = new AvnApi(AVN_GATEWAY_URL, singleUserOptions);
//replace with the relayer address for this network, found in the set up section of this docs.
const AVN_RELAYER = "5DA...gxV";
//replace with your address on the Aventus network or public key.
const USER = "5DA...gxV";
const TRANSACTION_TYPE = "proxyAvtTransfer"; //example of a transaction type.
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
const fees = await api.query.getRelayerFees(
AVN_RELAYER,
USER,
TRANSACTION_TYPE
);
console.log(fees);
}
(async () => {
await main();
})();
Example Output
Below is an example of a returned object showing the transaction types supported by the relayer and what it charges for each transaction type.
7000000000000000
JSON-RPC
- Transaction Types
- JSON-RPC Example
- Example Output
Returns fees for a particular relayer, optionally by user and/or transaction type
REQUEST
POST https://AVN_GATEWAY_URL/query
HEADERS
Content-Type: application/json Authorization': bearer <awtToken>
REQUEST PARAMS
relayer
(AVN_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",
"proxyCreateNftBatch",
"proxyMintSingleNft",
"proxyMintBatchNft",
"proxyListNftOpenForSale",
"proxyListNftBatchForSale",
"proxyTransferFiatNft",
"proxyCancelListFiatNft",
"proxyEndNftBatchSale",
"proxyBond",
"proxyNominate",
"proxyIncreaseStake",
"proxyUnstake",
"proxyWithdrawUnlocked",
curl https://AVN_GATEWAY_URL/query \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"getRelayerFees", "params":{"relayer":"5FbUQ2kJWLoqHuSTSNNqBwKwdQnBVe4HF3TeGyu6UoZaryTh", "user":"5GnPqcy...gyLcDTCg", "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)
{
"jsonrpc": "2.0",
"id": 1,
"result": "7000000000000000"
}
OR
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"proxyAvtTransfer": "7000000000000000",
"proxyTokenTransfer": "7000000000000000",
"proxyConfirmTokenLift": "7000000000000000",
"proxyTokenLower": "7000000000000000",
"proxyCreateNftBatch": "7000000000000000",
"proxyMintSingleNft": "7000000000000000",
"proxyMintBatchNft": "7000000000000000",
"proxyListNftOpenForSale": "7000000000000000",
"proxyListNftBatchForSale": "7000000000000000",
"proxyTransferFiatNft": "7000000000000000",
"proxyCancelListFiatNft": "7000000000000000",
"proxyEndNftBatchSale": "7000000000000000",
"proxyBond": "7000000000000000",
"proxyNominate": "7000000000000000",
"proxyIncreaseStake": "7000000000000000",
"proxyUnstake": "7000000000000000",
"proxyWithdrawUnlocked": "7000000000000000"
}
}