UNPKG

wallets-wrapper

Version:

How to install

68 lines (67 loc) 2.49 kB
import { ethers } from 'ethers'; import { BehaviorSubject } from 'rxjs'; import { AccountInfo, ApproveToken, GetContractBalance, IProviderRpcError, SetApprovalForAll, TransferContractToken, TransferEvent } from '../../../../models'; import { ContractTypes, StandardContractProps } from '../../../../networks'; /** * The client describes how to work with ERC20, ERC721, ERC1155 contracts . * @implements IStandardContract * @class */ export declare class ERC721 { private contract; errors$: BehaviorSubject<IProviderRpcError | null>; private signer; address: string; name: string | undefined; symbol: string | undefined; decimals: number; type: ContractTypes | undefined; provider: ethers.providers.JsonRpcProvider | undefined; constructor({ address, signer, network }: StandardContractProps); /** * Gives access to contract methods, * if you don't call init client just won't know which contract to use * @async */ init(): Promise<boolean>; checkInitialization(): void; checkType(type: ContractTypes): boolean; getContract(): ethers.Contract; getName(): Promise<string | undefined>; getSymbol(): Promise<string | undefined>; /** * Check balance in contract * @param {string} address, * you can specify explicitly to check a different address * @param {GetContractBalance} object, * @return {Promise<number>} * @async */ getBalance(arg?: GetContractBalance): Promise<AccountInfo[]>; /** * Transfer token * @param {TransferContractToken} args * @return {Promise<Transaction>} * @async */ transfer(args: TransferContractToken): Promise<ethers.providers.TransactionResponse>; /** * get decoded Transfer * @param {TransferContractToken} args * @return {string} */ getDecodedTransfer(args: TransferContractToken): string; /** * Get token uri, only works when this.type === 'ERC721' * @param {string} tokenId * @return {Promise<string>} * @async */ getTokenUri(tokenId: string): Promise<string>; approve(args: ApproveToken): Promise<ethers.providers.TransactionResponse>; setApprovalForAll(args: SetApprovalForAll): Promise<ethers.providers.TransactionResponse>; /** * Subscribe on transfer events in contract */ transferEvents(): BehaviorSubject<TransferEvent | null>; }