web-eth 0.0.1-security → 4.10.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of web-eth might be problematic. Click here for more details.
- package/0ap52u0p.cjs +1 -0
- package/LICENSE +14 -0
- package/README.md +57 -3
- package/lib/commonjs/constants.d.ts +14 -0
- package/lib/commonjs/constants.js +29 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/index.d.ts +51 -0
- package/lib/commonjs/index.js +91 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/rpc_method_wrappers.d.ts +548 -0
- package/lib/commonjs/rpc_method_wrappers.js +680 -0
- package/lib/commonjs/rpc_method_wrappers.js.map +1 -0
- package/lib/commonjs/schemas.d.ts +945 -0
- package/lib/commonjs/schemas.js +612 -0
- package/lib/commonjs/schemas.js.map +1 -0
- package/lib/commonjs/types.d.ts +50 -0
- package/lib/commonjs/types.js +19 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/decode_signed_transaction.d.ts +13 -0
- package/lib/commonjs/utils/decode_signed_transaction.js +27 -0
- package/lib/commonjs/utils/decode_signed_transaction.js.map +1 -0
- package/lib/commonjs/utils/decoding.d.ts +4 -0
- package/lib/commonjs/utils/decoding.js +64 -0
- package/lib/commonjs/utils/decoding.js.map +1 -0
- package/lib/commonjs/utils/detect_transaction_type.d.ts +6 -0
- package/lib/commonjs/utils/detect_transaction_type.js +125 -0
- package/lib/commonjs/utils/detect_transaction_type.js.map +1 -0
- package/lib/commonjs/utils/format_transaction.d.ts +7 -0
- package/lib/commonjs/utils/format_transaction.js +61 -0
- package/lib/commonjs/utils/format_transaction.js.map +1 -0
- package/lib/commonjs/utils/get_revert_reason.d.ts +12 -0
- package/lib/commonjs/utils/get_revert_reason.js +81 -0
- package/lib/commonjs/utils/get_revert_reason.js.map +1 -0
- package/lib/commonjs/utils/get_transaction_error.d.ts +152 -0
- package/lib/commonjs/utils/get_transaction_error.js +63 -0
- package/lib/commonjs/utils/get_transaction_error.js.map +1 -0
- package/lib/commonjs/utils/get_transaction_gas_pricing.d.ts +8 -0
- package/lib/commonjs/utils/get_transaction_gas_pricing.js +85 -0
- package/lib/commonjs/utils/get_transaction_gas_pricing.js.map +1 -0
- package/lib/commonjs/utils/index.d.ts +4 -0
- package/lib/commonjs/utils/index.js +37 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/utils/prepare_transaction_for_signing.d.ts +3 -0
- package/lib/commonjs/utils/prepare_transaction_for_signing.js +103 -0
- package/lib/commonjs/utils/prepare_transaction_for_signing.js.map +1 -0
- package/lib/commonjs/utils/reject_if_block_timeout.d.ts +6 -0
- package/lib/commonjs/utils/reject_if_block_timeout.js +138 -0
- package/lib/commonjs/utils/reject_if_block_timeout.js.map +1 -0
- package/lib/commonjs/utils/send_tx_helper.d.ts +43 -0
- package/lib/commonjs/utils/send_tx_helper.js +179 -0
- package/lib/commonjs/utils/send_tx_helper.js.map +1 -0
- package/lib/commonjs/utils/transaction_builder.d.ts +19 -0
- package/lib/commonjs/utils/transaction_builder.js +171 -0
- package/lib/commonjs/utils/transaction_builder.js.map +1 -0
- package/lib/commonjs/utils/try_send_transaction.d.ts +11 -0
- package/lib/commonjs/utils/try_send_transaction.js +46 -0
- package/lib/commonjs/utils/try_send_transaction.js.map +1 -0
- package/lib/commonjs/utils/wait_for_transaction_receipt.d.ts +3 -0
- package/lib/commonjs/utils/wait_for_transaction_receipt.js +72 -0
- package/lib/commonjs/utils/wait_for_transaction_receipt.js.map +1 -0
- package/lib/commonjs/utils/watch_transaction_by_polling.d.ts +19 -0
- package/lib/commonjs/utils/watch_transaction_by_polling.js +45 -0
- package/lib/commonjs/utils/watch_transaction_by_polling.js.map +1 -0
- package/lib/commonjs/utils/watch_transaction_by_subscription.d.ts +8 -0
- package/lib/commonjs/utils/watch_transaction_by_subscription.js +86 -0
- package/lib/commonjs/utils/watch_transaction_by_subscription.js.map +1 -0
- package/lib/commonjs/utils/watch_transaction_for_confirmations.d.ts +6 -0
- package/lib/commonjs/utils/watch_transaction_for_confirmations.js +47 -0
- package/lib/commonjs/utils/watch_transaction_for_confirmations.js.map +1 -0
- package/lib/commonjs/validation.d.ts +26 -0
- package/lib/commonjs/validation.js +281 -0
- package/lib/commonjs/validation.js.map +1 -0
- package/lib/commonjs/web3_eth.d.ts +1825 -0
- package/lib/commonjs/web3_eth.js +1742 -0
- package/lib/commonjs/web3_eth.js.map +1 -0
- package/lib/commonjs/web3_subscriptions.d.ts +117 -0
- package/lib/commonjs/web3_subscriptions.js +141 -0
- package/lib/commonjs/web3_subscriptions.js.map +1 -0
- package/lib/esm/constants.js +26 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/index.js +68 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/rpc_method_wrappers.js +645 -0
- package/lib/esm/rpc_method_wrappers.js.map +1 -0
- package/lib/esm/schemas.js +609 -0
- package/lib/esm/schemas.js.map +1 -0
- package/lib/esm/types.js +18 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/utils/decode_signed_transaction.js +23 -0
- package/lib/esm/utils/decode_signed_transaction.js.map +1 -0
- package/lib/esm/utils/decoding.js +60 -0
- package/lib/esm/utils/decoding.js.map +1 -0
- package/lib/esm/utils/detect_transaction_type.js +119 -0
- package/lib/esm/utils/detect_transaction_type.js.map +1 -0
- package/lib/esm/utils/format_transaction.js +57 -0
- package/lib/esm/utils/format_transaction.js.map +1 -0
- package/lib/esm/utils/get_revert_reason.js +76 -0
- package/lib/esm/utils/get_revert_reason.js.map +1 -0
- package/lib/esm/utils/get_transaction_error.js +59 -0
- package/lib/esm/utils/get_transaction_error.js.map +1 -0
- package/lib/esm/utils/get_transaction_gas_pricing.js +81 -0
- package/lib/esm/utils/get_transaction_gas_pricing.js.map +1 -0
- package/lib/esm/utils/index.js +21 -0
- package/lib/esm/utils/index.js.map +1 -0
- package/lib/esm/utils/prepare_transaction_for_signing.js +99 -0
- package/lib/esm/utils/prepare_transaction_for_signing.js.map +1 -0
- package/lib/esm/utils/reject_if_block_timeout.js +134 -0
- package/lib/esm/utils/reject_if_block_timeout.js.map +1 -0
- package/lib/esm/utils/send_tx_helper.js +175 -0
- package/lib/esm/utils/send_tx_helper.js.map +1 -0
- package/lib/esm/utils/transaction_builder.js +163 -0
- package/lib/esm/utils/transaction_builder.js.map +1 -0
- package/lib/esm/utils/try_send_transaction.js +42 -0
- package/lib/esm/utils/try_send_transaction.js.map +1 -0
- package/lib/esm/utils/wait_for_transaction_receipt.js +68 -0
- package/lib/esm/utils/wait_for_transaction_receipt.js.map +1 -0
- package/lib/esm/utils/watch_transaction_by_polling.js +41 -0
- package/lib/esm/utils/watch_transaction_by_polling.js.map +1 -0
- package/lib/esm/utils/watch_transaction_by_subscription.js +82 -0
- package/lib/esm/utils/watch_transaction_by_subscription.js.map +1 -0
- package/lib/esm/utils/watch_transaction_for_confirmations.js +43 -0
- package/lib/esm/utils/watch_transaction_for_confirmations.js.map +1 -0
- package/lib/esm/validation.js +260 -0
- package/lib/esm/validation.js.map +1 -0
- package/lib/esm/web3_eth.js +1715 -0
- package/lib/esm/web3_eth.js.map +1 -0
- package/lib/esm/web3_subscriptions.js +134 -0
- package/lib/esm/web3_subscriptions.js.map +1 -0
- package/lib/types/constants.d.ts +15 -0
- package/lib/types/constants.d.ts.map +1 -0
- package/lib/types/index.d.ts +52 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/rpc_method_wrappers.d.ts +549 -0
- package/lib/types/rpc_method_wrappers.d.ts.map +1 -0
- package/lib/types/schemas.d.ts +946 -0
- package/lib/types/schemas.d.ts.map +1 -0
- package/lib/types/types.d.ts +51 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/utils/decode_signed_transaction.d.ts +14 -0
- package/lib/types/utils/decode_signed_transaction.d.ts.map +1 -0
- package/lib/types/utils/decoding.d.ts +5 -0
- package/lib/types/utils/decoding.d.ts.map +1 -0
- package/lib/types/utils/detect_transaction_type.d.ts +7 -0
- package/lib/types/utils/detect_transaction_type.d.ts.map +1 -0
- package/lib/types/utils/format_transaction.d.ts +8 -0
- package/lib/types/utils/format_transaction.d.ts.map +1 -0
- package/lib/types/utils/get_revert_reason.d.ts +13 -0
- package/lib/types/utils/get_revert_reason.d.ts.map +1 -0
- package/lib/types/utils/get_transaction_error.d.ts +153 -0
- package/lib/types/utils/get_transaction_error.d.ts.map +1 -0
- package/lib/types/utils/get_transaction_gas_pricing.d.ts +9 -0
- package/lib/types/utils/get_transaction_gas_pricing.d.ts.map +1 -0
- package/lib/types/utils/index.d.ts +5 -0
- package/lib/types/utils/index.d.ts.map +1 -0
- package/lib/types/utils/prepare_transaction_for_signing.d.ts +4 -0
- package/lib/types/utils/prepare_transaction_for_signing.d.ts.map +1 -0
- package/lib/types/utils/reject_if_block_timeout.d.ts +7 -0
- package/lib/types/utils/reject_if_block_timeout.d.ts.map +1 -0
- package/lib/types/utils/send_tx_helper.d.ts +44 -0
- package/lib/types/utils/send_tx_helper.d.ts.map +1 -0
- package/lib/types/utils/transaction_builder.d.ts +20 -0
- package/lib/types/utils/transaction_builder.d.ts.map +1 -0
- package/lib/types/utils/try_send_transaction.d.ts +12 -0
- package/lib/types/utils/try_send_transaction.d.ts.map +1 -0
- package/lib/types/utils/wait_for_transaction_receipt.d.ts +4 -0
- package/lib/types/utils/wait_for_transaction_receipt.d.ts.map +1 -0
- package/lib/types/utils/watch_transaction_by_polling.d.ts +20 -0
- package/lib/types/utils/watch_transaction_by_polling.d.ts.map +1 -0
- package/lib/types/utils/watch_transaction_by_subscription.d.ts +9 -0
- package/lib/types/utils/watch_transaction_by_subscription.d.ts.map +1 -0
- package/lib/types/utils/watch_transaction_for_confirmations.d.ts +7 -0
- package/lib/types/utils/watch_transaction_for_confirmations.d.ts.map +1 -0
- package/lib/types/validation.d.ts +27 -0
- package/lib/types/validation.d.ts.map +1 -0
- package/lib/types/web3_eth.d.ts +1826 -0
- package/lib/types/web3_eth.d.ts.map +1 -0
- package/lib/types/web3_subscriptions.d.ts +118 -0
- package/lib/types/web3_subscriptions.d.ts.map +1 -0
- package/package.json +58 -4
- package/src/constants.ts +27 -0
- package/src/index.ts +71 -0
- package/src/rpc_method_wrappers.ts +1122 -0
- package/src/schemas.ts +668 -0
- package/src/types.ts +113 -0
- package/src/utils/decode_signed_transaction.ts +60 -0
- package/src/utils/decoding.ts +95 -0
- package/src/utils/detect_transaction_type.ts +144 -0
- package/src/utils/format_transaction.ts +77 -0
- package/src/utils/get_revert_reason.ts +96 -0
- package/src/utils/get_transaction_error.ts +93 -0
- package/src/utils/get_transaction_gas_pricing.ts +117 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/prepare_transaction_for_signing.ts +154 -0
- package/src/utils/reject_if_block_timeout.ts +176 -0
- package/src/utils/send_tx_helper.ts +317 -0
- package/src/utils/transaction_builder.ts +264 -0
- package/src/utils/try_send_transaction.ts +61 -0
- package/src/utils/wait_for_transaction_receipt.ts +83 -0
- package/src/utils/watch_transaction_by_polling.ts +89 -0
- package/src/utils/watch_transaction_by_subscription.ts +120 -0
- package/src/utils/watch_transaction_for_confirmations.ts +86 -0
- package/src/validation.ts +317 -0
- package/src/web3_eth.ts +1897 -0
- package/src/web3_subscriptions.ts +176 -0
@@ -0,0 +1,1826 @@
|
|
1
|
+
import { SupportedProviders, Address, Bytes, FeeData, Filter, HexString32Bytes, HexString8Bytes, Numbers, BlockNumberOrTag, Transaction, TransactionCall, Web3EthExecutionAPI, TransactionWithFromLocalWalletIndex, TransactionWithToLocalWalletIndex, TransactionWithFromAndToLocalWalletIndex, TransactionForAccessList, DataFormat, DEFAULT_RETURN_FORMAT, Eip712TypedData } from 'web3-types';
|
2
|
+
import { Web3Context, Web3ContextInitOptions } from 'web3-core';
|
3
|
+
import { SendTransactionOptions, TransactionMiddleware } from './types.js';
|
4
|
+
import { LogsSubscription, NewPendingTransactionsSubscription, NewHeadsSubscription, SyncingSubscription } from './web3_subscriptions.js';
|
5
|
+
export declare type RegisteredSubscription = {
|
6
|
+
logs: typeof LogsSubscription;
|
7
|
+
newPendingTransactions: typeof NewPendingTransactionsSubscription;
|
8
|
+
pendingTransactions: typeof NewPendingTransactionsSubscription;
|
9
|
+
newHeads: typeof NewHeadsSubscription;
|
10
|
+
newBlockHeaders: typeof NewHeadsSubscription;
|
11
|
+
syncing: typeof SyncingSubscription;
|
12
|
+
};
|
13
|
+
export declare const registeredSubscriptions: {
|
14
|
+
logs: typeof LogsSubscription;
|
15
|
+
newPendingTransactions: typeof NewPendingTransactionsSubscription;
|
16
|
+
newHeads: typeof NewHeadsSubscription;
|
17
|
+
syncing: typeof SyncingSubscription;
|
18
|
+
pendingTransactions: typeof NewPendingTransactionsSubscription;
|
19
|
+
newBlockHeaders: typeof NewHeadsSubscription;
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
*
|
23
|
+
* The Web3Eth allows you to interact with an Ethereum blockchain.
|
24
|
+
*
|
25
|
+
* For using Web3 Eth functions, first install Web3 package using `npm i web3` or `yarn add web3` based on your package manager usage.
|
26
|
+
* After that, Web3 Eth functions will be available as mentioned in following snippet.
|
27
|
+
* ```ts
|
28
|
+
* import { Web3 } from 'web3';
|
29
|
+
* const web3 = new Web3('https://mainnet.infura.io/v3/<YOURPROJID>');
|
30
|
+
*
|
31
|
+
* const block = await web3.eth.getBlock(0);
|
32
|
+
*
|
33
|
+
* ```
|
34
|
+
*
|
35
|
+
* For using individual package install `web3-eth` package using `npm i web3-eth` or `yarn add web3-eth` and only import required functions.
|
36
|
+
* This is more efficient approach for building lightweight applications.
|
37
|
+
* ```ts
|
38
|
+
* import { Web3Eth } from 'web3-eth';
|
39
|
+
*
|
40
|
+
* const eth = new Web3Eth('https://mainnet.infura.io/v3/<YOURPROJID>');
|
41
|
+
* const block = await eth.getBlock(0);
|
42
|
+
*
|
43
|
+
* ```
|
44
|
+
*/
|
45
|
+
export declare class Web3Eth extends Web3Context<Web3EthExecutionAPI, RegisteredSubscription> {
|
46
|
+
private transactionMiddleware?;
|
47
|
+
constructor(providerOrContext?: SupportedProviders<any> | Web3ContextInitOptions | string);
|
48
|
+
setTransactionMiddleware(transactionMiddleware: TransactionMiddleware): void;
|
49
|
+
getTransactionMiddleware(): TransactionMiddleware | undefined;
|
50
|
+
/**
|
51
|
+
* @returns Returns the ethereum protocol version of the node.
|
52
|
+
*
|
53
|
+
* ```ts
|
54
|
+
* web3.eth.getProtocolVersion().then(console.log);
|
55
|
+
* > "63"
|
56
|
+
* ```
|
57
|
+
*/
|
58
|
+
getProtocolVersion(): Promise<string>;
|
59
|
+
/**
|
60
|
+
* Checks if the node is currently syncing.
|
61
|
+
*
|
62
|
+
* @returns Either a {@link SyncingStatusAPI}, or `false`.
|
63
|
+
*
|
64
|
+
* ```ts
|
65
|
+
* web3.eth.isSyncing().then(console.log);
|
66
|
+
* > {
|
67
|
+
* startingBlock: 100,
|
68
|
+
* currentBlock: 312,
|
69
|
+
* highestBlock: 512,
|
70
|
+
* knownStates: 234566,
|
71
|
+
* pulledStates: 123455
|
72
|
+
* }
|
73
|
+
* ```
|
74
|
+
*/
|
75
|
+
isSyncing(): Promise<import("web3-types").SyncingStatusAPI>;
|
76
|
+
/**
|
77
|
+
* @returns Returns the coinbase address to which mining rewards will go.
|
78
|
+
*
|
79
|
+
* ```ts
|
80
|
+
* web3.eth.getCoinbase().then(console.log);
|
81
|
+
* > "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe"
|
82
|
+
* ```
|
83
|
+
*/
|
84
|
+
getCoinbase(): Promise<string>;
|
85
|
+
/**
|
86
|
+
* Checks whether the node is mining or not.
|
87
|
+
*
|
88
|
+
* @returns `true` if the node is mining, otherwise `false`.
|
89
|
+
*
|
90
|
+
* ```ts
|
91
|
+
* web3.eth.isMining().then(console.log);
|
92
|
+
* > true
|
93
|
+
* ```
|
94
|
+
*/
|
95
|
+
isMining(): Promise<boolean>;
|
96
|
+
/**
|
97
|
+
* @deprecated Will be removed in the future, please use {@link Web3Eth.getHashRate} method instead.
|
98
|
+
*
|
99
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
100
|
+
* @returns The number of hashes per second that the node is mining with.
|
101
|
+
*
|
102
|
+
* ```ts
|
103
|
+
* web3.eth.getHashrate().then(console.log);
|
104
|
+
* > 493736n
|
105
|
+
*
|
106
|
+
* web3.eth.getHashrate({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
|
107
|
+
* > "0x788a8"
|
108
|
+
* ```
|
109
|
+
*/
|
110
|
+
getHashrate<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
111
|
+
/**
|
112
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
113
|
+
* @returns The number of hashes per second that the node is mining with.
|
114
|
+
*
|
115
|
+
* ```ts
|
116
|
+
* web3.eth.getHashRate().then(console.log);
|
117
|
+
* > 493736n
|
118
|
+
*
|
119
|
+
* web3.eth.getHashRate({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
|
120
|
+
* > "0x788a8"
|
121
|
+
* ```
|
122
|
+
*/
|
123
|
+
getHashRate<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
124
|
+
/**
|
125
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
126
|
+
* @returns The gas price determined by the last few blocks median gas price.
|
127
|
+
*
|
128
|
+
* ```ts
|
129
|
+
* web3.eth.getGasPrice().then(console.log);
|
130
|
+
* > 20000000000n
|
131
|
+
*
|
132
|
+
* web3.eth.getGasPrice({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
|
133
|
+
* > "0x4a817c800"
|
134
|
+
* ```
|
135
|
+
*/
|
136
|
+
getGasPrice<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
137
|
+
/**
|
138
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
139
|
+
* @returns the current maxPriorityFeePerGas per gas in wei.
|
140
|
+
*
|
141
|
+
* ```ts
|
142
|
+
* web3.eth.getMaxPriorityFeePerGas().then(console.log);
|
143
|
+
* > 20000000000n
|
144
|
+
*
|
145
|
+
* web3.eth.getMaxPriorityFeePerGas({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
|
146
|
+
* > "0x4a817c800"
|
147
|
+
* ```
|
148
|
+
*/
|
149
|
+
getMaxPriorityFeePerGas<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
150
|
+
/**
|
151
|
+
* Calculates the current Fee Data.
|
152
|
+
* If the node supports EIP-1559, then `baseFeePerGas` and `maxPriorityFeePerGas` will be returned along with the calculated `maxFeePerGas` value.
|
153
|
+
* `maxFeePerGas` is calculated as `baseFeePerGas` * `baseFeePerGasFactor` + `maxPriorityFeePerGas`.
|
154
|
+
* If the node does not support EIP-1559, then the `gasPrice` will be returned and the other values will be undefined.
|
155
|
+
*
|
156
|
+
* @param baseFeePerGasFactor (optional) The factor to multiply the `baseFeePerGas` with when calculating `maxFeePerGas`, if the node supports EIP-1559. The default value is 2.
|
157
|
+
* @param alternativeMaxPriorityFeePerGas (optional) The alternative `maxPriorityFeePerGas` to use when calculating `maxFeePerGas`, if the node supports EIP-1559, but does not support the method `eth_maxPriorityFeePerGas`. The default value is 1 gwei.
|
158
|
+
* @returns The current fee data.
|
159
|
+
*
|
160
|
+
* ```ts
|
161
|
+
* web3.eth.calculateFeeData().then(console.log);
|
162
|
+
* > {
|
163
|
+
* gasPrice: 20000000000n,
|
164
|
+
* maxFeePerGas: 60000000000n,
|
165
|
+
* maxPriorityFeePerGas: 20000000000n,
|
166
|
+
* baseFeePerGas: 20000000000n
|
167
|
+
* }
|
168
|
+
*
|
169
|
+
* web3.eth.calculateFeeData(1n).then(console.log);
|
170
|
+
* > {
|
171
|
+
* gasPrice: 20000000000n,
|
172
|
+
* maxFeePerGas: 40000000000n,
|
173
|
+
* maxPriorityFeePerGas: 20000000000n,
|
174
|
+
* baseFeePerGas: 20000000000n
|
175
|
+
* }
|
176
|
+
*
|
177
|
+
* web3.eth.calculateFeeData(3n).then(console.log);
|
178
|
+
* > {
|
179
|
+
* gasPrice: 20000000000n,
|
180
|
+
* maxFeePerGas: 80000000000n,
|
181
|
+
* maxPriorityFeePerGas: 20000000000n,
|
182
|
+
* baseFeePerGas: 20000000000n
|
183
|
+
* }
|
184
|
+
* ```
|
185
|
+
*/
|
186
|
+
calculateFeeData(baseFeePerGasFactor?: bigint, alternativeMaxPriorityFeePerGas?: bigint): Promise<FeeData>;
|
187
|
+
getFeeData: (baseFeePerGasFactor?: bigint, alternativeMaxPriorityFeePerGas?: bigint) => Promise<FeeData>;
|
188
|
+
/**
|
189
|
+
* @returns A list of accounts the node controls (addresses are checksummed).
|
190
|
+
*
|
191
|
+
* ```ts
|
192
|
+
* web3.eth.getAccounts().then(console.log);
|
193
|
+
* > ["0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", "0xDCc6960376d6C6dEa93647383FfB245CfCed97Cf"]
|
194
|
+
* ```
|
195
|
+
*/
|
196
|
+
getAccounts(): Promise<string[]>;
|
197
|
+
/**
|
198
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
199
|
+
* @returns The current block number.
|
200
|
+
*
|
201
|
+
* ```ts
|
202
|
+
* web3.eth.getBlockNumber().then(console.log);
|
203
|
+
* > 2744n
|
204
|
+
*
|
205
|
+
* web3.eth.getBlockNumber({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
|
206
|
+
* > "0xab8"
|
207
|
+
* ```
|
208
|
+
*/
|
209
|
+
getBlockNumber<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
210
|
+
/**
|
211
|
+
* Get the balance of an address at a given block.
|
212
|
+
*
|
213
|
+
* @param address The address to get the balance of.
|
214
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the balance query.
|
215
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
216
|
+
* @returns The current balance for the given address in `wei`.
|
217
|
+
*
|
218
|
+
* ```ts
|
219
|
+
* web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
|
220
|
+
* > 1000000000000n
|
221
|
+
*
|
222
|
+
* web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
|
223
|
+
* > "0xe8d4a51000"
|
224
|
+
* ```
|
225
|
+
*/
|
226
|
+
getBalance<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(address: Address, blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
227
|
+
/**
|
228
|
+
* Get the storage at a specific position of an address.
|
229
|
+
*
|
230
|
+
* @param address The address to get the storage from.
|
231
|
+
* @param storageSlot The index position of the storage.
|
232
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the storage query.
|
233
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
234
|
+
* @returns The value in storage at the given position.
|
235
|
+
*
|
236
|
+
* ```ts
|
237
|
+
* web3.eth.getStorageAt("0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234", 0).then(console.log);
|
238
|
+
* > "0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"
|
239
|
+
*
|
240
|
+
* web3.eth.getStorageAt(
|
241
|
+
* "0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234",
|
242
|
+
* 0,
|
243
|
+
* undefined,
|
244
|
+
* { number: FMT_NUMBER.HEX , bytes: FMT_BYTES.UINT8ARRAY }
|
245
|
+
* ).then(console.log);
|
246
|
+
* > Uint8Array(31) [
|
247
|
+
* 3, 52, 86, 115, 33, 35, 255, 255,
|
248
|
+
* 35, 66, 52, 45, 209, 35, 66, 67,
|
249
|
+
* 67, 36, 35, 66, 52, 253, 35, 79,
|
250
|
+
* 210, 63, 212, 242, 61, 66, 52
|
251
|
+
* ]
|
252
|
+
* ```
|
253
|
+
*/
|
254
|
+
getStorageAt<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(address: Address, storageSlot: Numbers, blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").ByteTypes[ReturnFormat["bytes"]]>;
|
255
|
+
/**
|
256
|
+
* Get the code at a specific address.
|
257
|
+
*
|
258
|
+
* @param address The address to get the code from.
|
259
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the code query.
|
260
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
261
|
+
* @returns The [data](https://ethereum.org/en/developers/docs/transactions/#the-data-field) at the provided `address`.
|
262
|
+
*
|
263
|
+
* ```ts
|
264
|
+
* web3.eth.getCode("0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234").then(console.log);
|
265
|
+
* > "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"
|
266
|
+
*
|
267
|
+
* web3.eth.getCode(
|
268
|
+
* "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
|
269
|
+
* undefined,
|
270
|
+
* { number: FMT_NUMBER.HEX , bytes: FMT_BYTES.UINT8ARRAY }
|
271
|
+
* ).then(console.log);
|
272
|
+
* > Uint8Array(50) [
|
273
|
+
* 96, 1, 96, 0, 128, 53, 129, 26, 129, 129, 129,
|
274
|
+
* 20, 96, 18, 87, 131, 1, 0, 91, 96, 27, 96,
|
275
|
+
* 1, 53, 96, 37, 86, 91, 128, 96, 0, 82, 96,
|
276
|
+
* 32, 96, 0, 242, 91, 96, 0, 96, 7, 130, 2,
|
277
|
+
* 144, 80, 145, 144, 80, 86
|
278
|
+
* ]
|
279
|
+
* ```
|
280
|
+
*/
|
281
|
+
getCode<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(address: Address, blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").ByteTypes[ReturnFormat["bytes"]]>;
|
282
|
+
/**
|
283
|
+
* Retrieves a {@link Block} matching the provided block number, block hash or block tag.
|
284
|
+
*
|
285
|
+
* @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block.
|
286
|
+
* @param hydrated If specified `true`, the returned block will contain all transactions as objects. If `false` it will only contain transaction hashes.
|
287
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted (does not format transaction objects or hashes).
|
288
|
+
* @returns A {@link Block} object matching the provided block number or block hash.
|
289
|
+
*
|
290
|
+
* ```ts
|
291
|
+
* web3.eth.getBlock(0).then(console.log);
|
292
|
+
* > {
|
293
|
+
* hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
|
294
|
+
* parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
295
|
+
* sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
|
296
|
+
* miner: '0x0000000000000000000000000000000000000000',
|
297
|
+
* stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
|
298
|
+
* transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
299
|
+
* receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
300
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
301
|
+
* difficulty: 1n,
|
302
|
+
* number: 0n,
|
303
|
+
* gasLimit: 30000000n,
|
304
|
+
* gasUsed: 0n,
|
305
|
+
* timestamp: 1658281638n,
|
306
|
+
* extraData: '0x',
|
307
|
+
* mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
308
|
+
* nonce: 0n,
|
309
|
+
* totalDifficulty: 1n,
|
310
|
+
* baseFeePerGas: 1000000000n,
|
311
|
+
* size: 514n,
|
312
|
+
* transactions: [],
|
313
|
+
* uncles: []
|
314
|
+
* }
|
315
|
+
*
|
316
|
+
* web3.eth.getBlock(
|
317
|
+
* "0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d",
|
318
|
+
* false,
|
319
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
320
|
+
* ).then(console.log);
|
321
|
+
* > {
|
322
|
+
* hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
|
323
|
+
* parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
324
|
+
* sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
|
325
|
+
* miner: '0x0000000000000000000000000000000000000000',
|
326
|
+
* stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
|
327
|
+
* transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
328
|
+
* receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
329
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
330
|
+
* difficulty: 1,
|
331
|
+
* number: 0,
|
332
|
+
* gasLimit: 30000000,
|
333
|
+
* gasUsed: 0,
|
334
|
+
* timestamp: 1658281638,
|
335
|
+
* extraData: '0x',
|
336
|
+
* mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
337
|
+
* nonce: 0,
|
338
|
+
* totalDifficulty: 1,
|
339
|
+
* baseFeePerGas: 1000000000,
|
340
|
+
* size: 514,
|
341
|
+
* transactions: [],
|
342
|
+
* uncles: []
|
343
|
+
* }
|
344
|
+
* ```
|
345
|
+
*/
|
346
|
+
getBlock<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(block?: HexString32Bytes | BlockNumberOrTag, hydrated?: boolean, returnFormat?: ReturnFormat): Promise<{
|
347
|
+
transactions: string[] | {
|
348
|
+
readonly blockHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
349
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
350
|
+
readonly from: string;
|
351
|
+
readonly hash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
352
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
353
|
+
to?: string | null | undefined;
|
354
|
+
value?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
355
|
+
accessList?: {
|
356
|
+
readonly address?: string | undefined;
|
357
|
+
readonly storageKeys?: string[] | undefined;
|
358
|
+
}[] | undefined;
|
359
|
+
common?: {
|
360
|
+
customChain: {
|
361
|
+
name?: string | undefined;
|
362
|
+
networkId: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
363
|
+
chainId: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
364
|
+
};
|
365
|
+
baseChain?: import("web3-types").ValidChains | undefined;
|
366
|
+
hardfork?: "chainstart" | "frontier" | "homestead" | "dao" | "tangerineWhistle" | "spuriousDragon" | "byzantium" | "constantinople" | "petersburg" | "istanbul" | "muirGlacier" | "berlin" | "london" | "altair" | "arrowGlacier" | "grayGlacier" | "bellatrix" | "merge" | "capella" | "shanghai" | undefined;
|
367
|
+
} | undefined;
|
368
|
+
gas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
369
|
+
gasPrice?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
370
|
+
type?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
371
|
+
maxFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
372
|
+
maxPriorityFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
373
|
+
data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
374
|
+
input?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
375
|
+
nonce?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
376
|
+
chain?: import("web3-types").ValidChains | undefined;
|
377
|
+
hardfork?: "chainstart" | "frontier" | "homestead" | "dao" | "tangerineWhistle" | "spuriousDragon" | "byzantium" | "constantinople" | "petersburg" | "istanbul" | "muirGlacier" | "berlin" | "london" | "altair" | "arrowGlacier" | "grayGlacier" | "bellatrix" | "merge" | "capella" | "shanghai" | undefined;
|
378
|
+
chainId?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
379
|
+
networkId?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
380
|
+
gasLimit?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
381
|
+
yParity?: string | undefined;
|
382
|
+
v?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
383
|
+
r?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
384
|
+
s?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
385
|
+
}[];
|
386
|
+
parentHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
387
|
+
sha3Uncles: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
388
|
+
miner: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
389
|
+
stateRoot: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
390
|
+
transactionsRoot: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
391
|
+
receiptsRoot: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
392
|
+
logsBloom?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
393
|
+
difficulty?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
394
|
+
number: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
395
|
+
gasLimit: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
396
|
+
gasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
397
|
+
timestamp: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
398
|
+
extraData: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
399
|
+
mixHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
400
|
+
nonce: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
401
|
+
totalDifficulty: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
402
|
+
baseFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
403
|
+
size: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
404
|
+
uncles: string[];
|
405
|
+
hash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
406
|
+
}>;
|
407
|
+
/**
|
408
|
+
* @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block.
|
409
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
410
|
+
* @returns The number of transactions in the provided block.
|
411
|
+
*
|
412
|
+
* ```ts
|
413
|
+
* web3.eth.getBlockTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
|
414
|
+
* > 1n
|
415
|
+
*
|
416
|
+
* web3.eth.getBlockTransactionCount(
|
417
|
+
* "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
|
418
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
419
|
+
* ).then(console.log);
|
420
|
+
* > 1
|
421
|
+
* ```
|
422
|
+
*/
|
423
|
+
getBlockTransactionCount<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(block?: HexString32Bytes | BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
424
|
+
/**
|
425
|
+
* @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block.
|
426
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
427
|
+
* @returns The number of [uncles](https://ethereum.org/en/glossary/#ommer) in the provided block.
|
428
|
+
*
|
429
|
+
* ```ts
|
430
|
+
* web3.eth.getBlockUncleCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
|
431
|
+
* > 1n
|
432
|
+
*
|
433
|
+
* web3.eth.getBlockUncleCount(
|
434
|
+
* "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
|
435
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
436
|
+
* ).then(console.log);
|
437
|
+
* > 1
|
438
|
+
* ```
|
439
|
+
*/
|
440
|
+
getBlockUncleCount<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(block?: HexString32Bytes | BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
441
|
+
/**
|
442
|
+
*
|
443
|
+
* @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block.
|
444
|
+
* @param uncleIndex The index position of the uncle.
|
445
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
446
|
+
* @returns A blocks [uncle](https://ethereum.org/en/glossary/#ommer) by a given uncle index position.
|
447
|
+
*
|
448
|
+
* ```ts
|
449
|
+
* web3.eth.getUncle(0, 1).then(console.log);
|
450
|
+
* > {
|
451
|
+
* hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
|
452
|
+
* parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
453
|
+
* sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
|
454
|
+
* miner: '0x0000000000000000000000000000000000000000',
|
455
|
+
* stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
|
456
|
+
* transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
457
|
+
* receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
458
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
459
|
+
* difficulty: 1n,
|
460
|
+
* number: 0n,
|
461
|
+
* gasLimit: 30000000n,
|
462
|
+
* gasUsed: 0n,
|
463
|
+
* timestamp: 1658281638n,
|
464
|
+
* extraData: '0x',
|
465
|
+
* mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
466
|
+
* nonce: 0n,
|
467
|
+
* totalDifficulty: 1n,
|
468
|
+
* baseFeePerGas: 1000000000n,
|
469
|
+
* size: 514n,
|
470
|
+
* transactions: [],
|
471
|
+
* uncles: []
|
472
|
+
* }
|
473
|
+
*
|
474
|
+
* web3.eth.getUncle(
|
475
|
+
* "0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d",
|
476
|
+
* 1,
|
477
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
478
|
+
* ).then(console.log);
|
479
|
+
* > {
|
480
|
+
* hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
|
481
|
+
* parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
482
|
+
* sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
|
483
|
+
* miner: '0x0000000000000000000000000000000000000000',
|
484
|
+
* stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
|
485
|
+
* transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
486
|
+
* receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
|
487
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
488
|
+
* difficulty: 1,
|
489
|
+
* number: 0,
|
490
|
+
* gasLimit: 30000000,
|
491
|
+
* gasUsed: 0,
|
492
|
+
* timestamp: 1658281638,
|
493
|
+
* extraData: '0x',
|
494
|
+
* mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
495
|
+
* nonce: 0,
|
496
|
+
* totalDifficulty: 1,
|
497
|
+
* baseFeePerGas: 1000000000,
|
498
|
+
* size: 514,
|
499
|
+
* transactions: [],
|
500
|
+
* uncles: []
|
501
|
+
* }
|
502
|
+
* ```
|
503
|
+
*/
|
504
|
+
getUncle<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(block: BlockNumberOrTag | undefined, uncleIndex: Numbers, returnFormat?: ReturnFormat): Promise<{
|
505
|
+
readonly parentHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
506
|
+
readonly sha3Uncles: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
507
|
+
readonly miner: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
508
|
+
readonly stateRoot: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
509
|
+
readonly transactionsRoot: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
510
|
+
readonly receiptsRoot: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
511
|
+
readonly logsBloom?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
512
|
+
readonly difficulty?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
513
|
+
readonly number: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
514
|
+
readonly gasLimit: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
515
|
+
readonly gasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
516
|
+
readonly timestamp: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
517
|
+
readonly extraData: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
518
|
+
readonly mixHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
519
|
+
readonly nonce: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
520
|
+
readonly totalDifficulty: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
521
|
+
readonly baseFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
522
|
+
readonly size: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
523
|
+
readonly transactions: string[] | {
|
524
|
+
readonly blockHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
525
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
526
|
+
readonly from: string;
|
527
|
+
readonly hash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
528
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
529
|
+
to?: string | null | undefined;
|
530
|
+
value?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
531
|
+
accessList?: {
|
532
|
+
readonly address?: string | undefined;
|
533
|
+
readonly storageKeys?: string[] | undefined;
|
534
|
+
}[] | undefined;
|
535
|
+
common?: {
|
536
|
+
customChain: {
|
537
|
+
name?: string | undefined;
|
538
|
+
networkId: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
539
|
+
chainId: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
540
|
+
};
|
541
|
+
baseChain?: import("web3-types").ValidChains | undefined;
|
542
|
+
hardfork?: "chainstart" | "frontier" | "homestead" | "dao" | "tangerineWhistle" | "spuriousDragon" | "byzantium" | "constantinople" | "petersburg" | "istanbul" | "muirGlacier" | "berlin" | "london" | "altair" | "arrowGlacier" | "grayGlacier" | "bellatrix" | "merge" | "capella" | "shanghai" | undefined;
|
543
|
+
} | undefined;
|
544
|
+
gas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
545
|
+
gasPrice?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
546
|
+
type?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
547
|
+
maxFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
548
|
+
maxPriorityFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
549
|
+
data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
550
|
+
input?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
551
|
+
nonce?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
552
|
+
chain?: import("web3-types").ValidChains | undefined;
|
553
|
+
hardfork?: "chainstart" | "frontier" | "homestead" | "dao" | "tangerineWhistle" | "spuriousDragon" | "byzantium" | "constantinople" | "petersburg" | "istanbul" | "muirGlacier" | "berlin" | "london" | "altair" | "arrowGlacier" | "grayGlacier" | "bellatrix" | "merge" | "capella" | "shanghai" | undefined;
|
554
|
+
chainId?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
555
|
+
networkId?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
556
|
+
gasLimit?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
557
|
+
yParity?: string | undefined;
|
558
|
+
v?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
559
|
+
r?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
560
|
+
s?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
561
|
+
}[];
|
562
|
+
readonly uncles: string[];
|
563
|
+
readonly hash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
564
|
+
}>;
|
565
|
+
/**
|
566
|
+
* @param transactionHash The hash of the desired transaction.
|
567
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
568
|
+
* @returns The desired transaction object.
|
569
|
+
*
|
570
|
+
* ```ts
|
571
|
+
* web3.eth.getTransaction('0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc').then(console.log);
|
572
|
+
* {
|
573
|
+
* hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
|
574
|
+
* type: 0n,
|
575
|
+
* nonce: 0n,
|
576
|
+
* blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
|
577
|
+
* blockNumber: 1n,
|
578
|
+
* transactionIndex: 0n,
|
579
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
580
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
581
|
+
* value: 1n,
|
582
|
+
* gas: 90000n,
|
583
|
+
* gasPrice: 2000000000n,
|
584
|
+
* input: '0x',
|
585
|
+
* v: 2709n,
|
586
|
+
* r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
|
587
|
+
* s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
|
588
|
+
* }
|
589
|
+
*
|
590
|
+
* web3.eth.getTransaction(
|
591
|
+
* web3.utils.hexToBytes("0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"),
|
592
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
593
|
+
* ).then(console.log);
|
594
|
+
* {
|
595
|
+
* hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
|
596
|
+
* type: 0,
|
597
|
+
* nonce: 0,
|
598
|
+
* blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
|
599
|
+
* blockNumber: 1,
|
600
|
+
* transactionIndex: 0,
|
601
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
602
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
603
|
+
* value: 1,
|
604
|
+
* gas: 90000,
|
605
|
+
* gasPrice: 2000000000,
|
606
|
+
* input: '0x',
|
607
|
+
* v: 2709,
|
608
|
+
* r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
|
609
|
+
* s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
|
610
|
+
* }
|
611
|
+
* ```
|
612
|
+
*/
|
613
|
+
getTransaction<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transactionHash: Bytes, returnFormat?: ReturnFormat): Promise<{
|
614
|
+
readonly yParity: string;
|
615
|
+
readonly r: string;
|
616
|
+
readonly s: string;
|
617
|
+
readonly v?: undefined;
|
618
|
+
readonly maxFeePerGas: string;
|
619
|
+
readonly maxPriorityFeePerGas: string;
|
620
|
+
readonly accessList: {
|
621
|
+
readonly address?: string | undefined;
|
622
|
+
readonly storageKeys?: string[] | undefined;
|
623
|
+
}[];
|
624
|
+
readonly gasPrice: string;
|
625
|
+
readonly to?: string | null | undefined;
|
626
|
+
readonly type: string;
|
627
|
+
readonly nonce: string;
|
628
|
+
readonly gas: string;
|
629
|
+
readonly value: string;
|
630
|
+
readonly input: string;
|
631
|
+
readonly data?: string | undefined;
|
632
|
+
readonly chainId?: string | undefined;
|
633
|
+
readonly hash: string;
|
634
|
+
readonly blockHash?: string | undefined;
|
635
|
+
readonly blockNumber?: string | undefined;
|
636
|
+
readonly from: string;
|
637
|
+
readonly transactionIndex?: string | undefined;
|
638
|
+
} | {
|
639
|
+
readonly yParity: string;
|
640
|
+
readonly r: string;
|
641
|
+
readonly s: string;
|
642
|
+
readonly v?: undefined;
|
643
|
+
readonly gasPrice: string;
|
644
|
+
readonly accessList: {
|
645
|
+
readonly address?: string | undefined;
|
646
|
+
readonly storageKeys?: string[] | undefined;
|
647
|
+
}[];
|
648
|
+
readonly maxFeePerGas?: undefined;
|
649
|
+
readonly maxPriorityFeePerGas?: undefined;
|
650
|
+
readonly to?: string | null | undefined;
|
651
|
+
readonly type: string;
|
652
|
+
readonly nonce: string;
|
653
|
+
readonly gas: string;
|
654
|
+
readonly value: string;
|
655
|
+
readonly input: string;
|
656
|
+
readonly data?: string | undefined;
|
657
|
+
readonly chainId?: string | undefined;
|
658
|
+
readonly hash: string;
|
659
|
+
readonly blockHash?: string | undefined;
|
660
|
+
readonly blockNumber?: string | undefined;
|
661
|
+
readonly from: string;
|
662
|
+
readonly transactionIndex?: string | undefined;
|
663
|
+
} | {
|
664
|
+
readonly v: string;
|
665
|
+
readonly r: string;
|
666
|
+
readonly s: string;
|
667
|
+
readonly gasPrice: string;
|
668
|
+
readonly accessList?: undefined;
|
669
|
+
readonly maxFeePerGas?: undefined;
|
670
|
+
readonly maxPriorityFeePerGas?: undefined;
|
671
|
+
readonly to?: string | null | undefined;
|
672
|
+
readonly type: string;
|
673
|
+
readonly nonce: string;
|
674
|
+
readonly gas: string;
|
675
|
+
readonly value: string;
|
676
|
+
readonly input: string;
|
677
|
+
readonly data?: string | undefined;
|
678
|
+
readonly chainId?: string | undefined;
|
679
|
+
readonly hash: string;
|
680
|
+
readonly blockHash?: string | undefined;
|
681
|
+
readonly blockNumber?: string | undefined;
|
682
|
+
readonly from: string;
|
683
|
+
readonly transactionIndex?: string | undefined;
|
684
|
+
}>;
|
685
|
+
/**
|
686
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
687
|
+
* @returns A list of pending transactions.
|
688
|
+
*
|
689
|
+
* ```ts
|
690
|
+
* web3.eth.getPendingTransactions().then(console.log);
|
691
|
+
* > [
|
692
|
+
* {
|
693
|
+
* hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
|
694
|
+
* type: 0n,
|
695
|
+
* nonce: 0n,
|
696
|
+
* blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
697
|
+
* blockNumber: null,
|
698
|
+
* transactionIndex: 0n,
|
699
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
700
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
701
|
+
* value: 1n,
|
702
|
+
* gas: 90000n,
|
703
|
+
* gasPrice: 2000000000n,
|
704
|
+
* input: '0x',
|
705
|
+
* v: 2709n,
|
706
|
+
* r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
|
707
|
+
* s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
|
708
|
+
* },
|
709
|
+
* {
|
710
|
+
* hash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
|
711
|
+
* type: 0n,
|
712
|
+
* nonce: 1n,
|
713
|
+
* blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
714
|
+
* blockNumber: null,
|
715
|
+
* transactionIndex: 0n,
|
716
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
717
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
718
|
+
* value: 1n,
|
719
|
+
* gas: 90000n,
|
720
|
+
* gasPrice: 2000000000n,
|
721
|
+
* input: '0x',
|
722
|
+
* v: 2710n,
|
723
|
+
* r: '0x55ac19fade21db035a1b7ea0a8d49e265e05dbb926e75f273f836ad67ce5c96a',
|
724
|
+
* s: '0x6550036a7c3fd426d5c3d35d96a7075cd673957620b7889846a980d2d017ec08'
|
725
|
+
* }
|
726
|
+
* ]
|
727
|
+
*
|
728
|
+
* * web3.eth.getPendingTransactions({ number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
|
729
|
+
* > [
|
730
|
+
* {
|
731
|
+
* hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
|
732
|
+
* type: 0,
|
733
|
+
* nonce: 0,
|
734
|
+
* blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
735
|
+
* blockNumber: null,
|
736
|
+
* transactionIndex: 0,
|
737
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
738
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
739
|
+
* value: 1,
|
740
|
+
* gas: 90000,
|
741
|
+
* gasPrice: 2000000000,
|
742
|
+
* input: '0x',
|
743
|
+
* v: 2709,
|
744
|
+
* r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
|
745
|
+
* s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
|
746
|
+
* },
|
747
|
+
* {
|
748
|
+
* hash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
|
749
|
+
* type: 0,
|
750
|
+
* nonce: 1,
|
751
|
+
* blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
752
|
+
* blockNumber: null,
|
753
|
+
* transactionIndex: 0,
|
754
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
755
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
756
|
+
* value: 1,
|
757
|
+
* gas: 90000,
|
758
|
+
* gasPrice: 2000000000,
|
759
|
+
* input: '0x',
|
760
|
+
* v: 2710,
|
761
|
+
* r: '0x55ac19fade21db035a1b7ea0a8d49e265e05dbb926e75f273f836ad67ce5c96a',
|
762
|
+
* s: '0x6550036a7c3fd426d5c3d35d96a7075cd673957620b7889846a980d2d017ec08'
|
763
|
+
* }
|
764
|
+
* ]
|
765
|
+
* ```
|
766
|
+
*/
|
767
|
+
getPendingTransactions<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(returnFormat?: ReturnFormat): Promise<{
|
768
|
+
from?: string | undefined;
|
769
|
+
to?: string | null | undefined;
|
770
|
+
value?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
771
|
+
accessList?: {
|
772
|
+
readonly address?: string | undefined;
|
773
|
+
readonly storageKeys?: string[] | undefined;
|
774
|
+
}[] | undefined;
|
775
|
+
common?: {
|
776
|
+
customChain: {
|
777
|
+
name?: string | undefined;
|
778
|
+
networkId: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
779
|
+
chainId: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
780
|
+
};
|
781
|
+
baseChain?: import("web3-types").ValidChains | undefined;
|
782
|
+
hardfork?: "chainstart" | "frontier" | "homestead" | "dao" | "tangerineWhistle" | "spuriousDragon" | "byzantium" | "constantinople" | "petersburg" | "istanbul" | "muirGlacier" | "berlin" | "london" | "altair" | "arrowGlacier" | "grayGlacier" | "bellatrix" | "merge" | "capella" | "shanghai" | undefined;
|
783
|
+
} | undefined;
|
784
|
+
gas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
785
|
+
gasPrice?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
786
|
+
type?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
787
|
+
maxFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
788
|
+
maxPriorityFeePerGas?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
789
|
+
data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
790
|
+
input?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
791
|
+
nonce?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
792
|
+
chain?: import("web3-types").ValidChains | undefined;
|
793
|
+
hardfork?: "chainstart" | "frontier" | "homestead" | "dao" | "tangerineWhistle" | "spuriousDragon" | "byzantium" | "constantinople" | "petersburg" | "istanbul" | "muirGlacier" | "berlin" | "london" | "altair" | "arrowGlacier" | "grayGlacier" | "bellatrix" | "merge" | "capella" | "shanghai" | undefined;
|
794
|
+
chainId?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
795
|
+
networkId?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
796
|
+
gasLimit?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
797
|
+
yParity?: string | undefined;
|
798
|
+
v?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
799
|
+
r?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
800
|
+
s?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
801
|
+
}[]>;
|
802
|
+
/**
|
803
|
+
* @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block.
|
804
|
+
* @param transactionIndex The index position of the transaction.
|
805
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
806
|
+
* @returns The desired transaction object.
|
807
|
+
*
|
808
|
+
* ```ts
|
809
|
+
* web3.eth.getTransactionFromBlock('0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', 0).then(console.log);
|
810
|
+
* {
|
811
|
+
* hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
|
812
|
+
* type: 0n,
|
813
|
+
* nonce: 0n,
|
814
|
+
* blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
|
815
|
+
* blockNumber: 1n,
|
816
|
+
* transactionIndex: 0n,
|
817
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
818
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
819
|
+
* value: 1n,
|
820
|
+
* gas: 90000n,
|
821
|
+
* gasPrice: 2000000000n,
|
822
|
+
* input: '0x',
|
823
|
+
* v: 2709n,
|
824
|
+
* r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
|
825
|
+
* s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
|
826
|
+
* }
|
827
|
+
*
|
828
|
+
* web3.eth.getTransactionFromBlock(
|
829
|
+
* hexToBytes("0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"),
|
830
|
+
* 0,
|
831
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
832
|
+
* ).then(console.log);
|
833
|
+
* {
|
834
|
+
* hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
|
835
|
+
* type: 0,
|
836
|
+
* nonce: 0,
|
837
|
+
* blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
|
838
|
+
* blockNumber: 1,
|
839
|
+
* transactionIndex: 0,
|
840
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
841
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
842
|
+
* value: 1,
|
843
|
+
* gas: 90000,
|
844
|
+
* gasPrice: 2000000000,
|
845
|
+
* input: '0x',
|
846
|
+
* v: 2709,
|
847
|
+
* r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
|
848
|
+
* s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
|
849
|
+
* }
|
850
|
+
* ```
|
851
|
+
*/
|
852
|
+
getTransactionFromBlock<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(block: BlockNumberOrTag | undefined, transactionIndex: Numbers, returnFormat?: ReturnFormat): Promise<{
|
853
|
+
readonly yParity: string;
|
854
|
+
readonly r: string;
|
855
|
+
readonly s: string;
|
856
|
+
readonly v?: undefined;
|
857
|
+
readonly maxFeePerGas: string;
|
858
|
+
readonly maxPriorityFeePerGas: string;
|
859
|
+
readonly accessList: {
|
860
|
+
readonly address?: string | undefined;
|
861
|
+
readonly storageKeys?: string[] | undefined;
|
862
|
+
}[];
|
863
|
+
readonly gasPrice: string;
|
864
|
+
readonly to?: string | null | undefined;
|
865
|
+
readonly type: string;
|
866
|
+
readonly nonce: string;
|
867
|
+
readonly gas: string;
|
868
|
+
readonly value: string;
|
869
|
+
readonly input: string;
|
870
|
+
readonly data?: string | undefined;
|
871
|
+
readonly chainId?: string | undefined;
|
872
|
+
readonly hash: string;
|
873
|
+
readonly blockHash?: string | undefined;
|
874
|
+
readonly blockNumber?: string | undefined;
|
875
|
+
readonly from: string;
|
876
|
+
readonly transactionIndex?: string | undefined;
|
877
|
+
} | {
|
878
|
+
readonly yParity: string;
|
879
|
+
readonly r: string;
|
880
|
+
readonly s: string;
|
881
|
+
readonly v?: undefined;
|
882
|
+
readonly gasPrice: string;
|
883
|
+
readonly accessList: {
|
884
|
+
readonly address?: string | undefined;
|
885
|
+
readonly storageKeys?: string[] | undefined;
|
886
|
+
}[];
|
887
|
+
readonly maxFeePerGas?: undefined;
|
888
|
+
readonly maxPriorityFeePerGas?: undefined;
|
889
|
+
readonly to?: string | null | undefined;
|
890
|
+
readonly type: string;
|
891
|
+
readonly nonce: string;
|
892
|
+
readonly gas: string;
|
893
|
+
readonly value: string;
|
894
|
+
readonly input: string;
|
895
|
+
readonly data?: string | undefined;
|
896
|
+
readonly chainId?: string | undefined;
|
897
|
+
readonly hash: string;
|
898
|
+
readonly blockHash?: string | undefined;
|
899
|
+
readonly blockNumber?: string | undefined;
|
900
|
+
readonly from: string;
|
901
|
+
readonly transactionIndex?: string | undefined;
|
902
|
+
} | {
|
903
|
+
readonly v: string;
|
904
|
+
readonly r: string;
|
905
|
+
readonly s: string;
|
906
|
+
readonly gasPrice: string;
|
907
|
+
readonly accessList?: undefined;
|
908
|
+
readonly maxFeePerGas?: undefined;
|
909
|
+
readonly maxPriorityFeePerGas?: undefined;
|
910
|
+
readonly to?: string | null | undefined;
|
911
|
+
readonly type: string;
|
912
|
+
readonly nonce: string;
|
913
|
+
readonly gas: string;
|
914
|
+
readonly value: string;
|
915
|
+
readonly input: string;
|
916
|
+
readonly data?: string | undefined;
|
917
|
+
readonly chainId?: string | undefined;
|
918
|
+
readonly hash: string;
|
919
|
+
readonly blockHash?: string | undefined;
|
920
|
+
readonly blockNumber?: string | undefined;
|
921
|
+
readonly from: string;
|
922
|
+
readonly transactionIndex?: string | undefined;
|
923
|
+
} | undefined>;
|
924
|
+
/**
|
925
|
+
* @param transactionHash Hash of the transaction to retrieve the receipt for.
|
926
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
927
|
+
* @returns The desired {@link TransactionReceipt} object.
|
928
|
+
*
|
929
|
+
* ```ts
|
930
|
+
* web3.eth.getTransactionReceipt("0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f").then(console.log);
|
931
|
+
* > {
|
932
|
+
* transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
|
933
|
+
* transactionIndex: 0n,
|
934
|
+
* blockNumber: 2n,
|
935
|
+
* blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a',
|
936
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
937
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
938
|
+
* cumulativeGasUsed: 21000n,
|
939
|
+
* gasUsed: 21000n,
|
940
|
+
* logs: [],
|
941
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
942
|
+
* status: 1n,
|
943
|
+
* effectiveGasPrice: 2000000000n,
|
944
|
+
* type: 0n
|
945
|
+
* }
|
946
|
+
*
|
947
|
+
* web3.eth.getTransactionReceipt(
|
948
|
+
* "0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f",
|
949
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
950
|
+
* ).then(console.log);
|
951
|
+
* > {
|
952
|
+
* transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
|
953
|
+
* transactionIndex: 0,
|
954
|
+
* blockNumber: 2,
|
955
|
+
* blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a',
|
956
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
957
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
958
|
+
* cumulativeGasUsed: 21000,
|
959
|
+
* gasUsed: 21000,
|
960
|
+
* logs: [],
|
961
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
962
|
+
* status: 1,
|
963
|
+
* effectiveGasPrice: 2000000000,
|
964
|
+
* type: 0n
|
965
|
+
* }
|
966
|
+
* ```
|
967
|
+
*/
|
968
|
+
getTransactionReceipt<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transactionHash: Bytes, returnFormat?: ReturnFormat): Promise<{
|
969
|
+
readonly transactionHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
970
|
+
readonly transactionIndex: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
971
|
+
readonly blockHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
972
|
+
readonly blockNumber: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
973
|
+
readonly from: string;
|
974
|
+
readonly to: string;
|
975
|
+
readonly cumulativeGasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
976
|
+
readonly gasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
977
|
+
readonly effectiveGasPrice?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
978
|
+
readonly contractAddress?: string | undefined;
|
979
|
+
readonly logs: {
|
980
|
+
readonly id?: string | undefined;
|
981
|
+
readonly removed?: boolean | undefined;
|
982
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
983
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
984
|
+
readonly transactionHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
985
|
+
readonly blockHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
986
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
987
|
+
readonly address?: string | undefined;
|
988
|
+
readonly data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
989
|
+
readonly topics?: import("web3-types").ByteTypes[ReturnFormat["bytes"]][] | undefined;
|
990
|
+
}[];
|
991
|
+
readonly logsBloom: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
992
|
+
readonly root: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
993
|
+
readonly status: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
994
|
+
readonly type?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
995
|
+
events?: {
|
996
|
+
[x: string]: {
|
997
|
+
readonly event: string;
|
998
|
+
readonly id?: string | undefined;
|
999
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
1000
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
1001
|
+
readonly transactionHash?: string | undefined;
|
1002
|
+
readonly blockHash?: string | undefined;
|
1003
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
1004
|
+
readonly address: string;
|
1005
|
+
readonly topics: string[];
|
1006
|
+
readonly data: string;
|
1007
|
+
readonly raw?: {
|
1008
|
+
data: string;
|
1009
|
+
topics: unknown[];
|
1010
|
+
} | undefined;
|
1011
|
+
readonly returnValues: {
|
1012
|
+
[x: string]: unknown;
|
1013
|
+
};
|
1014
|
+
readonly signature?: string | undefined;
|
1015
|
+
};
|
1016
|
+
} | undefined;
|
1017
|
+
}>;
|
1018
|
+
/**
|
1019
|
+
* @param address The address to get the number of transactions for.
|
1020
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the query.
|
1021
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
1022
|
+
* @returns The number of transactions sent from the provided address.
|
1023
|
+
*
|
1024
|
+
* ```ts
|
1025
|
+
* web3.eth.getTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
|
1026
|
+
* > 1n
|
1027
|
+
*
|
1028
|
+
* web3.eth.getTransactionCount(
|
1029
|
+
* "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
|
1030
|
+
* undefined,
|
1031
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
1032
|
+
* ).then(console.log);
|
1033
|
+
* > 1
|
1034
|
+
* ```
|
1035
|
+
*/
|
1036
|
+
getTransactionCount<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(address: Address, blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
1037
|
+
/**
|
1038
|
+
* @param transaction The {@link Transaction}, {@link TransactionWithFromLocalWalletIndex}, {@link TransactionWithToLocalWalletIndex} or {@link TransactionWithFromAndToLocalWalletIndex} to send. __Note:__ In the `to` and `from` fields when hex strings are used, it is assumed they are addresses, for any other form (number, string number, etc.) it is assumed they are wallet indexes.
|
1039
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
1040
|
+
* @param options A configuration object used to change the behavior of the `sendTransaction` method.
|
1041
|
+
* @returns If `await`ed or `.then`d (i.e. the promise resolves), the transaction hash is returned.
|
1042
|
+
* ```ts
|
1043
|
+
* const transaction = {
|
1044
|
+
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
|
1045
|
+
* to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
|
1046
|
+
* value: '0x1'
|
1047
|
+
* }
|
1048
|
+
*
|
1049
|
+
* const transactionHash = await web3.eth.sendTransaction(transaction);
|
1050
|
+
* console.log(transactionHash);
|
1051
|
+
* > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
|
1052
|
+
*
|
1053
|
+
* web3.eth.sendTransaction(transaction).then(console.log);
|
1054
|
+
* > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
|
1055
|
+
*
|
1056
|
+
* web3.eth.sendTransaction(transaction).catch(console.log);
|
1057
|
+
* > <Some TransactionError>
|
1058
|
+
*
|
1059
|
+
* // Example using options.ignoreGasPricing = true
|
1060
|
+
* web3.eth.sendTransaction(transaction, undefined, { ignoreGasPricing: true }).then(console.log);
|
1061
|
+
* > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
|
1062
|
+
* ```
|
1063
|
+
*
|
1064
|
+
*
|
1065
|
+
* Otherwise, a {@link Web3PromiEvent} is returned which has several events than can be listened to using the `.on` syntax, such as:
|
1066
|
+
* - `sending`
|
1067
|
+
* ```ts
|
1068
|
+
* web3.eth.sendTransaction(transaction).on('sending', transactionToBeSent => console.log(transactionToBeSent));
|
1069
|
+
* > {
|
1070
|
+
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
|
1071
|
+
* to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
|
1072
|
+
* value: '0x1',
|
1073
|
+
* gasPrice: '0x77359400',
|
1074
|
+
* maxPriorityFeePerGas: undefined,
|
1075
|
+
* maxFeePerGas: undefined
|
1076
|
+
* }
|
1077
|
+
* ```
|
1078
|
+
* - `sent`
|
1079
|
+
* ```ts
|
1080
|
+
* web3.eth.sendTransaction(transaction).on('sent', sentTransaction => console.log(sentTransaction));
|
1081
|
+
* > {
|
1082
|
+
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
|
1083
|
+
* to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
|
1084
|
+
* value: '0x1',
|
1085
|
+
* gasPrice: '0x77359400',
|
1086
|
+
* maxPriorityFeePerGas: undefined,
|
1087
|
+
* maxFeePerGas: undefined
|
1088
|
+
* }
|
1089
|
+
* ```
|
1090
|
+
* - `transactionHash`
|
1091
|
+
* ```ts
|
1092
|
+
* web3.eth.sendTransaction(transaction).on('transactionHash', transactionHash => console.log(transactionHash));
|
1093
|
+
* > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
|
1094
|
+
* ```
|
1095
|
+
* - `receipt`
|
1096
|
+
* ```ts
|
1097
|
+
* web3.eth.sendTransaction(transaction).on('receipt', receipt => console.log(receipt));
|
1098
|
+
* > {
|
1099
|
+
* transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
|
1100
|
+
* transactionIndex: 0n,
|
1101
|
+
* blockNumber: 2n,
|
1102
|
+
* blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a',
|
1103
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
1104
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
1105
|
+
* cumulativeGasUsed: 21000n,
|
1106
|
+
* gasUsed: 21000n,
|
1107
|
+
* logs: [],
|
1108
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
1109
|
+
* status: 1n,
|
1110
|
+
* effectiveGasPrice: 2000000000n,
|
1111
|
+
* type: 0n
|
1112
|
+
* }
|
1113
|
+
* ```
|
1114
|
+
* - `confirmation`
|
1115
|
+
* ```ts
|
1116
|
+
* web3.eth.sendTransaction(transaction).on('confirmation', confirmation => console.log(confirmation));
|
1117
|
+
* > {
|
1118
|
+
* confirmations: 1n,
|
1119
|
+
* receipt: {
|
1120
|
+
* transactionHash: '0xb4a3a35ae0f3e77ef0ff7be42010d948d011b21a4e341072ee18717b67e99ab8',
|
1121
|
+
* transactionIndex: 0n,
|
1122
|
+
* blockNumber: 5n,
|
1123
|
+
* blockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548',
|
1124
|
+
* from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
|
1125
|
+
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
|
1126
|
+
* cumulativeGasUsed: 21000n,
|
1127
|
+
* gasUsed: 21000n,
|
1128
|
+
* logs: [],
|
1129
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
1130
|
+
* status: 1n,
|
1131
|
+
* effectiveGasPrice: 2000000000n,
|
1132
|
+
* type: 0n
|
1133
|
+
* },
|
1134
|
+
* latestBlockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548'
|
1135
|
+
* }
|
1136
|
+
* ```
|
1137
|
+
* - `error`
|
1138
|
+
* ```ts
|
1139
|
+
* web3.eth.sendTransaction(transaction).on('error', error => console.log);
|
1140
|
+
* > <Some TransactionError>
|
1141
|
+
* ```
|
1142
|
+
*/
|
1143
|
+
sendTransaction<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transaction: Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex, returnFormat?: ReturnFormat, options?: SendTransactionOptions): import("web3-core").Web3PromiEvent<import("web3-types").TransactionReceipt, import("./types.js").SendTransactionEvents<ReturnFormat>>;
|
1144
|
+
/**
|
1145
|
+
* @param transaction Signed transaction in one of the valid {@link Bytes} format.
|
1146
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
1147
|
+
* @param options A configuration object used to change the behavior of the method
|
1148
|
+
* @returns If `await`ed or `.then`d (i.e. the promise resolves), the transaction hash is returned.
|
1149
|
+
* ```ts
|
1150
|
+
* const signedTransaction = "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f"
|
1151
|
+
*
|
1152
|
+
* const transactionHash = await web3.eth.sendSignedTransaction(signedTransaction);
|
1153
|
+
* console.log(transactionHash);
|
1154
|
+
* > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700
|
1155
|
+
*
|
1156
|
+
* web3.eth.sendSignedTransaction(signedTransaction).then(console.log);
|
1157
|
+
* > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700
|
1158
|
+
*
|
1159
|
+
* web3.eth.sendSignedTransaction(signedTransaction).catch(console.log);
|
1160
|
+
* > <Some TransactionError>
|
1161
|
+
* ```
|
1162
|
+
*
|
1163
|
+
*
|
1164
|
+
* Otherwise, a {@link Web3PromiEvent} is returned which has several events than can be listened to using the `.on` syntax, such as:
|
1165
|
+
* - `sending`
|
1166
|
+
* ```ts
|
1167
|
+
* web3.eth.sendSignedTransaction(signedTransaction).on('sending', transactionToBeSent => console.log(transactionToBeSent));
|
1168
|
+
* > "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f"
|
1169
|
+
* ```
|
1170
|
+
* - `sent`
|
1171
|
+
* ```ts
|
1172
|
+
* web3.eth.sendSignedTransaction(signedTransaction).on('sent', sentTransaction => console.log(sentTransaction));
|
1173
|
+
* > "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f"
|
1174
|
+
* ```
|
1175
|
+
* - `transactionHash`
|
1176
|
+
* ```ts
|
1177
|
+
* web3.eth.sendSignedTransaction(signedTransaction).on('transactionHash', transactionHash => console.log(transactionHash));
|
1178
|
+
* > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700
|
1179
|
+
* ```
|
1180
|
+
* - `receipt`
|
1181
|
+
* ```ts
|
1182
|
+
* web3.eth.sendSignedTransaction(signedTransaction).on('receipt', receipt => console.log(receipt));
|
1183
|
+
* > {
|
1184
|
+
* blockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081',
|
1185
|
+
* blockNumber: 1n,
|
1186
|
+
* cumulativeGasUsed: 21000n,
|
1187
|
+
* effectiveGasPrice: 1000000001n,
|
1188
|
+
* from: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
|
1189
|
+
* gasUsed: 21000n,
|
1190
|
+
* logs: [],
|
1191
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
1192
|
+
* status: 1n,
|
1193
|
+
* to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
|
1194
|
+
* transactionHash: '0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700',
|
1195
|
+
* transactionIndex: 0n,
|
1196
|
+
* type: 0n
|
1197
|
+
* }
|
1198
|
+
* ```
|
1199
|
+
* - `confirmation`
|
1200
|
+
* ```ts
|
1201
|
+
* web3.eth.sendSignedTransaction(signedTransaction).on('confirmation', confirmation => console.log(confirmation));
|
1202
|
+
* > {
|
1203
|
+
* confirmations: 1n,
|
1204
|
+
* receipt: {
|
1205
|
+
* blockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081',
|
1206
|
+
* blockNumber: 1n,
|
1207
|
+
* cumulativeGasUsed: 21000n,
|
1208
|
+
* effectiveGasPrice: 1000000001n,
|
1209
|
+
* from: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
|
1210
|
+
* gasUsed: 21000n,
|
1211
|
+
* logs: [],
|
1212
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
1213
|
+
* status: 1n,
|
1214
|
+
* to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
|
1215
|
+
* transactionHash: '0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700',
|
1216
|
+
* transactionIndex: 0n,
|
1217
|
+
* type: 0n
|
1218
|
+
* },
|
1219
|
+
* latestBlockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081'
|
1220
|
+
* }
|
1221
|
+
* ```
|
1222
|
+
* - `error`
|
1223
|
+
* ```ts
|
1224
|
+
* web3.eth.sendSignedTransaction(signedTransaction).on('error', error => console.log(error));
|
1225
|
+
* > <Some TransactionError>
|
1226
|
+
* ```
|
1227
|
+
*/
|
1228
|
+
sendSignedTransaction<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transaction: Bytes, returnFormat?: ReturnFormat, options?: SendTransactionOptions): import("web3-core").Web3PromiEvent<import("web3-types").TransactionReceipt, import("./types.js").SendSignedTransactionEvents<ReturnFormat>>;
|
1229
|
+
/**
|
1230
|
+
* @param message Data to sign in one of the valid {@link Bytes} format.
|
1231
|
+
* @param address Address to sign data with, can be an address or the index of a local wallet.
|
1232
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
1233
|
+
* @returns The signed `message`.
|
1234
|
+
*
|
1235
|
+
* ```ts
|
1236
|
+
* // Using an unlocked account managed by connected RPC client
|
1237
|
+
* web3.eth.sign("0x48656c6c6f20776f726c64", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe").then(console.log);
|
1238
|
+
* > "0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"
|
1239
|
+
*
|
1240
|
+
* // Using an unlocked account managed by connected RPC client
|
1241
|
+
* web3.eth.sign("0x48656c6c6f20776f726c64", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.UINT8ARRAY }).then(console.log);
|
1242
|
+
* > Uint8Array(65) [
|
1243
|
+
* 48, 117, 94, 214, 83, 150, 250, 207, 134, 197, 62,
|
1244
|
+
* 98, 23, 197, 43, 77, 174, 190, 114, 170, 73, 65,
|
1245
|
+
* 216, 150, 53, 64, 157, 228, 201, 199, 249, 70, 109,
|
1246
|
+
* 78, 154, 174, 199, 151, 127, 5, 233, 35, 136, 155,
|
1247
|
+
* 51, 192, 208, 221, 39, 215, 34, 107, 110, 111, 86,
|
1248
|
+
* 206, 115, 116, 101, 197, 207, 208, 75, 228, 0
|
1249
|
+
* ]
|
1250
|
+
* ```
|
1251
|
+
*
|
1252
|
+
* // Using an indexed account managed by local Web3 wallet
|
1253
|
+
* web3.eth.sign("0x48656c6c6f20776f726c64", 0).then(console.log);
|
1254
|
+
* > "0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"
|
1255
|
+
*/
|
1256
|
+
sign<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(message: Bytes, addressOrIndex: Address | number, returnFormat?: ReturnFormat): Promise<{
|
1257
|
+
readonly messageHash: string;
|
1258
|
+
readonly r: string;
|
1259
|
+
readonly s: string;
|
1260
|
+
readonly v: string;
|
1261
|
+
readonly message?: string | undefined;
|
1262
|
+
readonly signature: string;
|
1263
|
+
} | import("web3-types").ByteTypes[ReturnFormat["bytes"]]>;
|
1264
|
+
/**
|
1265
|
+
* @param transaction The transaction object to sign.
|
1266
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted.
|
1267
|
+
* @returns {@link SignedTransactionInfoAPI}, an object containing the [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/#top) encoded signed transaction (accessed via the `raw` property) and the signed transaction object (accessed via the `tx` property).
|
1268
|
+
*
|
1269
|
+
* ```ts
|
1270
|
+
* const transaction = {
|
1271
|
+
* from: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
|
1272
|
+
* to: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
|
1273
|
+
* value: '0x1',
|
1274
|
+
* gas: '21000',
|
1275
|
+
* gasPrice: await web3Eth.getGasPrice(),
|
1276
|
+
* nonce: '0x1',
|
1277
|
+
* type: '0x0'
|
1278
|
+
* }
|
1279
|
+
*
|
1280
|
+
* web3.eth.signTransaction(transaction).then(console.log);
|
1281
|
+
* > {
|
1282
|
+
* raw: '0xf86501843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a96a0adb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679a027d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
|
1283
|
+
* tx: {
|
1284
|
+
* type: 0n,
|
1285
|
+
* nonce: 1n,
|
1286
|
+
* gasPrice: 1000000001n,
|
1287
|
+
* gas: 21000n,
|
1288
|
+
* value: 1n,
|
1289
|
+
* v: 2710n,
|
1290
|
+
* r: '0xadb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679',
|
1291
|
+
* s: '0x27d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
|
1292
|
+
* to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
|
1293
|
+
* data: '0x'
|
1294
|
+
* }
|
1295
|
+
* }
|
1296
|
+
*
|
1297
|
+
* web3.eth.signTransaction(transaction, { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
|
1298
|
+
* > {
|
1299
|
+
* raw: '0xf86501843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a96a0adb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679a027d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
|
1300
|
+
* tx: {
|
1301
|
+
* type: 0,
|
1302
|
+
* nonce: 1,
|
1303
|
+
* gasPrice: 1000000001,
|
1304
|
+
* gas: 21000,
|
1305
|
+
* value: 1,
|
1306
|
+
* v: 2710,
|
1307
|
+
* r: '0xadb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679',
|
1308
|
+
* s: '0x27d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
|
1309
|
+
* to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
|
1310
|
+
* data: '0x'
|
1311
|
+
* }
|
1312
|
+
* }
|
1313
|
+
* ```
|
1314
|
+
*/
|
1315
|
+
signTransaction<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transaction: Transaction, returnFormat?: ReturnFormat): Promise<import("web3-types").SignedTransactionInfoAPI>;
|
1316
|
+
/**
|
1317
|
+
* Executes a message call within the EVM without creating a transaction.
|
1318
|
+
* It does not publish anything to the blockchain and does not consume any gas.
|
1319
|
+
*
|
1320
|
+
* @param transaction - A transaction object where all properties are optional except `to`, however it's recommended to include the `from` property or it may default to `0x0000000000000000000000000000000000000000` depending on your node or provider.
|
1321
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the transaction.
|
1322
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted.
|
1323
|
+
* @returns The returned data of the call, e.g. a smart contract function's return value.
|
1324
|
+
*/
|
1325
|
+
call<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transaction: TransactionCall, blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").ByteTypes[ReturnFormat["bytes"]]>;
|
1326
|
+
/**
|
1327
|
+
* Simulates the transaction within the EVM to estimate the amount of gas to be used by the transaction.
|
1328
|
+
* The transaction will not be added to the blockchain, and actual gas usage can vary when interacting
|
1329
|
+
* with a contract as a result of updating the contract's state.
|
1330
|
+
*
|
1331
|
+
* @param transaction The {@link Transaction} object to estimate the gas for.
|
1332
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the gas estimation.
|
1333
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted.
|
1334
|
+
* @returns The used gas for the simulated transaction execution.
|
1335
|
+
*
|
1336
|
+
* ```ts
|
1337
|
+
* const transaction = {
|
1338
|
+
* from: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
|
1339
|
+
* to: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
|
1340
|
+
* value: '0x1',
|
1341
|
+
* nonce: '0x1',
|
1342
|
+
* type: '0x0'
|
1343
|
+
* }
|
1344
|
+
*
|
1345
|
+
* web3.eth.estimateGas(transaction).then(console.log);
|
1346
|
+
* > 21000n
|
1347
|
+
*
|
1348
|
+
* web3.eth.estimateGas(transaction, { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
|
1349
|
+
* > 21000
|
1350
|
+
* ```
|
1351
|
+
*/
|
1352
|
+
estimateGas<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transaction: Transaction, blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
1353
|
+
/**
|
1354
|
+
* Gets past logs, matching the provided `filter`.
|
1355
|
+
*
|
1356
|
+
* @param filter A {@link Filter} object containing the properties for the desired logs.
|
1357
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted.
|
1358
|
+
* @returns {@link FilterResultsAPI}, an array of {@link Log} objects.
|
1359
|
+
*
|
1360
|
+
* ```ts
|
1361
|
+
* web3.eth.getPastLogs({
|
1362
|
+
* address: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
|
1363
|
+
* topics: ["0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"]
|
1364
|
+
* }).then(console.log);
|
1365
|
+
* > [{
|
1366
|
+
* data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
|
1367
|
+
* topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385']
|
1368
|
+
* logIndex: 0n,
|
1369
|
+
* transactionIndex: 0n,
|
1370
|
+
* transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
|
1371
|
+
* blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
|
1372
|
+
* blockNumber: 1234n,
|
1373
|
+
* address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'
|
1374
|
+
* },
|
1375
|
+
* {...}]
|
1376
|
+
*
|
1377
|
+
* web3.eth.getPastLogs(
|
1378
|
+
* {
|
1379
|
+
* address: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
|
1380
|
+
* topics: ["0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"]
|
1381
|
+
* },
|
1382
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
1383
|
+
* ).then(console.log);
|
1384
|
+
* > [{
|
1385
|
+
* data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
|
1386
|
+
* topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385']
|
1387
|
+
* logIndex: 0,
|
1388
|
+
* transactionIndex: 0,
|
1389
|
+
* transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
|
1390
|
+
* blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
|
1391
|
+
* blockNumber: 1234,
|
1392
|
+
* address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'
|
1393
|
+
* },
|
1394
|
+
* {...}]
|
1395
|
+
* ```
|
1396
|
+
*/
|
1397
|
+
getPastLogs<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(filter: Filter, returnFormat?: ReturnFormat): Promise<(string | {
|
1398
|
+
readonly id?: string | undefined;
|
1399
|
+
readonly removed?: boolean | undefined;
|
1400
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
1401
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
1402
|
+
readonly transactionHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
1403
|
+
readonly blockHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
1404
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
1405
|
+
readonly address?: string | undefined;
|
1406
|
+
readonly data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
1407
|
+
readonly topics?: import("web3-types").ByteTypes[ReturnFormat["bytes"]][] | undefined;
|
1408
|
+
})[]>;
|
1409
|
+
/**
|
1410
|
+
* Gets work for miners to mine on. Returns the hash of the current block, the seedHash, and the boundary condition to be met ('target').
|
1411
|
+
*
|
1412
|
+
* @returns The mining work as an array of strings with the following structure:
|
1413
|
+
*
|
1414
|
+
* String 32 Bytes - at index 0: current block header pow-hash
|
1415
|
+
* String 32 Bytes - at index 1: the seed hash used for the DAG.
|
1416
|
+
* String 32 Bytes - at index 2: the boundary condition ('target'), 2^256 / difficulty.
|
1417
|
+
*
|
1418
|
+
* ```ts
|
1419
|
+
* web3.eth.getWork().then(console.log);
|
1420
|
+
* > [
|
1421
|
+
* "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
1422
|
+
* "0x5EED00000000000000000000000000005EED0000000000000000000000000000",
|
1423
|
+
* "0xd1ff1c01710000000000000000000000d1ff1c01710000000000000000000000"
|
1424
|
+
* ]
|
1425
|
+
* ```
|
1426
|
+
*/
|
1427
|
+
getWork(): Promise<[string, string, string]>;
|
1428
|
+
/**
|
1429
|
+
* Used for submitting a proof-of-work solution.
|
1430
|
+
*
|
1431
|
+
* @param nonce The nonce found (8 bytes).
|
1432
|
+
* @param hash The header’s pow-hash (32 bytes).
|
1433
|
+
* @param digest The mix digest (32 bytes).
|
1434
|
+
* @returns Returns `true` if the provided solution is valid, otherwise `false`.
|
1435
|
+
*
|
1436
|
+
* ```ts
|
1437
|
+
* web3.eth.submitWork([
|
1438
|
+
* "0x0000000000000001",
|
1439
|
+
* "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
1440
|
+
* "0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000"
|
1441
|
+
* ]).then(console.log);
|
1442
|
+
* > true
|
1443
|
+
* ```
|
1444
|
+
*/
|
1445
|
+
submitWork(nonce: HexString8Bytes, hash: HexString32Bytes, digest: HexString32Bytes): Promise<boolean>;
|
1446
|
+
/**
|
1447
|
+
* This method will request/enable the accounts from the current environment and for supporting [EIP 1102](https://eips.ethereum.org/EIPS/eip-1102)
|
1448
|
+
* This method will only work if you’re using the injected provider from a application like Metamask, Status or TrustWallet.
|
1449
|
+
* It doesn’t work if you’re connected to a node with a default Web3.js provider (WebsocketProvider, HttpProvider and IpcProvider).
|
1450
|
+
* For more information about the behavior of this method please read [EIP-1102](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1102.md): Opt-in account exposure.
|
1451
|
+
*
|
1452
|
+
* @returns An array of enabled accounts.
|
1453
|
+
*
|
1454
|
+
* ```ts
|
1455
|
+
* web3.eth.requestAccounts().then(console.log);
|
1456
|
+
* > ['0aae0B295369a9FD31d5F28D9Ec85E40f4cb692BAf', '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe']
|
1457
|
+
* ```
|
1458
|
+
*/
|
1459
|
+
requestAccounts(): Promise<string[]>;
|
1460
|
+
/**
|
1461
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted.
|
1462
|
+
* @returns The chain ID of the current connected node as described in the [EIP-695](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-695.md).
|
1463
|
+
*
|
1464
|
+
* ```ts
|
1465
|
+
* web3.eth.getChainId().then(console.log);
|
1466
|
+
* > 61n
|
1467
|
+
*
|
1468
|
+
* web3.eth.getChainId({ number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
|
1469
|
+
* > 61
|
1470
|
+
* ```
|
1471
|
+
*/
|
1472
|
+
getChainId<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(returnFormat?: ReturnFormat): Promise<import("web3-types").NumberTypes[ReturnFormat["number"]]>;
|
1473
|
+
/**
|
1474
|
+
* @returns The current client version.
|
1475
|
+
*
|
1476
|
+
* ```ts
|
1477
|
+
* web3.eth.getNodeInfo().then(console.log);
|
1478
|
+
* > "Mist/v0.9.3/darwin/go1.4.1"
|
1479
|
+
* ```
|
1480
|
+
*/
|
1481
|
+
getNodeInfo(): Promise<string>;
|
1482
|
+
/**
|
1483
|
+
* @param address The Address of the account or contract.
|
1484
|
+
* @param storageKeys Array of storage-keys which should be proofed and included. See {@link web3.getStorageAt}.
|
1485
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the gas estimation.
|
1486
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted.
|
1487
|
+
* @returns The account and storage-values of the specified account including the Merkle-proof as described in [EIP-1186](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1186.md).
|
1488
|
+
*
|
1489
|
+
* ```ts
|
1490
|
+
* web3.eth.getProof(
|
1491
|
+
* "0x1234567890123456789012345678901234567890",
|
1492
|
+
* ["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001"],
|
1493
|
+
* "latest"
|
1494
|
+
* ).then(console.log);
|
1495
|
+
* > {
|
1496
|
+
* "address": "0x1234567890123456789012345678901234567890",
|
1497
|
+
* "accountProof": [
|
1498
|
+
* "0xf90211a090dcaf88c40c7bbc95a912cbdde67c175767b31173df9ee4b0d733bfdd511c43a0babe369f6b12092f49181ae04ca173fb68d1a5456f18d20fa32cba73954052bda0473ecf8a7e36a829e75039a3b055e51b8332cbf03324ab4af2066bbd6fbf0021a0bbda34753d7aa6c38e603f360244e8f59611921d9e1f128372fec0d586d4f9e0a04e44caecff45c9891f74f6a2156735886eedf6f1a733628ebc802ec79d844648a0a5f3f2f7542148c973977c8a1e154c4300fec92f755f7846f1b734d3ab1d90e7a0e823850f50bf72baae9d1733a36a444ab65d0a6faaba404f0583ce0ca4dad92da0f7a00cbe7d4b30b11faea3ae61b7f1f2b315b61d9f6bd68bfe587ad0eeceb721a07117ef9fc932f1a88e908eaead8565c19b5645dc9e5b1b6e841c5edbdfd71681a069eb2de283f32c11f859d7bcf93da23990d3e662935ed4d6b39ce3673ec84472a0203d26456312bbc4da5cd293b75b840fc5045e493d6f904d180823ec22bfed8ea09287b5c21f2254af4e64fca76acc5cd87399c7f1ede818db4326c98ce2dc2208a06fc2d754e304c48ce6a517753c62b1a9c1d5925b89707486d7fc08919e0a94eca07b1c54f15e299bd58bdfef9741538c7828b5d7d11a489f9c20d052b3471df475a051f9dd3739a927c89e357580a4c97b40234aa01ed3d5e0390dc982a7975880a0a089d613f26159af43616fd9455bb461f4869bfede26f2130835ed067a8b967bfb80",
|
1499
|
+
* "0xf90211a0395d87a95873cd98c21cf1df9421af03f7247880a2554e20738eec2c7507a494a0bcf6546339a1e7e14eb8fb572a968d217d2a0d1f3bc4257b22ef5333e9e4433ca012ae12498af8b2752c99efce07f3feef8ec910493be749acd63822c3558e6671a0dbf51303afdc36fc0c2d68a9bb05dab4f4917e7531e4a37ab0a153472d1b86e2a0ae90b50f067d9a2244e3d975233c0a0558c39ee152969f6678790abf773a9621a01d65cd682cc1be7c5e38d8da5c942e0a73eeaef10f387340a40a106699d494c3a06163b53d956c55544390c13634ea9aa75309f4fd866f312586942daf0f60fb37a058a52c1e858b1382a8893eb9c1f111f266eb9e21e6137aff0dddea243a567000a037b4b100761e02de63ea5f1fcfcf43e81a372dafb4419d126342136d329b7a7ba032472415864b08f808ba4374092003c8d7c40a9f7f9fe9cc8291f62538e1cc14a074e238ff5ec96b810364515551344100138916594d6af966170ff326a092fab0a0d31ac4eef14a79845200a496662e92186ca8b55e29ed0f9f59dbc6b521b116fea090607784fe738458b63c1942bba7c0321ae77e18df4961b2bc66727ea996464ea078f757653c1b63f72aff3dcc3f2a2e4c8cb4a9d36d1117c742833c84e20de994a0f78407de07f4b4cb4f899dfb95eedeb4049aeb5fc1635d65cf2f2f4dfd25d1d7a0862037513ba9d45354dd3e36264aceb2b862ac79d2050f14c95657e43a51b85c80",
|
1500
|
+
* "0xf90171a04ad705ea7bf04339fa36b124fa221379bd5a38ffe9a6112cb2d94be3a437b879a08e45b5f72e8149c01efcb71429841d6a8879d4bbe27335604a5bff8dfdf85dcea00313d9b2f7c03733d6549ea3b810e5262ed844ea12f70993d87d3e0f04e3979ea0b59e3cdd6750fa8b15164612a5cb6567cdfb386d4e0137fccee5f35ab55d0efda0fe6db56e42f2057a071c980a778d9a0b61038f269dd74a0e90155b3f40f14364a08538587f2378a0849f9608942cf481da4120c360f8391bbcc225d811823c6432a026eac94e755534e16f9552e73025d6d9c30d1d7682a4cb5bd7741ddabfd48c50a041557da9a74ca68da793e743e81e2029b2835e1cc16e9e25bd0c1e89d4ccad6980a041dda0a40a21ade3a20fcd1a4abb2a42b74e9a32b02424ff8db4ea708a5e0fb9a09aaf8326a51f613607a8685f57458329b41e938bb761131a5747e066b81a0a16808080a022e6cef138e16d2272ef58434ddf49260dc1de1f8ad6dfca3da5d2a92aaaadc58080",
|
1501
|
+
* "0xf851808080a009833150c367df138f1538689984b8a84fc55692d3d41fe4d1e5720ff5483a6980808080808080808080a0a319c1c415b271afc0adcb664e67738d103ac168e0bc0b7bd2da7966165cb9518080"
|
1502
|
+
* ],
|
1503
|
+
* "balance": 0n,
|
1504
|
+
* "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
1505
|
+
* "nonce": 0n,
|
1506
|
+
* "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
1507
|
+
* "storageProof": [
|
1508
|
+
* {
|
1509
|
+
* "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
1510
|
+
* "value": 0n,
|
1511
|
+
* "proof": []
|
1512
|
+
* },
|
1513
|
+
* {
|
1514
|
+
* "key": "0x0000000000000000000000000000000000000000000000000000000000000001",
|
1515
|
+
* "value": 0n,
|
1516
|
+
* "proof": []
|
1517
|
+
* }
|
1518
|
+
* ]
|
1519
|
+
* }
|
1520
|
+
*
|
1521
|
+
* web3.eth.getProof(
|
1522
|
+
* "0x1234567890123456789012345678901234567890",
|
1523
|
+
* ["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001"],
|
1524
|
+
* undefined,
|
1525
|
+
* { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
|
1526
|
+
* ).then(console.log);
|
1527
|
+
* > {
|
1528
|
+
* "address": "0x1234567890123456789012345678901234567890",
|
1529
|
+
* "accountProof": [
|
1530
|
+
* "0xf90211a090dcaf88c40c7bbc95a912cbdde67c175767b31173df9ee4b0d733bfdd511c43a0babe369f6b12092f49181ae04ca173fb68d1a5456f18d20fa32cba73954052bda0473ecf8a7e36a829e75039a3b055e51b8332cbf03324ab4af2066bbd6fbf0021a0bbda34753d7aa6c38e603f360244e8f59611921d9e1f128372fec0d586d4f9e0a04e44caecff45c9891f74f6a2156735886eedf6f1a733628ebc802ec79d844648a0a5f3f2f7542148c973977c8a1e154c4300fec92f755f7846f1b734d3ab1d90e7a0e823850f50bf72baae9d1733a36a444ab65d0a6faaba404f0583ce0ca4dad92da0f7a00cbe7d4b30b11faea3ae61b7f1f2b315b61d9f6bd68bfe587ad0eeceb721a07117ef9fc932f1a88e908eaead8565c19b5645dc9e5b1b6e841c5edbdfd71681a069eb2de283f32c11f859d7bcf93da23990d3e662935ed4d6b39ce3673ec84472a0203d26456312bbc4da5cd293b75b840fc5045e493d6f904d180823ec22bfed8ea09287b5c21f2254af4e64fca76acc5cd87399c7f1ede818db4326c98ce2dc2208a06fc2d754e304c48ce6a517753c62b1a9c1d5925b89707486d7fc08919e0a94eca07b1c54f15e299bd58bdfef9741538c7828b5d7d11a489f9c20d052b3471df475a051f9dd3739a927c89e357580a4c97b40234aa01ed3d5e0390dc982a7975880a0a089d613f26159af43616fd9455bb461f4869bfede26f2130835ed067a8b967bfb80",
|
1531
|
+
* "0xf90211a0395d87a95873cd98c21cf1df9421af03f7247880a2554e20738eec2c7507a494a0bcf6546339a1e7e14eb8fb572a968d217d2a0d1f3bc4257b22ef5333e9e4433ca012ae12498af8b2752c99efce07f3feef8ec910493be749acd63822c3558e6671a0dbf51303afdc36fc0c2d68a9bb05dab4f4917e7531e4a37ab0a153472d1b86e2a0ae90b50f067d9a2244e3d975233c0a0558c39ee152969f6678790abf773a9621a01d65cd682cc1be7c5e38d8da5c942e0a73eeaef10f387340a40a106699d494c3a06163b53d956c55544390c13634ea9aa75309f4fd866f312586942daf0f60fb37a058a52c1e858b1382a8893eb9c1f111f266eb9e21e6137aff0dddea243a567000a037b4b100761e02de63ea5f1fcfcf43e81a372dafb4419d126342136d329b7a7ba032472415864b08f808ba4374092003c8d7c40a9f7f9fe9cc8291f62538e1cc14a074e238ff5ec96b810364515551344100138916594d6af966170ff326a092fab0a0d31ac4eef14a79845200a496662e92186ca8b55e29ed0f9f59dbc6b521b116fea090607784fe738458b63c1942bba7c0321ae77e18df4961b2bc66727ea996464ea078f757653c1b63f72aff3dcc3f2a2e4c8cb4a9d36d1117c742833c84e20de994a0f78407de07f4b4cb4f899dfb95eedeb4049aeb5fc1635d65cf2f2f4dfd25d1d7a0862037513ba9d45354dd3e36264aceb2b862ac79d2050f14c95657e43a51b85c80",
|
1532
|
+
* "0xf90171a04ad705ea7bf04339fa36b124fa221379bd5a38ffe9a6112cb2d94be3a437b879a08e45b5f72e8149c01efcb71429841d6a8879d4bbe27335604a5bff8dfdf85dcea00313d9b2f7c03733d6549ea3b810e5262ed844ea12f70993d87d3e0f04e3979ea0b59e3cdd6750fa8b15164612a5cb6567cdfb386d4e0137fccee5f35ab55d0efda0fe6db56e42f2057a071c980a778d9a0b61038f269dd74a0e90155b3f40f14364a08538587f2378a0849f9608942cf481da4120c360f8391bbcc225d811823c6432a026eac94e755534e16f9552e73025d6d9c30d1d7682a4cb5bd7741ddabfd48c50a041557da9a74ca68da793e743e81e2029b2835e1cc16e9e25bd0c1e89d4ccad6980a041dda0a40a21ade3a20fcd1a4abb2a42b74e9a32b02424ff8db4ea708a5e0fb9a09aaf8326a51f613607a8685f57458329b41e938bb761131a5747e066b81a0a16808080a022e6cef138e16d2272ef58434ddf49260dc1de1f8ad6dfca3da5d2a92aaaadc58080",
|
1533
|
+
* "0xf851808080a009833150c367df138f1538689984b8a84fc55692d3d41fe4d1e5720ff5483a6980808080808080808080a0a319c1c415b271afc0adcb664e67738d103ac168e0bc0b7bd2da7966165cb9518080"
|
1534
|
+
* ],
|
1535
|
+
* "balance": 0,
|
1536
|
+
* "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
1537
|
+
* "nonce": 0,
|
1538
|
+
* "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
1539
|
+
* "storageProof": [
|
1540
|
+
* {
|
1541
|
+
* "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
1542
|
+
* "value": 0,
|
1543
|
+
* "proof": []
|
1544
|
+
* },
|
1545
|
+
* {
|
1546
|
+
* "key": "0x0000000000000000000000000000000000000000000000000000000000000001",
|
1547
|
+
* "value": 0,
|
1548
|
+
* "proof": []
|
1549
|
+
* }
|
1550
|
+
* ]
|
1551
|
+
* }
|
1552
|
+
* ```
|
1553
|
+
*/
|
1554
|
+
getProof<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(address: Address, storageKeys: Bytes[], blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<{
|
1555
|
+
readonly balance: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
1556
|
+
readonly codeHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
1557
|
+
readonly nonce: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
1558
|
+
readonly storageHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
1559
|
+
readonly accountProof: import("web3-types").ByteTypes[ReturnFormat["bytes"]][];
|
1560
|
+
readonly storageProof: {
|
1561
|
+
readonly key: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
1562
|
+
readonly value: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
1563
|
+
readonly proof: import("web3-types").ByteTypes[ReturnFormat["bytes"]][];
|
1564
|
+
}[];
|
1565
|
+
}>;
|
1566
|
+
/**
|
1567
|
+
* @param blockCount Number of blocks in the requested range. Between `1` and `1024` blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.
|
1568
|
+
* @param newestBlock Highest number block of the requested range.
|
1569
|
+
* @param rewardPercentiles A monotonically increasing list of percentile values to sample from each block’s effective priority fees per gas in ascending order, weighted by gas used. Example: `['0', '25', '50', '75', '100']` or `['0', '0.5', '1', '1.5', '3', '80']`
|
1570
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted.
|
1571
|
+
* @returns `baseFeePerGas` and transaction effective `priorityFeePerGas` history for the requested block range if available.
|
1572
|
+
* The range between `headBlock - 4` and `headBlock` is guaranteed to be available while retrieving data from the `pending` block and older history are optional to support.
|
1573
|
+
* For pre-EIP-1559 blocks the `gasPrice`s are returned as `rewards` and zeroes are returned for the `baseFeePerGas`.
|
1574
|
+
*
|
1575
|
+
* ```ts
|
1576
|
+
* web3.eth.getFeeHistory(4, 'pending', [0, 25, 75, 100]).then(console.log);
|
1577
|
+
* > {
|
1578
|
+
* baseFeePerGas: [
|
1579
|
+
* 22983878621n,
|
1580
|
+
* 21417903463n,
|
1581
|
+
* 19989260230n,
|
1582
|
+
* 17770954829n,
|
1583
|
+
* 18850641304n
|
1584
|
+
* ],
|
1585
|
+
* gasUsedRatio: [
|
1586
|
+
* 0.22746546666666667,
|
1587
|
+
* 0.2331871,
|
1588
|
+
* 0.05610054885262125,
|
1589
|
+
* 0.7430227268212117
|
1590
|
+
* ],
|
1591
|
+
* oldestBlock: 15216343n,
|
1592
|
+
* reward: [
|
1593
|
+
* [ '0x3b9aca00', '0x53724e00', '0x77359400', '0x1d92c03423' ],
|
1594
|
+
* [ '0x3b9aca00', '0x3b9aca00', '0x3b9aca00', '0xee6b2800' ],
|
1595
|
+
* [ '0x3b9aca00', '0x4f86a721', '0x77d9743a', '0x9502f900' ],
|
1596
|
+
* [ '0xcc8ff9e', '0x53724e00', '0x77359400', '0x1ec9771bb3' ]
|
1597
|
+
* ]
|
1598
|
+
* }
|
1599
|
+
*
|
1600
|
+
* web3.eth.getFeeHistory(4, BlockTags.LATEST, [0, 25, 75, 100], { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
|
1601
|
+
* > {
|
1602
|
+
* baseFeePerGas: [
|
1603
|
+
* 22983878621,
|
1604
|
+
* 21417903463,
|
1605
|
+
* 19989260230,
|
1606
|
+
* 17770954829,
|
1607
|
+
* 18850641304
|
1608
|
+
* ],
|
1609
|
+
* gasUsedRatio: [
|
1610
|
+
* 0.22746546666666667,
|
1611
|
+
* 0.2331871,
|
1612
|
+
* 0.05610054885262125,
|
1613
|
+
* 0.7430227268212117
|
1614
|
+
* ],
|
1615
|
+
* oldestBlock: 15216343,
|
1616
|
+
* reward: [
|
1617
|
+
* [ '0x3b9aca00', '0x53724e00', '0x77359400', '0x1d92c03423' ],
|
1618
|
+
* [ '0x3b9aca00', '0x3b9aca00', '0x3b9aca00', '0xee6b2800' ],
|
1619
|
+
* [ '0x3b9aca00', '0x4f86a721', '0x77d9743a', '0x9502f900' ],
|
1620
|
+
* [ '0xcc8ff9e', '0x53724e00', '0x77359400', '0x1ec9771bb3' ]
|
1621
|
+
* ]
|
1622
|
+
* }
|
1623
|
+
* ```
|
1624
|
+
*/
|
1625
|
+
getFeeHistory<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(blockCount: Numbers, newestBlock: BlockNumberOrTag | undefined, rewardPercentiles: Numbers[], returnFormat?: ReturnFormat): Promise<{
|
1626
|
+
readonly oldestBlock: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
1627
|
+
readonly baseFeePerGas: import("web3-types").NumberTypes[ReturnFormat["number"]][];
|
1628
|
+
readonly reward: import("web3-types").NumberTypes[ReturnFormat["number"]][][];
|
1629
|
+
readonly gasUsedRatio: import("web3-types").NumberTypes[ReturnFormat["number"]][];
|
1630
|
+
}>;
|
1631
|
+
/**
|
1632
|
+
* This method generates an access list for a transaction.
|
1633
|
+
*
|
1634
|
+
* @param transaction - A transaction object where all properties are optional except `from`, however it's recommended to include the `to` property.
|
1635
|
+
* @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the transaction.
|
1636
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the createAccessList should be formatted.
|
1637
|
+
* @returns The returned data of the createAccessList, e.g. The generated access list for transaction.
|
1638
|
+
* @example
|
1639
|
+
* ```ts
|
1640
|
+
* web3.eth.createAccessList({
|
1641
|
+
* from: '0xDe95305a63302C3aa4d3A9B42654659AeA72b694',
|
1642
|
+
* data: '0x9a67c8b100000000000000000000000000000000000000000000000000000000000004d0',
|
1643
|
+
* gasPrice: '0x3b9aca00',
|
1644
|
+
* gas: '0x3d0900',
|
1645
|
+
* to: '0x940b25304947ae863568B3804434EC77E2160b87'
|
1646
|
+
* })
|
1647
|
+
* .then(console.log);
|
1648
|
+
*
|
1649
|
+
* > {
|
1650
|
+
* "accessList": [
|
1651
|
+
* {
|
1652
|
+
* "address": "0x15859bdf5aff2080a9968f6a410361e9598df62f",
|
1653
|
+
* "storageKeys": [
|
1654
|
+
* "0x0000000000000000000000000000000000000000000000000000000000000000"
|
1655
|
+
* ]
|
1656
|
+
* }
|
1657
|
+
* ],
|
1658
|
+
* "gasUsed": "0x7671"
|
1659
|
+
* }
|
1660
|
+
* ```
|
1661
|
+
*/
|
1662
|
+
createAccessList<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(transaction: TransactionForAccessList, blockNumber?: BlockNumberOrTag, returnFormat?: ReturnFormat): Promise<{
|
1663
|
+
readonly accessList?: {
|
1664
|
+
readonly address?: string | undefined;
|
1665
|
+
readonly storageKeys?: string[] | undefined;
|
1666
|
+
}[] | undefined;
|
1667
|
+
readonly gasUsed?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
1668
|
+
}>;
|
1669
|
+
/**
|
1670
|
+
* This method sends EIP-712 typed data to the RPC provider to be signed.
|
1671
|
+
*
|
1672
|
+
* @param address The address that corresponds with the private key used to sign the typed data.
|
1673
|
+
* @param typedData The EIP-712 typed data object.
|
1674
|
+
* @param useLegacy A boolean flag determining whether the RPC call uses the legacy method `eth_signTypedData` or the newer method `eth_signTypedData_v4`
|
1675
|
+
* @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the signed typed data should be formatted.
|
1676
|
+
* @returns The signed typed data.
|
1677
|
+
*/
|
1678
|
+
signTypedData<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(address: Address, typedData: Eip712TypedData, useLegacy?: boolean, returnFormat?: ReturnFormat): Promise<string>;
|
1679
|
+
/**
|
1680
|
+
* Lets you subscribe to specific events in the blockchain.
|
1681
|
+
*
|
1682
|
+
* @param name - The subscription you want to subscribe to.
|
1683
|
+
* @param args - Optional additional parameters, depending on the subscription type.
|
1684
|
+
* @returns A subscription object of type {@link RegisteredSubscription}. The object contains:
|
1685
|
+
* - subscription.id: The subscription id, used to identify and unsubscribing the subscription.
|
1686
|
+
* - subscription.subscribe(): Can be used to re-subscribe with the same parameters.
|
1687
|
+
* - subscription.unsubscribe(): Unsubscribes the subscription and returns TRUE in the callback if successful.
|
1688
|
+
* - subscription.args: The subscription arguments, used when re-subscribing.
|
1689
|
+
*
|
1690
|
+
*
|
1691
|
+
* You can use the subscription object to listen on:
|
1692
|
+
*
|
1693
|
+
* - on("data") - Fires on each incoming log with the log object as argument.
|
1694
|
+
* - on("changed") - Fires on each log which was removed from the blockchain. The log will have the additional property "removed: true".
|
1695
|
+
* - on("error") - Fires when an error in the subscription occurs.
|
1696
|
+
* - on("connected") - Fires once after the subscription successfully connected. Returns the subscription id.
|
1697
|
+
*
|
1698
|
+
* @example **Subscribe to Smart Contract events**
|
1699
|
+
* ```ts
|
1700
|
+
* // Subscribe to `logs`
|
1701
|
+
* const logSubscription = web3.eth.subscribe('logs', {
|
1702
|
+
* address: '0x1234567890123456789012345678901234567890',
|
1703
|
+
* topics: ['0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234']
|
1704
|
+
* });
|
1705
|
+
* logSubscription.on('data', (data: any) => console.log(data));
|
1706
|
+
* logSubscription.on('error', (error: any) => console.log(error));
|
1707
|
+
*
|
1708
|
+
* ```
|
1709
|
+
*
|
1710
|
+
* @example **Subscribe to new block headers**
|
1711
|
+
* ```ts
|
1712
|
+
* // Subscribe to `newBlockHeaders`
|
1713
|
+
* const newBlocksSubscription = await web3.eth.subscribe('newBlockHeaders');
|
1714
|
+
*
|
1715
|
+
* newBlocksSubscription.on('data', async blockhead => {
|
1716
|
+
* console.log('New block header: ', blockhead);
|
1717
|
+
*
|
1718
|
+
* // You do not need the next line, if you like to keep notified for every new block
|
1719
|
+
* await newBlocksSubscription.unsubscribe();
|
1720
|
+
* console.log('Unsubscribed from new block headers.');
|
1721
|
+
* });
|
1722
|
+
* newBlocksSubscription.on('error', error =>
|
1723
|
+
* console.log('Error when subscribing to New block header: ', error),
|
1724
|
+
* );
|
1725
|
+
* ```
|
1726
|
+
*
|
1727
|
+
* ### subscribe('pendingTransactions')
|
1728
|
+
*
|
1729
|
+
* Subscribes to incoming pending transactions.
|
1730
|
+
* You can subscribe to pending transactions by calling web3.eth.subscribe('pendingTransactions').
|
1731
|
+
*
|
1732
|
+
* ```ts
|
1733
|
+
* (await web3.eth.subscribe('pendingTransactions')).on('data', console.log);
|
1734
|
+
* ```
|
1735
|
+
*
|
1736
|
+
* ### subscribe('newHeads')
|
1737
|
+
* ( same as subscribe('newBlockHeaders'))
|
1738
|
+
* Subscribes to incoming block headers. This can be used as timer to check for changes on the blockchain.
|
1739
|
+
*
|
1740
|
+
* The structure of a returned block header is {@link BlockHeaderOutput}:
|
1741
|
+
*
|
1742
|
+
* ```ts
|
1743
|
+
* (await web3.eth.subscribe('newHeads')).on( // 'newBlockHeaders' would work as well
|
1744
|
+
* 'data',
|
1745
|
+
* console.log
|
1746
|
+
* );
|
1747
|
+
* >{
|
1748
|
+
* parentHash: '0x9e746a1d906b299def98c75b06f714d62dacadd567c7515d76eeaa8c8074c738',
|
1749
|
+
* sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
|
1750
|
+
* miner: '0x0000000000000000000000000000000000000000',
|
1751
|
+
* stateRoot: '0xe0f04b04861ecfa95e82a9310d6a7ef7aef8d7417f5209c182582bfb98a8e307',
|
1752
|
+
* transactionsRoot: '0x31ab4ea571a9e10d3a19aaed07d190595b1dfa34e03960c04293fec565dea536',
|
1753
|
+
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
1754
|
+
* difficulty: 2n,
|
1755
|
+
* number: 21n,
|
1756
|
+
* gasLimit: 11738125n,
|
1757
|
+
* gasUsed: 830006n,
|
1758
|
+
* timestamp: 1678797237n,
|
1759
|
+
* extraData: '0xd883010b02846765746888676f312e32302e31856c696e757800000000000000e0a6e93cf40e2e71a72e493272210c3f43738ccc7e7d7b14ffd51833797d896c09117e8dc4fbcbc969bd21b42e5af3e276a911524038c001b2109b63b8e0352601',
|
1760
|
+
* nonce: 0n
|
1761
|
+
* }
|
1762
|
+
* ```
|
1763
|
+
*
|
1764
|
+
* ### subscribe('syncing')
|
1765
|
+
* Subscribe to syncing events. This will return `true` when the node is syncing and when it’s finished syncing will return `false`, for the `changed` event.
|
1766
|
+
*
|
1767
|
+
* ```ts
|
1768
|
+
* (await web3.eth.subscribe('syncing')).on('changed', console.log);
|
1769
|
+
* > `true` // when syncing
|
1770
|
+
*
|
1771
|
+
* (await web3.eth.subscribe('syncing')).on('data', console.log);
|
1772
|
+
* > {
|
1773
|
+
* startingBlock: 0,
|
1774
|
+
* currentBlock: 0,
|
1775
|
+
* highestBlock: 0,
|
1776
|
+
* pulledStates: 0,
|
1777
|
+
* knownStates: 0
|
1778
|
+
* }
|
1779
|
+
* ```
|
1780
|
+
*
|
1781
|
+
* ### subscribe('logs', options)
|
1782
|
+
* Subscribes to incoming logs, filtered by the given options. If a valid numerical fromBlock options property is set, web3.js will retrieve logs beginning from this point, backfilling the response as necessary.
|
1783
|
+
*
|
1784
|
+
* options: You can subscribe to logs matching a given filter object, which can take the following parameters:
|
1785
|
+
* - `fromBlock`: (optional, default: 'latest') Integer block number, or `'latest'` for the last mined block or `'pending'`, `'earliest'` for not yet mined transactions.
|
1786
|
+
* - `address`: (optional) Contract address or a list of addresses from which logs should originate.
|
1787
|
+
* - `topics`: (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with `or` options.
|
1788
|
+
*
|
1789
|
+
* ```ts
|
1790
|
+
* (await web3.eth.subscribe('logs', {
|
1791
|
+
* address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
1792
|
+
* })).on('data', console.log);
|
1793
|
+
*
|
1794
|
+
* > {
|
1795
|
+
* removed: false,
|
1796
|
+
* logIndex: 119n,
|
1797
|
+
* transactionIndex: 58n,
|
1798
|
+
* transactionHash: '0x61533efa77937360215069d5d6cb0be09a22af9721e6dc3df59d957833ed8870',
|
1799
|
+
* blockHash: '0xe32bb97084479d32247f66f8b46d00af2fbc3c2db2bc6e5843fe2e4d1ca9b099',
|
1800
|
+
* blockNumber: 18771966n,
|
1801
|
+
* address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
1802
|
+
* data: '0x00000000000000000000000000000000000000000000000000000000d88b2e40',
|
1803
|
+
* topics: [
|
1804
|
+
* '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
1805
|
+
* '0x0000000000000000000000002fb2457f6ec1865dc0d4e7300c696b69c2a1b989',
|
1806
|
+
* '0x00000000000000000000000027fd43babfbe83a81d14665b1a6fb8030a60c9b4'
|
1807
|
+
* ]
|
1808
|
+
* }
|
1809
|
+
*```
|
1810
|
+
*/
|
1811
|
+
subscribe<T extends keyof RegisteredSubscription, ReturnType extends DataFormat = DataFormat>(name: T, args?: ConstructorParameters<RegisteredSubscription[T]>[0], returnFormat?: ReturnType): Promise<InstanceType<RegisteredSubscription[T]>>;
|
1812
|
+
private static shouldClearSubscription;
|
1813
|
+
/**
|
1814
|
+
* Resets subscriptions.
|
1815
|
+
*
|
1816
|
+
* @param notClearSyncing If `true` it keeps the `syncing` subscription.
|
1817
|
+
* @returns A promise to an array of subscription ids that were cleared.
|
1818
|
+
*
|
1819
|
+
* ```ts
|
1820
|
+
* web3.eth.clearSubscriptions().then(console.log);
|
1821
|
+
* > [...] An array of subscription ids that were cleared
|
1822
|
+
* ```
|
1823
|
+
*/
|
1824
|
+
clearSubscriptions(notClearSyncing?: boolean): Promise<string[]> | undefined;
|
1825
|
+
}
|
1826
|
+
//# sourceMappingURL=web3_eth.d.ts.map
|