UNPKG

@substrate/api-sidecar

Version:

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

48 lines (47 loc) 2.35 kB
import { AccountsVestingInfoService } from '../../../services'; import AbstractController from '../../AbstractController'; /** * GET vesting information for an address on the relay chain. * * Paths: * - `address`: Address to query. * * Query params: * - (Optional)`at`: Block at which to retrieve vesting information at. Block * identifier, as the block height or block hash. Defaults to most recent block. * - (Optional)`includeClaimable`: When set to 'true', calculates and includes vested * amounts for each vesting schedule plus the claimable amount. Defaults to 'false'. * * Returns: * - `at`: Block number and hash at which the call was made. * - `vesting`: Array of vesting schedules for an account. * - `locked`: Number of tokens locked at start. * - `perBlock`: Number of tokens that gets unlocked every block after `startingBlock`. * - `startingBlock`: Starting block for unlocking(vesting). * - `vested`: (Only when `includeClaimable=true`) Amount that has vested based on time elapsed. * - `vestedBalance`: (Only when `includeClaimable=true`) Total vested across all schedules. * - `vestingTotal`: (Only when `includeClaimable=true`) Total locked across all schedules. * - `vestedClaimable`: (Only when `includeClaimable=true`) Actual amount that can be claimed now. * - `blockNumberForCalculation`: (Only when `includeClaimable=true`) The block number used for calculations. * - `blockNumberSource`: (Only when `includeClaimable=true`) Which chain's block number was used ('relay' or 'self'). * * Note: For relay chain pre-migration queries, vested amounts are calculated using the relay * chain's own block number. Post-migration, vesting has moved to Asset Hub. * * Substrate Reference: * - Vesting Pallet: https://crates.parity.io/pallet_vesting/index.html * - `VestingInfo`: https://crates.parity.io/pallet_vesting/struct.VestingInfo.html */ export default class RcAccountsVestingInfoController extends AbstractController<AccountsVestingInfoService> { static controllerName: string; static requiredPallets: string[][]; constructor(_api: string); protected initRoutes(): void; /** * Get vesting information for an account on the relay chain. * * @param req Express Request * @param res Express Response */ private getAccountVestingInfo; }