Payout Stakers
Initiates the payment to stakers the AVT earned in the previous era.
await api.send.payoutStakers(AVN_RELAYER, previousEra)
important
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "<endpoint_url>";
const API = new AVN_API(AVN_GATEWAY_URL);
const AVN_RELAYER = "5Fb...yTh";
async function main() {
await api.init();
// Get the current era
let era = await api.query.getActiveEra();
let previousEra = era - 1;
let result = await api.send.payoutStakers(AVN_RELAYER, previousEra)
// Returns a request id
console.log(result);
}
(async () => {
await main();
})();
You have now successfully submitted a transaction to the AVN.
1392
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 SS58 address.
- user [required] - a string representing the user's SS58 address.
- payer [required] - a string representing the payer's SS58 address.
- era [required] - a string integer value representing the era to payout
- proxySignature [required] - a proof signed by the user allowing the transaction to be proxied.
- feePaymentSignature [required] - a proof signed by the payer allowing the relayer fees to be paid.
- paymentNonce [required] - string integer value of the current payment nonce of the payer.
JSON-RPC Example
curl https://AVN-API-URL/send \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"proxyPayoutstakers", "params":{"relayer":"5Fb...oZaryTh", "user":"5DAgx...VJDdMr", "payer":"5DAgx...VJDdMr", "era":"1599", "proxySignature":"0x22ad3b01db96bf5b22d998a4296ff2d58180dc6eab357300b9613583f9570016fc5c439a80f17639e47ffb7100aa8cbea8def6ab2add7837ba0074321ed9c739", "feePaymentSignature":"0x6efb3277c7ee6f965bbf07d6a3faf2acb2fff71029ccd96f9c39b8ba3e2b27084420eae53fecc2bad956c90c5150df9bc3edbbddae5ef1dc538965b25f9efe41", "paymentNonce":"332"}, "id":1}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "7fd01739-2a52-4eba-941a-00497e7e0bf0"
}
Validation
This endpoint can only be called while the eraElectionWindow
is closed. The status of the Election period can be checked here. If it is called during an election, the following error response will be returned:
{
"code":-32600,
"message":"Invalid Request",
"data": {
"gatewayError":"election window is open",
"request":"{...}"
}