redelegateStake
redelegateStake
is a method on the ARIO
class that moves staked tokens from one gateway to another. A vault ID can be optionally included to redelegate from an existing withdrawal vault. The redelegation fee is calculated based on the fee rate and the stake amount. Users receive one free redelegation every seven epochs. Each additional redelegation increases the fee by 10%, up to a maximum of 60%.
For example: If 1000 mARIO is redelegated with a 10% fee rate, the fee will be 100 mARIO. This results in 900 mARIO being redelegated to the new gateway and 100 mARIO being returned to the protocol balance.
redelegateStake
requires authentication.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
target | string | Destination gateway address for the stake | Yes |
source | string | Current gateway address of the stake | Yes |
stakeQty | number | Amount in mARIO to redelegate | Yes |
vaultId | string | ID of the vault to move stake from | No |
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();