viem 2.21.33 → 2.21.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/_cjs/actions/public/waitForTransactionReceipt.js +94 -91
  3. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  4. package/_cjs/chains/definitions/worldchain.js +37 -1
  5. package/_cjs/chains/definitions/worldchain.js.map +1 -1
  6. package/_cjs/chains/definitions/worldchainSepolia.js +36 -1
  7. package/_cjs/chains/definitions/worldchainSepolia.js.map +1 -1
  8. package/_cjs/chains/definitions/xdc.js +5 -5
  9. package/_cjs/chains/definitions/xdc.js.map +1 -1
  10. package/_cjs/errors/version.js +1 -1
  11. package/_cjs/linea/actions/estimateGas.js +1 -4
  12. package/_cjs/linea/actions/estimateGas.js.map +1 -1
  13. package/_cjs/op-stack/chains.js +5 -1
  14. package/_cjs/op-stack/chains.js.map +1 -1
  15. package/_cjs/utils/promise/createBatchScheduler.js +8 -11
  16. package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
  17. package/_cjs/utils/promise/withResolvers.js +13 -0
  18. package/_cjs/utils/promise/withResolvers.js.map +1 -0
  19. package/_esm/actions/public/waitForTransactionReceipt.js +109 -106
  20. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  21. package/_esm/chains/definitions/worldchain.js +37 -1
  22. package/_esm/chains/definitions/worldchain.js.map +1 -1
  23. package/_esm/chains/definitions/worldchainSepolia.js +36 -1
  24. package/_esm/chains/definitions/worldchainSepolia.js.map +1 -1
  25. package/_esm/chains/definitions/xdc.js +5 -5
  26. package/_esm/chains/definitions/xdc.js.map +1 -1
  27. package/_esm/errors/version.js +1 -1
  28. package/_esm/linea/actions/estimateGas.js +1 -4
  29. package/_esm/linea/actions/estimateGas.js.map +1 -1
  30. package/_esm/op-stack/chains.js +2 -0
  31. package/_esm/op-stack/chains.js.map +1 -1
  32. package/_esm/utils/promise/createBatchScheduler.js +8 -11
  33. package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
  34. package/_esm/utils/promise/withResolvers.js +11 -0
  35. package/_esm/utils/promise/withResolvers.js.map +1 -0
  36. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  37. package/_types/chains/definitions/worldchain.d.ts +52 -12
  38. package/_types/chains/definitions/worldchain.d.ts.map +1 -1
  39. package/_types/chains/definitions/worldchainSepolia.d.ts +51 -12
  40. package/_types/chains/definitions/worldchainSepolia.d.ts.map +1 -1
  41. package/_types/chains/definitions/xdc.d.ts +5 -5
  42. package/_types/errors/version.d.ts +1 -1
  43. package/_types/linea/actions/estimateGas.d.ts.map +1 -1
  44. package/_types/op-stack/chains.d.ts +2 -0
  45. package/_types/op-stack/chains.d.ts.map +1 -1
  46. package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
  47. package/_types/utils/promise/withResolvers.d.ts +9 -0
  48. package/_types/utils/promise/withResolvers.d.ts.map +1 -0
  49. package/actions/public/waitForTransactionReceipt.ts +162 -156
  50. package/chains/definitions/worldchain.ts +38 -1
  51. package/chains/definitions/worldchainSepolia.ts +37 -1
  52. package/chains/definitions/xdc.ts +5 -5
  53. package/errors/version.ts +1 -1
  54. package/linea/actions/estimateGas.ts +1 -11
  55. package/op-stack/chains.ts +2 -0
  56. package/package.json +1 -1
  57. package/utils/promise/createBatchScheduler.ts +12 -16
  58. package/utils/promise/withResolvers.ts +19 -0
