@coinmeca/ethers
Version:
Solidty helpers and utilities for using ethers.
52 lines • 2.63 kB
TypeScript
import { HardhatEthersSigner, SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { AddressString } from "./types";
import { type IERC20 } from "./interfaces/ERC20";
import { type IERC721 } from "./interfaces/ERC721";
export interface AccountLike {
address: AddressString;
[x: string | number | symbol]: unknown;
}
export type SignerLike = AccountLike | SignerWithAddress | HardhatEthersSigner;
export interface Signers {
[x: string | number | symbol]: any;
}
export declare let signers: Signers;
export interface IAccounts {
User: (indexOrName: string | number | AddressString) => IUser;
}
type Contract = {
[x: string | number | symbol]: any;
} | Function | Promise<any>;
type History = string | string[] | number | number[];
type HistoryParsing = (x: History) => any | Promise<any>;
export interface IUser extends AccountLike {
name: number | string;
signer: SignerWithAddress | HardhatEthersSigner;
as(address: AddressString): Promise<SignerLike>;
set(name: number | string): any;
balance(token?: IERC20 | IERC721 | AddressString, display?: boolean): Promise<any>;
send(token: IERC20 | IERC721 | AddressString, to: AccountLike | AddressString, amount: number): Promise<boolean | void>;
faucet(token: IERC20 | AddressString, amount: number, display?: boolean): Promise<boolean | void>;
allowance(token: IERC20 | IERC721 | AccountLike | AddressString, spender: AccountLike | AddressString | AddressString): Promise<number | string>;
approve(token: IERC20 | IERC721 | AccountLike | AddressString, to: AccountLike | AddressString | AddressString, amount: number | string | "max"): Promise<boolean | void>;
history(): Promise<any[]>;
history(keyOrIndex: History): Promise<any[]>;
history(address: Contract): Promise<any[]>;
history(keyOrIndex: History, fn: HistoryParsing): Promise<any[]>;
history(address: Contract, fn: HistoryParsing): Promise<any[]>;
history(address: Contract, keyOrIndex: History): Promise<any[]>;
history(address: Contract, keyOrIndex: History, fn: HistoryParsing): Promise<any[]>;
getHistory(): Promise<any>;
getHistory(keyOrIndex: History): Promise<any>;
getHistory(address: Contract): Promise<any>;
getHistory(keyOrIndex: History, address: Contract): Promise<any>;
getHistory(address: Contract, keyOrIndex: History): Promise<any>;
}
export declare function Accounts(contracts?: {
tokens: IERC20[] | {
[x: string | number | symbol]: IERC20;
};
[x: string | number | symbol]: object;
}): Promise<IAccounts>;
export {};
//# sourceMappingURL=accounts.d.ts.map