UNPKG

2.8 kBTypeScriptView Raw
1import { Bytes, Transaction } from 'web3-types';
2import Eth from 'web3-eth';
3import { decodeLog, decodeParameter, decodeParameters, encodeFunctionCall, encodeFunctionSignature, encodeParameter, encodeParameters } from 'web3-eth-abi';
4import { encrypt, hashMessage, recover, recoverTransaction, sign, signTransaction, Wallet, Web3Account } from 'web3-eth-accounts';
5import { Contract } from 'web3-eth-contract';
6import { ENS } from 'web3-eth-ens';
7import { Net } from 'web3-net';
8import { Iban } from 'web3-eth-iban';
9import { Personal } from 'web3-eth-personal';
10export type { Web3Account, Wallet } from 'web3-eth-accounts';
11/**
12 * The Ethereum interface for main web3 object. It provides extra methods in addition to `web3-eth` interface.
13 *
14 * {@link web3_eth.Web3Eth} for details about the `Eth` interface.
15 */
16export interface Web3EthInterface extends Eth {
17 /**
18 * Extended [Contract](/api/web3-eth-contract/class/Contract) constructor for main `web3` object. See [Contract](/api/web3-eth-contract/class/Contract) for further details.
19 *
20 * You can use `.setProvider` on this constructor to set provider for **all the instances** of the contracts which were created by `web3.eth.Contract`.
21 * Please check the {@doclink guides/web3_upgrade_guide/providers_migration_guide | following guide} to understand more about setting provider.
22 *
23 * ```ts
24 * web3.eth.Contract.setProvider(myProvider)
25 * ```
26 */
27 Contract: typeof Contract;
28 Iban: typeof Iban;
29 net: Net;
30 ens: ENS;
31 abi: {
32 encodeEventSignature: typeof encodeFunctionSignature;
33 encodeFunctionCall: typeof encodeFunctionCall;
34 encodeFunctionSignature: typeof encodeFunctionSignature;
35 encodeParameter: typeof encodeParameter;
36 encodeParameters: typeof encodeParameters;
37 decodeParameter: typeof decodeParameter;
38 decodeParameters: typeof decodeParameters;
39 decodeLog: typeof decodeLog;
40 };
41 accounts: {
42 create: () => Web3Account;
43 privateKeyToAccount: (privateKey: Uint8Array | string) => Web3Account;
44 signTransaction: (transaction: Transaction, privateKey: Bytes) => ReturnType<typeof signTransaction>;
45 recoverTransaction: typeof recoverTransaction;
46 hashMessage: typeof hashMessage;
47 sign: typeof sign;
48 recover: typeof recover;
49 encrypt: typeof encrypt;
50 decrypt: (keystore: string, password: string, options?: Record<string, unknown>) => Promise<Web3Account>;
51 wallet: Wallet;
52 privateKeyToAddress: (privateKey: Bytes) => string;
53 privateKeyToPublicKey: (privateKey: Bytes, isCompressed: boolean) => string;
54 parseAndValidatePrivateKey: (data: Bytes, ignoreLength?: boolean) => Uint8Array;
55 };
56 personal: Personal;
57}