@substrate/api-sidecar
Version:
REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.
51 lines (50 loc) • 2.73 kB
TypeScript
import { AccountsForeignAssetsService } from '../../services/accounts';
import AbstractController from '../AbstractController';
/**
* Get foreign asset balance information for an address.
*
* Paths:
* - `address`: The address to query
*
* Query:
* - (Optional)`at`: Block at which to retrieve balance information. Block
* identifier, as the block height or block hash. Defaults to most recent block.
* - (Optional) `useRcBlock`: When true, treats the `at` parameter as a relay chain block
* to find corresponding Asset Hub blocks. Only supported for Asset Hub endpoints.
* - (Optional)`foreignAssets`: Comma-separated list of multilocation JSON strings to filter by.
* If not provided, all foreign asset balances for the account will be returned.
*
* `/accounts/:address/foreign-asset-balances`
* Returns:
* - When using `useRcBlock=true`: 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 `useRcBlock=false` or omitted: A single response object.
*
* Response object structure:
* - `at`: Block number and hash at which the call was made.
* - `foreignAssets`: An array of `ForeignAssetBalance` objects which have a multilocation attached to them
* - `multiLocation`: The multilocation identifier of the foreign asset.
* - `balance`: The balance of the foreign asset.
* - `isFrozen`: Whether the asset is frozen for non-admin transfers.
* - `isSufficient`: Whether a non-zero balance of this 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).
* - `rcBlockHash`: The relay chain block hash used for the query. Only present when `useRcBlock=true`.
* - `rcBlockNumber`: The relay chain block number used for the query. Only present when `useRcBlock=true`.
* - `ahTimestamp`: The Asset Hub block timestamp. Only present when `useRcBlock=true`.
*
* Substrate Reference:
* - ForeignAssets Pallet: https://crates.parity.io/pallet_assets/index.html
* - `AssetBalance`: https://crates.parity.io/pallet_assets/struct.AssetBalance.html
* - XCM Multilocations: https://wiki.polkadot.network/docs/learn-xcm
*
*/
export default class AccountsForeignAssetsController extends AbstractController<AccountsForeignAssetsService> {
static controllerName: string;
static requiredPallets: string[][];
constructor(api: string);
protected initRoutes(): void;
private getForeignAssetBalances;
}