@@ -1,20 +1,60 @@
1
1
  export declare const worldchain: {
2
2
  blockExplorers: {
3
3
  readonly default: {
4
- readonly name: "World Chain Explorer";
4
+ readonly name: "Worldscan";
5
+ readonly url: "https://worldscan.org";
6
+ readonly apiUrl: "https://api.worldscan.org/api";
7
+ };
8
+ readonly blockscout: {
9
+ readonly name: "Blockscout";
5
10
  readonly url: "https://worldchain-mainnet.explorer.alchemy.com";
11
+ readonly apiUrl: "https://worldchain-mainnet.explorer.alchemy.com/api";
12
+ };
13
+ };
14
+ contracts: {
15
+ readonly multicall3: {
16
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
17
+ readonly blockCreated: 0;
18
+ };
19
+ readonly disputeGameFactory: {
20
+ readonly 1: {
21
+ readonly address: "0x0E90dCAFBC242D2C861A20Bb20EC8E7182965a52";
22
+ };
23
+ };
24
+ readonly l2OutputOracle: {
25
+ readonly 1: {
26
+ readonly address: "0x19A6d1E9034596196295CF148509796978343c5D";
27
+ };
28
+ };
29
+ readonly portal: {
30
+ readonly 1: {
31
+ readonly address: "0xd5ec14a83B7d95BE1E2Ac12523e2dEE12Cbeea6C";
32
+ };
33
+ };
34
+ readonly l1StandardBridge: {
35
+ readonly 1: {
36
+ readonly address: "0x470458C91978D2d929704489Ad730DC3E3001113";
37
+ };
38
+ };
39
+ readonly gasPriceOracle: {
40
+ readonly address: "0x420000000000000000000000000000000000000F";
41
+ };
42
+ readonly l1Block: {
43
+ readonly address: "0x4200000000000000000000000000000000000015";
44
+ };
45
+ readonly l2CrossDomainMessenger: {
46
+ readonly address: "0x4200000000000000000000000000000000000007";
47
+ };
48
+ readonly l2Erc721Bridge: {
49
+ readonly address: "0x4200000000000000000000000000000000000014";
50
+ };
51
+ readonly l2StandardBridge: {
52
+ readonly address: "0x4200000000000000000000000000000000000010";
53
+ };
54
+ readonly l2ToL1MessagePasser: {
55
+ readonly address: "0x4200000000000000000000000000000000000016";
6
56
  };
7
57
  };
8
- contracts?: import("../index.js").Prettify<{
9
- [key: string]: import("../../index.js").ChainContract | {
10
- [sourceId: number]: import("../../index.js").ChainContract | undefined;
11
- } | undefined;
12
- } & {
13
- ensRegistry?: import("../../index.js").ChainContract | undefined;
14
- ensUniversalResolver?: import("../../index.js").ChainContract | undefined;
15
- multicall3?: import("../../index.js").ChainContract | undefined;
16
- universalSignatureVerifier?: import("../../index.js").ChainContract | undefined;
17
- }> | undefined;
18
58
  id: 480;
19
59
  name: "World Chain";
20
60
  nativeCurrency: {
@@ -27,7 +67,7 @@ export declare const worldchain: {
27
67
  readonly http: readonly ["https://worldchain-mainnet.g.alchemy.com/public"];
28
68
  };
29
69
  };
30
- sourceId?: number | undefined;
70
+ sourceId: 1;
31
71
  testnet: false;
32
72
  custom?: Record<string, unknown> | undefined;
33
73
  fees?: import("../../index.js").ChainFees<undefined> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"worldchain.d.ts","sourceRoot":"","sources":["../../../chains/definitions/worldchain.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;mBAgBm7B,CAAC;4BAA0D,CAAC;kBAAgD,CAAC;kCAAgE,CAAC;;;;;;;;;;;;;;;;;;;;;CADtnC,CAAA"}
1
+ {"version":3,"file":"worldchain.d.ts","sourceRoot":"","sources":["../../../chains/definitions/worldchain.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDrB,CAAA"}
@@ -1,20 +1,59 @@
1
1
  export declare const worldchainSepolia: {
2
2
  blockExplorers: {
3
3
  readonly default: {
4
- readonly name: "World Chain Sepolia Explorer";
4
+ readonly name: "Worldscan Sepolia";
5
+ readonly url: "https://sepolia.worldscan.org";
6
+ };
7
+ readonly blockscout: {
8
+ readonly name: "Blockscout";
5
9
  readonly url: "https://worldchain-sepolia.explorer.alchemy.com";
10
+ readonly apiUrl: "https://worldchain-sepolia.explorer.alchemy.com/api";
11
+ };
12
+ };
13
+ contracts: {
14
+ readonly multicall3: {
15
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
16
+ readonly blockCreated: 0;
17
+ };
18
+ readonly disputeGameFactory: {
19
+ readonly 11155111: {
20
+ readonly address: "0x8cF97Ee616C986a070F5020d973b456D0120C253";
21
+ };
22
+ };
23
+ readonly l2OutputOracle: {
24
+ readonly 11155111: {
25
+ readonly address: "0xc8886f8BAb6Eaeb215aDB5f1c686BF699248300e";
26
+ };
27
+ };
28
+ readonly portal: {
29
+ readonly 11155111: {
30
+ readonly address: "0xFf6EBa109271fe6d4237EeeD4bAb1dD9A77dD1A4";
31
+ };
32
+ };
33
+ readonly l1StandardBridge: {
34
+ readonly 11155111: {
35
+ readonly address: "0xd7DF54b3989855eb66497301a4aAEc33Dbb3F8DE";
36
+ };
37
+ };
38
+ readonly gasPriceOracle: {
39
+ readonly address: "0x420000000000000000000000000000000000000F";
40
+ };
41
+ readonly l1Block: {
42
+ readonly address: "0x4200000000000000000000000000000000000015";
43
+ };
44
+ readonly l2CrossDomainMessenger: {
45
+ readonly address: "0x4200000000000000000000000000000000000007";
46
+ };
47
+ readonly l2Erc721Bridge: {
48
+ readonly address: "0x4200000000000000000000000000000000000014";
49
+ };
50
+ readonly l2StandardBridge: {
51
+ readonly address: "0x4200000000000000000000000000000000000010";
52
+ };
53
+ readonly l2ToL1MessagePasser: {
54
+ readonly address: "0x4200000000000000000000000000000000000016";
6
55
  };
7
56
  };
8
- contracts?: import("../index.js").Prettify<{
9
- [key: string]: import("../../index.js").ChainContract | {
10
- [sourceId: number]: import("../../index.js").ChainContract | undefined;
11
- } | undefined;
12
- } & {
13
- ensRegistry?: import("../../index.js").ChainContract | undefined;
14
- ensUniversalResolver?: import("../../index.js").ChainContract | undefined;
15
- multicall3?: import("../../index.js").ChainContract | undefined;
16
- universalSignatureVerifier?: import("../../index.js").ChainContract | undefined;
17
- }> | undefined;
18
57
  id: 4801;
19
58
  name: "World Chain Sepolia";
20
59
  nativeCurrency: {
@@ -30,7 +69,7 @@ export declare const worldchainSepolia: {
30
69
  readonly http: readonly ["https://worldchain-sepolia.g.alchemy.com/public"];
31
70
  };
32
71
  };
33
- sourceId?: number | undefined;
72
+ sourceId: 11155111;
34
73
  testnet: true;
35
74
  custom?: Record<string, unknown> | undefined;
36
75
  fees?: import("../../index.js").ChainFees<undefined> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"worldchainSepolia.d.ts","sourceRoot":"","sources":["../../../chains/definitions/worldchainSepolia.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;mBAiBk0B,CAAC;4BAA0D,CAAC;kBAAgD,CAAC;kCAAgE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAD5gC,CAAA"}
1
+ {"version":3,"file":"worldchainSepolia.d.ts","sourceRoot":"","sources":["../../../chains/definitions/worldchainSepolia.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiD5B,CAAA"}
@@ -1,14 +1,14 @@
1
1
  export declare const xdc: {
2
2
  blockExplorers: {
3
3
  readonly default: {
4
- readonly name: "Blocksscan";
5
- readonly url: "https://xdc.blocksscan.io";
4
+ readonly name: "XDCScan";
5
+ readonly url: "https://xdcscan.com";
6
6
  };
7
7
  };
8
8
  contracts: {
9
9
  readonly multicall3: {
10
- readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
11
- readonly blockCreated: 71542788;
10
+ readonly address: "0x0B1795ccA8E4eC4df02346a082df54D437F8D9aF";
11
+ readonly blockCreated: 75884020;
12
12
  };
13
13
  };
14
14
  id: 50;
@@ -20,7 +20,7 @@ export declare const xdc: {
20
20
  };
21
21
  rpcUrls: {
22
22
  readonly default: {
23
- readonly http: readonly ["https://rpc.xinfin.network"];
23
+ readonly http: readonly ["https://rpc.xdcrpc.com"];
24
24
  };
25
25
  };
26
26
  sourceId?: number | undefined;
@@ -1,2 +1,2 @@
1
- export declare const version = "2.21.33";
1
+ export declare const version = "2.21.34";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"estimateGas.d.ts","sourceRoot":"","sources":["../../../linea/actions/estimateGas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,qBAAqB,IAAI,0BAA0B,EAAE,MAAM,qCAAqC,CAAA;AAK9G,OAAO,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MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAajD,MAAM,MAAM,qBAAqB,CAC/B,KAAK,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACnD,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACvD,0BAA0B,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;AAEpE,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,SAAS,KAAK,GAAG,SAAS,EAC/B,OAAO,SAAS,OAAO,GAAG,SAAS,EAEnC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,EACzC,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,GACjC,OAAO,CAAC,qBAAqB,CAAC,CAkEhC"}
@@ -15,6 +15,8 @@ export { shape } from '../chains/definitions/shape.js';
15
15
  export { snax } from '../chains/definitions/snax.js';
16
16
  export { snaxTestnet } from '../chains/definitions/snaxTestnet.js';
17
17
  export { soneiumMinato } from '../chains/definitions/soneiumMinato.js';
18
+ export { worldchain } from '../chains/definitions/worldchain.js';
19
+ export { worldchainSepolia } from '../chains/definitions/worldchainSepolia.js';
18
20
  export { zora } from '../chains/definitions/zora.js';
19
21
  export { zoraSepolia } from '../chains/definitions/zoraSepolia.js';
20
22
  export { zoraTestnet } from '../chains/definitions/zoraTestnet.js';
@@ -1 +1 @@
1
- {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../op-stack/chains.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAC5D,OAAO,E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E,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAA;CACxD,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,SAAS,CAAA;AAIrD,gBAAgB;AAChB,wBAAgB,oBAAoB,CAClC,UAAU,EACV,UAAU,SAAS,SAAS,OAAO,EAAE,EACrC,EACA,EAAE,EACF,EAAE,EACF,gBAAgB,EAChB,IAAQ,EACR,IAAI,GACL,EAAE,6BAA6B,CAC9B,UAAU,EACV,UAAU,CACX,GAAG,8BAA8B,CAAC,UAAU,EAAE,UAAU,CAAC,CAuDzD"}
@@ -0,0 +1,9 @@
1
+ /** @internal */
2
+ export type PromiseWithResolvers<type> = {
3
+ promise: Promise<type>;
4
+ resolve: (value: type | PromiseLike<type>) => void;
5
+ reject: (reason?: unknown) => void;
6
+ };
7
+ /** @internal */
8
+ export declare function withResolvers<type>(): PromiseWithResolvers<type>;
9
+ //# sourceMappingURL=withResolvers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withResolvers.d.ts","sourceRoot":"","sources":["../../../utils/promise/withResolvers.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,MAAM,MAAM,oBAAoB,CAAC,IAAI,IAAI;IACvC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;IAClD,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC,CAAA;AAED,gBAAgB;AAChB,wBAAgB,aAAa,CAAC,IAAI,KAAK,oBAAoB,CAAC,IAAI,CAAC,CAUhE"}
@@ -12,6 +12,7 @@ import type { Hash } from '../../types/misc.js'
12
12
  import type { Transaction } from '../../types/transaction.js'
13
13
  import { getAction } from '../../utils/getAction.js'
14
14
  import { type ObserveErrorType, observe } from '../../utils/observe.js'
15
+ import { withResolvers } from '../../utils/promise/withResolvers.js'
15
16
  import {
16
17
  type WithRetryParameters,
17
18
  withRetry,
@@ -149,189 +150,194 @@ export async function waitForTransactionReceipt<
149
150
  let receipt: GetTransactionReceiptReturnType<chain>
150
151
  let retrying = false
151
152
 
152
- return new Promise((resolve, reject) => {
153
- if (timeout)
154
- setTimeout(
153
+ const { promise, resolve, reject } =
154
+ withResolvers<WaitForTransactionReceiptReturnType<chain>>()
155
+
156
+ const timer = timeout
157
+ ? setTimeout(
155
158
  () => reject(new WaitForTransactionReceiptTimeoutError({ hash })),
156
159
  timeout,
157
160
  )
161
+ : undefined
162
+
163
+ const _unobserve = observe(
164
+ observerId,
165
+ { onReplaced, resolve, reject },
166
+ (emit) => {
167
+ const _unwatch = getAction(
168
+ client,
169
+ watchBlockNumber,
170
+ 'watchBlockNumber',
171
+ )({
172
+ emitMissed: true,
173
+ emitOnBegin: true,
174
+ poll: true,
175
+ pollingInterval,
176
+ async onBlockNumber(blockNumber_) {
177
+ const done = (fn: () => void) => {
178
+ clearTimeout(timer)
179
+ _unwatch()
180
+ fn()
181
+ _unobserve()
182
+ }
183
+
184
+ let blockNumber = blockNumber_
185
+
186
+ if (retrying) return
187
+
188
+ try {
189
+ // If we already have a valid receipt, let's check if we have enough
190
+ // confirmations. If we do, then we can resolve.
191
+ if (receipt) {
192
+ if (
193
+ confirmations > 1 &&
194
+ (!receipt.blockNumber ||
195
+ blockNumber - receipt.blockNumber + 1n < confirmations)
196
+ )
197
+ return
158
198
 
159
- const _unobserve = observe(
160
- observerId,
161
- { onReplaced, resolve, reject },
162
- (emit) => {
163
- const _unwatch = getAction(
164
- client,
165
- watchBlockNumber,
166
- 'watchBlockNumber',
167
- )({
168
- emitMissed: true,
169
- emitOnBegin: true,
170
- poll: true,
171
- pollingInterval,
172
- async onBlockNumber(blockNumber_) {
173
- const done = (fn: () => void) => {
174
- _unwatch()
175
- fn()
176
- _unobserve()
199
+ done(() => emit.resolve(receipt))
200
+ return
177
201
  }
178
202
 
179
- let blockNumber = blockNumber_
203
+ // Get the transaction to check if it's been replaced.
204
+ // We need to retry as some RPC Providers may be slow to sync
205
+ // up mined transactions.
206
+ if (!transaction) {
207
+ retrying = true
208
+ await withRetry(
209
+ async () => {
210
+ transaction = (await getAction(
211
+ client,
212
+ getTransaction,
213
+ 'getTransaction',
214
+ )({ hash })) as GetTransactionReturnType<chain>
215
+ if (transaction.blockNumber)
216
+ blockNumber = transaction.blockNumber
217
+ },
218
+ {
219
+ delay: retryDelay,
220
+ retryCount,
221
+ },
222
+ )
223
+ retrying = false
224
+ }
180
225
 
181
- if (retrying) return
226
+ // Get the receipt to check if it's been processed.
227
+ receipt = await getAction(
228
+ client,
229
+ getTransactionReceipt,
230
+ 'getTransactionReceipt',
231
+ )({ hash })
182
232
 
183
- try {
184
- // If we already have a valid receipt, let's check if we have enough
185
- // confirmations. If we do, then we can resolve.
186
- if (receipt) {
187
- if (
188
- confirmations > 1 &&
189
- (!receipt.blockNumber ||
190
- blockNumber - receipt.blockNumber + 1n < confirmations)
191
- )
192
- return
233
+ // Check if we have enough confirmations. If not, continue polling.
234
+ if (
235
+ confirmations > 1 &&
236
+ (!receipt.blockNumber ||
237
+ blockNumber - receipt.blockNumber + 1n < confirmations)
238
+ )
239
+ return
193
240
 
194
- done(() => emit.resolve(receipt))
241
+ done(() => emit.resolve(receipt))
242
+ } catch (err) {
243
+ // If the receipt is not found, the transaction will be pending.
244
+ // We need to check if it has potentially been replaced.
245
+ if (
246
+ err instanceof TransactionNotFoundError ||
247
+ err instanceof TransactionReceiptNotFoundError
248
+ ) {
249
+ if (!transaction) {
250
+ retrying = false
195
251
  return
196
252
  }
197
253
 
198
- // Get the transaction to check if it's been replaced.
199
- // We need to retry as some RPC Providers may be slow to sync
200
- // up mined transactions.
201
- if (!transaction) {
254
+ try {
255
+ replacedTransaction = transaction
256
+
257
+ // Let's retrieve the transactions from the current block.
258
+ // We need to retry as some RPC Providers may be slow to sync
259
+ // up mined blocks.
202
260
  retrying = true
203
- await withRetry(
204
- async () => {
205
- transaction = (await getAction(
261
+ const block = await withRetry(
262
+ () =>
263
+ getAction(
206
264
  client,
207
- getTransaction,
208
- 'getTransaction',
209
- )({ hash })) as GetTransactionReturnType<chain>
210
- if (transaction.blockNumber)
211
- blockNumber = transaction.blockNumber
212
- },
265
+ getBlock,
266
+ 'getBlock',
267
+ )({
268
+ blockNumber,
269
+ includeTransactions: true,
270
+ }),
213
271
  {
214
272
  delay: retryDelay,
215
273
  retryCount,
274
+ shouldRetry: ({ error }) =>
275
+ error instanceof BlockNotFoundError,
216
276
  },
217
277
  )
218
278
  retrying = false
219
- }
220
-
221
- // Get the receipt to check if it's been processed.
222
- receipt = await getAction(
223
- client,
224
- getTransactionReceipt,
225
- 'getTransactionReceipt',
226
- )({ hash })
227
279
 
228
- // Check if we have enough confirmations. If not, continue polling.
229
- if (
230
- confirmations > 1 &&
231
- (!receipt.blockNumber ||
232
- blockNumber - receipt.blockNumber + 1n < confirmations)
233
- )
234
- return
235
-
236
- done(() => emit.resolve(receipt))
237
- } catch (err) {
238
- // If the receipt is not found, the transaction will be pending.
239
- // We need to check if it has potentially been replaced.
240
- if (
241
- err instanceof TransactionNotFoundError ||
242
- err instanceof TransactionReceiptNotFoundError
243
- ) {
244
- if (!transaction) {
245
- retrying = false
246
- return
247
- }
248
-
249
- try {
250
- replacedTransaction = transaction
251
-
252
- // Let's retrieve the transactions from the current block.
253
- // We need to retry as some RPC Providers may be slow to sync
254
- // up mined blocks.
255
- retrying = true
256
- const block = await withRetry(
257
- () =>
258
- getAction(
259
- client,
260
- getBlock,
261
- 'getBlock',
262
- )({
263
- blockNumber,
264
- includeTransactions: true,
265
- }),
266
- {
267
- delay: retryDelay,
268
- retryCount,
269
- shouldRetry: ({ error }) =>
270
- error instanceof BlockNotFoundError,
271
- },
272
- )
273
- retrying = false
274
-
275
- const replacementTransaction = (
276
- block.transactions as {} as Transaction[]
277
- ).find(
278
- ({ from, nonce }) =>
279
- from === replacedTransaction!.from &&
280
- nonce === replacedTransaction!.nonce,
281
- )
280
+ const replacementTransaction = (
281
+ block.transactions as {} as Transaction[]
282
+ ).find(
283
+ ({ from, nonce }) =>
284
+ from === replacedTransaction!.from &&
285
+ nonce === replacedTransaction!.nonce,
286
+ )
282
287
 
283
- // If we couldn't find a replacement transaction, continue polling.
284
- if (!replacementTransaction) return
288
+ // If we couldn't find a replacement transaction, continue polling.
289
+ if (!replacementTransaction) return
285
290
 
286
- // If we found a replacement transaction, return it's receipt.
287
- receipt = await getAction(
288
- client,
289
- getTransactionReceipt,
290
- 'getTransactionReceipt',
291
- )({
292
- hash: replacementTransaction.hash,
293
- })
291
+ // If we found a replacement transaction, return it's receipt.
292
+ receipt = await getAction(
293
+ client,
294
+ getTransactionReceipt,
295
+ 'getTransactionReceipt',
296
+ )({
297
+ hash: replacementTransaction.hash,
298
+ })
294
299
 
295
- // Check if we have enough confirmations. If not, continue polling.
296
- if (
297
- confirmations > 1 &&
298
- (!receipt.blockNumber ||
299
- blockNumber - receipt.blockNumber + 1n < confirmations)
300
- )
301
- return
300
+ // Check if we have enough confirmations. If not, continue polling.
301
+ if (
302
+ confirmations > 1 &&
303
+ (!receipt.blockNumber ||
304
+ blockNumber - receipt.blockNumber + 1n < confirmations)
305
+ )
306
+ return
302
307
 
303
- let reason: ReplacementReason = 'replaced'
304
- if (
305
- replacementTransaction.to === replacedTransaction.to &&
306
- replacementTransaction.value === replacedTransaction.value
307
- ) {
308
- reason = 'repriced'
309
- } else if (
310
- replacementTransaction.from === replacementTransaction.to &&
311
- replacementTransaction.value === 0n
312
- ) {
313
- reason = 'cancelled'
314
- }
308
+ let reason: ReplacementReason = 'replaced'
309
+ if (
310
+ replacementTransaction.to === replacedTransaction.to &&
311
+ replacementTransaction.value === replacedTransaction.value
312
+ ) {
313
+ reason = 'repriced'
314
+ } else if (
315
+ replacementTransaction.from === replacementTransaction.to &&
316
+ replacementTransaction.value === 0n
317
+ ) {
318
+ reason = 'cancelled'
319
+ }
315
320
 
316
- done(() => {
317
- emit.onReplaced?.({
318
- reason,
319
- replacedTransaction: replacedTransaction! as any,
320
- transaction: replacementTransaction,
321
- transactionReceipt: receipt,
322
- })
323
- emit.resolve(receipt)
321
+ done(() => {
322
+ emit.onReplaced?.({
323
+ reason,
324
+ replacedTransaction: replacedTransaction! as any,
325
+ transaction: replacementTransaction,
326
+ transactionReceipt: receipt,
324
327
  })
325
- } catch (err_) {
326
- done(() => emit.reject(err_))
327
- }
328
- } else {
329
- done(() => emit.reject(err))
328
+ emit.resolve(receipt)
329
+ })
330
+ } catch (err_) {
331
+ done(() => emit.reject(err_))
330
332
  }
333
+ } else {
334
+ done(() => emit.reject(err))
331
335
  }
332
- },
333
- })
334
- },
335
- )
336
- })
336
+ }
337
+ },
338
+ })
339
+ },
340
+ )
341
+
342
+ return promise
337
343
  }