import { Address, Amount } from '@safeblock/blockchain-utils'; import { Network } from 'ethers'; import { default as SafeBlock, SdkConfig } from '../sdk'; import { default as SdkExtension } from '../sdk/sdk-extension'; import { BasicToken } from '../types'; interface FindTokensOptions { networks?: Network[]; maxTokensPerRequest?: number; } /** * SDK extension that provides token search, import, and balance‑retrieval * via the SafeBlock API. * * Requires the following extension: * - `TokensListExtension` */ export default class TokensExtension extends SdkExtension { private readonly sdk; private readonly config; static name: string; readonly events: {}; private _fetchedBalances; private _currentTask; /** * SDK extension that provides token search, import, and balance‑retrieval * via the SafeBlock API. * * Requires the following extension: * - `TokensListExtension` * * @param {SafeBlock} sdk SDK instance * @param {SdkConfig} config SDK configuration */ constructor(sdk: SafeBlock, config: SdkConfig); onInitialize(): void; /** Reset the current task and clear the balance store */ reset(): void; /** * Get the balance of a specific token. * * @param {Address} of account address * @param {BasicToken} token token to query * @returns {Amount} token balance */ balanceOf(of: Address, token: BasicToken): Amount; /** * Search for external tokens using the SafeBlock API. * * @param {string} query symbol, address, or name * @param {FindTokensOptions} options search options * @returns {Promise} found tokens or `null` on error */ findTokens(query: string, options?: FindTokensOptions): Promise; /** * Update balances of all registered tokens for a given account. * * @param {Address} of account to update * @returns {Promise} */ fetchBalances(of: Address): Promise; /** * Shortcut that scopes `balanceOf` and `fetchBalances` * to operate on a specific account. * * @param {Address} of account address */ as(of: Address): { balanceOf: (token: BasicToken) => Amount; fetchBalances: () => Promise; }; private fetchTokens; } export {};