UNPKG

@substrate/api-sidecar

Version:

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

69 lines (68 loc) 3.9 kB
import { AccountsPoolAssetsService } from '../../services/accounts'; import AbstractController from '../AbstractController'; /** * Get pool asset information for an address. * * Paths: * - `address`: The address to query * * Query: * - (Optional)`at`: Block at which to retrieve runtime version information at. Block * identifier, as the block height or block hash. Defaults to most recent block. * - (Optional)`useRcBlock`: When set to 'true', uses the relay chain block specified in the 'at' parameter to determine corresponding Asset Hub block(s). Only supported for Asset Hub endpoints. * - (Optional for `/accounts/:address/pool-asset-balances`)`assets` * - (Required for `/accounts/:address/pool-asset-approvals)`assetId` The assetId associated * with the `AssetApproval`. * - (Required for `/accounts/:address/pool-asset-approvals)`delegate` The delegate associated * with the `ApprovalKey` which is tied to a `Approval`. The `ApprovalKey` consists * of an `owner` which is the `address` path parameter, and a `delegate`. * * `/accounts/:address/pool-asset-balances` * Returns: * - When using `useRcBlock` parameter: An array of response objects, one for each Asset Hub block found * in the specified relay chain block. Returns empty array `[]` if no Asset Hub blocks found. * - When using `at` parameter or no query params: A single response object. * * Response object structure: * - `at`: Block number and hash at which the call was made. * - `poolAssets`: An array of `AssetBalance` objects which have a AssetId attached to them * - `assetId`: The identifier of the asset. * - `balance`: The balance of the asset. * - `isFrozen`: Whether the pool asset is frozen for non-admin transfers. * - `isSufficient`: Whether a non-zero balance of this pool asset is a deposit of sufficient * value to account for the state bloat associated with its balance storage. If set to * `true`, then non-zero balances may be stored without a `consumer` reference (and thus * an ED in the Balances pallet or whatever else is used to control user-account state * growth). * - `rcBlockNumber`: The relay chain block number used for the query. Only present when `useRcBlock` parameter is used. * - `ahTimestamp`: The Asset Hub block timestamp. Only present when `useRcBlock` parameter is used. * * `/accounts/:address/pool-asset-approvals` * Returns: * - When using `useRcBlock` parameter: An array of response objects, one for each Asset Hub block found * in the specified relay chain block. Returns empty array `[]` if no Asset Hub blocks found. * - When using `at` parameter or no query params: A single response object. * * Response object structure: * - `at`: Block number and hash at which the call was made. * - `amount`: The amount of funds approved for the balance transfer from the owner * to some delegated target. * - `deposit`: The amount reserved on the owner's account to hold this item in storage. * - `rcBlockNumber`: The relay chain block number used for the query. Only present when `useRcBlock` parameter is used. * - `ahTimestamp`: The Asset Hub block timestamp. Only present when `useRcBlock` parameter is used. * * Substrate Reference: * - PoolAssets Pallet: instance of Assets Pallet https://crates.parity.io/pallet_assets/index.html * - `AssetBalance`: https://crates.parity.io/pallet_assets/struct.AssetBalance.html * - `ApprovalKey`: https://crates.parity.io/pallet_assets/struct.ApprovalKey.html * - `Approval`: https://crates.parity.io/pallet_assets/struct.Approval.html * */ export default class AccountsPoolAssetsController extends AbstractController<AccountsPoolAssetsService> { static controllerName: string; static requiredPallets: string[][]; constructor(api: string); protected initRoutes(): void; private getPoolAssetBalances; private getPoolAssetApprovals; }