@substrate/api-sidecar
Version:
REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.
66 lines (65 loc) • 2.63 kB
TypeScript
import { Option } from '@polkadot/types/codec';
import { VestingInfo } from '@polkadot/types/interfaces';
import { IAt } from '.';
/**
* Vesting schedule with calculated vested amount.
* Extends the base VestingInfo with additional computed fields.
*/
export interface IVestingSchedule {
/** Total amount of tokens locked at the start of vesting */
locked: string;
/** Number of tokens that unlock per block */
perBlock: string;
/** Block number when vesting/unlocking begins */
startingBlock: string;
/** Amount that has vested based on time elapsed at the queried block */
vested: string;
}
/**
* Indicates which chain's block number was used for vesting calculations.
* - 'relay': Relay chain block number (used for Asset Hub post-migration)
* - 'self': The queried chain's own block number (used for relay chain pre-migration)
*/
export type BlockNumberSource = 'relay' | 'self';
export interface IAccountVestingInfo {
at: IAt;
/**
* Array of vesting schedules for the account.
* Can be raw VestingInfo from the pallet or enhanced IVestingSchedule with vested amounts.
*/
vesting: Option<VestingInfo> | IVestingSchedule[] | {};
/**
* Total amount that has vested across all schedules (sum of per-schedule vested).
* Only present when vesting calculations are performed.
*/
vestedBalance?: string;
/**
* Total locked amount across all vesting schedules.
* Only present when vesting calculations are performed.
*/
vestingTotal?: string;
/**
* Actual amount that can be claimed/unlocked right now.
* Calculated as: vestingLocked - (vestingTotal - vestedBalance)
* This accounts for previous claims that reduced the on-chain lock.
* Only present when vesting calculations are performed.
*/
vestedClaimable?: string;
/**
* The block number used for calculating vested amounts.
* For Asset Hub post-migration, this is the relay chain block number.
* For relay chain pre-migration, this is the queried block number.
*/
blockNumberForCalculation?: string;
/**
* Indicates which chain's block number was used for the calculation.
* 'relay' for Asset Hub post-migration, 'self' for relay chain pre-migration.
*/
blockNumberSource?: BlockNumberSource;
/** Relay chain block hash (when using useRcBlock parameter) */
rcBlockHash?: string;
/** Relay chain block number (when using useRcBlock parameter) */
rcBlockNumber?: string;
/** Asset Hub timestamp (when using useRcBlock parameter) */
ahTimestamp?: string;
}