@coinmeca/ethers
Version:
Solidty helpers and utilities for using ethers.
44 lines • 2.33 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>;
type HistoryArgs = [] | [History] | [Contract] | [History, HistoryParsing] | [Contract, HistoryParsing] | [Contract, History] | [Contract, History, HistoryParsing];
type GetHistoryArgs = [] | [History] | [Contract] | [History, Contract] | [Contract, History];
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: (...args: HistoryArgs) => Promise<any[]>;
getHistory: (...args: GetHistoryArgs) => 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