-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
types.ts
95 lines (90 loc) · 2.97 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
This file is part of web3.js.
web3.js 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.
web3.js 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 web3.js. If not, see <http://www.gnu.org/licenses/>.
*/
import { Bytes, Transaction } from 'web3-types';
import Eth from 'web3-eth';
import {
decodeLog,
decodeParameter,
decodeParameters,
encodeFunctionCall,
encodeFunctionSignature,
encodeParameter,
encodeParameters,
} from 'web3-eth-abi';
import {
encrypt,
hashMessage,
recover,
recoverTransaction,
sign,
signTransaction,
Wallet,
Web3Account,
} from 'web3-eth-accounts';
import { Contract } from 'web3-eth-contract';
import { ENS } from 'web3-eth-ens';
import { Net } from 'web3-net';
import { Iban } from 'web3-eth-iban';
import { Personal } from 'web3-eth-personal';
/**
* The Ethereum interface for main web3 object. It provides extra methods in addition to `web3-eth` interface.
*
* {@link web3_eth.Web3Eth} for details about the `Eth` interface.
*/
export interface Web3EthInterface extends Eth {
/**
* Extended [Contract](/api/web3-eth-contract/class/Contract) constructor for main `web3` object. See [Contract](/api/web3-eth-contract/class/Contract) for further details.
*
* You can use `.setProvider` on this constructor to set provider for **all the instances** of the contracts which were created by `web3.eth.Contract`.
* Please check the {@doclink guides/web3_upgrade_guide/x/providers_migration_guide | following guide} to understand more about setting provider.
*
* ```ts
* web3.eth.Contract.setProvider(myProvider)
* ```
*/
Contract: typeof Contract;
Iban: typeof Iban;
net: Net;
ens: ENS;
abi: {
encodeEventSignature: typeof encodeFunctionSignature;
encodeFunctionCall: typeof encodeFunctionCall;
encodeFunctionSignature: typeof encodeFunctionSignature;
encodeParameter: typeof encodeParameter;
encodeParameters: typeof encodeParameters;
decodeParameter: typeof decodeParameter;
decodeParameters: typeof decodeParameters;
decodeLog: typeof decodeLog;
};
accounts: {
create: () => Web3Account;
privateKeyToAccount: (privateKey: Uint8Array | string) => Web3Account;
signTransaction: (
transaction: Transaction,
privateKey: Bytes,
) => ReturnType<typeof signTransaction>;
recoverTransaction: typeof recoverTransaction;
hashMessage: typeof hashMessage;
sign: typeof sign;
recover: typeof recover;
encrypt: typeof encrypt;
decrypt: (
keystore: string,
password: string,
options?: Record<string, unknown>,
) => Promise<Web3Account>;
wallet: Wallet;
};
personal: Personal;
}