viem 2.21.33 → 2.21.34
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/_cjs/actions/public/waitForTransactionReceipt.js +94 -91
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/chains/definitions/worldchain.js +37 -1
- package/_cjs/chains/definitions/worldchain.js.map +1 -1
- package/_cjs/chains/definitions/worldchainSepolia.js +36 -1
- package/_cjs/chains/definitions/worldchainSepolia.js.map +1 -1
- package/_cjs/chains/definitions/xdc.js +5 -5
- package/_cjs/chains/definitions/xdc.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/linea/actions/estimateGas.js +1 -4
- package/_cjs/linea/actions/estimateGas.js.map +1 -1
- package/_cjs/op-stack/chains.js +5 -1
- package/_cjs/op-stack/chains.js.map +1 -1
- package/_cjs/utils/promise/createBatchScheduler.js +8 -11
- package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
- package/_cjs/utils/promise/withResolvers.js +13 -0
- package/_cjs/utils/promise/withResolvers.js.map +1 -0
- package/_esm/actions/public/waitForTransactionReceipt.js +109 -106
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/chains/definitions/worldchain.js +37 -1
- package/_esm/chains/definitions/worldchain.js.map +1 -1
- package/_esm/chains/definitions/worldchainSepolia.js +36 -1
- package/_esm/chains/definitions/worldchainSepolia.js.map +1 -1
- package/_esm/chains/definitions/xdc.js +5 -5
- package/_esm/chains/definitions/xdc.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/linea/actions/estimateGas.js +1 -4
- package/_esm/linea/actions/estimateGas.js.map +1 -1
- package/_esm/op-stack/chains.js +2 -0
- package/_esm/op-stack/chains.js.map +1 -1
- package/_esm/utils/promise/createBatchScheduler.js +8 -11
- package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
- package/_esm/utils/promise/withResolvers.js +11 -0
- package/_esm/utils/promise/withResolvers.js.map +1 -0
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/chains/definitions/worldchain.d.ts +52 -12
- package/_types/chains/definitions/worldchain.d.ts.map +1 -1
- package/_types/chains/definitions/worldchainSepolia.d.ts +51 -12
- package/_types/chains/definitions/worldchainSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/xdc.d.ts +5 -5
- package/_types/errors/version.d.ts +1 -1
- package/_types/linea/actions/estimateGas.d.ts.map +1 -1
- package/_types/op-stack/chains.d.ts +2 -0
- package/_types/op-stack/chains.d.ts.map +1 -1
- package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
- package/_types/utils/promise/withResolvers.d.ts +9 -0
- package/_types/utils/promise/withResolvers.d.ts.map +1 -0
- package/actions/public/waitForTransactionReceipt.ts +162 -156
- package/chains/definitions/worldchain.ts +38 -1
- package/chains/definitions/worldchainSepolia.ts +37 -1
- package/chains/definitions/xdc.ts +5 -5
- package/errors/version.ts +1 -1
- package/linea/actions/estimateGas.ts +1 -11
- package/op-stack/chains.ts +2 -0
- package/package.json +1 -1
- package/utils/promise/createBatchScheduler.ts +12 -16
- package/utils/promise/withResolvers.ts +19 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# viem
|
2
2
|
|
3
|
+
## 2.21.34
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2917](https://github.com/wevm/viem/pull/2917) [`b3f8199f5560fb64b2c84de75b7f8d6b30990262`](https://github.com/wevm/viem/commit/b3f8199f5560fb64b2c84de75b7f8d6b30990262) Thanks [@0xPenryn](https://github.com/0xPenryn)! - Updated World Chain (Mainnet and Sepolia)
|
8
|
+
|
9
|
+
- [`80f43544f82e8621ad71e74441b900967dfc306c`](https://github.com/wevm/viem/commit/80f43544f82e8621ad71e74441b900967dfc306c) Thanks [@jxom](https://github.com/jxom)! - Resolved timer leak in `waitForTransactionReceipt`.
|
10
|
+
|
11
|
+
- [#2915](https://github.com/wevm/viem/pull/2915) [`8032ffa98db644cb3abcd13eedbd05b41e74637f`](https://github.com/wevm/viem/commit/8032ffa98db644cb3abcd13eedbd05b41e74637f) Thanks [@iltumio](https://github.com/iltumio)! - **Linea Extension:** Fixed `estimateGas` infinite loop.
|
12
|
+
|
3
13
|
## 2.21.33
|
4
14
|
|
5
15
|
### Patch Changes
|
@@ -5,6 +5,7 @@ const block_js_1 = require("../../errors/block.js");
|
|
5
5
|
const transaction_js_1 = require("../../errors/transaction.js");
|
6
6
|
const getAction_js_1 = require("../../utils/getAction.js");
|
7
7
|
const observe_js_1 = require("../../utils/observe.js");
|
8
|
+
const withResolvers_js_1 = require("../../utils/promise/withResolvers.js");
|
8
9
|
const withRetry_js_1 = require("../../utils/promise/withRetry.js");
|
9
10
|
const stringify_js_1 = require("../../utils/stringify.js");
|
10
11
|
const getBlock_js_1 = require("./getBlock.js");
|
@@ -17,112 +18,114 @@ async function waitForTransactionReceipt(client, { confirmations = 1, hash, onRe
|
|
17
18
|
let replacedTransaction;
|
18
19
|
let receipt;
|
19
20
|
let retrying = false;
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
21
|
+
const { promise, resolve, reject } = (0, withResolvers_js_1.withResolvers)();
|
22
|
+
const timer = timeout
|
23
|
+
? setTimeout(() => reject(new transaction_js_1.WaitForTransactionReceiptTimeoutError({ hash })), timeout)
|
24
|
+
: undefined;
|
25
|
+
const _unobserve = (0, observe_js_1.observe)(observerId, { onReplaced, resolve, reject }, (emit) => {
|
26
|
+
const _unwatch = (0, getAction_js_1.getAction)(client, watchBlockNumber_js_1.watchBlockNumber, 'watchBlockNumber')({
|
27
|
+
emitMissed: true,
|
28
|
+
emitOnBegin: true,
|
29
|
+
poll: true,
|
30
|
+
pollingInterval,
|
31
|
+
async onBlockNumber(blockNumber_) {
|
32
|
+
const done = (fn) => {
|
33
|
+
clearTimeout(timer);
|
34
|
+
_unwatch();
|
35
|
+
fn();
|
36
|
+
_unobserve();
|
37
|
+
};
|
38
|
+
let blockNumber = blockNumber_;
|
39
|
+
if (retrying)
|
40
|
+
return;
|
41
|
+
try {
|
42
|
+
if (receipt) {
|
43
|
+
if (confirmations > 1 &&
|
44
|
+
(!receipt.blockNumber ||
|
45
|
+
blockNumber - receipt.blockNumber + 1n < confirmations))
|
46
|
+
return;
|
47
|
+
done(() => emit.resolve(receipt));
|
37
48
|
return;
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
}
|
50
|
+
if (!transaction) {
|
51
|
+
retrying = true;
|
52
|
+
await (0, withRetry_js_1.withRetry)(async () => {
|
53
|
+
transaction = (await (0, getAction_js_1.getAction)(client, getTransaction_js_1.getTransaction, 'getTransaction')({ hash }));
|
54
|
+
if (transaction.blockNumber)
|
55
|
+
blockNumber = transaction.blockNumber;
|
56
|
+
}, {
|
57
|
+
delay: retryDelay,
|
58
|
+
retryCount,
|
59
|
+
});
|
60
|
+
retrying = false;
|
61
|
+
}
|
62
|
+
receipt = await (0, getAction_js_1.getAction)(client, getTransactionReceipt_js_1.getTransactionReceipt, 'getTransactionReceipt')({ hash });
|
63
|
+
if (confirmations > 1 &&
|
64
|
+
(!receipt.blockNumber ||
|
65
|
+
blockNumber - receipt.blockNumber + 1n < confirmations))
|
66
|
+
return;
|
67
|
+
done(() => emit.resolve(receipt));
|
68
|
+
}
|
69
|
+
catch (err) {
|
70
|
+
if (err instanceof transaction_js_1.TransactionNotFoundError ||
|
71
|
+
err instanceof transaction_js_1.TransactionReceiptNotFoundError) {
|
72
|
+
if (!transaction) {
|
73
|
+
retrying = false;
|
45
74
|
return;
|
46
75
|
}
|
47
|
-
|
76
|
+
try {
|
77
|
+
replacedTransaction = transaction;
|
48
78
|
retrying = true;
|
49
|
-
await (0, withRetry_js_1.withRetry)(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}, {
|
79
|
+
const block = await (0, withRetry_js_1.withRetry)(() => (0, getAction_js_1.getAction)(client, getBlock_js_1.getBlock, 'getBlock')({
|
80
|
+
blockNumber,
|
81
|
+
includeTransactions: true,
|
82
|
+
}), {
|
54
83
|
delay: retryDelay,
|
55
84
|
retryCount,
|
85
|
+
shouldRetry: ({ error }) => error instanceof block_js_1.BlockNotFoundError,
|
56
86
|
});
|
57
87
|
retrying = false;
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
(!receipt.blockNumber ||
|
62
|
-
blockNumber - receipt.blockNumber + 1n < confirmations))
|
63
|
-
return;
|
64
|
-
done(() => emit.resolve(receipt));
|
65
|
-
}
|
66
|
-
catch (err) {
|
67
|
-
if (err instanceof transaction_js_1.TransactionNotFoundError ||
|
68
|
-
err instanceof transaction_js_1.TransactionReceiptNotFoundError) {
|
69
|
-
if (!transaction) {
|
70
|
-
retrying = false;
|
88
|
+
const replacementTransaction = block.transactions.find(({ from, nonce }) => from === replacedTransaction.from &&
|
89
|
+
nonce === replacedTransaction.nonce);
|
90
|
+
if (!replacementTransaction)
|
71
91
|
return;
|
92
|
+
receipt = await (0, getAction_js_1.getAction)(client, getTransactionReceipt_js_1.getTransactionReceipt, 'getTransactionReceipt')({
|
93
|
+
hash: replacementTransaction.hash,
|
94
|
+
});
|
95
|
+
if (confirmations > 1 &&
|
96
|
+
(!receipt.blockNumber ||
|
97
|
+
blockNumber - receipt.blockNumber + 1n < confirmations))
|
98
|
+
return;
|
99
|
+
let reason = 'replaced';
|
100
|
+
if (replacementTransaction.to === replacedTransaction.to &&
|
101
|
+
replacementTransaction.value === replacedTransaction.value) {
|
102
|
+
reason = 'repriced';
|
72
103
|
}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
const block = await (0, withRetry_js_1.withRetry)(() => (0, getAction_js_1.getAction)(client, getBlock_js_1.getBlock, 'getBlock')({
|
77
|
-
blockNumber,
|
78
|
-
includeTransactions: true,
|
79
|
-
}), {
|
80
|
-
delay: retryDelay,
|
81
|
-
retryCount,
|
82
|
-
shouldRetry: ({ error }) => error instanceof block_js_1.BlockNotFoundError,
|
83
|
-
});
|
84
|
-
retrying = false;
|
85
|
-
const replacementTransaction = block.transactions.find(({ from, nonce }) => from === replacedTransaction.from &&
|
86
|
-
nonce === replacedTransaction.nonce);
|
87
|
-
if (!replacementTransaction)
|
88
|
-
return;
|
89
|
-
receipt = await (0, getAction_js_1.getAction)(client, getTransactionReceipt_js_1.getTransactionReceipt, 'getTransactionReceipt')({
|
90
|
-
hash: replacementTransaction.hash,
|
91
|
-
});
|
92
|
-
if (confirmations > 1 &&
|
93
|
-
(!receipt.blockNumber ||
|
94
|
-
blockNumber - receipt.blockNumber + 1n < confirmations))
|
95
|
-
return;
|
96
|
-
let reason = 'replaced';
|
97
|
-
if (replacementTransaction.to === replacedTransaction.to &&
|
98
|
-
replacementTransaction.value === replacedTransaction.value) {
|
99
|
-
reason = 'repriced';
|
100
|
-
}
|
101
|
-
else if (replacementTransaction.from === replacementTransaction.to &&
|
102
|
-
replacementTransaction.value === 0n) {
|
103
|
-
reason = 'cancelled';
|
104
|
-
}
|
105
|
-
done(() => {
|
106
|
-
emit.onReplaced?.({
|
107
|
-
reason,
|
108
|
-
replacedTransaction: replacedTransaction,
|
109
|
-
transaction: replacementTransaction,
|
110
|
-
transactionReceipt: receipt,
|
111
|
-
});
|
112
|
-
emit.resolve(receipt);
|
113
|
-
});
|
114
|
-
}
|
115
|
-
catch (err_) {
|
116
|
-
done(() => emit.reject(err_));
|
104
|
+
else if (replacementTransaction.from === replacementTransaction.to &&
|
105
|
+
replacementTransaction.value === 0n) {
|
106
|
+
reason = 'cancelled';
|
117
107
|
}
|
108
|
+
done(() => {
|
109
|
+
emit.onReplaced?.({
|
110
|
+
reason,
|
111
|
+
replacedTransaction: replacedTransaction,
|
112
|
+
transaction: replacementTransaction,
|
113
|
+
transactionReceipt: receipt,
|
114
|
+
});
|
115
|
+
emit.resolve(receipt);
|
116
|
+
});
|
118
117
|
}
|
119
|
-
|
120
|
-
done(() => emit.reject(
|
118
|
+
catch (err_) {
|
119
|
+
done(() => emit.reject(err_));
|
121
120
|
}
|
122
121
|
}
|
123
|
-
|
124
|
-
|
122
|
+
else {
|
123
|
+
done(() => emit.reject(err));
|
124
|
+
}
|
125
|
+
}
|
126
|
+
},
|
125
127
|
});
|
126
128
|
});
|
129
|
+
return promise;
|
127
130
|
}
|
128
131
|
//# sourceMappingURL=waitForTransactionReceipt.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"waitForTransactionReceipt.js","sourceRoot":"","sources":["../../../actions/public/waitForTransactionReceipt.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"waitForTransactionReceipt.js","sourceRoot":"","sources":["../../../actions/public/waitForTransactionReceipt.ts"],"names":[],"mappings":";;AAmIA,8DAmNC;AApVD,oDAA0D;AAC1D,gEAIoC;AAKpC,2DAAoD;AACpD,uDAAuE;AACvE,2EAAoE;AACpE,mEAGyC;AACzC,2DAAoD;AAEpD,+CAAgE;AAChE,2DAI4B;AAC5B,yEAImC;AACnC,+DAG8B;AAgGvB,KAAK,UAAU,yBAAyB,CAG7C,MAAgC,EAChC,EACE,aAAa,GAAG,CAAC,EACjB,IAAI,EACJ,UAAU,EACV,eAAe,GAAG,MAAM,CAAC,eAAe,EACxC,UAAU,GAAG,CAAC,EACd,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,GAAG,EAChD,OAAO,GAAG,OAAO,GAC0B;IAE7C,MAAM,UAAU,GAAG,IAAA,wBAAS,EAAC,CAAC,2BAA2B,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IAE7E,IAAI,WAAwD,CAAA;IAC5D,IAAI,mBAAgE,CAAA;IACpE,IAAI,OAA+C,CAAA;IACnD,IAAI,QAAQ,GA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AO;iCAC5B,CAAC,CAAA;gCACF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;4BACvB,CAAC,CAAC,CAAA;wBACJ,CAAC;wBAAC,OAAO,IAAI,EAAE,CAAC;4BACd,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;wBAC/B,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;oBAC9B,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CACF,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.worldchain = void 0;
|
4
|
+
const chainConfig_js_1 = require("../../op-stack/chainConfig.js");
|
4
5
|
const defineChain_js_1 = require("../../utils/chain/defineChain.js");
|
6
|
+
const sourceId = 1;
|
5
7
|
exports.worldchain = (0, defineChain_js_1.defineChain)({
|
6
8
|
id: 480,
|
7
9
|
name: 'World Chain',
|
@@ -12,10 +14,44 @@ exports.worldchain = (0, defineChain_js_1.defineChain)({
|
|
12
14
|
},
|
13
15
|
blockExplorers: {
|
14
16
|
default: {
|
15
|
-
name: '
|
17
|
+
name: 'Worldscan',
|
18
|
+
url: 'https://worldscan.org',
|
19
|
+
apiUrl: 'https://api.worldscan.org/api',
|
20
|
+
},
|
21
|
+
blockscout: {
|
22
|
+
name: 'Blockscout',
|
16
23
|
url: 'https://worldchain-mainnet.explorer.alchemy.com',
|
24
|
+
apiUrl: 'https://worldchain-mainnet.explorer.alchemy.com/api',
|
25
|
+
},
|
26
|
+
},
|
27
|
+
contracts: {
|
28
|
+
...chainConfig_js_1.chainConfig.contracts,
|
29
|
+
multicall3: {
|
30
|
+
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
31
|
+
blockCreated: 0,
|
32
|
+
},
|
33
|
+
disputeGameFactory: {
|
34
|
+
[sourceId]: {
|
35
|
+
address: '0x0E90dCAFBC242D2C861A20Bb20EC8E7182965a52',
|
36
|
+
},
|
37
|
+
},
|
38
|
+
l2OutputOracle: {
|
39
|
+
[sourceId]: {
|
40
|
+
address: '0x19A6d1E9034596196295CF148509796978343c5D',
|
41
|
+
},
|
42
|
+
},
|
43
|
+
portal: {
|
44
|
+
[sourceId]: {
|
45
|
+
address: '0xd5ec14a83B7d95BE1E2Ac12523e2dEE12Cbeea6C',
|
46
|
+
},
|
47
|
+
},
|
48
|
+
l1StandardBridge: {
|
49
|
+
[sourceId]: {
|
50
|
+
address: '0x470458C91978D2d929704489Ad730DC3E3001113',
|
51
|
+
},
|
17
52
|
},
|
18
53
|
},
|
19
54
|
testnet: false,
|
55
|
+
sourceId,
|
20
56
|
});
|
21
57
|
//# sourceMappingURL=worldchain.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"worldchain.js","sourceRoot":"","sources":["../../../chains/definitions/worldchain.ts"],"names":[],"mappings":";;;AAAA,qEAA8D;
|
1
|
+
{"version":3,"file":"worldchain.js","sourceRoot":"","sources":["../../../chains/definitions/worldchain.ts"],"names":[],"mappings":";;;AAAA,kEAA2D;AAC3D,qEAA8D;AAE9D,MAAM,QAAQ,GAAG,CAAC,CAAA;AAEL,QAAA,UAAU,GAAiB,IAAA,4BAAW,EAAC;IAClD,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,YAAY;IACrB,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,iDAAiD,CAAC,EAAE;KACvE;IACD,cAAc,EAAE;QACd,OAAO,EAAE;YACP,IAAI,EAAE,WAAW;YACjB,GAAG,EAAE,uBAAuB;YAC5B,MAAM,EAAE,+BAA+B;SACxC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,iDAAiD;YACtD,MAAM,EAAE,qDAAqD;SAC9D;KACF;IACD,SAAS,EAAE;QACT,GAAG,4BAAW,CAAC,SAAS;QACxB,UAAU,EAAE;YACV,OAAO,EAAE,4CAA4C;YACrD,YAAY,EAAE,CAAC;SAChB;QACD,kBAAkB,EAAE;YAClB,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;QACD,cAAc,EAAE;YACd,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;QACD,MAAM,EAAE;YACN,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;QACD,gBAAgB,EAAE;YAChB,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;KACF;IACD,OAAO,EAAE,KAAK;IACd,QAAQ;CACT,CAAC,CAAA"}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.worldchainSepolia = void 0;
|
4
|
+
const chainConfig_js_1 = require("../../op-stack/chainConfig.js");
|
4
5
|
const defineChain_js_1 = require("../../utils/chain/defineChain.js");
|
6
|
+
const sourceId = 11_155_111;
|
5
7
|
exports.worldchainSepolia = (0, defineChain_js_1.defineChain)({
|
6
8
|
id: 4801,
|
7
9
|
name: 'World Chain Sepolia',
|
@@ -13,10 +15,43 @@ exports.worldchainSepolia = (0, defineChain_js_1.defineChain)({
|
|
13
15
|
},
|
14
16
|
blockExplorers: {
|
15
17
|
default: {
|
16
|
-
name: '
|
18
|
+
name: 'Worldscan Sepolia',
|
19
|
+
url: 'https://sepolia.worldscan.org',
|
20
|
+
},
|
21
|
+
blockscout: {
|
22
|
+
name: 'Blockscout',
|
17
23
|
url: 'https://worldchain-sepolia.explorer.alchemy.com',
|
24
|
+
apiUrl: 'https://worldchain-sepolia.explorer.alchemy.com/api',
|
25
|
+
},
|
26
|
+
},
|
27
|
+
contracts: {
|
28
|
+
...chainConfig_js_1.chainConfig.contracts,
|
29
|
+
multicall3: {
|
30
|
+
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
31
|
+
blockCreated: 0,
|
32
|
+
},
|
33
|
+
disputeGameFactory: {
|
34
|
+
[sourceId]: {
|
35
|
+
address: '0x8cF97Ee616C986a070F5020d973b456D0120C253',
|
36
|
+
},
|
37
|
+
},
|
38
|
+
l2OutputOracle: {
|
39
|
+
[sourceId]: {
|
40
|
+
address: '0xc8886f8BAb6Eaeb215aDB5f1c686BF699248300e',
|
41
|
+
},
|
42
|
+
},
|
43
|
+
portal: {
|
44
|
+
[sourceId]: {
|
45
|
+
address: '0xFf6EBa109271fe6d4237EeeD4bAb1dD9A77dD1A4',
|
46
|
+
},
|
47
|
+
},
|
48
|
+
l1StandardBridge: {
|
49
|
+
[sourceId]: {
|
50
|
+
address: '0xd7DF54b3989855eb66497301a4aAEc33Dbb3F8DE',
|
51
|
+
},
|
18
52
|
},
|
19
53
|
},
|
20
54
|
testnet: true,
|
55
|
+
sourceId,
|
21
56
|
});
|
22
57
|
//# sourceMappingURL=worldchainSepolia.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"worldchainSepolia.js","sourceRoot":"","sources":["../../../chains/definitions/worldchainSepolia.ts"],"names":[],"mappings":";;;AAAA,qEAA8D;
|
1
|
+
{"version":3,"file":"worldchainSepolia.js","sourceRoot":"","sources":["../../../chains/definitions/worldchainSepolia.ts"],"names":[],"mappings":";;;AAAA,kEAA2D;AAC3D,qEAA8D;AAE9D,MAAM,QAAQ,GAAG,UAAU,CAAA;AAEd,QAAA,iBAAiB,GAAiB,IAAA,4BAAW,EAAC;IACzD,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,oBAAoB;IAC7B,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,iDAAiD,CAAC,EAAE;QACtE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,iDAAiD,CAAC,EAAE;KACtE;IACD,cAAc,EAAE;QACd,OAAO,EAAE;YACP,IAAI,EAAE,mBAAmB;YACzB,GAAG,EAAE,+BAA+B;SACrC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,iDAAiD;YACtD,MAAM,EAAE,qDAAqD;SAC9D;KACF;IACD,SAAS,EAAE;QACT,GAAG,4BAAW,CAAC,SAAS;QACxB,UAAU,EAAE;YACV,OAAO,EAAE,4CAA4C;YACrD,YAAY,EAAE,CAAC;SAChB;QACD,kBAAkB,EAAE;YAClB,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;QACD,cAAc,EAAE;YACd,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;QACD,MAAM,EAAE;YACN,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;QACD,gBAAgB,EAAE;YAChB,CAAC,QAAQ,CAAC,EAAE;gBACV,OAAO,EAAE,4CAA4C;aACtD;SACF;KACF;IACD,OAAO,EAAE,IAAI;IACb,QAAQ;CACT,CAAC,CAAA"}
|
@@ -11,18 +11,18 @@ exports.xdc = (0, defineChain_js_1.defineChain)({
|
|
11
11
|
symbol: 'XDC',
|
12
12
|
},
|
13
13
|
rpcUrls: {
|
14
|
-
default: { http: ['https://rpc.
|
14
|
+
default: { http: ['https://rpc.xdcrpc.com'] },
|
15
15
|
},
|
16
16
|
blockExplorers: {
|
17
17
|
default: {
|
18
|
-
name: '
|
19
|
-
url: 'https://
|
18
|
+
name: 'XDCScan',
|
19
|
+
url: 'https://xdcscan.com',
|
20
20
|
},
|
21
21
|
},
|
22
22
|
contracts: {
|
23
23
|
multicall3: {
|
24
|
-
address: '
|
25
|
-
blockCreated:
|
24
|
+
address: '0x0B1795ccA8E4eC4df02346a082df54D437F8D9aF',
|
25
|
+
blockCreated: 75884020,
|
26
26
|
},
|
27
27
|
},
|
28
28
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"xdc.js","sourceRoot":"","sources":["../../../chains/definitions/xdc.ts"],"names":[],"mappings":";;;AAAA,qEAA8D;AAEjD,QAAA,GAAG,GAAiB,IAAA,4BAAW,EAAC;IAC3C,EAAE,EAAE,EAAE;IACN,IAAI,EAAE,gBAAgB;IACtB,cAAc,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;KACd;IACD,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,
|
1
|
+
{"version":3,"file":"xdc.js","sourceRoot":"","sources":["../../../chains/definitions/xdc.ts"],"names":[],"mappings":";;;AAAA,qEAA8D;AAEjD,QAAA,GAAG,GAAiB,IAAA,4BAAW,EAAC;IAC3C,EAAE,EAAE,EAAE;IACN,IAAI,EAAE,gBAAgB;IACtB,cAAc,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;KACd;IACD,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,wBAAwB,CAAC,EAAE;KAC9C;IACD,cAAc,EAAE;QACd,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,GAAG,EAAE,qBAAqB;SAC3B;KACF;IACD,SAAS,EAAE;QACT,UAAU,EAAE;YACV,OAAO,EAAE,4CAA4C;YACrD,YAAY,EAAE,QAAQ;SACvB;KACF;CACF,CAAC,CAAA"}
|
package/_cjs/errors/version.js
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.estimateGas = estimateGas;
|
4
4
|
const parseAccount_js_1 = require("../../accounts/utils/parseAccount.js");
|
5
|
-
const prepareTransactionRequest_js_1 = require("../../actions/wallet/prepareTransactionRequest.js");
|
6
5
|
const account_js_1 = require("../../errors/account.js");
|
7
6
|
const toHex_js_1 = require("../../utils/encoding/toHex.js");
|
8
7
|
const getCallError_js_1 = require("../../utils/errors/getCallError.js");
|
@@ -15,9 +14,7 @@ async function estimateGas(client, args) {
|
|
15
14
|
throw new account_js_1.AccountNotFoundError();
|
16
15
|
const account = (0, parseAccount_js_1.parseAccount)(account_);
|
17
16
|
try {
|
18
|
-
const { accessList, blockNumber, blockTag, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest } =
|
19
|
-
? (await (0, prepareTransactionRequest_js_1.prepareTransactionRequest)(client, args))
|
20
|
-
: args;
|
17
|
+
const { accessList, blockNumber, blockTag, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest } = args;
|
21
18
|
const blockNumberHex = blockNumber ? (0, toHex_js_1.numberToHex)(blockNumber) : undefined;
|
22
19
|
const block = blockNumberHex || blockTag;
|
23
20
|
(0, assertRequest_js_1.assertRequest)(args);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"estimateGas.js","sourceRoot":"","sources":["../../../linea/actions/estimateGas.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"estimateGas.js","sourceRoot":"","sources":["../../../linea/actions/estimateGas.ts"],"names":[],"mappings":";;AAsDA,kCAwEC;AA7HD,0EAAmE;AAInE,wDAA8D;AAM9D,4DAA2D;AAC3D,wEAAiE;AACjE,kEAA2D;AAC3D,wFAAuF;AACvF,+EAGiD;AAoC1C,KAAK,UAAU,WAAW,CAI/B,MAAyC,EACzC,IAAkC;IAElC,MAAM,EAAE,OAA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AO,CAAC;SAC7C,CAAC,CAAA;QACJ,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC;YACpC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;YAC1B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,CAAC;SAC7C,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAA,8BAAY,EAAC,GAAgB,EAAE;YACnC,GAAG,IAAI;YACP,OAAO;YACP,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
package/_cjs/op-stack/chains.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.zoraTestnet = exports.zoraSepolia = exports.zora = exports.soneiumMinato = exports.snaxTestnet = exports.snax = exports.shape = exports.pgnTestnet = exports.pgn = exports.optimismSepolia = exports.optimismGoerli = exports.optimism = exports.metalL2 = exports.fraxtalTestnet = exports.fraxtal = exports.baseSepolia = exports.baseGoerli = exports.base = exports.ancient8Sepolia = exports.ancient8 = void 0;
|
3
|
+
exports.zoraTestnet = exports.zoraSepolia = exports.zora = exports.worldchainSepolia = exports.worldchain = exports.soneiumMinato = exports.snaxTestnet = exports.snax = exports.shape = exports.pgnTestnet = exports.pgn = exports.optimismSepolia = exports.optimismGoerli = exports.optimism = exports.metalL2 = exports.fraxtalTestnet = exports.fraxtal = exports.baseSepolia = exports.baseGoerli = exports.base = exports.ancient8Sepolia = exports.ancient8 = void 0;
|
4
4
|
var ancient8_js_1 = require("../chains/definitions/ancient8.js");
|
5
5
|
Object.defineProperty(exports, "ancient8", { enumerable: true, get: function () { return ancient8_js_1.ancient8; } });
|
6
6
|
var ancient8Sepolia_js_1 = require("../chains/definitions/ancient8Sepolia.js");
|
@@ -35,6 +35,10 @@ var snaxTestnet_js_1 = require("../chains/definitions/snaxTestnet.js");
|
|
35
35
|
Object.defineProperty(exports, "snaxTestnet", { enumerable: true, get: function () { return snaxTestnet_js_1.snaxTestnet; } });
|
36
36
|
var soneiumMinato_js_1 = require("../chains/definitions/soneiumMinato.js");
|
37
37
|
Object.defineProperty(exports, "soneiumMinato", { enumerable: true, get: function () { return soneiumMinato_js_1.soneiumMinato; } });
|
38
|
+
var worldchain_js_1 = require("../chains/definitions/worldchain.js");
|
39
|
+
Object.defineProperty(exports, "worldchain", { enumerable: true, get: function () { return worldchain_js_1.worldchain; } });
|
40
|
+
var worldchainSepolia_js_1 = require("../chains/definitions/worldchainSepolia.js");
|
41
|
+
Object.defineProperty(exports, "worldchainSepolia", { enumerable: true, get: function () { return worldchainSepolia_js_1.worldchainSepolia; } });
|
38
42
|
var zora_js_1 = require("../chains/definitions/zora.js");
|
39
43
|
Object.defineProperty(exports, "zora", { enumerable: true, get: function () { return zora_js_1.zora; } });
|
40
44
|
var zoraSepolia_js_1 = require("../chains/definitions/zoraSepolia.js");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../../op-stack/chains.ts"],"names":[],"mappings":";;;AACA,iEAA4D;AAAnD,uGAAA,QAAQ,OAAA;AACjB,+EAA0E;AAAjE,qHAAA,eAAe,OAAA;AACxB,yDAAoD;AAA3C,+FAAA,IAAI,OAAA;AACb,qEAAgE;AAAvD,2GAAA,UAAU,OAAA;AACnB,uEAAkE;AAAzD,6GAAA,WAAW,OAAA;AACpB,+DAA0D;AAAjD,qGAAA,OAAO,OAAA;AAChB,6EAAwE;AAA/D,mHAAA,cAAc,OAAA;AACvB,+DAA0D;AAAjD,qGAAA,OAAO,OAAA;AAChB,iEAA4D;AAAnD,uGAAA,QAAQ,OAAA;AACjB,6EAAwE;AAA/D,mHAAA,cAAc,OAAA;AACvB,+EAA0E;AAAjE,qHAAA,eAAe,OAAA;AACxB,uDAAkD;AAAzC,6FAAA,GAAG,OAAA;AACZ,qEAAgE;AAAvD,2GAAA,UAAU,OA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AkE;AAAzD,6GAAA,WAAW,OAAA"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.createBatchScheduler = createBatchScheduler;
|
4
|
+
const withResolvers_js_1 = require("./withResolvers.js");
|
4
5
|
const schedulerCache = new Map();
|
5
6
|
function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort, }) {
|
6
7
|
const exec = async () => {
|
@@ -14,14 +15,14 @@ function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort, }) {
|
|
14
15
|
if (sort && Array.isArray(data))
|
15
16
|
data.sort(sort);
|
16
17
|
for (let i = 0; i < scheduler.length; i++) {
|
17
|
-
const {
|
18
|
-
|
18
|
+
const { resolve } = scheduler[i];
|
19
|
+
resolve?.([data[i], data]);
|
19
20
|
}
|
20
21
|
})
|
21
22
|
.catch((err) => {
|
22
23
|
for (let i = 0; i < scheduler.length; i++) {
|
23
|
-
const {
|
24
|
-
|
24
|
+
const { reject } = scheduler[i];
|
25
|
+
reject?.(err);
|
25
26
|
}
|
26
27
|
});
|
27
28
|
};
|
@@ -32,20 +33,16 @@ function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort, }) {
|
|
32
33
|
return {
|
33
34
|
flush,
|
34
35
|
async schedule(args) {
|
35
|
-
const
|
36
|
-
const promise = new Promise((resolve, reject) => {
|
37
|
-
pendingPromise.resolve = resolve;
|
38
|
-
pendingPromise.reject = reject;
|
39
|
-
});
|
36
|
+
const { promise, resolve, reject } = (0, withResolvers_js_1.withResolvers)();
|
40
37
|
const split = shouldSplitBatch?.([...getBatchedArgs(), args]);
|
41
38
|
if (split)
|
42
39
|
exec();
|
43
40
|
const hasActiveScheduler = getScheduler().length > 0;
|
44
41
|
if (hasActiveScheduler) {
|
45
|
-
setScheduler({ args,
|
42
|
+
setScheduler({ args, resolve, reject });
|
46
43
|
return promise;
|
47
44
|
}
|
48
|
-
setScheduler({ args,
|
45
|
+
setScheduler({ args, resolve, reject });
|
49
46
|
setTimeout(exec, wait);
|
50
47
|
return promise;
|
51
48
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createBatchScheduler.js","sourceRoot":"","sources":["../../../utils/promise/createBatchScheduler.ts"],"names":[],"mappings":";;AA0CA,
|
1
|
+
{"version":3,"file":"createBatchScheduler.js","sourceRoot":"","sources":["../../../utils/promise/createBatchScheduler.ts"],"names":[],"mappings":";;AA0CA,oDAmEC;AA5GD,yDAA6E;AAsC7E,MAAM,cAAc,GAAiB,IAAI,GAAG,EAAoC,CAAA;AAGhF,SAAgB,oBAAoB,CAGlC,EACA,EAAE,EACF,EAAE,EACF,gBAAgB,EAChB,IAAI,GAAG,CAAC,EACR,IAAI,GAIL;IACC,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;QACtB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;QAChC,KAAK,EAAE,CAAA;QAEP,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;QAE9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QAE7B,EAAE,CAAC,IAAoB,CAAC;aACrB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACb,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC1C,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;gBAChC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC,CAAC;aACD,KAAK,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,OAAO,OAAO,CAAA;YAChB,CAAC;YAED,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;YACvC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YACtB,OAAO,OAAO,CAAA;QAChB,CAAC;KACmE,CAAA;AACxE,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.withResolvers = withResolvers;
|
4
|
+
function withResolvers() {
|
5
|
+
let resolve = () => undefined;
|
6
|
+
let reject = () => undefined;
|
7
|
+
const promise = new Promise((resolve_, reject_) => {
|
8
|
+
resolve = resolve_;
|
9
|
+
reject = reject_;
|
10
|
+
});
|
11
|
+
return { promise, resolve, reject };
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=withResolvers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"withResolvers.js","sourceRoot":"","sources":["../../../utils/promise/withResolvers.ts"],"names":[],"mappings":";;AAQA,sCAUC;AAVD,SAAgB,aAAa;IAC3B,IAAI,OAAO,GAA0C,GAAG,EAAE,CAAC,SAAS,CAAA;IACpE,IAAI,MAAM,GAAyC,GAAG,EAAE,CAAC,SAAS,CAAA;IAElE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;QACtD,OAAO,GAAG,QAAQ,CAAA;QAClB,MAAM,GAAG,OAAO,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AACrC,CAAC"}
|