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,13 @@
|
|
1
|
+
import { DataFormat, HexStringBytes, SignedTransactionInfoAPI } from 'web3-types';
|
2
|
+
import { type CustomTransactionSchema } from '../types.js';
|
3
|
+
/**
|
4
|
+
* Decodes an [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/#top) encoded transaction.
|
5
|
+
*
|
6
|
+
* @param encodedSignedTransaction The RLP encoded transaction.
|
7
|
+
* @param returnFormat ({@link DataFormat} Specifies how the return data should be formatted.
|
8
|
+
* @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).
|
9
|
+
*/
|
10
|
+
export declare function decodeSignedTransaction<ReturnFormat extends DataFormat>(encodedSignedTransaction: HexStringBytes, returnFormat: ReturnFormat, options?: {
|
11
|
+
fillInputAndData?: boolean;
|
12
|
+
transactionSchema?: CustomTransactionSchema;
|
13
|
+
}): SignedTransactionInfoAPI;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.decodeSignedTransaction = void 0;
|
4
|
+
const web3_utils_1 = require("web3-utils");
|
5
|
+
const web3_eth_accounts_1 = require("web3-eth-accounts");
|
6
|
+
const detect_transaction_type_js_1 = require("./detect_transaction_type.js");
|
7
|
+
const format_transaction_js_1 = require("./format_transaction.js");
|
8
|
+
/**
|
9
|
+
* Decodes an [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/#top) encoded transaction.
|
10
|
+
*
|
11
|
+
* @param encodedSignedTransaction The RLP encoded transaction.
|
12
|
+
* @param returnFormat ({@link DataFormat} Specifies how the return data should be formatted.
|
13
|
+
* @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).
|
14
|
+
*/
|
15
|
+
function decodeSignedTransaction(encodedSignedTransaction, returnFormat, options = {
|
16
|
+
fillInputAndData: false,
|
17
|
+
}) {
|
18
|
+
return {
|
19
|
+
raw: (0, web3_utils_1.format)({ format: 'bytes' }, encodedSignedTransaction, returnFormat),
|
20
|
+
tx: (0, format_transaction_js_1.formatTransaction)(Object.assign(Object.assign({}, web3_eth_accounts_1.TransactionFactory.fromSerializedData((0, web3_utils_1.hexToBytes)(encodedSignedTransaction)).toJSON()), { hash: (0, web3_utils_1.bytesToHex)((0, web3_utils_1.keccak256)((0, web3_utils_1.hexToBytes)(encodedSignedTransaction))), type: (0, detect_transaction_type_js_1.detectRawTransactionType)((0, web3_utils_1.hexToBytes)(encodedSignedTransaction)) }), returnFormat, {
|
21
|
+
fillInputAndData: options.fillInputAndData,
|
22
|
+
transactionSchema: options.transactionSchema,
|
23
|
+
}),
|
24
|
+
};
|
25
|
+
}
|
26
|
+
exports.decodeSignedTransaction = decodeSignedTransaction;
|
27
|
+
//# 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,2CAAuE;AACvE,yDAAuD;AACvD,6EAAwE;AACxE,mEAA4D;AAG5D;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACtC,wBAAwC,EACxC,YAA0B,EAC1B,UAAuF;IACtF,gBAAgB,EAAE,KAAK;CACvB;IAED,OAAO;QACN,GAAG,EAAE,IAAA,mBAAM,EAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,wBAAwB,EAAE,YAAY,CAAC;QACxE,EAAE,EAAE,IAAA,yCAAiB,EACpB,gCACI,sCAAkB,CAAC,kBAAkB,CACvC,IAAA,uBAAU,EAAC,wBAAwB,CAAC,CACpC,CAAC,MAAM,EAAE,KACV,IAAI,EAAE,IAAA,uBAAU,EAAC,IAAA,sBAAS,EAAC,IAAA,uBAAU,EAAC,wBAAwB,CAAC,CAAC,CAAC,EACjE,IAAI,EAAE,IAAA,qDAAwB,EAAC,IAAA,uBAAU,EAAC,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;AAxBD,0DAwBC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { AbiEventFragment, LogsInput, DataFormat, EventLog, ContractAbiWithSignature } from 'web3-types';
|
2
|
+
export declare const decodeEventABI: (event: AbiEventFragment & {
|
3
|
+
signature: string;
|
4
|
+
}, data: LogsInput, jsonInterface: ContractAbiWithSignature, returnFormat?: DataFormat) => EventLog;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
This file is part of web3.js.
|
4
|
+
|
5
|
+
web3.js is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU Lesser General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
web3.js is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU Lesser General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU Lesser General Public License
|
16
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
19
|
+
exports.decodeEventABI = void 0;
|
20
|
+
const web3_utils_1 = require("web3-utils");
|
21
|
+
const web3_types_1 = require("web3-types");
|
22
|
+
const web3_eth_abi_1 = require("web3-eth-abi");
|
23
|
+
const schemas_js_1 = require("../schemas.js");
|
24
|
+
const constants_js_1 = require("../constants.js");
|
25
|
+
const decodeEventABI = (event, data, jsonInterface, returnFormat = web3_types_1.DEFAULT_RETURN_FORMAT) => {
|
26
|
+
var _a, _b, _c, _d, _e;
|
27
|
+
let modifiedEvent = Object.assign({}, event);
|
28
|
+
const result = (0, web3_utils_1.format)(schemas_js_1.logSchema, data, returnFormat);
|
29
|
+
// if allEvents get the right event
|
30
|
+
if ([constants_js_1.ALL_EVENTS, 'allEvents'].includes(modifiedEvent.name)) {
|
31
|
+
const matchedEvent = jsonInterface.find(j => j.signature === data.topics[0]);
|
32
|
+
if (matchedEvent) {
|
33
|
+
modifiedEvent = matchedEvent;
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
modifiedEvent = { anonymous: true };
|
37
|
+
}
|
38
|
+
}
|
39
|
+
// create empty inputs if none are present (e.g. anonymous events on allEvents)
|
40
|
+
modifiedEvent.inputs = (_b = (_a = modifiedEvent.inputs) !== null && _a !== void 0 ? _a : event.inputs) !== null && _b !== void 0 ? _b : [];
|
41
|
+
// Handle case where an event signature shadows the current ABI with non-identical
|
42
|
+
// arg indexing. If # of topics doesn't match, event is anon.
|
43
|
+
if (!modifiedEvent.anonymous) {
|
44
|
+
let indexedInputs = 0;
|
45
|
+
((_c = modifiedEvent.inputs) !== null && _c !== void 0 ? _c : []).forEach(input => {
|
46
|
+
if (input.indexed) {
|
47
|
+
indexedInputs += 1;
|
48
|
+
}
|
49
|
+
});
|
50
|
+
if (indexedInputs > 0 && (data === null || data === void 0 ? void 0 : data.topics) && (data === null || data === void 0 ? void 0 : data.topics.length) !== indexedInputs + 1) {
|
51
|
+
// checks if event is anonymous
|
52
|
+
modifiedEvent = Object.assign(Object.assign({}, modifiedEvent), { anonymous: true, inputs: [] });
|
53
|
+
}
|
54
|
+
}
|
55
|
+
const argTopics = modifiedEvent.anonymous ? data.topics : ((_d = data.topics) !== null && _d !== void 0 ? _d : []).slice(1);
|
56
|
+
return Object.assign(Object.assign({}, result), { returnValues: (0, web3_eth_abi_1.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]
|
57
|
+
? undefined
|
58
|
+
: data.topics[0], raw: {
|
59
|
+
data: data.data,
|
60
|
+
topics: data.topics,
|
61
|
+
} });
|
62
|
+
};
|
63
|
+
exports.decodeEventABI = decodeEventABI;
|
64
|
+
//# sourceMappingURL=decoding.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"decoding.js","sourceRoot":"","sources":["../../../src/utils/decoding.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;EAeE;;;AAEF,2CAAoC;AAEpC,2CAOoB;AAEpB,+CAAyC;AAEzC,8CAA0C;AAC1C,kDAA6C;AAEtC,MAAM,cAAc,GAAG,CAC7B,KAA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AAS,EAAE,IAAI,EACf,MAAM,EAAE,EAAE,GACV,CAAC;SACF;KACD;IAED,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEvF,uCACI,MAAM,KACT,YAAY,EAAE,IAAA,wBAAS,EAAC,CAAC,GAAG,CAAC,MAAA,aAAa,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,EAChF,KAAK,EAAE,aAAa,CAAC,IAAI,EACzB,SAAS,EACR,aAAa,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YACrF,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAElB,GAAG,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;SACnB,IACA;AACH,CAAC,CAAC;AA7DW,QAAA,cAAc,kBA6DzB"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { TransactionTypeParser, Web3Context } from 'web3-core';
|
2
|
+
import { EthExecutionAPI } from 'web3-types';
|
3
|
+
import { InternalTransaction } from '../types.js';
|
4
|
+
export declare const defaultTransactionTypeParser: TransactionTypeParser;
|
5
|
+
export declare const detectTransactionType: (transaction: InternalTransaction, web3Context?: Web3Context<EthExecutionAPI>) => string | undefined;
|
6
|
+
export declare const detectRawTransactionType: (transaction: Uint8Array) => string;
|
@@ -0,0 +1,125 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
This file is part of web3.js.
|
4
|
+
|
5
|
+
web3.js is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU Lesser General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
web3.js is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU Lesser General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU Lesser General Public License
|
16
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
19
|
+
exports.detectRawTransactionType = exports.detectTransactionType = exports.defaultTransactionTypeParser = void 0;
|
20
|
+
const web3_utils_1 = require("web3-utils");
|
21
|
+
const web3_types_1 = require("web3-types");
|
22
|
+
const web3_validator_1 = require("web3-validator");
|
23
|
+
const web3_errors_1 = require("web3-errors");
|
24
|
+
// undefined is treated as null for JSON schema validator
|
25
|
+
const transactionType0x0Schema = {
|
26
|
+
type: 'object',
|
27
|
+
properties: {
|
28
|
+
accessList: {
|
29
|
+
type: 'null',
|
30
|
+
},
|
31
|
+
maxFeePerGas: {
|
32
|
+
type: 'null',
|
33
|
+
},
|
34
|
+
maxPriorityFeePerGas: {
|
35
|
+
type: 'null',
|
36
|
+
},
|
37
|
+
},
|
38
|
+
};
|
39
|
+
const transactionType0x1Schema = {
|
40
|
+
type: 'object',
|
41
|
+
properties: {
|
42
|
+
maxFeePerGas: {
|
43
|
+
type: 'null',
|
44
|
+
},
|
45
|
+
maxPriorityFeePerGas: {
|
46
|
+
type: 'null',
|
47
|
+
},
|
48
|
+
},
|
49
|
+
};
|
50
|
+
const transactionType0x2Schema = {
|
51
|
+
type: 'object',
|
52
|
+
properties: {
|
53
|
+
gasPrice: {
|
54
|
+
type: 'null',
|
55
|
+
},
|
56
|
+
},
|
57
|
+
};
|
58
|
+
const validateTxTypeAndHandleErrors = (txSchema, tx, txType) => {
|
59
|
+
try {
|
60
|
+
web3_validator_1.validator.validateJSONSchema(txSchema, tx);
|
61
|
+
}
|
62
|
+
catch (error) {
|
63
|
+
if (error instanceof web3_validator_1.Web3ValidatorError)
|
64
|
+
// Erroneously reported error
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
66
|
+
throw new web3_errors_1.InvalidPropertiesForTransactionTypeError(error.errors, txType);
|
67
|
+
throw error;
|
68
|
+
}
|
69
|
+
};
|
70
|
+
const defaultTransactionTypeParser = transaction => {
|
71
|
+
var _a, _b;
|
72
|
+
const tx = transaction;
|
73
|
+
if (!(0, web3_validator_1.isNullish)(tx.type)) {
|
74
|
+
let txSchema;
|
75
|
+
switch (tx.type) {
|
76
|
+
case '0x0':
|
77
|
+
txSchema = transactionType0x0Schema;
|
78
|
+
break;
|
79
|
+
case '0x1':
|
80
|
+
txSchema = transactionType0x1Schema;
|
81
|
+
break;
|
82
|
+
case '0x2':
|
83
|
+
txSchema = transactionType0x2Schema;
|
84
|
+
break;
|
85
|
+
default:
|
86
|
+
return (0, web3_utils_1.format)({ format: 'uint' }, tx.type, web3_types_1.ETH_DATA_FORMAT);
|
87
|
+
}
|
88
|
+
validateTxTypeAndHandleErrors(txSchema, tx, tx.type);
|
89
|
+
return (0, web3_utils_1.format)({ format: 'uint' }, tx.type, web3_types_1.ETH_DATA_FORMAT);
|
90
|
+
}
|
91
|
+
if (!(0, web3_validator_1.isNullish)(tx.maxFeePerGas) || !(0, web3_validator_1.isNullish)(tx.maxPriorityFeePerGas)) {
|
92
|
+
validateTxTypeAndHandleErrors(transactionType0x2Schema, tx, '0x2');
|
93
|
+
return '0x2';
|
94
|
+
}
|
95
|
+
if (!(0, web3_validator_1.isNullish)(tx.accessList)) {
|
96
|
+
validateTxTypeAndHandleErrors(transactionType0x1Schema, tx, '0x1');
|
97
|
+
return '0x1';
|
98
|
+
}
|
99
|
+
const givenHardfork = (_a = tx.hardfork) !== null && _a !== void 0 ? _a : (_b = tx.common) === null || _b === void 0 ? void 0 : _b.hardfork;
|
100
|
+
if (!(0, web3_validator_1.isNullish)(givenHardfork)) {
|
101
|
+
const hardforkIndex = Object.keys(web3_types_1.HardforksOrdered).indexOf(givenHardfork);
|
102
|
+
// givenHardfork is London or later, so EIP-2718 is supported
|
103
|
+
if (hardforkIndex >= Object.keys(web3_types_1.HardforksOrdered).indexOf('london'))
|
104
|
+
return !(0, web3_validator_1.isNullish)(tx.gasPrice) ? '0x0' : '0x2';
|
105
|
+
// givenHardfork is Berlin, tx.accessList is undefined, assume type is 0x0
|
106
|
+
if (hardforkIndex === Object.keys(web3_types_1.HardforksOrdered).indexOf('berlin'))
|
107
|
+
return '0x0';
|
108
|
+
}
|
109
|
+
// gasprice is defined
|
110
|
+
if (!(0, web3_validator_1.isNullish)(tx.gasPrice)) {
|
111
|
+
validateTxTypeAndHandleErrors(transactionType0x0Schema, tx, '0x0');
|
112
|
+
return '0x0';
|
113
|
+
}
|
114
|
+
// no transaction type can be inferred from properties, use default transaction type
|
115
|
+
return undefined;
|
116
|
+
};
|
117
|
+
exports.defaultTransactionTypeParser = defaultTransactionTypeParser;
|
118
|
+
const detectTransactionType = (transaction, web3Context) => {
|
119
|
+
var _a;
|
120
|
+
return ((_a = web3Context === null || web3Context === void 0 ? void 0 : web3Context.transactionTypeParser) !== null && _a !== void 0 ? _a : exports.defaultTransactionTypeParser)(transaction);
|
121
|
+
};
|
122
|
+
exports.detectTransactionType = detectTransactionType;
|
123
|
+
const detectRawTransactionType = (transaction) => transaction[0] > 0x7f ? '0x0' : (0, web3_utils_1.toHex)(transaction[0]);
|
124
|
+
exports.detectRawTransactionType = detectRawTransactionType;
|
125
|
+
//# 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;;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,IAAA,0BAAS,EAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAEhD,0EAA0E;QAC1E,IAAI,aAAa,KAAK,MAAM,CAAC,IAAI,CAAC,6BAAgB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,OAAO,KAAK,CAAC;KACpF;IAED,sBAAsB;IACtB,IAAI,CAAC,IAAA,0BAAS,EAAC,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;AAvDW,QAAA,4BAA4B,gCAuDvC;AAEK,MAAM,qBAAqB,GAAG,CACpC,WAAgC,EAChC,WAA0C,EACzC,EAAE;;IACH,OAAA,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,mCAAI,oCAA4B,CAAC,CACnE,WAAiD,CACjD,CAAA;CAAA,CAAC;AANU,QAAA,qBAAqB,yBAM/B;AAEI,MAAM,wBAAwB,GAAG,CAAC,WAAuB,EAAE,EAAE,CACnE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,kBAAK,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAD1C,QAAA,wBAAwB,4BACkB"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Transaction, DataFormat, DEFAULT_RETURN_FORMAT, FormatType } from 'web3-types';
|
2
|
+
import { ValidationSchemaInput } from 'web3-validator';
|
3
|
+
import { type CustomTransactionSchema } from '../types.js';
|
4
|
+
export declare function formatTransaction<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT, TransactionType extends Transaction = Transaction>(transaction: TransactionType, returnFormat?: ReturnFormat, options?: {
|
5
|
+
transactionSchema?: ValidationSchemaInput | CustomTransactionSchema | undefined;
|
6
|
+
fillInputAndData?: boolean;
|
7
|
+
}): FormatType<TransactionType, ReturnFormat>;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
This file is part of web3.js.
|
4
|
+
|
5
|
+
web3.js is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU Lesser General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
web3.js is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU Lesser General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU Lesser General Public License
|
16
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
19
|
+
exports.formatTransaction = void 0;
|
20
|
+
const web3_types_1 = require("web3-types");
|
21
|
+
const web3_validator_1 = require("web3-validator");
|
22
|
+
const web3_utils_1 = require("web3-utils");
|
23
|
+
const web3_errors_1 = require("web3-errors");
|
24
|
+
const schemas_js_1 = require("../schemas.js");
|
25
|
+
function formatTransaction(transaction, returnFormat = web3_types_1.DEFAULT_RETURN_FORMAT, options = {
|
26
|
+
transactionSchema: schemas_js_1.transactionInfoSchema,
|
27
|
+
fillInputAndData: false,
|
28
|
+
}) {
|
29
|
+
var _a, _b;
|
30
|
+
let formattedTransaction = (0, web3_utils_1.mergeDeep)({}, transaction);
|
31
|
+
if (!(0, web3_validator_1.isNullish)(transaction === null || transaction === void 0 ? void 0 : transaction.common)) {
|
32
|
+
formattedTransaction.common = Object.assign({}, transaction.common);
|
33
|
+
if (!(0, web3_validator_1.isNullish)((_a = transaction.common) === null || _a === void 0 ? void 0 : _a.customChain))
|
34
|
+
formattedTransaction.common.customChain = Object.assign({}, transaction.common.customChain);
|
35
|
+
}
|
36
|
+
formattedTransaction = (0, web3_utils_1.format)((_b = options.transactionSchema) !== null && _b !== void 0 ? _b : schemas_js_1.transactionInfoSchema, formattedTransaction, returnFormat);
|
37
|
+
if (!(0, web3_validator_1.isNullish)(formattedTransaction.data) &&
|
38
|
+
!(0, web3_validator_1.isNullish)(formattedTransaction.input) &&
|
39
|
+
// Converting toHex is accounting for data and input being Uint8Arrays
|
40
|
+
// since comparing Uint8Array is not as straightforward as comparing strings
|
41
|
+
(0, web3_utils_1.toHex)(formattedTransaction.data) !== (0, web3_utils_1.toHex)(formattedTransaction.input))
|
42
|
+
throw new web3_errors_1.TransactionDataAndInputError({
|
43
|
+
data: (0, web3_utils_1.bytesToHex)(formattedTransaction.data),
|
44
|
+
input: (0, web3_utils_1.bytesToHex)(formattedTransaction.input),
|
45
|
+
});
|
46
|
+
if (options.fillInputAndData) {
|
47
|
+
if (!(0, web3_validator_1.isNullish)(formattedTransaction.data)) {
|
48
|
+
formattedTransaction.input = formattedTransaction.data;
|
49
|
+
}
|
50
|
+
else if (!(0, web3_validator_1.isNullish)(formattedTransaction.input)) {
|
51
|
+
formattedTransaction.data = formattedTransaction.input;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
if (!(0, web3_validator_1.isNullish)(formattedTransaction.gasLimit)) {
|
55
|
+
formattedTransaction.gas = formattedTransaction.gasLimit;
|
56
|
+
delete formattedTransaction.gasLimit;
|
57
|
+
}
|
58
|
+
return formattedTransaction;
|
59
|
+
}
|
60
|
+
exports.formatTransaction = formatTransaction;
|
61
|
+
//# sourceMappingURL=format_transaction.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"format_transaction.js","sourceRoot":"","sources":["../../../src/utils/format_transaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;EAeE;;;AAEF,2CAAwF;AACxF,mDAAkE;AAClE,2CAAkE;AAClE,6CAA2D;AAE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AAoB,CAAC,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC;SACvD;aAAM,IAAI,CAAC,IAAA,0BAAS,EAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE;YAClD,oBAAoB,CAAC,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAAC;SACvD;KACD;IAED,IAAI,CAAC,IAAA,0BAAS,EAAC,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;AAnDD,8CAmDC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Web3Context } from 'web3-core';
|
2
|
+
import { ContractAbi, DataFormat, DEFAULT_RETURN_FORMAT, EthExecutionAPI, TransactionCall } from 'web3-types';
|
3
|
+
import { RevertReason, RevertReasonWithCustomError } from '../types.js';
|
4
|
+
export declare const parseTransactionError: (error: unknown, contractAbi?: ContractAbi) => string | RevertReason;
|
5
|
+
/**
|
6
|
+
* Returns the revert reason generated by the EVM if the transaction were to be executed.
|
7
|
+
*
|
8
|
+
* @param web3Context - ({@link Web3Context}) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.
|
9
|
+
* @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.
|
10
|
+
* @returns `undefined` if no revert reason was given, a revert reason object, a revert reason string, or an `unknown` error
|
11
|
+
*/
|
12
|
+
export declare function getRevertReason<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(web3Context: Web3Context<EthExecutionAPI>, transaction: TransactionCall, contractAbi?: ContractAbi, returnFormat?: ReturnFormat): Promise<undefined | RevertReason | RevertReasonWithCustomError | string>;
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
This file is part of web3.js.
|
4
|
+
|
5
|
+
web3.js is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU Lesser General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
web3.js is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU Lesser General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU Lesser General Public License
|
16
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
19
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
20
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
21
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
24
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
25
|
+
});
|
26
|
+
};
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
28
|
+
exports.getRevertReason = exports.parseTransactionError = void 0;
|
29
|
+
const web3_errors_1 = require("web3-errors");
|
30
|
+
const web3_eth_abi_1 = require("web3-eth-abi");
|
31
|
+
// eslint-disable-next-line import/no-cycle
|
32
|
+
const rpc_method_wrappers_js_1 = require("../rpc_method_wrappers.js");
|
33
|
+
const parseTransactionError = (error, contractAbi) => {
|
34
|
+
var _a, _b, _c, _d, _e;
|
35
|
+
if (error instanceof web3_errors_1.ContractExecutionError && error.cause instanceof web3_errors_1.Eip838ExecutionError) {
|
36
|
+
if (contractAbi !== undefined) {
|
37
|
+
const errorsAbi = contractAbi.filter(abi => (0, web3_eth_abi_1.isAbiErrorFragment)(abi));
|
38
|
+
(0, web3_eth_abi_1.decodeContractErrorData)(errorsAbi, error.cause);
|
39
|
+
return {
|
40
|
+
reason: error.cause.message,
|
41
|
+
signature: (_a = error.cause.data) === null || _a === void 0 ? void 0 : _a.slice(0, 10),
|
42
|
+
data: (_b = error.cause.data) === null || _b === void 0 ? void 0 : _b.substring(10),
|
43
|
+
customErrorName: error.cause.errorName,
|
44
|
+
customErrorDecodedSignature: error.cause.errorSignature,
|
45
|
+
customErrorArguments: error.cause.errorArgs,
|
46
|
+
};
|
47
|
+
}
|
48
|
+
return {
|
49
|
+
reason: error.cause.message,
|
50
|
+
signature: (_c = error.cause.data) === null || _c === void 0 ? void 0 : _c.slice(0, 10),
|
51
|
+
data: (_d = error.cause.data) === null || _d === void 0 ? void 0 : _d.substring(10),
|
52
|
+
};
|
53
|
+
}
|
54
|
+
if (error instanceof web3_errors_1.InvalidResponseError &&
|
55
|
+
!Array.isArray((_e = error.cause) === null || _e === void 0 ? void 0 : _e.errors) &&
|
56
|
+
error.cause !== undefined) {
|
57
|
+
return error.cause.message;
|
58
|
+
}
|
59
|
+
throw error;
|
60
|
+
};
|
61
|
+
exports.parseTransactionError = parseTransactionError;
|
62
|
+
/**
|
63
|
+
* Returns the revert reason generated by the EVM if the transaction were to be executed.
|
64
|
+
*
|
65
|
+
* @param web3Context - ({@link Web3Context}) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.
|
66
|
+
* @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.
|
67
|
+
* @returns `undefined` if no revert reason was given, a revert reason object, a revert reason string, or an `unknown` error
|
68
|
+
*/
|
69
|
+
function getRevertReason(web3Context, transaction, contractAbi, returnFormat = web3Context.defaultReturnFormat) {
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
71
|
+
try {
|
72
|
+
yield (0, rpc_method_wrappers_js_1.call)(web3Context, transaction, web3Context.defaultBlock, returnFormat);
|
73
|
+
return undefined;
|
74
|
+
}
|
75
|
+
catch (error) {
|
76
|
+
return (0, exports.parseTransactionError)(error, contractAbi);
|
77
|
+
}
|
78
|
+
});
|
79
|
+
}
|
80
|
+
exports.getRevertReason = getRevertReason;
|
81
|
+
//# 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,6CAKqB;AACrB,+CAA2E;AAU3E,2CAA2C;AAC3C,sEAAiD;AAG1C,MAAM,qBAAqB,GAAG,CAAC,KAAc,EAAE,WAAyB,EAAE,EAAE;;IAClF,IAAI,KAAK,YAAY,oCAAsB,IAAI,KAAK,CAAC,KAAK,YAAY,kCAAoB,EAAE;QAC3F,IAAI,WAAW,KAAK,SAAS,EAAE;YAC9B,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAC1C,IAAA,iCAAkB,EAAC,GAAG,CAAC,CACU,CAAC;YACnC,IAAA,sCAAuB,EAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAEhD,OAAO;gBACN,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;gBAC3B,SAAS,EAAE,MAAA,KAAK,CAAC,KAAK,CAAC,IAAI,0CAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;gBACzC,IAAI,EAAE,MAAA,KAAK,CAAC,KAAK,CAAC,IAAI,0CAAE,SAAS,CAAC,EAAE,CAAC;gBACrC,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;gBACtC,2BAA2B,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc;gBACvD,oBAAoB,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;aACZ,CAAC;SACjC;QAED,OAAO;YACN,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;YAC3B,SAAS,EAAE,MAAA,KAAK,CAAC,KAAK,CAAC,IAAI,0CAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,EAAE,MAAA,KAAK,CAAC,KAAK,CAAC,IAAI,0CAAE,SAAS,CAAC,EAAE,CAAC;SACrB,CAAC;KAClB;IAED,IACC,KAAK,YAAY,kCAAoB;QACrC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAC,KAAK,CAAC,KAAwB,0CAAE,MAAM,CAAC;QACvD,KAAK,CAAC,KAAK,KAAK,SAAS,EACxB;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;KAC3B;IAED,MAAM,KAAK,CAAC;AACb,CAAC,CAAC;AAlCW,QAAA,qBAAqB,yBAkChC;AAEF;;;;;;GAMG;AACH,SAAsB,eAAe,CAGpC,WAAyC,EACzC,WAA4B,EAC5B,WAAyB,EACzB,eAA6B,WAAW,CAAC,mBAAmC;;QAE5E,IAAI;YACH,MAAM,IAAA,6BAAI,EAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YAC7E,OAAO,SAAS,CAAC;SACjB;QAAC,OAAO,KAAK,EAAE;YACf,OAAO,IAAA,6BAAqB,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC;SACjD;IACF,CAAC;CAAA;AAdD,0CAcC"}
|
@@ -0,0 +1,152 @@
|
|
1
|
+
import { Web3Context } from 'web3-core';
|
2
|
+
import { TransactionRevertedWithoutReasonError, TransactionRevertInstructionError, TransactionRevertWithCustomError } from 'web3-errors';
|
3
|
+
import { DataFormat, FormatType, ContractAbi, TransactionCall, TransactionReceipt } from 'web3-types';
|
4
|
+
import { RevertReason, RevertReasonWithCustomError } from '../types.js';
|
5
|
+
export declare function getTransactionError<ReturnFormat extends DataFormat>(web3Context: Web3Context, transactionFormatted?: TransactionCall, transactionReceiptFormatted?: FormatType<TransactionReceipt, ReturnFormat>, receivedError?: unknown, contractAbi?: ContractAbi, knownReason?: string | RevertReason | RevertReasonWithCustomError): Promise<TransactionRevertedWithoutReasonError<{
|
6
|
+
readonly transactionHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
7
|
+
readonly transactionIndex: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
8
|
+
readonly blockHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
9
|
+
readonly blockNumber: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
10
|
+
readonly from: string;
|
11
|
+
readonly to: string;
|
12
|
+
readonly cumulativeGasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
13
|
+
readonly gasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
14
|
+
readonly effectiveGasPrice?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
15
|
+
readonly contractAddress?: string | undefined;
|
16
|
+
readonly logs: {
|
17
|
+
readonly id?: string | undefined;
|
18
|
+
readonly removed?: boolean | undefined;
|
19
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
20
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
21
|
+
readonly transactionHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
22
|
+
readonly blockHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
23
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
24
|
+
readonly address?: string | undefined;
|
25
|
+
readonly data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
26
|
+
readonly topics?: import("web3-types").ByteTypes[ReturnFormat["bytes"]][] | undefined;
|
27
|
+
}[];
|
28
|
+
readonly logsBloom: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
29
|
+
readonly root: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
30
|
+
readonly status: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
31
|
+
readonly type?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
32
|
+
events?: {
|
33
|
+
[x: string]: {
|
34
|
+
readonly event: string;
|
35
|
+
readonly id?: string | undefined;
|
36
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
37
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
38
|
+
readonly transactionHash?: string | undefined;
|
39
|
+
readonly blockHash?: string | undefined;
|
40
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
41
|
+
readonly address: string;
|
42
|
+
readonly topics: string[];
|
43
|
+
readonly data: string;
|
44
|
+
readonly raw?: {
|
45
|
+
data: string;
|
46
|
+
topics: unknown[];
|
47
|
+
} | undefined;
|
48
|
+
readonly returnValues: {
|
49
|
+
[x: string]: unknown;
|
50
|
+
};
|
51
|
+
readonly signature?: string | undefined;
|
52
|
+
};
|
53
|
+
} | undefined;
|
54
|
+
}> | TransactionRevertInstructionError<{
|
55
|
+
readonly transactionHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
56
|
+
readonly transactionIndex: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
57
|
+
readonly blockHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
58
|
+
readonly blockNumber: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
59
|
+
readonly from: string;
|
60
|
+
readonly to: string;
|
61
|
+
readonly cumulativeGasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
62
|
+
readonly gasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
63
|
+
readonly effectiveGasPrice?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
64
|
+
readonly contractAddress?: string | undefined;
|
65
|
+
readonly logs: {
|
66
|
+
readonly id?: string | undefined;
|
67
|
+
readonly removed?: boolean | undefined;
|
68
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
69
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
70
|
+
readonly transactionHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
71
|
+
readonly blockHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
72
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
73
|
+
readonly address?: string | undefined;
|
74
|
+
readonly data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
75
|
+
readonly topics?: import("web3-types").ByteTypes[ReturnFormat["bytes"]][] | undefined;
|
76
|
+
}[];
|
77
|
+
readonly logsBloom: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
78
|
+
readonly root: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
79
|
+
readonly status: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
80
|
+
readonly type?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
81
|
+
events?: {
|
82
|
+
[x: string]: {
|
83
|
+
readonly event: string;
|
84
|
+
readonly id?: string | undefined;
|
85
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
86
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
87
|
+
readonly transactionHash?: string | undefined;
|
88
|
+
readonly blockHash?: string | undefined;
|
89
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
90
|
+
readonly address: string;
|
91
|
+
readonly topics: string[];
|
92
|
+
readonly data: string;
|
93
|
+
readonly raw?: {
|
94
|
+
data: string;
|
95
|
+
topics: unknown[];
|
96
|
+
} | undefined;
|
97
|
+
readonly returnValues: {
|
98
|
+
[x: string]: unknown;
|
99
|
+
};
|
100
|
+
readonly signature?: string | undefined;
|
101
|
+
};
|
102
|
+
} | undefined;
|
103
|
+
}> | TransactionRevertWithCustomError<{
|
104
|
+
readonly transactionHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
105
|
+
readonly transactionIndex: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
106
|
+
readonly blockHash: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
107
|
+
readonly blockNumber: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
108
|
+
readonly from: string;
|
109
|
+
readonly to: string;
|
110
|
+
readonly cumulativeGasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
111
|
+
readonly gasUsed: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
112
|
+
readonly effectiveGasPrice?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
113
|
+
readonly contractAddress?: string | undefined;
|
114
|
+
readonly logs: {
|
115
|
+
readonly id?: string | undefined;
|
116
|
+
readonly removed?: boolean | undefined;
|
117
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
118
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
119
|
+
readonly transactionHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
120
|
+
readonly blockHash?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
121
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
122
|
+
readonly address?: string | undefined;
|
123
|
+
readonly data?: import("web3-types").ByteTypes[ReturnFormat["bytes"]] | undefined;
|
124
|
+
readonly topics?: import("web3-types").ByteTypes[ReturnFormat["bytes"]][] | undefined;
|
125
|
+
}[];
|
126
|
+
readonly logsBloom: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
127
|
+
readonly root: import("web3-types").ByteTypes[ReturnFormat["bytes"]];
|
128
|
+
readonly status: import("web3-types").NumberTypes[ReturnFormat["number"]];
|
129
|
+
readonly type?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
130
|
+
events?: {
|
131
|
+
[x: string]: {
|
132
|
+
readonly event: string;
|
133
|
+
readonly id?: string | undefined;
|
134
|
+
readonly logIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
135
|
+
readonly transactionIndex?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
136
|
+
readonly transactionHash?: string | undefined;
|
137
|
+
readonly blockHash?: string | undefined;
|
138
|
+
readonly blockNumber?: import("web3-types").NumberTypes[ReturnFormat["number"]] | undefined;
|
139
|
+
readonly address: string;
|
140
|
+
readonly topics: string[];
|
141
|
+
readonly data: string;
|
142
|
+
readonly raw?: {
|
143
|
+
data: string;
|
144
|
+
topics: unknown[];
|
145
|
+
} | undefined;
|
146
|
+
readonly returnValues: {
|
147
|
+
[x: string]: unknown;
|
148
|
+
};
|
149
|
+
readonly signature?: string | undefined;
|
150
|
+
};
|
151
|
+
} | undefined;
|
152
|
+
}>>;
|