instantWithdrawal
instantWithdrawal
is a method on the ARIO
class that instantly withdraws an existing vault on a gateway. If no gatewayAddress
is provided, the signer's address will be used.
instantWithdrawal
requires authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
gatewayAddress | String - WalletAddress | Gateway address where delegate vault exists | true |
vaultId | string | Delegated vault id to cancel. | false |
tags | array | An array of GQL tag objects to attach to the transfer AO message. | true |
Examples
instantWithdrawal
const fs = require("fs");
const { ARIO, ArweaveSigner } = 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.instantWithdrawal(
{
// gateway address where delegate vault exists
gatewayAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
// delegated vault id to cancel
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
},
// optional additional tags
{
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
},
);
// removes an operator vault from a gateway
const { id: txId } = await ario.instantWithdrawal(
{
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
},
);
}
main();