@volare.finance/utils.js
Version:
The Blockchain Utils
42 lines (41 loc) • 1.96 kB
TypeScript
/**
* @file erc20.ts
* @author astra <astra@volare.finance>
* @date 2022
*/
import { TransactionResponse } from '@ethersproject/providers';
import { ContractInterface, Wallet } from 'ethers';
import { Provider } from '../provider';
import { Address, BigNumber, Sym } from '../type';
export interface IERC20 {
address: Address;
name: string;
symbol: Sym;
decimals: number;
totalSupply?: BigNumber;
logo?: string;
}
export declare class ERC20 extends Provider {
static Transfer_t0: string;
static Approval_t0: string;
static ABI(): ContractInterface;
static Name(contract: Address): Promise<string>;
static Symbol(contract: Address): Promise<Sym>;
static Decimals(contract: Address): Promise<number>;
static TotalSupply(contract: Address): Promise<BigNumber>;
static BalanceOf(contract: Address, owner: Address): Promise<BigNumber>;
static Transfer(contract: Address, owner: Wallet, to: Address, value: BigNumber): Promise<TransactionResponse>;
static TransferFrom(contract: Address, owner: Wallet, from: Address, to: Address, value: BigNumber): Promise<TransactionResponse>;
static Approve(contract: Address, owner: Wallet, spender: Address, value: BigNumber): Promise<TransactionResponse>;
static Allowance(contract: Address, owner: Address, spender: Address): Promise<BigNumber>;
constructor(contract: Address, endpoint: string);
name(): Promise<string>;
symbol(): Promise<Sym>;
decimals(): Promise<number>;
totalSupply(): Promise<BigNumber>;
balanceOf(owner: Address): Promise<BigNumber>;
transfer(owner: Wallet, to: Address, value: BigNumber): Promise<TransactionResponse>;
transferFrom(owner: Wallet, from: Address, to: Address, value: BigNumber): Promise<TransactionResponse>;
approve(owner: Wallet, spender: Address, value: BigNumber): Promise<TransactionResponse>;
allowance(owner: Address, spender: Address): Promise<BigNumber>;
}