///
declare module "@ijstech/eth-wallet/web3.ts" {
import { BigNumber } from 'bignumber.js';
export type Hex = string | number;
export type Unit = 'noether' | 'wei' | 'kwei' | 'Kwei' | 'babbage' | 'femtoether' | 'mwei' | 'Mwei' | 'lovelace' | 'picoether' | 'gwei' | 'Gwei' | 'shannon' | 'nanoether' | 'nano' | 'szabo' | 'microether' | 'micro' | 'finney' | 'milliether' | 'milli' | 'ether' | 'kether' | 'grand' | 'mether' | 'gether' | 'tether';
export type Mixed = string | number | BigNumber | {
type: string;
value: string;
} | {
t: string;
v: string | BigNumber | number;
} | boolean;
export interface Units {
noether: string;
wei: string;
kwei: string;
Kwei: string;
babbage: string;
femtoether: string;
mwei: string;
Mwei: string;
lovelace: string;
picoether: string;
gwei: string;
Gwei: string;
shannon: string;
nanoether: string;
nano: string;
szabo: string;
microether: string;
micro: string;
finney: string;
milliether: string;
milli: string;
ether: string;
kether: string;
grand: string;
mether: string;
gether: string;
tether: string;
}
export interface Utils {
isBN(value: string | number): boolean;
isBigNumber(value: BigNumber): boolean;
toBN(value: number | string): BigNumber;
toTwosComplement(value: number | string | BigNumber): string;
isAddress(address: string, chainId?: number): boolean;
isHex(hex: Hex): boolean;
isHexStrict(hex: Hex): boolean;
asciiToHex(string: string, length?: number): string;
hexToAscii(string: string): string;
toAscii(string: string): string;
bytesToHex(bytes: number[]): string;
numberToHex(value: number | string | BigNumber): string;
checkAddressChecksum(address: string, chainId?: number): boolean;
fromAscii(string: string): string;
fromDecimal(value: string | number): string;
fromUtf8(string: string): string;
fromWei(value: string | BigNumber, unit?: Unit): string;
hexToBytes(hex: Hex): number[];
hexToNumber(hex: Hex, bigIntOnOverflow?: boolean): number | string;
hexToNumberString(hex: Hex): string;
hexToString(hex: Hex): string;
hexToUtf8(string: string): string;
keccak256(value: string | BigNumber): string;
padLeft(value: string | number, characterAmount: number, sign?: string): string;
padRight(string: string | number, characterAmount: number, sign?: string): string;
leftPad(string: string | number, characterAmount: number, sign?: string): string;
rightPad(string: string | number, characterAmount: number, sign?: string): string;
sha3(value: string | BigNumber): string | null;
randomHex(bytesSize: number): string;
utf8ToHex(string: string): string;
stringToHex(string: string): string;
toChecksumAddress(address: string, chainId?: number): string;
toDecimal(hex: Hex): number;
toHex(value: number | string | BigNumber): string;
toUtf8(string: string): string;
toWei(val: BigNumber, unit?: Unit): BigNumber;
toWei(val: string, unit?: Unit): string;
isBloom(bloom: string): boolean;
isInBloom(bloom: string, value: string | Uint8Array): boolean;
isUserEthereumAddressInBloom(bloom: string, ethereumAddress: string): boolean;
isContractAddressInBloom(bloom: string, contractAddress: string): boolean;
isTopicInBloom(bloom: string, topic: string): boolean;
isTopic(topic: string): boolean;
_jsonInterfaceMethodToString(abiItem: AbiItem): string;
soliditySha3(...val: Mixed[]): string | null;
soliditySha3Raw(...val: Mixed[]): string;
encodePacked(...val: Mixed[]): string | null;
getUnitValue(unit: Unit): string;
unitMap(): Units;
testAddress(bloom: string, address: string): boolean;
testTopic(bloom: string, topic: string): boolean;
getSignatureParameters(signature: string): {
r: string;
s: string;
v: number;
};
stripHexPrefix(str: string): string;
toNumber(value: number | string | BigNumber, bigIntOnOverflow?: boolean): number | string;
}
export interface HttpHeader {
name: string;
value: string;
}
export interface HttpProviderOptions {
keepAlive?: boolean;
timeout?: number;
headers?: HttpHeader[];
withCredentials?: boolean;
agent?: HttpAgent;
}
export interface HttpAgent {
http?: string;
https?: string;
baseUrl?: string;
}
export interface HttpProvider {
constructor(host: string, options?: HttpProviderOptions): any;
host: string;
connected: boolean;
supportsSubscriptions(): boolean;
send(payload: any, callback: (error: Error | null, result?: any) => void): void;
disconnect(): boolean;
}
export interface ReconnectOptions {
auto?: boolean;
delay?: number;
maxAttempts?: number;
onTimeout?: boolean;
}
export interface WebsocketProviderOptions {
host?: string;
timeout?: number;
reconnectDelay?: number;
headers?: any;
protocol?: string;
clientConfig?: object;
requestOptions?: any;
origin?: string;
reconnect?: ReconnectOptions;
}
export interface JsonRpcPayload {
jsonrpc: string;
method: string;
params?: any[];
id?: string | number;
}
export interface RequestItem {
payload: JsonRpcPayload;
callback: (error: any, result: any) => void;
}
export interface JsonRpcResponse {
jsonrpc: string;
id: string | number;
result?: any;
error?: {
readonly code?: number;
readonly data?: unknown;
readonly message: string;
};
}
export interface WebsocketProvider {
constructor(host: string, options?: WebsocketProviderOptions): any;
isConnecting(): boolean;
requestQueue: Map;
responseQueue: Map;
connected: boolean;
connection: any;
supportsSubscriptions(): boolean;
send(payload: JsonRpcPayload, callback: (error: Error | null, result?: JsonRpcResponse) => void): void;
on(type: string, callback: () => void): void;
once(type: string, callback: () => void): void;
removeListener(type: string, callback: () => void): void;
removeAllListeners(type: string): void;
reset(): void;
disconnect(code?: number, reason?: string): void;
connect(): void;
reconnect(): void;
}
export interface RequestArguments {
method: string;
params?: any;
[key: string]: any;
}
export interface AbstractProvider {
sendAsync(payload: JsonRpcPayload, callback?: (error: Error | null, result?: JsonRpcResponse) => Promise | void): void;
send?(payload: JsonRpcPayload, callback: (error: Error | null, result?: JsonRpcResponse) => unknown): void;
request?(args: RequestArguments): Promise;
connected?: boolean;
}
export type provider = HttpProvider | WebsocketProvider | AbstractProvider | string | null;
export interface AbiInput {
name: string;
type: string;
indexed?: boolean;
components?: AbiInput[];
internalType?: string;
}
export interface AbiOutput {
name: string;
type: string;
components?: AbiOutput[];
internalType?: string;
}
export type AbiType = 'function' | 'constructor' | 'event' | 'fallback' | 'receive';
export type StateMutabilityType = 'pure' | 'view' | 'nonpayable' | 'payable';
export interface AbiItem {
anonymous?: boolean;
constant?: boolean;
inputs?: AbiInput[];
name?: string;
outputs?: AbiOutput[];
payable?: boolean;
stateMutability?: StateMutabilityType;
type: AbiType;
gas?: number;
}
export interface ContractOptions {
from?: string;
gasPrice?: string;
gas?: number;
data?: string;
}
export type chain = 'mainnet' | 'goerli' | 'kovan' | 'rinkeby' | 'ropsten';
export type hardfork = 'chainstart' | 'homestead' | 'dao' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople' | 'petersburg' | 'istanbul';
export interface CustomChainParams {
name?: string;
networkId: number;
chainId: number;
}
export interface Common {
customChain: CustomChainParams;
baseChain?: chain;
hardfork?: hardfork;
}
export interface TransactionConfig {
from?: string | number;
to?: string;
value?: number | string | BigNumber;
gas?: number | string;
gasPrice?: number | string | BigNumber;
maxPriorityFeePerGas?: number | string | BigNumber;
maxFeePerGas?: number | string | BigNumber;
data?: string;
nonce?: number;
chainId?: number;
common?: Common;
chain?: string;
hardfork?: string;
}
export interface SignedTransaction {
messageHash?: string;
r: string;
s: string;
v: string;
rawTransaction?: string;
transactionHash?: string;
}
export interface Sign extends SignedTransaction {
message: string;
signature: string;
}
export interface EncryptedKeystoreV3Json {
version: number;
id: string;
address: string;
crypto: {
ciphertext: string;
cipherparams: {
iv: string;
};
cipher: string;
kdf: string;
kdfparams: {
dklen: number;
salt: string;
n: number;
r: number;
p: number;
};
mac: string;
};
}
export interface Account {
address: string;
privateKey: string;
signTransaction: (transactionConfig: TransactionConfig) => Promise;
sign: (data: string) => Sign;
encrypt: (password: string) => EncryptedKeystoreV3Json;
}
export interface SignatureObject {
messageHash: string;
r: string;
s: string;
v: string;
}
export interface AddedAccount extends Account {
index: number;
}
export interface AddAccount {
address: string;
privateKey: string;
}
export interface WalletBase {
constructor(accounts: Accounts): any;
length: number;
defaultKeyName: string;
[key: number]: Account;
create(numberOfAccounts: number, entropy?: string): WalletBase;
add(account: string | AddAccount): AddedAccount;
remove(account: string | number): boolean;
clear(): WalletBase;
encrypt(password: string): EncryptedKeystoreV3Json[];
decrypt(keystoreArray: EncryptedKeystoreV3Json[], password: string): WalletBase;
save(password: string, keyName?: string): boolean;
load(password: string, keyName?: string): WalletBase;
}
export interface Accounts {
constructor(provider?: provider): any;
readonly givenProvider: any;
readonly currentProvider: provider;
setProvider(provider: provider): boolean;
create(entropy?: string): Account;
privateKeyToAccount(privateKey: string, ignoreLength?: boolean): Account;
signTransaction(transactionConfig: TransactionConfig, privateKey: string): Promise;
recoverTransaction(signature: string): string;
hashMessage(message: string): string;
sign(data: string, privateKey: string): Sign;
recover(signatureObject: SignatureObject): string;
recover(message: string, signature: string, preFixed?: boolean): string;
recover(message: string, v: string, r: string, s: string, preFixed?: boolean): string;
encrypt(privateKey: string, password: string): EncryptedKeystoreV3Json;
decrypt(keystoreJsonV3: EncryptedKeystoreV3Json, password: string): Account;
wallet: WalletBase;
}
export type BlockNumber = bigint | string | number | BigNumber | 'latest' | 'pending' | 'earliest' | 'genesis' | 'finalized' | 'safe';
export interface Options extends ContractOptions {
address: string;
jsonInterface: AbiItem[];
}
export interface DeployOptions {
data: string;
arguments?: any[];
}
export interface SendOptions {
from: string;
gasPrice?: string;
gas?: number;
value?: number | string | BigNumber;
nonce?: number;
}
export interface EventLog {
event: string;
address: string;
returnValues: any;
logIndex: bigint;
transactionIndex: bigint;
transactionHash: string;
blockHash: string;
blockNumber: bigint;
raw?: {
data: string;
topics: any[];
};
}
export interface Log {
address: string;
data: string;
topics: string[];
logIndex: bigint;
transactionIndex: bigint;
transactionHash: string;
blockHash: string;
blockNumber: bigint;
removed: boolean;
}
export interface TransactionReceipt {
status: bigint;
transactionHash: string;
transactionIndex: bigint;
blockHash: string;
blockNumber: bigint;
from: string;
to: string;
contractAddress?: string;
cumulativeGasUsed: bigint;
gasUsed: bigint;
effectiveGasPrice: bigint;
logs: Log[];
logsBloom: string;
events?: {
[eventName: string]: EventLog;
};
}
export interface ConfirmationObject {
confirmationNumber: bigint;
receipt: TransactionReceipt;
latestBlockHash: string;
}
export interface PromiEvent extends Promise {
once(type: 'sending', handler: (payload: object) => void): PromiEvent;
once(type: 'sent', handler: (payload: object) => void): PromiEvent;
once(type: 'transactionHash', handler: (transactionHash: string) => void): PromiEvent;
once(type: 'receipt', handler: (receipt: TransactionReceipt) => void): PromiEvent;
once(type: 'confirmation', handler: (confirmationObject: ConfirmationObject) => void): PromiEvent;
once(type: 'error', handler: (error: Error) => void): PromiEvent;
once(type: 'error' | 'confirmation' | 'receipt' | 'transactionHash' | 'sent' | 'sending', handler: (error: Error | TransactionReceipt | string | object) => void): PromiEvent;
on(type: 'sending', handler: (payload: object) => void): PromiEvent;
on(type: 'sent', handler: (payload: object) => void): PromiEvent;
on(type: 'transactionHash', handler: (receipt: string) => void): PromiEvent;
on(type: 'receipt', handler: (receipt: TransactionReceipt) => void): PromiEvent;
on(type: 'confirmation', handler: (confirmationObject: ConfirmationObject) => void): PromiEvent;
on(type: 'error', handler: (error: Error) => void): PromiEvent;
on(type: 'error' | 'confirmation' | 'receipt' | 'transactionHash' | 'sent' | 'sending', handler: (error: Error | TransactionReceipt | string | object) => void): PromiEvent;
}
export interface CallOptions {
from?: string;
gasPrice?: string;
gas?: bigint;
}
export interface EstimateGasOptions {
from?: string;
gas?: bigint;
value?: number | string | BigNumber;
}
export interface ContractSendMethod {
send(options: SendOptions): PromiEvent;
call(options?: CallOptions): Promise;
estimateGas(options: EstimateGasOptions): Promise;
estimateGas(): Promise;
estimateGas(options: EstimateGasOptions): Promise;
estimateGas(options: EstimateGasOptions): Promise;
estimateGas(): Promise;
encodeABI(): string;
}
export interface EventData {
returnValues: {
[key: string]: any;
};
raw: {
data: string;
topics: string[];
};
event: string;
signature: string;
logIndex: bigint;
transactionIndex: bigint;
transactionHash: string;
blockHash: string;
blockNumber: bigint;
address: string;
}
export interface Filter {
[key: string]: number | string | string[] | number[];
}
export interface LogsOptions {
fromBlock?: BlockNumber;
address?: string | string[];
topics?: Array;
}
export interface EventOptions extends LogsOptions {
filter?: Filter;
}
export interface PastLogsOptions extends LogsOptions {
toBlock?: BlockNumber;
}
export interface PastEventOptions extends PastLogsOptions {
filter?: Filter;
}
export interface Contract {
constructor(jsonInterface: AbiItem[], address?: string, options?: ContractOptions): any;
setProvider(provider: provider, accounts?: Accounts): void;
defaultAccount: string | null;
defaultBlock: BlockNumber;
defaultCommon: Common;
defaultHardfork: hardfork;
defaultChain: chain;
transactionPollingTimeout: number;
transactionConfirmationBlocks: number;
transactionBlockTimeout: number;
handleRevert: boolean;
options: Options;
clone(): Contract;
deploy(options: DeployOptions): ContractSendMethod;
methods: any;
once(event: string, callback: (error: Error, event: EventData) => void): void;
once(event: string, options: EventOptions, callback: (error: Error, event: EventData) => void): void;
events: any;
getPastEvents(event: string): Promise;
getPastEvents(event: string, options: PastEventOptions): Promise;
getPastEvents(event: string, options: PastEventOptions): Promise;
getPastEvents(event: string): Promise;
}
export interface IndirectOptions {
institution: string;
identifier: string;
}
export interface Iban {
constructor(iban: string): any;
toAddress(iban: string): string;
toIban(address: string): string;
fromAddress(address: string): Iban;
fromBban(bban: string): Iban;
createIndirect(options: IndirectOptions): Iban;
isValid(iban: string): boolean;
isValid(): boolean;
isDirect(): boolean;
isIndirect(): boolean;
checksum(): string;
institution(): string;
client(): string;
toAddress(): string;
toString(): string;
}
export interface Method {
name: string;
call: string;
params?: number;
inputFormatter?: Array<(() => void) | null>;
outputFormatter?: () => void;
transformPayload?: () => void;
extraFormatters?: any;
defaultBlock?: string;
defaultAccount?: string | null;
abiCoder?: any;
handleRevert?: boolean;
}
export interface BatchRequest {
constructor(): any;
add(method: Method): void;
execute(): void;
}
export interface Extension {
property?: string;
methods: Method[];
}
export interface RLPEncodedTransaction {
raw: string;
tx: {
nonce: string;
gasPrice: string;
gas: string;
to: string;
value: string;
input: string;
r: string;
s: string;
v: string;
hash: string;
};
}
export interface Personal {
constructor(provider?: provider): any;
readonly givenProvider: any;
readonly currentProvider: provider;
defaultAccount: string | null;
defaultBlock: string | number;
BatchRequest: new () => BatchRequest;
setProvider(provider: provider): boolean;
extend(extension: Extension): any;
newAccount(password: string): Promise;
sign(dataToSign: string, address: string, password: string): Promise;
ecRecover(dataThatWasSigned: string, signature: string): Promise;
signTransaction(transactionConfig: TransactionConfig, password: string): Promise;
sendTransaction(transactionConfig: TransactionConfig, password: string): Promise;
unlockAccount(address: string, password: string, unlockDuration: number): Promise;
lockAccount(address: string): Promise;
getAccounts(): Promise;
importRawKey(privateKey: string, password: string): Promise;
}
export interface AbiCoder {
encodeFunctionSignature(functionName: string | AbiItem): string;
encodeEventSignature(functionName: string | AbiItem): string;
encodeParameter(type: any, parameter: any): string;
encodeParameters(types: any[], paramaters: any[]): string;
encodeFunctionCall(abiItem: AbiItem, params: string[]): string;
decodeParameter(type: any, hex: string): {
[key: string]: any;
};
decodeParameters(types: any[], hex: string): {
[key: string]: any;
};
decodeLog(inputs: AbiInput[], hex: string, topics: string[]): {
[key: string]: string;
};
}
export interface Providers {
HttpProvider: new (host: string, options?: HttpProviderOptions) => HttpProvider;
WebsocketProvider: new (host: string, options?: WebsocketProviderOptions) => WebsocketProvider;
IpcProvider: new (path: string, net: any) => any;
}
export interface Network {
constructor(provider?: provider): any;
readonly givenProvider: any;
readonly currentProvider: provider;
readonly providers: Providers;
BatchRequest: new () => BatchRequest;
setProvider(provider: provider): boolean;
extend(extension: Extension): any;
getNetworkType(): Promise;
}
export interface SubscriptionOptions {
subscription: string;
type: string;
requestManager: any;
}
export interface Subscription {
constructor(options: SubscriptionOptions): any;
id: string;
options: SubscriptionOptions;
callback: () => void;
arguments: any;
lastBlock: number;
subscribe(callback?: (error: Error, result: T) => void): Subscription;
unsubscribe(callback?: (error: Error, result: boolean) => void): Promise;
on(type: 'data', handler: (data: T) => void): Subscription;
on(type: 'changed', handler: (data: T) => void): Subscription;
on(type: 'connected', handler: (subscriptionId: string) => void): Subscription;
on(type: 'error', handler: (data: Error) => void): Subscription;
}
export interface Syncing {
StartingBlock: number;
CurrentBlock: number;
HighestBlock: number;
KnownStates: number;
PulledStates: number;
}
export interface BlockHeader {
number: bigint;
hash: string;
parentHash: string;
nonce: string;
sha3Uncles: string;
logsBloom: string;
transactionsRoot: string;
stateRoot: string;
receiptsRoot: string;
miner: string;
extraData: string;
gasLimit: bigint;
gasUsed: bigint;
timestamp: bigint;
baseFeePerGas?: bigint;
}
export interface FeeHistoryResult {
baseFeePerGas: string[];
gasUsedRatio: number[];
oldestBlock: bigint;
reward: string[][];
}
export interface BlockTransactionBase extends BlockHeader {
size: bigint;
difficulty: bigint;
totalDifficulty: bigint;
uncles: string[];
}
export interface BlockTransactionString extends BlockTransactionBase {
transactions: string[];
}
export interface AccessTuple {
address: string;
storageKeys: string[];
}
export type AccessList = AccessTuple[];
export interface Transaction {
hash: string;
nonce: bigint;
blockHash: string | null;
blockNumber: bigint | null;
transactionIndex: bigint | null;
from: string;
to: string | null;
value: string;
gasPrice: string;
maxPriorityFeePerGas?: bigint | string | BigNumber;
maxFeePerGas?: bigint | string | BigNumber;
gas: bigint;
input: string;
chainId?: string;
accessList?: AccessList;
v?: string;
r?: string;
s?: string;
}
export interface BlockTransactionObject extends BlockTransactionBase {
transactions: Transaction[];
}
export interface CreateAccessList {
accessList: AccessTuple[];
error?: string;
gasUsed: string;
}
export interface Eth {
constructor(provider?: provider): any;
Contract: new (jsonInterface: AbiItem[] | AbiItem, address?: string, options?: ContractOptions) => Contract;
Iban: new (iban: string) => Iban;
personal: Personal;
accounts: Accounts;
ens: any;
abi: AbiCoder;
net: Network;
readonly givenProvider: any;
defaultAccount: string | null;
defaultBlock: BlockNumber;
defaultCommon: Common;
defaultHardfork: hardfork;
defaultChain: chain;
transactionPollingTimeout: number;
transactionConfirmationBlocks: number;
transactionBlockTimeout: number;
handleRevert: boolean;
readonly currentProvider: provider;
setProvider(provider: provider): boolean;
BatchRequest: new () => BatchRequest;
readonly providers: Providers;
extend(extension: Extension): any;
clearSubscriptions(callback: (error: Error, result: boolean) => void): void;
subscribe(type: 'logs', options: LogsOptions): Subscription;
subscribe(type: 'syncing'): Subscription;
subscribe(type: 'newBlockHeaders'): Subscription;
subscribe(type: 'pendingTransactions'): Subscription;
getProtocolVersion(): Promise;
isSyncing(): Promise;
getCoinbase(): Promise;
isMining(): Promise;
getHashRate(): Promise;
getNodeInfo(): Promise;
getChainId(): Promise;
getGasPrice(): Promise;
getFeeHistory(blockCount: number | BigNumber | BigNumber | string, lastBlock: number | BigNumber | BigNumber | string, rewardPercentiles: number[]): Promise;
getAccounts(): Promise;
getBlockNumber(): Promise;
getBalance(address: string): Promise;
getBalance(address: string, defaultBlock: BlockNumber): Promise;
getBalance(address: string): Promise;
getBalance(address: string, defaultBlock: BlockNumber): Promise;
getStorageAt(address: string, position: number | BigNumber | string): Promise;
getStorageAt(address: string, position: number | BigNumber | string, defaultBlock: BlockNumber): Promise;
getStorageAt(address: string, position: number | BigNumber | string): Promise;
getStorageAt(address: string, position: number | BigNumber | string, defaultBlock: BlockNumber): Promise;
getCode(address: string): Promise;
getCode(address: string, defaultBlock: BlockNumber): Promise;
getCode(address: string): Promise;
getCode(address: string, defaultBlock: BlockNumber): Promise;
getBlock(blockHashOrBlockNumber: BlockNumber | string): Promise;
getBlock(blockHashOrBlockNumber: BlockNumber | string, returnTransactionObjects: false): Promise;
getBlock(blockHashOrBlockNumber: BlockNumber | string, returnTransactionObjects: true): Promise;
getBlock(blockHashOrBlockNumber: BlockNumber | string): Promise;
getBlock(blockHashOrBlockNumber: BlockNumber | string, returnTransactionObjects: false): Promise;
getBlock(blockHashOrBlockNumber: BlockNumber | string, returnTransactionObjects: true): Promise;
getBlockTransactionCount(blockHashOrBlockNumber: BlockNumber | string): Promise;
getBlockUncleCount(blockHashOrBlockNumber: BlockNumber | string): Promise;
getUncle(blockHashOrBlockNumber: BlockNumber | string, uncleIndex: number | string | BigNumber): Promise;
getUncle(blockHashOrBlockNumber: BlockNumber | string, uncleIndex: number | string | BigNumber, returnTransactionObjects: boolean): Promise;
getUncle(blockHashOrBlockNumber: BlockNumber | string, uncleIndex: number | string | BigNumber): Promise;
getUncle(blockHashOrBlockNumber: BlockNumber | string, uncleIndex: number | string | BigNumber, returnTransactionObjects: boolean): Promise;
getTransaction(transactionHash: string): Promise;
getPendingTransactions(): Promise;
getTransactionFromBlock(blockHashOrBlockNumber: BlockNumber | string, indexNumber: number | string | BigNumber): Promise;
getTransactionReceipt(hash: string): Promise;
getTransactionCount(address: string): Promise;
getTransactionCount(address: string, defaultBlock: BlockNumber): Promise;
getTransactionCount(address: string): Promise;
getTransactionCount(address: string, defaultBlock: BlockNumber): Promise;
sendTransaction(transactionConfig: TransactionConfig): PromiEvent;
sendSignedTransaction(signedTransactionData: string): PromiEvent;
sign(dataToSign: string, address: string | number): Promise;
signTransaction(transactionConfig: TransactionConfig): Promise;
signTransaction(transactionConfig: TransactionConfig, address: string): Promise;
signTransaction(transactionConfig: TransactionConfig, address: string): Promise;
call(transactionConfig: TransactionConfig): Promise;
call(transactionConfig: TransactionConfig, defaultBlock?: BlockNumber): Promise;
call(transactionConfig: TransactionConfig): Promise;
call(transactionConfig: TransactionConfig, defaultBlock: BlockNumber): Promise;
estimateGas(transactionConfig: TransactionConfig): Promise;
createAccessList(transactionConfig: TransactionConfig): Promise;
createAccessList(transactionConfig: TransactionConfig, defaultBlock: BlockNumber): Promise;
getPastLogs(options: PastLogsOptions): Promise;
}
export interface IWeb3 {
eth: Eth;
utils: Utils;
currentProvider(): any;
setProvider(provider: any): any;
}
export class Web3 implements IWeb3 {
readonly eth: Eth;
readonly utils: Utils;
static utils: Utils;
constructor(provider?: any);
get currentProvider(): any;
setProvider(provider: any): boolean;
}
}
declare module "contracts/ERC1155/ERC1155.json" {
const _default: {
abi: ({
inputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
name?: undefined;
outputs?: undefined;
} | {
anonymous: boolean;
inputs: {
indexed: boolean;
internalType: string;
name: string;
type: string;
}[];
name: string;
type: string;
stateMutability?: undefined;
outputs?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
})[];
bytecode: string;
};
export default _default;
}
declare module "contracts/ERC1155/ERC1155" {
import { IWallet, Contract as _Contract, TransactionReceipt, BigNumber, Event, TransactionOptions } from "@ijstech/eth-contract";
export interface IBalanceOfParams {
account: string;
id: number | BigNumber;
}
export interface IBalanceOfBatchParams {
accounts: string[];
ids: (number | BigNumber)[];
}
export interface IIsApprovedForAllParams {
account: string;
operator: string;
}
export interface ISafeBatchTransferFromParams {
from: string;
to: string;
ids: (number | BigNumber)[];
amounts: (number | BigNumber)[];
data: string;
}
export interface ISafeTransferFromParams {
from: string;
to: string;
id: number | BigNumber;
amount: number | BigNumber;
data: string;
}
export interface ISetApprovalForAllParams {
operator: string;
approved: boolean;
}
export class ERC1155 extends _Contract {
static _abi: any;
constructor(wallet: IWallet, address?: string);
deploy(uri: string, options?: TransactionOptions): Promise;
parseApprovalForAllEvent(receipt: TransactionReceipt): ERC1155.ApprovalForAllEvent[];
decodeApprovalForAllEvent(event: Event): ERC1155.ApprovalForAllEvent;
parseTransferBatchEvent(receipt: TransactionReceipt): ERC1155.TransferBatchEvent[];
decodeTransferBatchEvent(event: Event): ERC1155.TransferBatchEvent;
parseTransferSingleEvent(receipt: TransactionReceipt): ERC1155.TransferSingleEvent[];
decodeTransferSingleEvent(event: Event): ERC1155.TransferSingleEvent;
parseURIEvent(receipt: TransactionReceipt): ERC1155.URIEvent[];
decodeURIEvent(event: Event): ERC1155.URIEvent;
balanceOf: {
(params: IBalanceOfParams, options?: TransactionOptions): Promise;
};
balanceOfBatch: {
(params: IBalanceOfBatchParams, options?: TransactionOptions): Promise;
};
isApprovedForAll: {
(params: IIsApprovedForAllParams, options?: TransactionOptions): Promise;
};
safeBatchTransferFrom: {
(params: ISafeBatchTransferFromParams, options?: TransactionOptions): Promise;
call: (params: ISafeBatchTransferFromParams, options?: TransactionOptions) => Promise;
txData: (params: ISafeBatchTransferFromParams, options?: TransactionOptions) => Promise;
};
safeTransferFrom: {
(params: ISafeTransferFromParams, options?: TransactionOptions): Promise;
call: (params: ISafeTransferFromParams, options?: TransactionOptions) => Promise;
txData: (params: ISafeTransferFromParams, options?: TransactionOptions) => Promise;
};
setApprovalForAll: {
(params: ISetApprovalForAllParams, options?: TransactionOptions): Promise;
call: (params: ISetApprovalForAllParams, options?: TransactionOptions) => Promise;
txData: (params: ISetApprovalForAllParams, options?: TransactionOptions) => Promise;
};
supportsInterface: {
(interfaceId: string, options?: TransactionOptions): Promise;
};
uri: {
(param1: number | BigNumber, options?: TransactionOptions): Promise;
};
private assign;
}
export module ERC1155 {
interface ApprovalForAllEvent {
account: string;
operator: string;
approved: boolean;
_event: Event;
}
interface TransferBatchEvent {
operator: string;
from: string;
to: string;
ids: BigNumber[];
values: BigNumber[];
_event: Event;
}
interface TransferSingleEvent {
operator: string;
from: string;
to: string;
id: BigNumber;
value: BigNumber;
_event: Event;
}
interface URIEvent {
value: string;
id: BigNumber;
_event: Event;
}
}
}
declare module "contracts/ERC20/ERC20.json" {
const _default_1: {
abi: ({
inputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
name?: undefined;
outputs?: undefined;
} | {
anonymous: boolean;
inputs: {
indexed: boolean;
internalType: string;
name: string;
type: string;
}[];
name: string;
type: string;
stateMutability?: undefined;
outputs?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
})[];
bytecode: string;
};
export default _default_1;
}
declare module "contracts/ERC20/ERC20" {
import { IWallet, Contract as _Contract, TransactionReceipt, BigNumber, Event, TransactionOptions } from "@ijstech/eth-contract";
export interface IDeployParams {
name: string;
symbol: string;
}
export interface IAllowanceParams {
owner: string;
spender: string;
}
export interface IApproveParams {
spender: string;
amount: number | BigNumber;
}
export interface IDecreaseAllowanceParams {
spender: string;
subtractedValue: number | BigNumber;
}
export interface IIncreaseAllowanceParams {
spender: string;
addedValue: number | BigNumber;
}
export interface ITransferParams {
to: string;
amount: number | BigNumber;
}
export interface ITransferFromParams {
from: string;
to: string;
amount: number | BigNumber;
}
export class ERC20 extends _Contract {
static _abi: any;
constructor(wallet: IWallet, address?: string);
deploy(params: IDeployParams, options?: TransactionOptions): Promise;
parseApprovalEvent(receipt: TransactionReceipt): ERC20.ApprovalEvent[];
decodeApprovalEvent(event: Event): ERC20.ApprovalEvent;
parseTransferEvent(receipt: TransactionReceipt): ERC20.TransferEvent[];
decodeTransferEvent(event: Event): ERC20.TransferEvent;
allowance: {
(params: IAllowanceParams, options?: TransactionOptions): Promise;
};
approve: {
(params: IApproveParams, options?: TransactionOptions): Promise;
call: (params: IApproveParams, options?: TransactionOptions) => Promise;
txData: (params: IApproveParams, options?: TransactionOptions) => Promise;
};
balanceOf: {
(account: string, options?: TransactionOptions): Promise;
};
decimals: {
(options?: TransactionOptions): Promise;
};
decreaseAllowance: {
(params: IDecreaseAllowanceParams, options?: TransactionOptions): Promise;
call: (params: IDecreaseAllowanceParams, options?: TransactionOptions) => Promise;
txData: (params: IDecreaseAllowanceParams, options?: TransactionOptions) => Promise;
};
increaseAllowance: {
(params: IIncreaseAllowanceParams, options?: TransactionOptions): Promise;
call: (params: IIncreaseAllowanceParams, options?: TransactionOptions) => Promise;
txData: (params: IIncreaseAllowanceParams, options?: TransactionOptions) => Promise;
};
name: {
(options?: TransactionOptions): Promise;
};
symbol: {
(options?: TransactionOptions): Promise;
};
totalSupply: {
(options?: TransactionOptions): Promise;
};
transfer: {
(params: ITransferParams, options?: TransactionOptions): Promise;
call: (params: ITransferParams, options?: TransactionOptions) => Promise;
txData: (params: ITransferParams, options?: TransactionOptions) => Promise;
};
transferFrom: {
(params: ITransferFromParams, options?: TransactionOptions): Promise;
call: (params: ITransferFromParams, options?: TransactionOptions) => Promise;
txData: (params: ITransferFromParams, options?: TransactionOptions) => Promise;
};
private assign;
}
export module ERC20 {
interface ApprovalEvent {
owner: string;
spender: string;
value: BigNumber;
_event: Event;
}
interface TransferEvent {
from: string;
to: string;
value: BigNumber;
_event: Event;
}
}
}
declare module "contracts/ERC721/ERC721.json" {
const _default_2: {
abi: ({
inputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
name?: undefined;
outputs?: undefined;
} | {
anonymous: boolean;
inputs: {
indexed: boolean;
internalType: string;
name: string;
type: string;
}[];
name: string;
type: string;
stateMutability?: undefined;
outputs?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
})[];
bytecode: string;
};
export default _default_2;
}
declare module "contracts/ERC721/ERC721" {
import { IWallet, Contract as _Contract, TransactionReceipt, BigNumber, Event, TransactionOptions } from "@ijstech/eth-contract";
export interface IDeployParams {
name: string;
symbol: string;
}
export interface IApproveParams {
to: string;
tokenId: number | BigNumber;
}
export interface IIsApprovedForAllParams {
owner: string;
operator: string;
}
export interface ISafeTransferFromParams {
from: string;
to: string;
tokenId: number | BigNumber;
}
export interface ISafeTransferFrom_1Params {
from: string;
to: string;
tokenId: number | BigNumber;
data: string;
}
export interface ISetApprovalForAllParams {
operator: string;
approved: boolean;
}
export interface ITransferFromParams {
from: string;
to: string;
tokenId: number | BigNumber;
}
export class ERC721 extends _Contract {
static _abi: any;
constructor(wallet: IWallet, address?: string);
deploy(params: IDeployParams, options?: TransactionOptions): Promise;
parseApprovalEvent(receipt: TransactionReceipt): ERC721.ApprovalEvent[];
decodeApprovalEvent(event: Event): ERC721.ApprovalEvent;
parseApprovalForAllEvent(receipt: TransactionReceipt): ERC721.ApprovalForAllEvent[];
decodeApprovalForAllEvent(event: Event): ERC721.ApprovalForAllEvent;
parseTransferEvent(receipt: TransactionReceipt): ERC721.TransferEvent[];
decodeTransferEvent(event: Event): ERC721.TransferEvent;
approve: {
(params: IApproveParams, options?: TransactionOptions): Promise;
call: (params: IApproveParams, options?: TransactionOptions) => Promise;
txData: (params: IApproveParams, options?: TransactionOptions) => Promise;
};
balanceOf: {
(owner: string, options?: TransactionOptions): Promise;
};
getApproved: {
(tokenId: number | BigNumber, options?: TransactionOptions): Promise;
};
isApprovedForAll: {
(params: IIsApprovedForAllParams, options?: TransactionOptions): Promise;
};
name: {
(options?: TransactionOptions): Promise;
};
ownerOf: {
(tokenId: number | BigNumber, options?: TransactionOptions): Promise;
};
safeTransferFrom: {
(params: ISafeTransferFromParams, options?: TransactionOptions): Promise;
call: (params: ISafeTransferFromParams, options?: TransactionOptions) => Promise;
txData: (params: ISafeTransferFromParams, options?: TransactionOptions) => Promise;
};
safeTransferFrom_1: {
(params: ISafeTransferFrom_1Params, options?: TransactionOptions): Promise;
call: (params: ISafeTransferFrom_1Params, options?: TransactionOptions) => Promise;
txData: (params: ISafeTransferFrom_1Params, options?: TransactionOptions) => Promise;
};
setApprovalForAll: {
(params: ISetApprovalForAllParams, options?: TransactionOptions): Promise;
call: (params: ISetApprovalForAllParams, options?: TransactionOptions) => Promise;
txData: (params: ISetApprovalForAllParams, options?: TransactionOptions) => Promise;
};
supportsInterface: {
(interfaceId: string, options?: TransactionOptions): Promise;
};
symbol: {
(options?: TransactionOptions): Promise;
};
tokenURI: {
(tokenId: number | BigNumber, options?: TransactionOptions): Promise;
};
transferFrom: {
(params: ITransferFromParams, options?: TransactionOptions): Promise;
call: (params: ITransferFromParams, options?: TransactionOptions) => Promise;
txData: (params: ITransferFromParams, options?: TransactionOptions) => Promise;
};
private assign;
}
export module ERC721 {
interface ApprovalEvent {
owner: string;
approved: string;
tokenId: BigNumber;
_event: Event;
}
interface ApprovalForAllEvent {
owner: string;
operator: string;
approved: boolean;
_event: Event;
}
interface TransferEvent {
from: string;
to: string;
tokenId: BigNumber;
_event: Event;
}
}
}
declare module "contracts/MultiCall/MultiCall.json" {
const _default_3: {
abi: {
inputs: ({
components: {
internalType: string;
name: string;
type: string;
}[];
internalType: string;
name: string;
type: string;
} | {
internalType: string;
name: string;
type: string;
components?: undefined;
})[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
}[];
bytecode: string;
};
export default _default_3;
}
declare module "contracts/MultiCall/MultiCall" {
import { IWallet, Contract as _Contract, TransactionReceipt, BigNumber, TransactionOptions } from "@ijstech/eth-contract";
export interface IMulticallWithGasLimitationParams {
calls: {
to: string;
data: string;
}[];
gasBuffer: number | BigNumber;
}
export class MultiCall extends _Contract {
static _abi: any;
constructor(wallet: IWallet, address?: string);
deploy(options?: TransactionOptions): Promise;
gasLeft: {
(options?: TransactionOptions): Promise;
};
gaslimit: {
(options?: TransactionOptions): Promise;
};
multicall: {
(calls: {
to: string;
data: string;
}[], options?: TransactionOptions): Promise;
call: (calls: {
to: string;
data: string;
}[], options?: TransactionOptions) => Promise;
txData: (calls: {
to: string;
data: string;
}[], options?: TransactionOptions) => Promise;
};
multicallWithGas: {
(calls: {
to: string;
data: string;
}[], options?: TransactionOptions): Promise;
call: (calls: {
to: string;
data: string;
}[], options?: TransactionOptions) => Promise<{
results: string[];
gasUsed: BigNumber[];
}>;
txData: (calls: {
to: string;
data: string;
}[], options?: TransactionOptions) => Promise;
};
multicallWithGasLimitation: {
(params: IMulticallWithGasLimitationParams, options?: TransactionOptions): Promise;
call: (params: IMulticallWithGasLimitationParams, options?: TransactionOptions) => Promise<{
results: string[];
lastSuccessIndex: BigNumber;
}>;
txData: (params: IMulticallWithGasLimitationParams, options?: TransactionOptions) => Promise;
};
private assign;
}
}
///
declare module "@ijstech/eth-wallet/contracts/index.ts" {
export { ERC1155 } from "contracts/ERC1155/ERC1155";
export { ERC20 } from "contracts/ERC20/ERC20";
export { ERC721 } from "contracts/ERC721/ERC721";
export { MultiCall } from "contracts/MultiCall/MultiCall";
}
///
declare module "@ijstech/eth-wallet/contract.ts" {
/*!-----------------------------------------------------------
* Copyright (c) IJS Technologies. All rights reserved.
* Released under dual AGPLv3/commercial license
* https://ijs.network
*-----------------------------------------------------------*/
import { IWallet, TransactionReceipt, Event, IBatchRequestObj } from "@ijstech/eth-wallet/wallet.ts";
import { BigNumber } from 'bignumber.js';
module Contract {
export interface EventType {
name: string;
}
export interface TransactionOptions {
from?: string;
to?: string;
nonce?: number;
gas?: number;
gasLimit?: number;
gasPrice?: BigNumber | number;
data?: string;
value?: BigNumber | number;
}
export interface DeployOptions extends TransactionOptions {
libraries?: {
[file: string]: {
[contract: string]: string;
};
};
}
interface LinkReferences {
[file: string]: {
[contract: string]: {
length: number;
start: number;
}[];
};
}
export class Contract {
wallet: IWallet;
_abi: any;
_bytecode: string;
_linkReferences: LinkReferences;
_address: string;
private _events;
privateKey: string;
private abiHash;
constructor(wallet: IWallet, address?: string, abi?: any, bytecode?: string, linkReferences?: LinkReferences);
at(address: string): Contract;
set address(value: string);
get address(): string;
protected decodeEvents(receipt: TransactionReceipt): any[];
protected parseEvents(receipt: TransactionReceipt, eventName: string): Event[];
get events(): EventType[];
getAbiEvents(): any;
getAbiTopics(eventNames?: string[]): any[];
scanEvents(fromBlock: number, toBlock: number | string, eventNames?: string[]): Promise;
batchCall(batchObj: IBatchRequestObj, key: string, methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
protected txData(methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
protected call(methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
private _send;
getDeployBytecode(options?: number | BigNumber | DeployOptions): string;
protected __deploy(params?: any[], options?: number | BigNumber | DeployOptions): Promise;
protected send(methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
protected _deploy(...params: any[]): Promise;
protected methods(methodName: string, ...params: any[]): Promise;
}
export {};
}
export = Contract;
}
///
declare module "@ijstech/eth-wallet/types.ts" {
/*!-----------------------------------------------------------
* Copyright (c) IJS Technologies. All rights reserved.
* Released under dual AGPLv3/commercial license
* https://ijs.network
*-----------------------------------------------------------*/
export interface MessageTypeProperty {
name: string;
type: string;
}
export type EIP712TypeMap = {
[type: string]: MessageTypeProperty[];
};
export interface IEIP712Domain {
name: string;
version: string;
chainId: number;
verifyingContract: string;
}
export enum SignTypedDataVersion {
V1 = "V1",
V3 = "V3",
V4 = "V4"
}
export interface MessageTypes {
EIP712Domain: MessageTypeProperty[];
[additionalProperties: string]: MessageTypeProperty[];
}
export interface TypedMessage {
types: T;
primaryType: keyof T;
domain: {
name?: string;
version?: string;
chainId?: number;
verifyingContract?: string;
salt?: ArrayBuffer;
};
message: Record;
}
export interface IAbiDefinition {
_abi: any;
[key: string]: any;
}
export interface ITokenObject {
address?: string;
name: string;
decimals: number;
symbol: string;
}
namespace nacl {
interface BoxKeyPair {
publicKey: Uint8Array;
secretKey: Uint8Array;
}
interface SignKeyPair {
publicKey: Uint8Array;
secretKey: Uint8Array;
}
interface secretbox {
(msg: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;
open(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array | null;
readonly keyLength: number;
readonly nonceLength: number;
readonly overheadLength: number;
}
interface scalarMult {
(n: Uint8Array, p: Uint8Array): Uint8Array;
base(n: Uint8Array): Uint8Array;
readonly scalarLength: number;
readonly groupElementLength: number;
}
namespace boxProps {
interface open {
(msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array | null;
after(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array | null;
}
interface keyPair {
(): BoxKeyPair;
fromSecretKey(secretKey: Uint8Array): BoxKeyPair;
}
}
interface box {
(msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array;
before(publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array;
after(msg: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;
open: boxProps.open;
keyPair: boxProps.keyPair;
readonly publicKeyLength: number;
readonly secretKeyLength: number;
readonly sharedKeyLength: number;
readonly nonceLength: number;
readonly overheadLength: number;
}
namespace signProps {
interface detached {
(msg: Uint8Array, secretKey: Uint8Array): Uint8Array;
verify(msg: Uint8Array, sig: Uint8Array, publicKey: Uint8Array): boolean;
}
interface keyPair {
(): SignKeyPair;
fromSecretKey(secretKey: Uint8Array): SignKeyPair;
fromSeed(secretKey: Uint8Array): SignKeyPair;
}
}
interface sign {
(msg: Uint8Array, secretKey: Uint8Array): Uint8Array;
open(signedMsg: Uint8Array, publicKey: Uint8Array): Uint8Array | null;
detached: signProps.detached;
keyPair: signProps.keyPair;
readonly publicKeyLength: number;
readonly secretKeyLength: number;
readonly seedLength: number;
readonly signatureLength: number;
}
interface hash {
(msg: Uint8Array): Uint8Array;
readonly hashLength: number;
}
}
export interface INacl {
randomBytes(n: number): Uint8Array;
secretbox: nacl.secretbox;
scalarMult: nacl.scalarMult;
box: nacl.box;
sign: nacl.sign;
hash: nacl.hash;
verify(x: Uint8Array, y: Uint8Array): boolean;
setPRNG(fn: (x: Uint8Array, n: number) => void): void;
}
}
///
declare module "@ijstech/eth-wallet/constants.ts" {
export const EIP712DomainAbi: {
name: string;
type: string;
}[];
export const TYPED_MESSAGE_SCHEMA: {
type: string;
properties: {
types: {
type: string;
additionalProperties: {
type: string;
items: {
type: string;
properties: {
name: {
type: string;
};
type: {
type: string;
};
};
required: string[];
};
};
};
primaryType: {
type: string;
};
domain: {
type: string;
};
message: {
type: string;
};
};
required: string[];
};
export enum ClientWalletEvent {
AccountsChanged = "accountsChanged",
ChainChanged = "chainChanged",
Connect = "connect",
Disconnect = "disconnect"
}
export enum RpcWalletEvent {
Connected = "connected",
Disconnected = "disconnected",
ChainChanged = "chainChanged"
}
}
///
declare module "@ijstech/eth-wallet/utils.ts" {
/*!-----------------------------------------------------------
* Copyright (c) IJS Technologies. All rights reserved.
* Released under dual AGPLv3/commercial license
* https://ijs.network
*-----------------------------------------------------------*/
import { BigNumber } from "bignumber.js";
import { EIP712TypeMap, IEIP712Domain, MessageTypes, TypedMessage } from "@ijstech/eth-wallet/types.ts";
import { ISendTxEventsOptions } from "@ijstech/eth-wallet/wallet.ts";
export function sleep(millisecond: number): Promise;
export function numberToBytes32(value: number | BigNumber, prefix?: boolean): string;
export function padLeft(string: string, chars: number, sign?: string): string;
export function padRight(string: string, chars: number, sign?: string): string;
type stringArray = string | _stringArray;
interface _stringArray extends Array {
}
export function stringToBytes32(value: string | stringArray): string | string[];
export function stringToBytes(value: string | stringArray, nByte?: number): string | string[];
export function addressToBytes32(value: string, prefix?: boolean): string;
export function bytes32ToAddress(value: string): string;
export function bytes32ToString(value: string): string;
export function addressToBytes32Right(value: string, prefix?: boolean): string;
export function toNumber(value: string | number | BigNumber | bigint): number;
export function toDecimals(value: BigNumber | number | string, decimals?: number): BigNumber;
export function fromDecimals(value: BigNumber | number | string, decimals?: number): BigNumber;
export function toString(value: any): any;
export const nullAddress = "0x0000000000000000000000000000000000000000";
export function constructTypedMessageData(domain: IEIP712Domain, customTypes: EIP712TypeMap, primaryType: string, message: Record): TypedMessage;
export function soliditySha3(...val: any[]): any;
export function toChecksumAddress(address: string): any;
export function registerSendTxEvents(sendTxEventHandlers: ISendTxEventsOptions): void;
export function uint8ArrayToHex(byteArray: Uint8Array): string;
export function stringToUnicodeHex(str: string): string;
export function hexToString(hex: string): string;
}
///
declare module "@ijstech/eth-wallet/contracts/erc20.ts" {
/*!-----------------------------------------------------------
* Copyright (c) IJS Technologies. All rights reserved.
* Released under dual AGPLv3/commercial license
* https://ijs.network
*-----------------------------------------------------------*/
import { IWallet, TransactionReceipt, Event } from "@ijstech/eth-wallet/wallet.ts";
import { Contract } from "@ijstech/eth-wallet/contract.ts";
import { BigNumber } from 'bignumber.js';
export class Erc20 extends Contract {
private _decimals;
constructor(wallet: IWallet, address?: string, decimals?: number);
deploy(params: {
name: string;
symbol: string;
minter?: string;
cap?: number | BigNumber;
}): Promise;
parseApprovalEvent(receipt: TransactionReceipt): Erc20.ApprovalEvent[];
decodeApprovalEvent(event: Event): Erc20.ApprovalEvent;
parseTransferEvent(receipt: TransactionReceipt): Erc20.TransferEvent[];
decodeTransferEvent(event: Event): Erc20.TransferEvent;
allowance(params: {
owner: string;
spender: string;
}): Promise;
approve(params: {
spender: string;
amount: number | BigNumber;
}): Promise;
get balance(): Promise;
balanceOf(address: string): Promise;
get cap(): Promise;
get decimals(): Promise;
mint(params: {
address: string;
amount: number | BigNumber;
}): Promise;
minter(): Promise;
get name(): Promise;
get symbol(): Promise;
get totalSupply(): Promise;
transfer(params: {
address: string;
amount: number | BigNumber;
}): Promise;
}
export module Erc20 {
interface ApprovalEvent {
owner: string;
spender: string;
value: BigNumber;
_event: Event;
}
interface TransferEvent {
from: string;
to: string;
value: BigNumber;
_event: Event;
}
}
}
///
declare module "@ijstech/eth-wallet/eventBus.ts" {
export interface IEventBusRegistry {
id: number;
event: string;
unregister: () => void;
}
export interface ICallable {
[key: string]: Function;
}
export interface ISubscriber {
[key: string]: ICallable;
}
export interface IEventBus {
dispatch(event: string, arg?: T): void;
register(sender: any, event: string, callback: Function): IEventBusRegistry;
}
export class EventBus implements IEventBus {
private subscribers;
private static nextId;
private static instance?;
private idEventMap;
private constructor();
static getInstance(): EventBus;
dispatch(event: string, arg?: T): void;
register(sender: any, event: string, callback: Function): IEventBusRegistry;
unregister(id: number): void;
private getNextId;
}
}
///
declare module "@ijstech/eth-wallet/providers.json.ts" {
const _default_4: {
MetaMask: {
displayName: string;
image: string;
homepage: string;
};
Web3Modal: {
displayName: string;
image: string;
};
};
export default _default_4;
}
declare module "ethers" {
export interface IEthers {
keccak256(data: Uint8Array): string;
toUtf8Bytes(data: string): Uint8Array;
toUtf8String(data: string): string;
isHexString(value: string): boolean;
getAddress(address: string): string;
isAddress(address: string): boolean;
hexlify(data: Uint8Array): string;
verifyMessage(message: string, signature: string): string;
verifyTypedData(domain: any, types: any, value: any, signature: string): string;
formatUnits(value: string, unit: string): string;
formatEther(value: string): string;
parseUnits(value: string, unit?: string): string;
solidityPackedKeccak256(types: string[], values: any[]): string;
JsonRpcProvider: new (url: string) => IEthersProvider;
BrowserProvider: new (provider: any) => IEthersProvider;
Wallet: {
new (privateKey: string, provider?: IEthersProvider): IEthersWallet;
createRandom(): IEthersWallet;
};
Interface: new (abi: any[]) => IEthersInterface;
Contract: new (address: string, abi: any[], provider: IEthersProvider) => IEthersContract;
ContractFactory: new (abi: any[], bytecode: string, signer: IEthersWallet) => IEthersContractFactory;
AbiCoder: {
defaultAbiCoder(): IEthersAbiCoder;
};
}
export interface IEthersProvider {
getBlock(blockHashOrBlockNumber: string | number, includeTransactions?: boolean): Promise;
getBlockNumber(): Promise;
getFeeData(): Promise<{
gasPrice: string;
}>;
getLogs(filter: any): Promise;
getTransaction(transactionHash: string): Promise;
getTransactionReceipt(transactionHash: string): Promise;
estimateGas(transaction: any): Promise;
call(transaction: any): Promise;
send(method: string, params: any[]): Promise;
broadcastTransaction(signedTransaction: string): Promise;
listAccounts(): Promise;
getBalance(address: string): Promise;
}
export interface IEthersWallet {
address: string;
privateKey: string;
signMessage(message: string): Promise;
signTransaction(transaction: any): Promise;
sendTransaction(transaction: any): Promise;
}
export interface IEthersInterface {
encodeFunctionData(functionName: string, params: any[]): string;
decodeFunctionData(functionName: string, data: string): any;
decodeEventLog(eventFragment: any, data: string, topics: string[]): any;
getEvent(eventName: string): any;
}
export interface IEthersContract {
[methodName: string]: any;
staticCall(...params: any[]): Promise;
populateTransaction(...params: any[]): Promise;
}
export interface IEthersContractFactory {
deploy(...params: any[]): Promise;
}
export interface IEthersAbiCoder {
encode(types: string[], values: any[]): string;
decode(types: string[], data: string): any;
}
export interface IEthersLib {
ethers: IEthers;
Wallet: {
new (privateKey: string, provider?: IEthersProvider): IEthersWallet;
createRandom(): IEthersWallet;
};
}
}
///
declare module "@ijstech/eth-wallet/wallet.ts" {
import { ConfirmationObject, TransactionReceipt } from "@ijstech/eth-wallet/web3.ts";
import { BigNumber } from 'bignumber.js';
import { Erc20 } from "@ijstech/eth-wallet/contracts/erc20.ts";
import { IAbiDefinition, MessageTypes, TypedMessage } from "@ijstech/eth-wallet/types.ts";
import { IEventBusRegistry } from "@ijstech/eth-wallet/eventBus.ts";
export { TransactionReceipt, ConfirmationObject };
export function toString(value: any): any;
export type stringArray = string | _stringArray;
export interface _stringArray extends Array {
}
export interface IWalletUtils {
fromDecimals(value: BigNumber | number | string, decimals?: number): BigNumber;
fromWei(value: any, unit?: string): string;
hexToUtf8(value: string): string;
sha3(value: string): string;
stringToBytes(value: string | stringArray, nByte?: number): string | string[];
stringToBytes32(value: string | stringArray): string | string[];
toDecimals(value: BigNumber | number | string, decimals?: number): BigNumber;
toString(value: any): string;
toUtf8(value: any): string;
toWei(value: string, unit?: string): string;
}
export interface IWalletTransaction {
hash: string;
nonce: bigint;
blockHash: string | null;
blockNumber: bigint | null;
transactionIndex: bigint | null;
from: string;
to: string | null;
value: BigNumber;
gasPrice: BigNumber;
maxPriorityFeePerGas?: bigint | string | BigNumber;
maxFeePerGas?: bigint | string | BigNumber;
gas: bigint;
input: string;
}
export interface IWalletBlockTransactionObject {
number: bigint;
hash: string;
parentHash: string;
nonce: string;
sha3Uncles: string;
logsBloom: string;
transactionRoot: string;
stateRoot: string;
receiptsRoot: string;
miner: string;
extraData: string;
gasLimit: bigint;
gasUsed: bigint;
timestamp: bigint | string;
baseFeePerGas?: bigint;
size: bigint;
difficulty: bigint;
totalDifficulty: bigint;
uncles: string[];
transactions: IWalletTransaction[];
}
export interface ITokenInfo {
name: string;
symbol: string;
totalSupply: BigNumber;
decimals: number;
}
export interface IBatchRequestResult {
key: string;
result: any;
}
export interface IBatchRequestObj {
batch: any;
promises: Promise[];
execute: (batch: IBatchRequestObj, promises: Promise[]) => Promise;
}
export interface IConnectWalletEventPayload {
userTriggeredConnect?: boolean;
[key: string]: any;
}
export interface IWallet {
account: IAccount;
accounts: Promise;
address: string;
balance: Promise;
balanceOf(address: string): Promise;
_call(abiHash: string, address: string, methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
chainId: number;
createAccount(): IAccount;
decode(abi: any, event: Log | EventLog, raw?: {
data: string;
topics: string[];
}): Event;
decodeErrorMessage(msg: string): any;
decodeEventData(data: Log, events?: any): Promise;
decodeLog(inputs: any, hexString: string, topics: any): any;
decodeParameters(types: string[], hexString: string): any;
encodeParameters(types: string[], values: any[]): string;
defaultAccount: string;
getAbiEvents(abi: any[]): any;
getAbiTopics(abi: any[], eventNames: string[]): any[];
getBlock(blockHashOrBlockNumber?: number | string, returnTransactionObjects?: boolean): Promise;
getBlockNumber(): Promise;
getBlockTimestamp(blockHashOrBlockNumber?: number | string): Promise;
getChainId(): Promise;
getContractAbi(address: string): any;
getContractAbiEvents(address: string): any;
getTransaction(transactionHash: string): Promise;
methods(...args: any): Promise;
privateKey: string;
recoverSigner(msg: string, signature: string): Promise;
registerAbi(abi: any[] | string, address?: string | string[], handler?: any): string;
registerAbiContracts(abiHash: string, address: string | string[], handler?: any): any;
send(to: string, amount: number): Promise;
_send(abiHash: string, address: string, methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
scanEvents(fromBlock: number, toBlock?: number | string, topics?: any, events?: any, address?: string | string[]): Promise;
scanEvents(params: {
fromBlock: number;
toBlock?: number | string;
topics?: any;
events?: any;
address?: string | string[];
}): Promise;
signMessage(msg: string): Promise;
signTransaction(tx: any, privateKey?: string): Promise;
soliditySha3(...val: any[]): string;
toChecksumAddress(address: string): string;
isAddress(address: string): boolean;
tokenInfo(address: string): Promise;
_txData(abiHash: string, address: string, methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
_txObj(abiHash: string, address: string, methodName: string, params?: any[], options?: number | BigNumber | TransactionOptions): Promise;
utils: IWalletUtils;
verifyMessage(account: string, msg: string, signature: string): Promise