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,86 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.watchTransactionBySubscription = void 0;
|
13
|
+
const web3_utils_1 = require("web3-utils");
|
14
|
+
const schemas_js_1 = require("../schemas.js");
|
15
|
+
const watch_transaction_by_polling_js_1 = require("./watch_transaction_by_polling.js");
|
16
|
+
/**
|
17
|
+
* This function watches a Transaction by subscribing to new heads.
|
18
|
+
* It is used by `watchTransactionForConfirmations`, in case the provider supports subscription.
|
19
|
+
*/
|
20
|
+
const watchTransactionBySubscription = ({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }) => {
|
21
|
+
// The following variable will stay true except if the data arrived,
|
22
|
+
// or if watching started after an error had occurred.
|
23
|
+
let needToWatchLater = true;
|
24
|
+
let lastCaughtBlockHash;
|
25
|
+
setImmediate(() => {
|
26
|
+
var _a;
|
27
|
+
(_a = web3Context.subscriptionManager) === null || _a === void 0 ? void 0 : _a.subscribe('newHeads').then((subscription) => {
|
28
|
+
subscription.on('data', (newBlockHeader) => __awaiter(void 0, void 0, void 0, function* () {
|
29
|
+
var _a;
|
30
|
+
needToWatchLater = false;
|
31
|
+
if (!(newBlockHeader === null || newBlockHeader === void 0 ? void 0 : newBlockHeader.number) ||
|
32
|
+
// For some cases, the on-data event is fired couple times for the same block!
|
33
|
+
// This needs investigation but seems to be because of multiple `subscription.on('data'...)` even this should not cause that.
|
34
|
+
lastCaughtBlockHash === (newBlockHeader === null || newBlockHeader === void 0 ? void 0 : newBlockHeader.parentHash)) {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
lastCaughtBlockHash = newBlockHeader === null || newBlockHeader === void 0 ? void 0 : newBlockHeader.parentHash;
|
38
|
+
const confirmations = BigInt(newBlockHeader.number) -
|
39
|
+
BigInt(transactionReceipt.blockNumber) +
|
40
|
+
BigInt(1);
|
41
|
+
transactionPromiEvent.emit('confirmation', {
|
42
|
+
confirmations: (0, web3_utils_1.format)({ format: 'uint' }, confirmations, returnFormat),
|
43
|
+
receipt: (0, web3_utils_1.format)(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat),
|
44
|
+
latestBlockHash: (0, web3_utils_1.format)({ format: 'bytes32' }, newBlockHeader.parentHash, returnFormat),
|
45
|
+
});
|
46
|
+
if (confirmations >= web3Context.transactionConfirmationBlocks) {
|
47
|
+
yield ((_a = web3Context.subscriptionManager) === null || _a === void 0 ? void 0 : _a.removeSubscription(subscription));
|
48
|
+
}
|
49
|
+
}));
|
50
|
+
subscription.on('error', () => __awaiter(void 0, void 0, void 0, function* () {
|
51
|
+
var _b;
|
52
|
+
yield ((_b = web3Context.subscriptionManager) === null || _b === void 0 ? void 0 : _b.removeSubscription(subscription));
|
53
|
+
needToWatchLater = false;
|
54
|
+
(0, watch_transaction_by_polling_js_1.watchTransactionByPolling)({
|
55
|
+
web3Context,
|
56
|
+
transactionReceipt,
|
57
|
+
transactionPromiEvent,
|
58
|
+
customTransactionReceiptSchema,
|
59
|
+
returnFormat,
|
60
|
+
});
|
61
|
+
}));
|
62
|
+
}).catch(() => {
|
63
|
+
needToWatchLater = false;
|
64
|
+
(0, watch_transaction_by_polling_js_1.watchTransactionByPolling)({
|
65
|
+
web3Context,
|
66
|
+
transactionReceipt,
|
67
|
+
customTransactionReceiptSchema,
|
68
|
+
transactionPromiEvent,
|
69
|
+
returnFormat,
|
70
|
+
});
|
71
|
+
});
|
72
|
+
});
|
73
|
+
// Fallback to polling if tx receipt didn't arrived in "blockHeaderTimeout" [10 seconds]
|
74
|
+
setTimeout(() => {
|
75
|
+
if (needToWatchLater) {
|
76
|
+
(0, watch_transaction_by_polling_js_1.watchTransactionByPolling)({
|
77
|
+
web3Context,
|
78
|
+
transactionReceipt,
|
79
|
+
transactionPromiEvent,
|
80
|
+
returnFormat,
|
81
|
+
});
|
82
|
+
}
|
83
|
+
}, web3Context.blockHeaderTimeout * 1000);
|
84
|
+
};
|
85
|
+
exports.watchTransactionBySubscription = watchTransactionBySubscription;
|
86
|
+
//# sourceMappingURL=watch_transaction_by_subscription.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"watch_transaction_by_subscription.js","sourceRoot":"","sources":["../../../src/utils/watch_transaction_by_subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,2CAAoC;AAIpC,8CAAyD;AACzD,uFAAyF;AACzF;;;GAGG;AACI,MAAM,8BAA8B,GAAG,CAG5C,EACD,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,8BAA8B,EAC9B,YAAY,GAC0B,EAAE,EAAE;IAC1C,oEAAoE;IACpE,sDAAsD;IACtD,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAC5B,IAAI,mBAA2B,CAAC;IAChC,YAAY,CAAC,GAAG,EAAE;;QACjB,MAAA,WAAW,CAAC,mBAAmB,0CAC5B,SAAS,CAAC,UAAU,EACrB,IAAI,CAAC,CAAC,YAAkC,EAAE,EAAE;YAC5C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAO,cAAiC,EAAE,EAAE;;gBACnE,gBAAgB,GAAG,KAAK,CAAC;gBACzB,IACC,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAA;oBACvB,8EAA8E;oBAC9E,6HAA6H;oBAC7H,mBAAmB,MAAK,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,CAAA,EACjD;oBACD,OAAO;iBACP;gBACD,mBAAmB,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAoB,CAAC;gBAE3D,MAAM,aAAa,GAClB,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC;oBAC7B,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC;oBACtC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAEX,qBAAqB,CAAC,IAAI,CAAC,cAAc,EAAE;oBAC1C,aAAa,EAAE,IAAA,mBAAM,EACpB,EAAE,MAAM,EAA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AAE,WAAW,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC,CAAC;AA5FW,QAAA,8BAA8B,kCA4FzC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Bytes, EthExecutionAPI, TransactionReceipt } from 'web3-types';
|
2
|
+
import { Web3Context, Web3PromiEvent } from 'web3-core';
|
3
|
+
import { JsonSchema } from 'web3-validator';
|
4
|
+
import { DataFormat } from 'web3-types';
|
5
|
+
import { Web3PromiEventEventTypeBase } from './watch_transaction_by_polling.js';
|
6
|
+
export declare function watchTransactionForConfirmations<ReturnFormat extends DataFormat, Web3PromiEventEventType extends Web3PromiEventEventTypeBase<ReturnFormat>, ResolveType = TransactionReceipt>(web3Context: Web3Context<EthExecutionAPI>, transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventType>, transactionReceipt: TransactionReceipt, transactionHash: Bytes, returnFormat: ReturnFormat, customTransactionReceiptSchema?: JsonSchema): void;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.watchTransactionForConfirmations = void 0;
|
4
|
+
const web3_utils_1 = require("web3-utils");
|
5
|
+
const web3_validator_1 = require("web3-validator");
|
6
|
+
const web3_errors_1 = require("web3-errors");
|
7
|
+
const schemas_js_1 = require("../schemas.js");
|
8
|
+
const watch_transaction_by_polling_js_1 = require("./watch_transaction_by_polling.js");
|
9
|
+
const watch_transaction_by_subscription_js_1 = require("./watch_transaction_by_subscription.js");
|
10
|
+
function watchTransactionForConfirmations(web3Context, transactionPromiEvent, transactionReceipt, transactionHash, returnFormat, customTransactionReceiptSchema) {
|
11
|
+
if ((0, web3_validator_1.isNullish)(transactionReceipt) || (0, web3_validator_1.isNullish)(transactionReceipt.blockHash))
|
12
|
+
throw new web3_errors_1.TransactionMissingReceiptOrBlockHashError({
|
13
|
+
receipt: transactionReceipt,
|
14
|
+
blockHash: (0, web3_utils_1.format)({ format: 'bytes32' }, transactionReceipt === null || transactionReceipt === void 0 ? void 0 : transactionReceipt.blockHash, returnFormat),
|
15
|
+
transactionHash: (0, web3_utils_1.format)({ format: 'bytes32' }, transactionHash, returnFormat),
|
16
|
+
});
|
17
|
+
if (!transactionReceipt.blockNumber)
|
18
|
+
throw new web3_errors_1.TransactionReceiptMissingBlockNumberError({ receipt: transactionReceipt });
|
19
|
+
// As we have the receipt, it's the first confirmation that tx is accepted.
|
20
|
+
transactionPromiEvent.emit('confirmation', {
|
21
|
+
confirmations: (0, web3_utils_1.format)({ format: 'uint' }, 1, returnFormat),
|
22
|
+
receipt: (0, web3_utils_1.format)(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat),
|
23
|
+
latestBlockHash: (0, web3_utils_1.format)({ format: 'bytes32' }, transactionReceipt.blockHash, returnFormat),
|
24
|
+
});
|
25
|
+
// so a subscription for newBlockHeaders can be made instead of polling
|
26
|
+
const provider = web3Context.requestManager.provider;
|
27
|
+
if (provider && 'supportsSubscriptions' in provider && provider.supportsSubscriptions()) {
|
28
|
+
(0, watch_transaction_by_subscription_js_1.watchTransactionBySubscription)({
|
29
|
+
web3Context,
|
30
|
+
transactionReceipt,
|
31
|
+
transactionPromiEvent,
|
32
|
+
customTransactionReceiptSchema,
|
33
|
+
returnFormat,
|
34
|
+
});
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
(0, watch_transaction_by_polling_js_1.watchTransactionByPolling)({
|
38
|
+
web3Context,
|
39
|
+
transactionReceipt,
|
40
|
+
transactionPromiEvent,
|
41
|
+
customTransactionReceiptSchema,
|
42
|
+
returnFormat,
|
43
|
+
});
|
44
|
+
}
|
45
|
+
}
|
46
|
+
exports.watchTransactionForConfirmations = watchTransactionForConfirmations;
|
47
|
+
//# sourceMappingURL=watch_transaction_for_confirmations.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"watch_transa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,uEAAuE;IACvE,MAAM,QAAQ,GAAqB,WAAW,CAAC,cAAc,CAAC,QAA4B,CAAC;IAC3F,IAAI,QAAQ,IAAI,uBAAuB,IAAI,QAAQ,IAAI,QAAQ,CAAC,qBAAqB,EAAE,EAAE;QACxF,IAAA,qEAA8B,EAAC;YAC9B,WAAW;YACX,kBAAkB;YAClB,qBAAqB;YACrB,8BAA8B;YAC9B,YAAY;SACZ,CAAC,CAAC;KACH;SAAM;QACN,IAAA,2DAAyB,EAAC;YACzB,WAAW;YACX,kBAAkB;YAClB,qBAAqB;YACrB,8BAA8B;YAC9B,YAAY;SACZ,CAAC,CAAC;KACH;AACF,CAAC;AApDD,4EAoDC"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { AccessList, AccessListEntry, BaseTransactionAPI, Transaction1559UnsignedAPI, Transaction2930UnsignedAPI, TransactionCall, TransactionLegacyUnsignedAPI, TransactionWithSenderAPI } from 'web3-types';
|
2
|
+
import { CustomTransactionSchema, InternalTransaction } from './types.js';
|
3
|
+
export declare function isBaseTransaction(value: BaseTransactionAPI): boolean;
|
4
|
+
export declare function isAccessListEntry(value: AccessListEntry): boolean;
|
5
|
+
export declare function isAccessList(value: AccessList): boolean;
|
6
|
+
export declare function isTransaction1559Unsigned(value: Transaction1559UnsignedAPI): boolean;
|
7
|
+
export declare function isTransaction2930Unsigned(value: Transaction2930UnsignedAPI): boolean;
|
8
|
+
export declare function isTransactionLegacyUnsigned(value: TransactionLegacyUnsignedAPI): boolean;
|
9
|
+
export declare function isTransactionWithSender(value: TransactionWithSenderAPI): boolean;
|
10
|
+
export declare function validateTransactionWithSender(value: TransactionWithSenderAPI): void;
|
11
|
+
export declare function isTransactionCall(value: TransactionCall): boolean;
|
12
|
+
export declare function validateTransactionCall(value: TransactionCall): void;
|
13
|
+
export declare const validateCustomChainInfo: (transaction: InternalTransaction) => void;
|
14
|
+
export declare const validateChainInfo: (transaction: InternalTransaction) => void;
|
15
|
+
export declare const validateBaseChain: (transaction: InternalTransaction) => void;
|
16
|
+
export declare const validateHardfork: (transaction: InternalTransaction) => void;
|
17
|
+
export declare const validateLegacyGas: (transaction: InternalTransaction) => void;
|
18
|
+
export declare const validateFeeMarketGas: (transaction: InternalTransaction) => void;
|
19
|
+
/**
|
20
|
+
* This method checks if all required gas properties are present for either
|
21
|
+
* legacy gas (type 0x0 and 0x1) OR fee market transactions (0x2)
|
22
|
+
*/
|
23
|
+
export declare const validateGas: (transaction: InternalTransaction) => void;
|
24
|
+
export declare const validateTransactionForSigning: (transaction: InternalTransaction, overrideMethod?: ((transaction: InternalTransaction) => void) | undefined, options?: {
|
25
|
+
transactionSchema?: CustomTransactionSchema;
|
26
|
+
}) => void;
|
@@ -0,0 +1,281 @@
|
|
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.validateTransactionForSigning = exports.validateGas = exports.validateFeeMarketGas = exports.validateLegacyGas = exports.validateHardfork = exports.validateBaseChain = exports.validateChainInfo = exports.validateCustomChainInfo = exports.validateTransactionCall = exports.isTransactionCall = exports.validateTransactionWithSender = exports.isTransactionWithSender = exports.isTransactionLegacyUnsigned = exports.isTransaction2930Unsigned = exports.isTransaction1559Unsigned = exports.isAccessList = exports.isAccessListEntry = exports.isBaseTransaction = void 0;
|
20
|
+
const web3_types_1 = require("web3-types");
|
21
|
+
const web3_validator_1 = require("web3-validator");
|
22
|
+
const web3_errors_1 = require("web3-errors");
|
23
|
+
const format_transaction_js_1 = require("./utils/format_transaction.js");
|
24
|
+
function isBaseTransaction(value) {
|
25
|
+
if (!(0, web3_validator_1.isNullish)(value.to) && !(0, web3_validator_1.isAddress)(value.to))
|
26
|
+
return false;
|
27
|
+
if (!(0, web3_validator_1.isHexStrict)(value.type) && !(0, web3_validator_1.isNullish)(value.type) && value.type.length !== 2)
|
28
|
+
return false;
|
29
|
+
if (!(0, web3_validator_1.isHexStrict)(value.nonce))
|
30
|
+
return false;
|
31
|
+
if (!(0, web3_validator_1.isHexStrict)(value.gas))
|
32
|
+
return false;
|
33
|
+
if (!(0, web3_validator_1.isHexStrict)(value.value))
|
34
|
+
return false;
|
35
|
+
if (!(0, web3_validator_1.isHexStrict)(value.input))
|
36
|
+
return false;
|
37
|
+
if (value.chainId && !(0, web3_validator_1.isHexStrict)(value.chainId))
|
38
|
+
return false;
|
39
|
+
return true;
|
40
|
+
}
|
41
|
+
exports.isBaseTransaction = isBaseTransaction;
|
42
|
+
function isAccessListEntry(value) {
|
43
|
+
if (!(0, web3_validator_1.isNullish)(value.address) && !(0, web3_validator_1.isAddress)(value.address))
|
44
|
+
return false;
|
45
|
+
if (!(0, web3_validator_1.isNullish)(value.storageKeys) &&
|
46
|
+
!value.storageKeys.every(storageKey => (0, web3_validator_1.isHexString32Bytes)(storageKey)))
|
47
|
+
return false;
|
48
|
+
return true;
|
49
|
+
}
|
50
|
+
exports.isAccessListEntry = isAccessListEntry;
|
51
|
+
function isAccessList(value) {
|
52
|
+
if (!Array.isArray(value) ||
|
53
|
+
!value.every(accessListEntry => isAccessListEntry(accessListEntry)))
|
54
|
+
return false;
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
exports.isAccessList = isAccessList;
|
58
|
+
function isTransaction1559Unsigned(value) {
|
59
|
+
if (!isBaseTransaction(value))
|
60
|
+
return false;
|
61
|
+
if (!(0, web3_validator_1.isHexStrict)(value.maxFeePerGas))
|
62
|
+
return false;
|
63
|
+
if (!(0, web3_validator_1.isHexStrict)(value.maxPriorityFeePerGas))
|
64
|
+
return false;
|
65
|
+
if (!isAccessList(value.accessList))
|
66
|
+
return false;
|
67
|
+
return true;
|
68
|
+
}
|
69
|
+
exports.isTransaction1559Unsigned = isTransaction1559Unsigned;
|
70
|
+
function isTransaction2930Unsigned(value) {
|
71
|
+
if (!isBaseTransaction(value))
|
72
|
+
return false;
|
73
|
+
if (!(0, web3_validator_1.isHexStrict)(value.gasPrice))
|
74
|
+
return false;
|
75
|
+
if (!isAccessList(value.accessList))
|
76
|
+
return false;
|
77
|
+
return true;
|
78
|
+
}
|
79
|
+
exports.isTransaction2930Unsigned = isTransaction2930Unsigned;
|
80
|
+
function isTransactionLegacyUnsigned(value) {
|
81
|
+
if (!isBaseTransaction(value))
|
82
|
+
return false;
|
83
|
+
if (!(0, web3_validator_1.isHexStrict)(value.gasPrice))
|
84
|
+
return false;
|
85
|
+
return true;
|
86
|
+
}
|
87
|
+
exports.isTransactionLegacyUnsigned = isTransactionLegacyUnsigned;
|
88
|
+
function isTransactionWithSender(value) {
|
89
|
+
if (!(0, web3_validator_1.isAddress)(value.from))
|
90
|
+
return false;
|
91
|
+
if (!isBaseTransaction(value))
|
92
|
+
return false;
|
93
|
+
if (!isTransaction1559Unsigned(value) &&
|
94
|
+
!isTransaction2930Unsigned(value) &&
|
95
|
+
!isTransactionLegacyUnsigned(value))
|
96
|
+
return false;
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
exports.isTransactionWithSender = isTransactionWithSender;
|
100
|
+
function validateTransactionWithSender(value) {
|
101
|
+
if (!isTransactionWithSender(value))
|
102
|
+
throw new web3_errors_1.InvalidTransactionWithSender(value);
|
103
|
+
}
|
104
|
+
exports.validateTransactionWithSender = validateTransactionWithSender;
|
105
|
+
function isTransactionCall(value) {
|
106
|
+
if (!(0, web3_validator_1.isNullish)(value.from) && !(0, web3_validator_1.isAddress)(value.from))
|
107
|
+
return false;
|
108
|
+
if (!(0, web3_validator_1.isAddress)(value.to))
|
109
|
+
return false;
|
110
|
+
if (!(0, web3_validator_1.isNullish)(value.gas) && !(0, web3_validator_1.isHexStrict)(value.gas))
|
111
|
+
return false;
|
112
|
+
if (!(0, web3_validator_1.isNullish)(value.gasPrice) && !(0, web3_validator_1.isHexStrict)(value.gasPrice))
|
113
|
+
return false;
|
114
|
+
if (!(0, web3_validator_1.isNullish)(value.value) && !(0, web3_validator_1.isHexStrict)(value.value))
|
115
|
+
return false;
|
116
|
+
if (!(0, web3_validator_1.isNullish)(value.data) && !(0, web3_validator_1.isHexStrict)(value.data))
|
117
|
+
return false;
|
118
|
+
if (!(0, web3_validator_1.isNullish)(value.input) && !(0, web3_validator_1.isHexStrict)(value.input))
|
119
|
+
return false;
|
120
|
+
if (!(0, web3_validator_1.isNullish)(value.type))
|
121
|
+
return false;
|
122
|
+
if (isTransaction1559Unsigned(value))
|
123
|
+
return false;
|
124
|
+
if (isTransaction2930Unsigned(value))
|
125
|
+
return false;
|
126
|
+
return true;
|
127
|
+
}
|
128
|
+
exports.isTransactionCall = isTransactionCall;
|
129
|
+
function validateTransactionCall(value) {
|
130
|
+
if (!isTransactionCall(value))
|
131
|
+
throw new web3_errors_1.InvalidTransactionCall(value);
|
132
|
+
}
|
133
|
+
exports.validateTransactionCall = validateTransactionCall;
|
134
|
+
const validateCustomChainInfo = (transaction) => {
|
135
|
+
if (!(0, web3_validator_1.isNullish)(transaction.common)) {
|
136
|
+
if ((0, web3_validator_1.isNullish)(transaction.common.customChain))
|
137
|
+
throw new web3_errors_1.MissingCustomChainError();
|
138
|
+
if ((0, web3_validator_1.isNullish)(transaction.common.customChain.chainId))
|
139
|
+
throw new web3_errors_1.MissingCustomChainIdError();
|
140
|
+
if (!(0, web3_validator_1.isNullish)(transaction.chainId) &&
|
141
|
+
transaction.chainId !== transaction.common.customChain.chainId)
|
142
|
+
throw new web3_errors_1.ChainIdMismatchError({
|
143
|
+
txChainId: transaction.chainId,
|
144
|
+
customChainId: transaction.common.customChain.chainId,
|
145
|
+
});
|
146
|
+
}
|
147
|
+
};
|
148
|
+
exports.validateCustomChainInfo = validateCustomChainInfo;
|
149
|
+
const validateChainInfo = (transaction) => {
|
150
|
+
if (!(0, web3_validator_1.isNullish)(transaction.common) &&
|
151
|
+
!(0, web3_validator_1.isNullish)(transaction.chain) &&
|
152
|
+
!(0, web3_validator_1.isNullish)(transaction.hardfork)) {
|
153
|
+
throw new web3_errors_1.CommonOrChainAndHardforkError();
|
154
|
+
}
|
155
|
+
if ((!(0, web3_validator_1.isNullish)(transaction.chain) && (0, web3_validator_1.isNullish)(transaction.hardfork)) ||
|
156
|
+
(!(0, web3_validator_1.isNullish)(transaction.hardfork) && (0, web3_validator_1.isNullish)(transaction.chain)))
|
157
|
+
throw new web3_errors_1.MissingChainOrHardforkError({
|
158
|
+
chain: transaction.chain,
|
159
|
+
hardfork: transaction.hardfork,
|
160
|
+
});
|
161
|
+
};
|
162
|
+
exports.validateChainInfo = validateChainInfo;
|
163
|
+
const validateBaseChain = (transaction) => {
|
164
|
+
if (!(0, web3_validator_1.isNullish)(transaction.common))
|
165
|
+
if (!(0, web3_validator_1.isNullish)(transaction.common.baseChain))
|
166
|
+
if (!(0, web3_validator_1.isNullish)(transaction.chain) &&
|
167
|
+
transaction.chain !== transaction.common.baseChain) {
|
168
|
+
throw new web3_errors_1.ChainMismatchError({
|
169
|
+
txChain: transaction.chain,
|
170
|
+
baseChain: transaction.common.baseChain,
|
171
|
+
});
|
172
|
+
}
|
173
|
+
};
|
174
|
+
exports.validateBaseChain = validateBaseChain;
|
175
|
+
const validateHardfork = (transaction) => {
|
176
|
+
if (!(0, web3_validator_1.isNullish)(transaction.common))
|
177
|
+
if (!(0, web3_validator_1.isNullish)(transaction.common.hardfork))
|
178
|
+
if (!(0, web3_validator_1.isNullish)(transaction.hardfork) &&
|
179
|
+
transaction.hardfork !== transaction.common.hardfork) {
|
180
|
+
throw new web3_errors_1.HardforkMismatchError({
|
181
|
+
txHardfork: transaction.hardfork,
|
182
|
+
commonHardfork: transaction.common.hardfork,
|
183
|
+
});
|
184
|
+
}
|
185
|
+
};
|
186
|
+
exports.validateHardfork = validateHardfork;
|
187
|
+
const validateLegacyGas = (transaction) => {
|
188
|
+
if (
|
189
|
+
// This check is verifying gas and gasPrice aren't less than 0.
|
190
|
+
(0, web3_validator_1.isNullish)(transaction.gas) ||
|
191
|
+
!(0, web3_validator_1.isUInt)(transaction.gas) ||
|
192
|
+
(0, web3_validator_1.isNullish)(transaction.gasPrice) ||
|
193
|
+
!(0, web3_validator_1.isUInt)(transaction.gasPrice))
|
194
|
+
throw new web3_errors_1.InvalidGasOrGasPrice({
|
195
|
+
gas: transaction.gas,
|
196
|
+
gasPrice: transaction.gasPrice,
|
197
|
+
});
|
198
|
+
if (!(0, web3_validator_1.isNullish)(transaction.maxFeePerGas) || !(0, web3_validator_1.isNullish)(transaction.maxPriorityFeePerGas))
|
199
|
+
throw new web3_errors_1.UnsupportedFeeMarketError({
|
200
|
+
maxFeePerGas: transaction.maxFeePerGas,
|
201
|
+
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
202
|
+
});
|
203
|
+
};
|
204
|
+
exports.validateLegacyGas = validateLegacyGas;
|
205
|
+
const validateFeeMarketGas = (transaction) => {
|
206
|
+
// These errors come from 1.x, so they must be checked before
|
207
|
+
// InvalidMaxPriorityFeePerGasOrMaxFeePerGas to throw the same error
|
208
|
+
// for the same code executing in 1.x
|
209
|
+
if (!(0, web3_validator_1.isNullish)(transaction.gasPrice) && transaction.type === '0x2')
|
210
|
+
throw new web3_errors_1.Eip1559GasPriceError(transaction.gasPrice);
|
211
|
+
if (transaction.type === '0x0' || transaction.type === '0x1')
|
212
|
+
throw new web3_errors_1.UnsupportedFeeMarketError({
|
213
|
+
maxFeePerGas: transaction.maxFeePerGas,
|
214
|
+
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
215
|
+
});
|
216
|
+
if ((0, web3_validator_1.isNullish)(transaction.maxFeePerGas) ||
|
217
|
+
!(0, web3_validator_1.isUInt)(transaction.maxFeePerGas) ||
|
218
|
+
(0, web3_validator_1.isNullish)(transaction.maxPriorityFeePerGas) ||
|
219
|
+
!(0, web3_validator_1.isUInt)(transaction.maxPriorityFeePerGas))
|
220
|
+
throw new web3_errors_1.InvalidMaxPriorityFeePerGasOrMaxFeePerGas({
|
221
|
+
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
222
|
+
maxFeePerGas: transaction.maxFeePerGas,
|
223
|
+
});
|
224
|
+
};
|
225
|
+
exports.validateFeeMarketGas = validateFeeMarketGas;
|
226
|
+
/**
|
227
|
+
* This method checks if all required gas properties are present for either
|
228
|
+
* legacy gas (type 0x0 and 0x1) OR fee market transactions (0x2)
|
229
|
+
*/
|
230
|
+
const validateGas = (transaction) => {
|
231
|
+
const gasPresent = !(0, web3_validator_1.isNullish)(transaction.gas) || !(0, web3_validator_1.isNullish)(transaction.gasLimit);
|
232
|
+
const legacyGasPresent = gasPresent && !(0, web3_validator_1.isNullish)(transaction.gasPrice);
|
233
|
+
const feeMarketGasPresent = gasPresent &&
|
234
|
+
!(0, web3_validator_1.isNullish)(transaction.maxPriorityFeePerGas) &&
|
235
|
+
!(0, web3_validator_1.isNullish)(transaction.maxFeePerGas);
|
236
|
+
if (!legacyGasPresent && !feeMarketGasPresent)
|
237
|
+
throw new web3_errors_1.MissingGasError({
|
238
|
+
gas: transaction.gas,
|
239
|
+
gasPrice: transaction.gasPrice,
|
240
|
+
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
241
|
+
maxFeePerGas: transaction.maxFeePerGas,
|
242
|
+
});
|
243
|
+
if (legacyGasPresent && feeMarketGasPresent)
|
244
|
+
throw new web3_errors_1.TransactionGasMismatchError({
|
245
|
+
gas: transaction.gas,
|
246
|
+
gasPrice: transaction.gasPrice,
|
247
|
+
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
248
|
+
maxFeePerGas: transaction.maxFeePerGas,
|
249
|
+
});
|
250
|
+
(legacyGasPresent ? exports.validateLegacyGas : exports.validateFeeMarketGas)(transaction);
|
251
|
+
(!(0, web3_validator_1.isNullish)(transaction.type) && transaction.type > '0x1'
|
252
|
+
? exports.validateFeeMarketGas
|
253
|
+
: exports.validateLegacyGas)(transaction);
|
254
|
+
};
|
255
|
+
exports.validateGas = validateGas;
|
256
|
+
const validateTransactionForSigning = (transaction, overrideMethod, options = { transactionSchema: undefined }) => {
|
257
|
+
if (!(0, web3_validator_1.isNullish)(overrideMethod)) {
|
258
|
+
overrideMethod(transaction);
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
if (typeof transaction !== 'object' || (0, web3_validator_1.isNullish)(transaction))
|
262
|
+
throw new web3_errors_1.InvalidTransactionObjectError(transaction);
|
263
|
+
(0, exports.validateCustomChainInfo)(transaction);
|
264
|
+
(0, exports.validateChainInfo)(transaction);
|
265
|
+
(0, exports.validateBaseChain)(transaction);
|
266
|
+
(0, exports.validateHardfork)(transaction);
|
267
|
+
const formattedTransaction = (0, format_transaction_js_1.formatTransaction)(transaction, web3_types_1.ETH_DATA_FORMAT, {
|
268
|
+
transactionSchema: options.transactionSchema,
|
269
|
+
});
|
270
|
+
(0, exports.validateGas)(formattedTransaction);
|
271
|
+
if ((0, web3_validator_1.isNullish)(formattedTransaction.nonce) ||
|
272
|
+
(0, web3_validator_1.isNullish)(formattedTransaction.chainId) ||
|
273
|
+
formattedTransaction.nonce.startsWith('-') ||
|
274
|
+
formattedTransaction.chainId.startsWith('-'))
|
275
|
+
throw new web3_errors_1.InvalidNonceOrChainIdError({
|
276
|
+
nonce: transaction.nonce,
|
277
|
+
chainId: transaction.chainId,
|
278
|
+
});
|
279
|
+
};
|
280
|
+
exports.validateTransactionForSigning = validateTransactionForSigning;
|
281
|
+
//# sourceMappingURL=validation.js.map
|
@@ -0,0 +1 @@
|
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