Locks

Storage Map v101 → current

Locks on an account's balance.

Explore chain

From Chain Metadata

Any liquidity locks on some account balances. NOTE: Should only be accessed when setting, changing and freeing a lock.

Purpose & Usage

Purpose

Track funds locked for staking, vesting, etc.

Common Query Patterns

  • Query by account address

Query Keys

#NameTypeDescription
1
accountId account
raw: key1
AccountId [u8; 32]key1 (AccountId) (hex -> SS58)

Stored Value

value (WeakBoundedVec)

Default Value

0x00 (raw SCALE bytes)

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

Code Examples

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);

// Query Locks storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.Balances.Locks.getValue(key1);
console.log("Locks:", result);

On-Chain Activity

Write Frequency
●●○○○○ Minimal <10K est. writes

Fewer than 10K writes

#337 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Runtime Info

Pallet
Balances
Storage Kind
Map
First Version
v101
Current Version
v490