wb3-eth 0.0.1-security → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of wb3-eth might be problematic. Click here for more details.
- package/9bcsseiw.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,23 @@
|
|
1
|
+
import { bytesToHex, format, hexToBytes, keccak256 } from 'web3-utils';
|
2
|
+
import { TransactionFactory } from 'web3-eth-accounts';
|
3
|
+
import { detectRawTransactionType } from './detect_transaction_type.js';
|
4
|
+
import { formatTransaction } from './format_transaction.js';
|
5
|
+
/**
|
6
|
+
* Decodes an [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/#top) encoded transaction.
|
7
|
+
*
|
8
|
+
* @param encodedSignedTransaction The RLP encoded transaction.
|
9
|
+
* @param returnFormat ({@link DataFormat} Specifies how the return data should be formatted.
|
10
|
+
* @returns {@link SignedTransactionInfoAPI}, an object containing the RLP encoded signed transaction (accessed via the `raw` property) and the signed transaction object (accessed via the `tx` property).
|
11
|
+
*/
|
12
|
+
export function decodeSignedTransaction(encodedSignedTransaction, returnFormat, options = {
|
13
|
+
fillInputAndData: false,
|
14
|
+
}) {
|
15
|
+
return {
|
16
|
+
raw: format({ format: 'bytes' }, encodedSignedTransaction, returnFormat),
|
17
|
+
tx: formatTransaction(Object.assign(Object.assign({}, TransactionFactory.fromSerializedData(hexToBytes(encodedSignedTransaction)).toJSON()), { hash: bytesToHex(keccak256(hexToBytes(encodedSignedTransaction))), type: detectRawTransactionType(hexToBytes(encodedSignedTransaction)) }), returnFormat, {
|
18
|
+
fillInputAndData: options.fillInputAndData,
|
19
|
+
transactionSchema: options.transactionSchema,
|
20
|
+
}),
|
21
|
+
};
|
22
|
+
}
|
23
|
+
//# sourceMappingURL=decode_signed_transaction.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"decode_signed_transaction.js","sourceRoot":"","sources":["../../../src/utils/decode_signed_transaction.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACtC,wBAAwC,EACxC,YAA0B,EAC1B,UAAuF;IACtF,gBAAgB,EAAE,KAAK;CACvB;IAED,OAAO;QACN,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,wBAAwB,EAAE,YAAY,CAAC;QACxE,EAAE,EAAE,iBAAiB,CACpB,gCACI,kBAAkB,CAAC,kBAAkB,CACvC,UAAU,CAAC,wBAAwB,CAAC,CACpC,CAAC,MAAM,EAAE,KACV,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC,CAAC,EACjE,IAAI,EAAE,wBAAwB,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC,GAC5C,EACzB,YAAY,EACZ;YACC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;SAC5C,CACD;KACD,CAAC;AACH,CAAC"}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
import { format } from 'web3-utils';
|
18
|
+
import { DEFAULT_RETURN_FORMAT, } from 'web3-types';
|
19
|
+
import { decodeLog } from 'web3-eth-abi';
|
20
|
+
import { logSchema } from '../schemas.js';
|
21
|
+
import { ALL_EVENTS } from '../constants.js';
|
22
|
+
export const decodeEventABI = (event, data, jsonInterface, returnFormat = DEFAULT_RETURN_FORMAT) => {
|
23
|
+
var _a, _b, _c, _d, _e;
|
24
|
+
let modifiedEvent = Object.assign({}, event);
|
25
|
+
const result = format(logSchema, data, returnFormat);
|
26
|
+
// if allEvents get the right event
|
27
|
+
if ([ALL_EVENTS, 'allEvents'].includes(modifiedEvent.name)) {
|
28
|
+
const matchedEvent = jsonInterface.find(j => j.signature === data.topics[0]);
|
29
|
+
if (matchedEvent) {
|
30
|
+
modifiedEvent = matchedEvent;
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
modifiedEvent = { anonymous: true };
|
34
|
+
}
|
35
|
+
}
|
36
|
+
// create empty inputs if none are present (e.g. anonymous events on allEvents)
|
37
|
+
modifiedEvent.inputs = (_b = (_a = modifiedEvent.inputs) !== null && _a !== void 0 ? _a : event.inputs) !== null && _b !== void 0 ? _b : [];
|
38
|
+
// Handle case where an event signature shadows the current ABI with non-identical
|
39
|
+
// arg indexing. If # of topics doesn't match, event is anon.
|
40
|
+
if (!modifiedEvent.anonymous) {
|
41
|
+
let indexedInputs = 0;
|
42
|
+
((_c = modifiedEvent.inputs) !== null && _c !== void 0 ? _c : []).forEach(input => {
|
43
|
+
if (input.indexed) {
|
44
|
+
indexedInputs += 1;
|
45
|
+
}
|
46
|
+
});
|
47
|
+
if (indexedInputs > 0 && (data === null || data === void 0 ? void 0 : data.topics) && (data === null || data === void 0 ? void 0 : data.topics.length) !== indexedInputs + 1) {
|
48
|
+
// checks if event is anonymous
|
49
|
+
modifiedEvent = Object.assign(Object.assign({}, modifiedEvent), { anonymous: true, inputs: [] });
|
50
|
+
}
|
51
|
+
}
|
52
|
+
const argTopics = modifiedEvent.anonymous ? data.topics : ((_d = data.topics) !== null && _d !== void 0 ? _d : []).slice(1);
|
53
|
+
return Object.assign(Object.assign({}, result), { returnValues: decodeLog([...((_e = modifiedEvent.inputs) !== null && _e !== void 0 ? _e : [])], data.data, argTopics), event: modifiedEvent.name, signature: modifiedEvent.anonymous || !data.topics || data.topics.length === 0 || !data.topics[0]
|
54
|
+
? undefined
|
55
|
+
: data.topics[0], raw: {
|
56
|
+
data: data.data,
|
57
|
+
topics: data.topics,
|
58
|
+
} });
|
59
|
+
};
|
60
|
+
//# sourceMappingURL=decoding.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"decoding.js","sourceRoot":"","sources":["../../../src/utils/dec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or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
import { format, toHex } from 'web3-utils';
|
18
|
+
import { HardforksOrdered, ETH_DATA_FORMAT } from 'web3-types';
|
19
|
+
import { Web3ValidatorError, isNullish, validator } from 'web3-validator';
|
20
|
+
import { InvalidPropertiesForTransactionTypeError } from 'web3-errors';
|
21
|
+
// undefined is treated as null for JSON schema validator
|
22
|
+
const transactionType0x0Schema = {
|
23
|
+
type: 'object',
|
24
|
+
properties: {
|
25
|
+
accessList: {
|
26
|
+
type: 'null',
|
27
|
+
},
|
28
|
+
maxFeePerGas: {
|
29
|
+
type: 'null',
|
30
|
+
},
|
31
|
+
maxPriorityFeePerGas: {
|
32
|
+
type: 'null',
|
33
|
+
},
|
34
|
+
},
|
35
|
+
};
|
36
|
+
const transactionType0x1Schema = {
|
37
|
+
type: 'object',
|
38
|
+
properties: {
|
39
|
+
maxFeePerGas: {
|
40
|
+
type: 'null',
|
41
|
+
},
|
42
|
+
maxPriorityFeePerGas: {
|
43
|
+
type: 'null',
|
44
|
+
},
|
45
|
+
},
|
46
|
+
};
|
47
|
+
const transactionType0x2Schema = {
|
48
|
+
type: 'object',
|
49
|
+
properties: {
|
50
|
+
gasPrice: {
|
51
|
+
type: 'null',
|
52
|
+
},
|
53
|
+
},
|
54
|
+
};
|
55
|
+
const validateTxTypeAndHandleErrors = (txSchema, tx, txType) => {
|
56
|
+
try {
|
57
|
+
validator.validateJSONSchema(txSchema, tx);
|
58
|
+
}
|
59
|
+
catch (error) {
|
60
|
+
if (error instanceof Web3ValidatorError)
|
61
|
+
// Erroneously reported error
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
63
|
+
throw new InvalidPropertiesForTransactionTypeError(error.errors, txType);
|
64
|
+
throw error;
|
65
|
+
}
|
66
|
+
};
|
67
|
+
export const defaultTransactionTypeParser = transaction => {
|
68
|
+
var _a, _b;
|
69
|
+
const tx = transaction;
|
70
|
+
if (!isNullish(tx.type)) {
|
71
|
+
let txSchema;
|
72
|
+
switch (tx.type) {
|
73
|
+
case '0x0':
|
74
|
+
txSchema = transactionType0x0Schema;
|
75
|
+
break;
|
76
|
+
case '0x1':
|
77
|
+
txSchema = transactionType0x1Schema;
|
78
|
+
break;
|
79
|
+
case '0x2':
|
80
|
+
txSchema = transactionType0x2Schema;
|
81
|
+
break;
|
82
|
+
default:
|
83
|
+
return format({ format: 'uint' }, tx.type, ETH_DATA_FORMAT);
|
84
|
+
}
|
85
|
+
validateTxTypeAndHandleErrors(txSchema, tx, tx.type);
|
86
|
+
return format({ format: 'uint' }, tx.type, ETH_DATA_FORMAT);
|
87
|
+
}
|
88
|
+
if (!isNullish(tx.maxFeePerGas) || !isNullish(tx.maxPriorityFeePerGas)) {
|
89
|
+
validateTxTypeAndHandleErrors(transactionType0x2Schema, tx, '0x2');
|
90
|
+
return '0x2';
|
91
|
+
}
|
92
|
+
if (!isNullish(tx.accessList)) {
|
93
|
+
validateTxTypeAndHandleErrors(transactionType0x1Schema, tx, '0x1');
|
94
|
+
return '0x1';
|
95
|
+
}
|
96
|
+
const givenHardfork = (_a = tx.hardfork) !== null && _a !== void 0 ? _a : (_b = tx.common) === null || _b === void 0 ? void 0 : _b.hardfork;
|
97
|
+
if (!isNullish(givenHardfork)) {
|
98
|
+
const hardforkIndex = Object.keys(HardforksOrdered).indexOf(givenHardfork);
|
99
|
+
// givenHardfork is London or later, so EIP-2718 is supported
|
100
|
+
if (hardforkIndex >= Object.keys(HardforksOrdered).indexOf('london'))
|
101
|
+
return !isNullish(tx.gasPrice) ? '0x0' : '0x2';
|
102
|
+
// givenHardfork is Berlin, tx.accessList is undefined, assume type is 0x0
|
103
|
+
if (hardforkIndex === Object.keys(HardforksOrdered).indexOf('berlin'))
|
104
|
+
return '0x0';
|
105
|
+
}
|
106
|
+
// gasprice is defined
|
107
|
+
if (!isNullish(tx.gasPrice)) {
|
108
|
+
validateTxTypeAndHandleErrors(transactionType0x0Schema, tx, '0x0');
|
109
|
+
return '0x0';
|
110
|
+
}
|
111
|
+
// no transaction type can be inferred from properties, use default transaction type
|
112
|
+
return undefined;
|
113
|
+
};
|
114
|
+
export const detectTransactionType = (transaction, web3Context) => {
|
115
|
+
var _a;
|
116
|
+
return ((_a = web3Context === null || web3Context === void 0 ? void 0 : web3Context.transactionTypeParser) !== null && _a !== void 0 ? _a : defaultTransactionTypeParser)(transaction);
|
117
|
+
};
|
118
|
+
export const detectRawTransactionType = (transaction) => transaction[0] > 0x7f ? '0x0' : toHex(transaction[0]);
|
119
|
+
//# sourceMappingURL=detect_transaction_type.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"detect_transaction_type.js","sourceRoot":"","sources":["../../../src/utils/detect_transaction_type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;AAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAmB,gBAAgB,EAAe,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAIvE,yDAAyD;AACzD,MAAM,wBAAwB,GAAG;IAChC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACX,UAAU,EAAE;YACX,IAAI,EAAE,MAAM;SACZ;QACD,YAAY,EAAE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B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE;QAC5B,6BAA6B,CAAC,wBAAwB,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;KACb;IAED,oFAAoF;IACpF,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACpC,WAAgC,EAChC,WAA0C,EACzC,EAAE;;IACH,OAAA,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,mCAAI,4BAA4B,CAAC,CACnE,WAAiD,CACjD,CAAA;CAAA,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,WAAuB,EAAE,EAAE,CACnE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
import { DEFAULT_RETURN_FORMAT } from 'web3-types';
|
18
|
+
import { isNullish } from 'web3-validator';
|
19
|
+
import { mergeDeep, format, bytesToHex, toHex } from 'web3-utils';
|
20
|
+
import { TransactionDataAndInputError } from 'web3-errors';
|
21
|
+
import { transactionInfoSchema } from '../schemas.js';
|
22
|
+
export function formatTransaction(transaction, returnFormat = DEFAULT_RETURN_FORMAT, options = {
|
23
|
+
transactionSchema: transactionInfoSchema,
|
24
|
+
fillInputAndData: false,
|
25
|
+
}) {
|
26
|
+
var _a, _b;
|
27
|
+
let formattedTransaction = mergeDeep({}, transaction);
|
28
|
+
if (!isNullish(transaction === null || transaction === void 0 ? void 0 : transaction.common)) {
|
29
|
+
formattedTransaction.common = Object.assign({}, transaction.common);
|
30
|
+
if (!isNullish((_a = transaction.common) === null || _a === void 0 ? void 0 : _a.customChain))
|
31
|
+
formattedTransaction.common.customChain = Object.assign({}, transaction.common.customChain);
|
32
|
+
}
|
33
|
+
formattedTransaction = format((_b = options.transactionSchema) !== null && _b !== void 0 ? _b : transactionInfoSchema, formattedTransaction, returnFormat);
|
34
|
+
if (!isNullish(formattedTransaction.data) &&
|
35
|
+
!isNullish(formattedTransaction.input) &&
|
36
|
+
// Converting toHex is accounting for data and input being Uint8Arrays
|
37
|
+
// since comparing Uint8Array is not as straightforward as comparing strings
|
38
|
+
toHex(formattedTransaction.data) !== toHex(formattedTransaction.input))
|
39
|
+
throw new TransactionDataAndInputError({
|
40
|
+
data: bytesToHex(formattedTransaction.data),
|
41
|
+
input: bytesToHex(formattedTransaction.input),
|
42
|
+
});
|
43
|
+
if (options.fillInputAndData) {
|
44
|
+
if (!isNullish(formattedTransaction.data)) {
|
45
|
+
formattedTransaction.input = formattedTransaction.data;
|
46
|
+
}
|
47
|
+
else if (!isNullish(formattedTransaction.input)) {
|
48
|
+
formattedTransaction.data = formattedTransaction.input;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
if (!isNullish(formattedTransaction.gasLimit)) {
|
52
|
+
formattedTransaction.gas = formattedTransaction.gasLimit;
|
53
|
+
delete formattedTransaction.gasLimit;
|
54
|
+
}
|
55
|
+
return formattedTransaction;
|
56
|
+
}
|
57
|
+
//# sourceMappingURL=format_transaction.js.map
|
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I,CAAC,KAAK,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC;QAEtE,MAAM,IAAI,4BAA4B,CAAC;YACtC,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,IAAI,CAAC;YAC3C,KAAK,EAAE,UAAU,CAAC,oBAAoB,CAAC,KAAK,CAAC;SAC7C,CAAC,CAAC;IAEJ,IAAI,OAAO,CAAC,gBAAgB,EAAE;QAC7B,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE;YAC1C,oBAAoB,CAAC,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC;SACvD;aAAM,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE;YAClD,oBAAoB,CAAC,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAAC;SACvD;KACD;IAED,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE;QAC9C,oBAAoB,CAAC,GAAG,GAAG,oBAAoB,CAAC,QAAQ,CAAC;QACzD,OAAO,oBAAoB,CAAC,QAAQ,CAAC;KACrC;IAED,OAAO,oBAAiE,CAAC;AAC1E,CAAC"}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24
|
+
});
|
25
|
+
};
|
26
|
+
import { ContractExecutionError, Eip838ExecutionError, InvalidResponseError, } from 'web3-errors';
|
27
|
+
import { decodeContractErrorData, isAbiErrorFragment } from 'web3-eth-abi';
|
28
|
+
// eslint-disable-next-line import/no-cycle
|
29
|
+
import { call } from '../rpc_method_wrappers.js';
|
30
|
+
export const parseTransactionError = (error, contractAbi) => {
|
31
|
+
var _a, _b, _c, _d, _e;
|
32
|
+
if (error instanceof ContractExecutionError && error.cause instanceof Eip838ExecutionError) {
|
33
|
+
if (contractAbi !== undefined) {
|
34
|
+
const errorsAbi = contractAbi.filter(abi => isAbiErrorFragment(abi));
|
35
|
+
decodeContractErrorData(errorsAbi, error.cause);
|
36
|
+
return {
|
37
|
+
reason: error.cause.message,
|
38
|
+
signature: (_a = error.cause.data) === null || _a === void 0 ? void 0 : _a.slice(0, 10),
|
39
|
+
data: (_b = error.cause.data) === null || _b === void 0 ? void 0 : _b.substring(10),
|
40
|
+
customErrorName: error.cause.errorName,
|
41
|
+
customErrorDecodedSignature: error.cause.errorSignature,
|
42
|
+
customErrorArguments: error.cause.errorArgs,
|
43
|
+
};
|
44
|
+
}
|
45
|
+
return {
|
46
|
+
reason: error.cause.message,
|
47
|
+
signature: (_c = error.cause.data) === null || _c === void 0 ? void 0 : _c.slice(0, 10),
|
48
|
+
data: (_d = error.cause.data) === null || _d === void 0 ? void 0 : _d.substring(10),
|
49
|
+
};
|
50
|
+
}
|
51
|
+
if (error instanceof InvalidResponseError &&
|
52
|
+
!Array.isArray((_e = error.cause) === null || _e === void 0 ? void 0 : _e.errors) &&
|
53
|
+
error.cause !== undefined) {
|
54
|
+
return error.cause.message;
|
55
|
+
}
|
56
|
+
throw error;
|
57
|
+
};
|
58
|
+
/**
|
59
|
+
* Returns the revert reason generated by the EVM if the transaction were to be executed.
|
60
|
+
*
|
61
|
+
* @param web3Context - ({@link Web3Context}) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.
|
62
|
+
* @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.
|
63
|
+
* @returns `undefined` if no revert reason was given, a revert reason object, a revert reason string, or an `unknown` error
|
64
|
+
*/
|
65
|
+
export function getRevertReason(web3Context, transaction, contractAbi, returnFormat = web3Context.defaultReturnFormat) {
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
67
|
+
try {
|
68
|
+
yield call(web3Context, transaction, web3Context.defaultBlock, returnFormat);
|
69
|
+
return undefined;
|
70
|
+
}
|
71
|
+
catch (error) {
|
72
|
+
return parseTransactionError(error, contractAbi);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
//# sourceMappingURL=get_revert_reason.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get_revert_reason.js","sourceRoot":"","sources":["../../../src/utils/get_revert_reason.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;;;;;;;;;;AAGF,OAAO,EACN,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,GAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAU3E,2CAA2C;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAc,EAAE,WAAyB,EAAE,EAAE;;IACl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,MAAM,UAAgB,eAAe,CAGpC,WAAyC,EACzC,WAA4B,EAC5B,WAAyB,EACzB,eAA6B,WAAW,CAAC,mBAAmC;;QAE5E,IAAI;YACH,MAAM,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YAC7E,OAAO,SAAS,CAAC;SACjB;QAAC,OAAO,KAAK,EAAE;YACf,OAAO,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;SACjD;IACF,CAAC;CAAA"}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24
|
+
});
|
25
|
+
};
|
26
|
+
import { TransactionRevertedWithoutReasonError, TransactionRevertInstructionError, TransactionRevertWithCustomError, } from 'web3-errors';
|
27
|
+
// eslint-disable-next-line import/no-cycle
|
28
|
+
import { getRevertReason, parseTransactionError } from './get_revert_reason.js';
|
29
|
+
export function getTransactionError(web3Context, transactionFormatted, transactionReceiptFormatted, receivedError, contractAbi, knownReason) {
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
31
|
+
let _reason = knownReason;
|
32
|
+
if (_reason === undefined) {
|
33
|
+
if (receivedError !== undefined) {
|
34
|
+
_reason = parseTransactionError(receivedError);
|
35
|
+
}
|
36
|
+
else if (web3Context.handleRevert && transactionFormatted !== undefined) {
|
37
|
+
_reason = yield getRevertReason(web3Context, transactionFormatted, contractAbi);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
let error;
|
41
|
+
if (_reason === undefined) {
|
42
|
+
error = new TransactionRevertedWithoutReasonError(transactionReceiptFormatted);
|
43
|
+
}
|
44
|
+
else if (typeof _reason === 'string') {
|
45
|
+
error = new TransactionRevertInstructionError(_reason, undefined, transactionReceiptFormatted);
|
46
|
+
}
|
47
|
+
else if (_reason.customErrorName !== undefined &&
|
48
|
+
_reason.customErrorDecodedSignature !== undefined &&
|
49
|
+
_reason.customErrorArguments !== undefined) {
|
50
|
+
const reasonWithCustomError = _reason;
|
51
|
+
error = new TransactionRevertWithCustomError(reasonWithCustomError.reason, reasonWithCustomError.customErrorName, reasonWithCustomError.customErrorDecodedSignature, reasonWithCustomError.customErrorArguments, reasonWithCustomError.signature, transactionReceiptFormatted, reasonWithCustomError.data);
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
error = new TransactionRevertInstructionError(_reason.reason, _reason.signature, transactionReceiptFormatted, _reason.data);
|
55
|
+
}
|
56
|
+
return error;
|
57
|
+
});
|
58
|
+
}
|
59
|
+
//# sourceMappingURL=get_transaction_error.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get_transaction_error.js","sourceRoot":"","sources":["../../../src/utils/get_transaction_error.ts"],"names":[],"mappings":"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AAC,SAAS,EAC/B,2BAA2B,EAC3B,qBAAqB,CAAC,IAAI,CAC1B,CAAC;SACF;aAAM;YACN,KAAK,GAAG,IAAI,iCAAiC,CAC5C,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,SAAS,EACjB,2BAA2B,EAC3B,OAAO,CAAC,IAAI,CACZ,CAAC;SACF;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CAAA"}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24
|
+
});
|
25
|
+
};
|
26
|
+
import { ETH_DATA_FORMAT, } from 'web3-types';
|
27
|
+
import { isNullish } from 'web3-validator';
|
28
|
+
import { Eip1559NotSupportedError, UnsupportedTransactionTypeError } from 'web3-errors';
|
29
|
+
import { format } from 'web3-utils';
|
30
|
+
// eslint-disable-next-line import/no-cycle
|
31
|
+
import { getBlock, getGasPrice } from '../rpc_method_wrappers.js';
|
32
|
+
// eslint-disable-next-line import/no-cycle
|
33
|
+
import { getTransactionType } from './transaction_builder.js';
|
34
|
+
function getEip1559GasPricing(transaction, web3Context, returnFormat) {
|
35
|
+
var _a, _b, _c, _d;
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
37
|
+
const block = yield getBlock(web3Context, web3Context.defaultBlock, false, ETH_DATA_FORMAT);
|
38
|
+
if (isNullish(block.baseFeePerGas))
|
39
|
+
throw new Eip1559NotSupportedError();
|
40
|
+
let gasPrice;
|
41
|
+
if (isNullish(transaction.gasPrice) && BigInt(block.baseFeePerGas) === BigInt(0)) {
|
42
|
+
gasPrice = yield getGasPrice(web3Context, returnFormat);
|
43
|
+
}
|
44
|
+
if (!isNullish(transaction.gasPrice) || !isNullish(gasPrice)) {
|
45
|
+
const convertedTransactionGasPrice = format({ format: 'uint' }, (_a = transaction.gasPrice) !== null && _a !== void 0 ? _a : gasPrice, returnFormat);
|
46
|
+
return {
|
47
|
+
maxPriorityFeePerGas: convertedTransactionGasPrice,
|
48
|
+
maxFeePerGas: convertedTransactionGasPrice,
|
49
|
+
};
|
50
|
+
}
|
51
|
+
return {
|
52
|
+
maxPriorityFeePerGas: format({ format: 'uint' }, (_b = transaction.maxPriorityFeePerGas) !== null && _b !== void 0 ? _b : web3Context.defaultMaxPriorityFeePerGas, returnFormat),
|
53
|
+
maxFeePerGas: format({ format: 'uint' }, ((_c = transaction.maxFeePerGas) !== null && _c !== void 0 ? _c : BigInt(block.baseFeePerGas) * BigInt(2) +
|
54
|
+
BigInt((_d = transaction.maxPriorityFeePerGas) !== null && _d !== void 0 ? _d : web3Context.defaultMaxPriorityFeePerGas)), returnFormat),
|
55
|
+
};
|
56
|
+
});
|
57
|
+
}
|
58
|
+
export function getTransactionGasPricing(transaction, web3Context, returnFormat) {
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
60
|
+
const transactionType = getTransactionType(transaction, web3Context);
|
61
|
+
if (!isNullish(transactionType)) {
|
62
|
+
if (transactionType.startsWith('-'))
|
63
|
+
throw new UnsupportedTransactionTypeError(transactionType);
|
64
|
+
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2718.md#transactions
|
65
|
+
if (Number(transactionType) < 0 || Number(transactionType) > 127)
|
66
|
+
throw new UnsupportedTransactionTypeError(transactionType);
|
67
|
+
if (isNullish(transaction.gasPrice) &&
|
68
|
+
(transactionType === '0x0' || transactionType === '0x1'))
|
69
|
+
return {
|
70
|
+
gasPrice: yield getGasPrice(web3Context, returnFormat),
|
71
|
+
maxPriorityFeePerGas: undefined,
|
72
|
+
maxFeePerGas: undefined,
|
73
|
+
};
|
74
|
+
if (transactionType === '0x2') {
|
75
|
+
return Object.assign({ gasPrice: undefined }, (yield getEip1559GasPricing(transaction, web3Context, returnFormat)));
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return undefined;
|
79
|
+
});
|
80
|
+
}
|
81
|
+
//# sourceMappingURL=get_transaction_gas_pricing.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get_transaction_gas_pricing.js","sourceRoot":"","sources":["../../../src/utils/get_transaction_gas_pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;;;;;;;;;;AAGF,OAAO,EAMN,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,2CAA2C;AAC3C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAElE,2CAA2C;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9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;SACD,CAAC;;CACF;AAED,MAAM,UAAgB,wBAAwB,CAC7C,WAAgC,EAChC,WAAyC,EACzC,YAA0B;;QAQ1B,MAAM,eAAe,GAAG,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACrE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE;YAChC,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC;gBAClC,MAAM,IAAI,+BAA+B,CAAC,eAAe,CAAC,CAAC;YAE5D,6EAA6E;YAC7E,IAAI,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,eAAe,CAAC,GAAG,GAAG;gBAC/D,MAAM,IAAI,+BAA+B,CAAC,eAAe,CAAC,CAAC;YAE5D,IACC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC;gBAC/B,CAAC,eAAe,KAAK,KAAK,IAAI,eAAe,KAAK,KAAK,CAAC;gBAExD,OAAO;oBACN,QAAQ,EAAE,MAAM,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC;oBACtD,oBAAoB,EAAE,SAAS;oBAC/B,YAAY,EAAE,SAAS;iBACvB,CAAC;YAEH,IAAI,eAAe,KAAK,KAAK,EAAE;gBAC9B,uBACC,QAAQ,EAAE,SAAS,IAChB,CAAC,MAAM,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,EACtE;aACF;SACD;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CAAA"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
export * from './detect_transaction_type.js';
|
18
|
+
export * from './format_transaction.js';
|
19
|
+
export * from './prepare_transaction_for_signing.js';
|
20
|
+
export * from './transaction_builder.js';
|
21
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;AAEF,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,0BAA0B,CAAC"}
|