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 AccountIdLookupOf<T>dest: Account address as a lookup source (typically resolves to AccountId)
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

// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Build transfer_all call (typed, named args)
const dest = undefined as any /* MultiAddress — replace with real value */;
const keep_alive = true;

const tx = api.tx.Balances.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
v411