@skalenetwork/ima-js
Version:
Simple TS/JS library to interact with SKALE IMA
41 lines (40 loc) • 2.3 kB
TypeScript
/**
* @license
* SKALE ima-js
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @file BaseChain.ts
* @copyright SKALE Labs 2021-Present
*/
import { type Provider, type TransactionResponse, type Contract } from 'ethers';
import type TxOpts from './TxOpts';
export type ContractsStringMap = Record<string, Contract>;
export declare abstract class BaseChain {
provider: Provider;
chainId?: number;
abi: any;
constructor(provider: Provider, abi: any, chainId?: number);
abstract ethBalance(address: string): Promise<bigint>;
getERC20Balance(tokenContract: Contract, address: string): Promise<bigint>;
getERC721OwnerOf(tokenContract: Contract, tokenId: number | string): Promise<string>;
getERC1155Balance(tokenContract: Contract, address: string, tokenId: number): Promise<bigint>;
setTokenURI(tokenContract: Contract, tokenId: number, tokenURI: string, opts: TxOpts): Promise<TransactionResponse>;
waitETHBalanceChange(address: string, initial: bigint, sleepInterval?: number, iterations?: number): Promise<void>;
waitForChange(tokenContract: Contract, getFunc: any, address: string | undefined, initial: string | bigint, tokenId: number | undefined, sleepInterval?: number, iterations?: number): Promise<void>;
waitERC20BalanceChange(tokenContract: Contract, address: string, initialBalance: bigint, sleepInterval?: number): Promise<void>;
waitERC721OwnerChange(tokenContract: Contract, tokenId: number, initialOwner: string, sleepInterval?: number): Promise<any>;
waitERC1155BalanceChange(tokenContract: Contract, address: string, tokenId: number, initialBalance: bigint, sleepInterval?: number): Promise<any>;
}