UNPKG

@broxus/js-bridge-essentials

Version:

Bridge JavaScript Essentials library

65 lines (64 loc) 2.41 kB
import { type Forceable } from '@broxus/js-core'; import type Web3 from 'web3'; import { type PayableMethodObject } from 'web3-eth-contract'; import { type EvmTokenData } from '../../models/evm-token/EvmToken'; export interface EvmTokenAllowanceParams { ownerAddress: string; spenderAddress: string; tokenAddress: string; } export interface EvmTokenApproveParams { amount: string; from: string; spenderAddress: string; tokenAddress: string; type?: string; } export declare abstract class EvmTokenUtils { static allowance(connection: Web3, params: EvmTokenAllowanceParams): Promise<string>; static approve(connection: Web3, params: EvmTokenApproveParams): Promise<ReturnType<PayableMethodObject['send']>>; /** @deprecated Use EvmTokenUtils.balance instead */ static getBalance(connection: Web3, address: string, ownerAddress: string): Promise<string>; /** * Get EVM token balance by the given token and owner addresses * @param {Web3} connection * @param {string} address * @param {string} ownerAddress * @returns {Promise<string>} */ static balance(connection: Web3, address: string, ownerAddress: string): Promise<string>; /** * * @param {Web3} connection * @param {string} address * @param {Forceable} options * @returns {Promise<EvmTokenData | undefined>} */ static getDetails(connection: Web3, address: string, options?: Forceable): Promise<EvmTokenData | undefined>; /** * Get EVM token decimals by the given token address * @param {Web3} connection * @param {string} address * @returns {Promise<number>} */ static getDecimals(connection: Web3, address: string): Promise<number>; /** * Get EVM token symbol by the given token address * @param {Web3} connection * @param {string} address */ static getSymbol(connection: Web3, address: string): Promise<string>; /** * Get EVM token name by the given token address * @param {Web3} connection * @param {string} address */ static getName(connection: Web3, address: string): Promise<string>; /** * Get EVM token total supply by the given token address * @param {Web3} connection * @param {string} address * @returns {Promise<string>} */ static totalSupply(connection: Web3, address: string): Promise<string>; }