UNPKG

@substrate/api-sidecar

Version:

REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.

54 lines (53 loc) 2.15 kB
import { BlockHash } from '@polkadot/types/interfaces'; import BN from 'bn.js'; import { IAccountVestingInfo } from 'src/types/responses'; import { AbstractService } from '../AbstractService'; export declare class AccountsVestingInfoService extends AbstractService { /** * Fetch vesting information for an account at a given block. * * @param hash `BlockHash` to make call at * @param address address of the account to get the vesting info of * @param includeVested whether to calculate and include vested amounts (default: false) * @param knownRelayBlockNumber optional relay block number to use for calculations (skips search when provided) */ fetchAccountVestingInfo(hash: BlockHash, address: string, includeVested?: boolean, knownRelayBlockNumber?: BN): Promise<IAccountVestingInfo>; /** * Get the vesting lock amount from balances.locks. * Returns 0 if no vesting lock exists. */ private getVestingLocked; /** * Calculate vested amounts for vesting schedules. * Returns null if calculation cannot be performed (e.g., during migration window). */ private calculateVestingAmounts; /** * Calculate vested amounts for Asset Hub chains. * Post-migration: uses relay chain inclusion block number for calculations. * If knownRelayBlockNumber is provided, uses it directly instead of searching. */ private calculateForAssetHub; /** * Calculate vested amounts for relay chains. * Pre-migration: uses the chain's own block number for calculations. */ private calculateForRelayChain; /** * Perform the actual vesting calculation for vesting schedules. */ private performCalculation; /** * Create a result with zero claimable for all schedules. * Used during migration windows or post-migration on relay chain. */ private createZeroClaimableResult; /** * Determine migration state for an Asset Hub block. */ private getAssetHubMigrationState; /** * Determine migration state for a relay chain block. */ private getRelayChainMigrationState; }