redelegateStake
redelegateStake
is a method on the ARIO
class that redelegates the stake of a specific address to a new gateway. Vault ID may be optionally included in order to redelegate from an existing withdrawal vault. The redelegation fee is calculated based on the fee rate and the stake amount. Users are allowed one free redelegation every seven epochs. Each additional redelegation beyond the free redelegation will increase the fee by 10%, capping at a 60% redelegation fee.
e.g: If 1000 mARIO is redelegated and the fee rate is 10%, the fee will be 100 mARIO. Resulting in 900 mARIO being redelegated to the new gateway and 100 mARIO being deducted back to the protocol balance.
redelegateStake
requires authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
target | String - WalletAddress | Gateway address stake is being moved to. | false |
source | String - WalletAddress | Gateway address stake is being moved from. | false |
stakeQty | number | The number of `mARIO` tokens to redelegate. | false |
vaultId | string | Specific vault to move stake from. | true |
Examples
redelegateStake
const fs = require("fs");
const { ARIO, ArweaveSigner, ARIOToken } = require("@ar.io/sdk");
async function main() {
const jwk = JSON.parse(fs.readFileSync("KeyFile.json"));
const ario = ARIO.init({
signer: new ArweaveSigner(jwk),
});
const { id: txId } = await ario.redelegateStake({
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
source: 'HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA',
stakeQty: new ARIOToken(1000).toMARIO(),
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
});
}
main();