transfer_all

Call v101 → current #4

Transfers entire free balance to recipient.

View calls on chain

Click items to navigate. Pan and zoom to explore.

From Chain Metadata

Transfer the entire transferable balance from the caller account. NOTE: This function only attempts to transfer _transferable_ balances. This means that any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be transferred by this function. To ensure that this function results in a killed account, you might need to prepare the account by removing any reference counters, storage deposits, etc... The dispatch origin of this call must be Signed. `dest`: The recipient of the transfer. `keep_alive`: A boolean to determine if the `transfer_all` operation should send all of the funds the account has, causing the sender account to be killed (false), or transfer everything except at least the existential deposit, which will guarantee to keep the sender account alive (true). ## Complexity O(1). Just like transfer, but reading the user's transferable balance first.

Input Parameters

#NameTypeDescription
0
dest
MultiAddress dest (MultiAddress)
1
keep_alive
bool keep_alive (bool)

Permissions

Origin
Signed
Required Role

Requirements

  • Sender has free balance greater than zero
  • Recipient account can receive funds

Effects

Events Emitted

Storage Modified

Postconditions

  • Sender free balance is zero
  • Recipient receives entire amount
  • Sender account may be removed

Side Effects

  • May create recipient account if new
  • Will kill sender account if no reserved balance

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Build transfer_all call
const dest = 0 as any /* MultiAddress */;
const keep_alive = true;

const call = api.tx[stringCamelCase("Balances")][stringCamelCase("transfer_all")](
  dest,
  keep_alive
);

On-Chain Activity

Usage Frequency
●●●○○○ Moderate 10K–100K extrinsics

Occasional use

#40 most used call

Success Rate Near-certain

Over 95% of submissions succeed

As of block 7,429,232

Runtime Info

Pallet Index
5
Call Index
4
First Version
v101
Current Version
v393