@gardenfi/utils 2.1.3-beta.2 → 2.1.3-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +1 -1
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +75 -46
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +4 -4
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +1 -1
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +1 -1
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +1 -1
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +1 -1
- package/dist/index125.cjs +1 -1
- package/dist/index125.js +1 -1
- package/dist/index166.cjs +1 -1
- package/dist/index166.js +36 -34
- package/dist/index192.cjs +1 -1
- package/dist/index192.js +27 -25
- package/dist/index203.cjs +1 -1
- package/dist/index203.js +16 -16
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +6 -6
- package/dist/index222.cjs +1 -1
- package/dist/index222.js +2 -2
- package/dist/index225.cjs +1 -1
- package/dist/index225.js +43 -43
- package/dist/index226.cjs +1 -1
- package/dist/index226.js +3 -113
- package/dist/index228.cjs +1 -1
- package/dist/index228.js +14 -14
- package/dist/index230.cjs +1 -1
- package/dist/index230.js +10 -25
- package/dist/index231.cjs +1 -1
- package/dist/index231.js +16 -13
- package/dist/index232.cjs +1 -1
- package/dist/index232.js +21 -14
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +30 -5
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +2 -14
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +12 -9
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +12 -16
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +47 -10
- package/dist/index238.cjs +1 -1
- package/dist/index238.js +10 -15
- package/dist/index239.cjs +1 -1
- package/dist/index239.js +7 -22
- package/dist/index240.cjs +1 -1
- package/dist/index240.js +9 -30
- package/dist/index241.cjs +1 -1
- package/dist/index241.js +14 -2
- package/dist/index242.cjs +1 -1
- package/dist/index242.js +14 -13
- package/dist/index243.cjs +1 -1
- package/dist/index243.js +9 -12
- package/dist/index244.cjs +1 -1
- package/dist/index244.js +24 -47
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +12 -11
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +24 -7
- package/dist/index247.cjs +1 -1
- package/dist/index247.js +12 -8
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +15 -13
- package/dist/index249.cjs +2 -1
- package/dist/index249.js +21 -11
- package/dist/index250.cjs +1 -1
- package/dist/index250.js +52 -9
- package/dist/index251.cjs +1 -1
- package/dist/index251.js +25 -24
- package/dist/index252.cjs +1 -1
- package/dist/index252.js +13 -12
- package/dist/index253.cjs +1 -1
- package/dist/index253.js +15 -24
- package/dist/index254.cjs +1 -2
- package/dist/index254.js +5 -24
- package/dist/index255.cjs +1 -1
- package/dist/index255.js +12 -12
- package/dist/index256.cjs +1 -1
- package/dist/index256.js +10 -15
- package/dist/index257.cjs +1 -1
- package/dist/index257.js +16 -52
- package/dist/index266.cjs +1 -1
- package/dist/index266.js +1 -1
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +103 -16
- package/dist/index278.cjs +1 -1
- package/dist/index278.js +5 -222
- package/dist/index279.cjs +1 -1
- package/dist/index279.js +224 -6
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +2 -2
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +7 -7
- package/dist/index281.cjs +1 -1
- package/dist/index281.js +7 -27
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +26 -34
- package/dist/index283.cjs +1 -1
- package/dist/index283.js +13 -12
- package/dist/index284.cjs +1 -1
- package/dist/index284.js +124 -48
- package/dist/index285.cjs +1 -1
- package/dist/index285.js +3 -67
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +137 -37
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +156 -2
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +8 -205
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +113 -3
- package/dist/index290.cjs +2 -1
- package/dist/index290.js +122 -128
- package/dist/index291.cjs +1 -1
- package/dist/index291.js +137 -153
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +42 -9
- package/dist/index293.cjs +1 -1
- package/dist/index293.js +72 -107
- package/dist/index294.cjs +1 -2
- package/dist/index294.js +2 -135
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +68 -11
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +696 -17
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +200 -67
- package/dist/index298.cjs +2 -1
- package/dist/index298.js +63 -639
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +4 -172
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +1 -1
- package/dist/index300.cjs +1 -2
- package/dist/index300.js +39 -65
- package/dist/index301.cjs +1 -1
- package/dist/index301.js +7 -4
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +60 -38
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +77 -7
- package/dist/index304.cjs +1 -1
- package/dist/index304.js +4 -63
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +181 -64
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +12 -4
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +19 -194
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +3 -3
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +1 -1
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +5 -105
- package/dist/index312.cjs +1 -1
- package/dist/index312.js +2 -5
- package/dist/index313.cjs +1 -1
- package/dist/index313.js +22 -2
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +41 -41
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +29 -24
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +40 -21
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +24 -24
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +2 -2
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +1 -1
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +2 -2
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +1 -1
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -2
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +98 -97
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +2 -2
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +1 -1
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +1 -1
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +1 -1
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +4 -4
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +1 -1
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +1 -1
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +1 -1
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +53 -51
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +56 -55
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +55 -59
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +1 -1
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +1 -1
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +44 -42
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +41 -41
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +35 -34
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +28 -28
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +26 -26
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +1 -1
- package/package.json +1 -1
- package/dist/index314.cjs +0 -1
- package/dist/index314.js +0 -22
- package/dist/index315.cjs +0 -1
- package/dist/index315.js +0 -74
- package/dist/index316.cjs +0 -1
- package/dist/index316.js +0 -24
package/dist/index84.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { multicall3Abi as
|
|
2
|
-
import { AbiDecodingZeroDataError as
|
|
3
|
-
import { BaseError as
|
|
4
|
-
import { RawContractError as
|
|
5
|
-
import { decodeFunctionResult as
|
|
6
|
-
import { encodeFunctionData as
|
|
7
|
-
import { getChainContractAddress as
|
|
8
|
-
import { getContractError as
|
|
9
|
-
import { getAction as
|
|
10
|
-
import { readContract as
|
|
11
|
-
async function
|
|
12
|
-
var
|
|
13
|
-
const { allowFailure: u = !0, batchSize:
|
|
14
|
-
let
|
|
15
|
-
if (!
|
|
1
|
+
import { multicall3Abi as P } from "./index21.js";
|
|
2
|
+
import { AbiDecodingZeroDataError as _ } from "./index122.js";
|
|
3
|
+
import { BaseError as v } from "./index38.js";
|
|
4
|
+
import { RawContractError as q } from "./index127.js";
|
|
5
|
+
import { decodeFunctionResult as B } from "./index170.js";
|
|
6
|
+
import { encodeFunctionData as O } from "./index177.js";
|
|
7
|
+
import { getChainContractAddress as T } from "./index214.js";
|
|
8
|
+
import { getContractError as F } from "./index221.js";
|
|
9
|
+
import { getAction as Z } from "./index29.js";
|
|
10
|
+
import { readContract as G } from "./index33.js";
|
|
11
|
+
async function X(n, w) {
|
|
12
|
+
var D;
|
|
13
|
+
const { account: b, allowFailure: u = !0, batchSize: j, blockNumber: p, blockTag: y, multicallAddress: N, stateOverride: R } = w, d = w.contracts, C = j ?? (typeof ((D = n.batch) == null ? void 0 : D.multicall) == "object" && n.batch.multicall.batchSize || 1024);
|
|
14
|
+
let m = N;
|
|
15
|
+
if (!m) {
|
|
16
16
|
if (!n.chain)
|
|
17
17
|
throw new Error("client chain not configured. multicallAddress is required.");
|
|
18
|
-
|
|
19
|
-
blockNumber:
|
|
18
|
+
m = T({
|
|
19
|
+
blockNumber: p,
|
|
20
20
|
chain: n.chain,
|
|
21
21
|
contract: "multicall3"
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const e = [[]];
|
|
25
25
|
let a = 0, f = 0;
|
|
26
|
-
for (let t = 0; t <
|
|
27
|
-
const { abi: o, address: s, args: r, functionName: i } =
|
|
26
|
+
for (let t = 0; t < d.length; t++) {
|
|
27
|
+
const { abi: o, address: s, args: r, functionName: i } = d[t];
|
|
28
28
|
try {
|
|
29
|
-
const c =
|
|
29
|
+
const c = O({ abi: o, args: r, functionName: i });
|
|
30
30
|
f += (c.length - 2) / 2, // Check if batching is enabled.
|
|
31
|
-
|
|
32
|
-
f >
|
|
31
|
+
C > 0 && // Check if the current size of the batch exceeds the size limit.
|
|
32
|
+
f > C && // Check if the current chunk is not already empty.
|
|
33
33
|
e[a].length > 0 && (a++, f = (c.length - 2) / 2, e[a] = []), e[a] = [
|
|
34
34
|
...e[a],
|
|
35
35
|
{
|
|
@@ -39,12 +39,13 @@ async function W(n, w) {
|
|
|
39
39
|
}
|
|
40
40
|
];
|
|
41
41
|
} catch (c) {
|
|
42
|
-
const g =
|
|
42
|
+
const g = F(c, {
|
|
43
43
|
abi: o,
|
|
44
44
|
address: s,
|
|
45
45
|
args: r,
|
|
46
46
|
docsPath: "/docs/contract/multicall",
|
|
47
|
-
functionName: i
|
|
47
|
+
functionName: i,
|
|
48
|
+
sender: b
|
|
48
49
|
});
|
|
49
50
|
if (!u)
|
|
50
51
|
throw g;
|
|
@@ -58,17 +59,18 @@ async function W(n, w) {
|
|
|
58
59
|
];
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
const
|
|
62
|
-
abi:
|
|
63
|
-
|
|
62
|
+
const A = await Promise.allSettled(e.map((t) => Z(n, G, "readContract")({
|
|
63
|
+
abi: P,
|
|
64
|
+
account: b,
|
|
65
|
+
address: m,
|
|
64
66
|
args: [t],
|
|
65
|
-
blockNumber:
|
|
66
|
-
blockTag:
|
|
67
|
+
blockNumber: p,
|
|
68
|
+
blockTag: y,
|
|
67
69
|
functionName: "aggregate3",
|
|
68
|
-
stateOverride:
|
|
70
|
+
stateOverride: R
|
|
69
71
|
}))), l = [];
|
|
70
|
-
for (let t = 0; t <
|
|
71
|
-
const o =
|
|
72
|
+
for (let t = 0; t < A.length; t++) {
|
|
73
|
+
const o = A[t];
|
|
72
74
|
if (o.status === "rejected") {
|
|
73
75
|
if (!u)
|
|
74
76
|
throw o.reason;
|
|
@@ -82,37 +84,37 @@ async function W(n, w) {
|
|
|
82
84
|
}
|
|
83
85
|
const s = o.value;
|
|
84
86
|
for (let r = 0; r < s.length; r++) {
|
|
85
|
-
const { returnData: i, success: c } = s[r], { callData: g } = e[t][r], { abi:
|
|
87
|
+
const { returnData: i, success: c } = s[r], { callData: g } = e[t][r], { abi: S, address: x, functionName: k, args: z } = d[l.length];
|
|
86
88
|
try {
|
|
87
89
|
if (g === "0x")
|
|
88
|
-
throw new
|
|
90
|
+
throw new _();
|
|
89
91
|
if (!c)
|
|
90
|
-
throw new
|
|
91
|
-
const
|
|
92
|
-
abi:
|
|
93
|
-
args:
|
|
92
|
+
throw new q({ data: i });
|
|
93
|
+
const h = B({
|
|
94
|
+
abi: S,
|
|
95
|
+
args: z,
|
|
94
96
|
data: i,
|
|
95
|
-
functionName:
|
|
97
|
+
functionName: k
|
|
96
98
|
});
|
|
97
|
-
l.push(u ? { result:
|
|
98
|
-
} catch (
|
|
99
|
-
const
|
|
100
|
-
abi:
|
|
101
|
-
address:
|
|
102
|
-
args:
|
|
99
|
+
l.push(u ? { result: h, status: "success" } : h);
|
|
100
|
+
} catch (h) {
|
|
101
|
+
const E = F(h, {
|
|
102
|
+
abi: S,
|
|
103
|
+
address: x,
|
|
104
|
+
args: z,
|
|
103
105
|
docsPath: "/docs/contract/multicall",
|
|
104
|
-
functionName:
|
|
106
|
+
functionName: k
|
|
105
107
|
});
|
|
106
108
|
if (!u)
|
|
107
|
-
throw
|
|
108
|
-
l.push({ error:
|
|
109
|
+
throw E;
|
|
110
|
+
l.push({ error: E, result: void 0, status: "failure" });
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
|
-
if (l.length !==
|
|
113
|
-
throw new
|
|
114
|
+
if (l.length !== d.length)
|
|
115
|
+
throw new v("multicall results mismatch");
|
|
114
116
|
return l;
|
|
115
117
|
}
|
|
116
118
|
export {
|
|
117
|
-
|
|
119
|
+
X as multicall
|
|
118
120
|
};
|
package/dist/index85.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index233.cjs"),B=require("./index45.cjs"),D=require("./index122.cjs"),F=require("./index127.cjs"),C=require("./index143.cjs"),H=require("./index170.cjs"),A=require("./index177.cjs"),U=require("./index154.cjs"),j=require("./index150.cjs"),z=require("./index221.cjs"),I=require("./index244.cjs"),L=require("./index155.cjs"),M=require("./index157.cjs"),P=require("./index184.cjs"),V=require("./index237.cjs"),Z=require("./index197.cjs");async function _(v,x){const{blockNumber:q,blockTag:O="latest",blocks:m,returnFullTransactions:w,traceTransfers:N,validation:R}=x;try{const a=[];for(const t of m){const f=t.blockOverrides?y.toRpc(t.blockOverrides):void 0,r=t.calls.map(c=>{const e=c,o=e.account?B.parseAccount(e.account):void 0,i=e.abi?A.encodeFunctionData(e):e.data,s={...e,data:e.dataSuffix?U.concat([i||"0x",e.dataSuffix]):i,from:e.from??(o==null?void 0:o.address)};return Z.assertRequest(s),P.formatTransactionRequest(s)}),b=t.stateOverrides?V.serializeStateOverride(t.stateOverrides):void 0;a.push({blockOverrides:f,calls:r,stateOverrides:b})}const u=(typeof q=="bigint"?j.numberToHex(q):void 0)||O;return(await v.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:w,traceTransfers:N,validation:R},u]})).map((t,f)=>({...L.formatBlock(t),calls:t.calls.map((r,b)=>{var g,k;const{abi:c,args:e,functionName:o,to:i}=m[f].calls[b],s=((g=r.error)==null?void 0:g.data)??r.returnData,E=BigInt(r.gasUsed),h=(k=r.logs)==null?void 0:k.map(n=>M.formatLog(n)),d=r.status==="0x1"?"success":"failure",S=c&&d==="success"&&s!=="0x"?H.decodeFunctionResult({abi:c,data:s,functionName:o}):null,T=(()=>{var p;if(d==="success")return;let n;if(((p=r.error)==null?void 0:p.data)==="0x"?n=new D.AbiDecodingZeroDataError:r.error&&(n=new F.RawContractError(r.error)),!!n)return z.getContractError(n,{abi:c??[],address:i??"0x",args:e,functionName:o??"<unknown>"})})();return{data:s,gasUsed:E,logs:h,status:d,...d==="success"?{result:S}:{error:T}}})}))}catch(a){const l=a,u=I.getNodeError(l,{});throw u instanceof C.UnknownNodeError?l:u}}exports.simulateBlocks=_;
|
package/dist/index85.js
CHANGED
|
@@ -1,71 +1,72 @@
|
|
|
1
|
-
import { toRpc as
|
|
2
|
-
import { parseAccount as
|
|
3
|
-
import { AbiDecodingZeroDataError as
|
|
4
|
-
import { RawContractError as
|
|
5
|
-
import { UnknownNodeError as
|
|
6
|
-
import { decodeFunctionResult as
|
|
7
|
-
import { encodeFunctionData as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { toRpc as S } from "./index233.js";
|
|
2
|
+
import { parseAccount as y } from "./index45.js";
|
|
3
|
+
import { AbiDecodingZeroDataError as B } from "./index122.js";
|
|
4
|
+
import { RawContractError as C } from "./index127.js";
|
|
5
|
+
import { UnknownNodeError as F } from "./index143.js";
|
|
6
|
+
import { decodeFunctionResult as H } from "./index170.js";
|
|
7
|
+
import { encodeFunctionData as U } from "./index177.js";
|
|
8
|
+
import { concat as A } from "./index154.js";
|
|
9
|
+
import { numberToHex as z } from "./index150.js";
|
|
10
|
+
import { getContractError as I } from "./index221.js";
|
|
11
|
+
import { getNodeError as L } from "./index244.js";
|
|
12
|
+
import { formatBlock as V } from "./index155.js";
|
|
13
|
+
import { formatLog as Z } from "./index157.js";
|
|
14
|
+
import { formatTransactionRequest as _ } from "./index184.js";
|
|
15
|
+
import { serializeStateOverride as j } from "./index237.js";
|
|
16
|
+
import { assertRequest as G } from "./index197.js";
|
|
17
|
+
async function ir(v, w) {
|
|
18
|
+
const { blockNumber: p, blockTag: N = "latest", blocks: b, returnFullTransactions: O, traceTransfers: h, validation: E } = w;
|
|
18
19
|
try {
|
|
19
|
-
const
|
|
20
|
-
for (const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
...
|
|
24
|
-
data:
|
|
25
|
-
from:
|
|
20
|
+
const c = [];
|
|
21
|
+
for (const o of b) {
|
|
22
|
+
const d = o.blockOverrides ? S(o.blockOverrides) : void 0, t = o.calls.map((a) => {
|
|
23
|
+
const r = a, e = r.account ? y(r.account) : void 0, m = r.abi ? U(r) : r.data, s = {
|
|
24
|
+
...r,
|
|
25
|
+
data: r.dataSuffix ? A([m || "0x", r.dataSuffix]) : m,
|
|
26
|
+
from: r.from ?? (e == null ? void 0 : e.address)
|
|
26
27
|
};
|
|
27
|
-
return
|
|
28
|
-
}),
|
|
29
|
-
|
|
30
|
-
blockOverrides:
|
|
31
|
-
calls:
|
|
32
|
-
stateOverrides:
|
|
28
|
+
return G(s), _(s);
|
|
29
|
+
}), l = o.stateOverrides ? j(o.stateOverrides) : void 0;
|
|
30
|
+
c.push({
|
|
31
|
+
blockOverrides: d,
|
|
32
|
+
calls: t,
|
|
33
|
+
stateOverrides: l
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
-
return (await
|
|
36
|
+
const i = (typeof p == "bigint" ? z(p) : void 0) || N;
|
|
37
|
+
return (await v.request({
|
|
37
38
|
method: "eth_simulateV1",
|
|
38
39
|
params: [
|
|
39
|
-
{ blockStateCalls:
|
|
40
|
-
|
|
40
|
+
{ blockStateCalls: c, returnFullTransactions: O, traceTransfers: h, validation: E },
|
|
41
|
+
i
|
|
41
42
|
]
|
|
42
|
-
})).map((
|
|
43
|
-
...
|
|
44
|
-
calls:
|
|
43
|
+
})).map((o, d) => ({
|
|
44
|
+
...V(o),
|
|
45
|
+
calls: o.calls.map((t, l) => {
|
|
45
46
|
var k, g;
|
|
46
|
-
const { abi:
|
|
47
|
-
abi:
|
|
48
|
-
data:
|
|
47
|
+
const { abi: a, args: r, functionName: e, to: m } = b[d].calls[l], s = ((k = t.error) == null ? void 0 : k.data) ?? t.returnData, R = BigInt(t.gasUsed), T = (g = t.logs) == null ? void 0 : g.map((n) => Z(n)), u = t.status === "0x1" ? "success" : "failure", q = a && u === "success" && s !== "0x" ? H({
|
|
48
|
+
abi: a,
|
|
49
|
+
data: s,
|
|
49
50
|
functionName: e
|
|
50
51
|
}) : null, D = (() => {
|
|
51
|
-
var
|
|
52
|
-
if (
|
|
52
|
+
var x;
|
|
53
|
+
if (u === "success")
|
|
53
54
|
return;
|
|
54
|
-
let
|
|
55
|
-
if (((
|
|
56
|
-
return
|
|
57
|
-
abi:
|
|
58
|
-
address:
|
|
59
|
-
args:
|
|
55
|
+
let n;
|
|
56
|
+
if (((x = t.error) == null ? void 0 : x.data) === "0x" ? n = new B() : t.error && (n = new C(t.error)), !!n)
|
|
57
|
+
return I(n, {
|
|
58
|
+
abi: a ?? [],
|
|
59
|
+
address: m ?? "0x",
|
|
60
|
+
args: r,
|
|
60
61
|
functionName: e ?? "<unknown>"
|
|
61
62
|
});
|
|
62
63
|
})();
|
|
63
64
|
return {
|
|
64
|
-
data:
|
|
65
|
+
data: s,
|
|
65
66
|
gasUsed: R,
|
|
66
67
|
logs: T,
|
|
67
|
-
status:
|
|
68
|
-
...
|
|
68
|
+
status: u,
|
|
69
|
+
...u === "success" ? {
|
|
69
70
|
result: q
|
|
70
71
|
} : {
|
|
71
72
|
error: D
|
|
@@ -73,11 +74,11 @@ async function ar(w, x) {
|
|
|
73
74
|
};
|
|
74
75
|
})
|
|
75
76
|
}));
|
|
76
|
-
} catch (
|
|
77
|
-
const
|
|
78
|
-
throw
|
|
77
|
+
} catch (c) {
|
|
78
|
+
const f = c, i = L(f, {});
|
|
79
|
+
throw i instanceof F ? f : i;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
export {
|
|
82
|
-
|
|
83
|
+
ir as simulateBlocks
|
|
83
84
|
};
|
package/dist/index86.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("./index245.cjs"),a=require("./index246.cjs"),K=require("./index45.cjs"),t=require("./index117.cjs"),Q=require("./index118.cjs"),W=require("./index38.cjs"),X=require("./index177.cjs"),Y=require("./index59.cjs"),Z=require("./index85.cjs"),v=require("./index182.cjs"),$="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function _(h,r){const{blockNumber:k,blockTag:C,calls:N,stateOverrides:q,traceAssetChanges:f,traceTransfers:T,validation:w}=r,n=r.account?K.parseAccount(r.account):void 0;if(f&&!n)throw new W.BaseError("`account` is required when `traceAssetChanges` is true");const B=n?z.encode(z.from("constructor(bytes, bytes)"),{bytecode:Q.deploylessCallViaBytecodeBytecode,args:[$,a.encodeData(a.from("function getBalance(address)"),[n.address])]}):void 0,c=f?await Promise.all(r.calls.map(async s=>{if(!s.data&&!s.abi)return;const{accessList:e}=await Y.createAccessList(h,{account:n.address,...s,data:s.abi?X.encodeFunctionData(s):s.data});return e.map(({address:o,storageKeys:d})=>d.length>0?o:null)})).then(s=>s.flat().filter(Boolean)):[],i=await Z.simulateBlocks(h,{blockNumber:k,blockTag:C,blocks:[...f?[{calls:[{data:B}],stateOverrides:q},{calls:c.map((s,e)=>({abi:[a.from("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[n.address],to:s,from:t.zeroAddress,nonce:e})),stateOverrides:[{address:t.zeroAddress,nonce:0}]}]:[],{calls:[...N,{}].map(s=>({...s,from:n==null?void 0:n.address})),stateOverrides:q},...f?[{calls:[{data:B}]},{calls:c.map((s,e)=>({abi:[a.from("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[n.address],to:s,from:t.zeroAddress,nonce:e})),stateOverrides:[{address:t.zeroAddress,nonce:0}]},{calls:c.map((s,e)=>({to:s,abi:[a.from("function decimals() returns (uint256)")],functionName:"decimals",from:t.zeroAddress,nonce:e})),stateOverrides:[{address:t.zeroAddress,nonce:0}]},{calls:c.map((s,e)=>({to:s,abi:[a.from("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:t.zeroAddress,nonce:e})),stateOverrides:[{address:t.zeroAddress,nonce:0}]},{calls:c.map((s,e)=>({to:s,abi:[a.from("function symbol() returns (string)")],functionName:"symbol",from:t.zeroAddress,nonce:e})),stateOverrides:[{address:t.zeroAddress,nonce:0}]}]:[]],traceTransfers:T,validation:w}),P=f?i[2]:i[0],[l,u,,b,m,g,A,p]=f?i:[],{calls:I,...D}=P,F=I.slice(0,-1)??[],L=(l==null?void 0:l.calls)??[],R=(u==null?void 0:u.calls)??[],U=[...L,...R].map(s=>s.status==="success"?v.hexToBigInt(s.data):null),E=(b==null?void 0:b.calls)??[],H=(m==null?void 0:m.calls)??[],S=[...E,...H].map(s=>s.status==="success"?v.hexToBigInt(s.data):null),j=((g==null?void 0:g.calls)??[]).map(s=>s.status==="success"?s.result:null),x=((p==null?void 0:p.calls)??[]).map(s=>s.status==="success"?s.result:null),M=((A==null?void 0:A.calls)??[]).map(s=>s.status==="success"?s.result:null),y=[];for(const[s,e]of S.entries()){const o=U[s];if(typeof e!="bigint"||typeof o!="bigint")continue;const d=j[s-1],V=x[s-1],G=M[s-1],O=s===0?{address:t.ethAddress,decimals:18,symbol:"ETH"}:{address:c[s-1],decimals:G||d?Number(d??1):void 0,symbol:V??void 0};y.some(J=>J.token.address===O.address)||y.push({token:O,value:{pre:o,post:e,diff:e-o}})}return{assetChanges:y,block:D,results:F}}exports.simulateCalls=_;
|
package/dist/index86.js
CHANGED
|
@@ -1,45 +1,42 @@
|
|
|
1
|
-
import { encode as K, from as M } from "./
|
|
2
|
-
import { encodeData as Q, from as c } from "./
|
|
3
|
-
import { parseAccount as
|
|
4
|
-
import { zeroAddress as
|
|
5
|
-
import { deploylessCallViaBytecodeBytecode as
|
|
6
|
-
import { BaseError as
|
|
7
|
-
import { encodeFunctionData as
|
|
8
|
-
import { createAccessList as
|
|
9
|
-
import { simulateBlocks as
|
|
10
|
-
import { hexToBigInt as
|
|
11
|
-
const
|
|
12
|
-
async function
|
|
13
|
-
const { blockNumber:
|
|
14
|
-
if (a && !
|
|
15
|
-
throw new
|
|
16
|
-
const
|
|
17
|
-
bytecode:
|
|
1
|
+
import { encode as K, from as M } from "./index245.js";
|
|
2
|
+
import { encodeData as Q, from as c } from "./index246.js";
|
|
3
|
+
import { parseAccount as S } from "./index45.js";
|
|
4
|
+
import { zeroAddress as f, ethAddress as W } from "./index117.js";
|
|
5
|
+
import { deploylessCallViaBytecodeBytecode as X } from "./index118.js";
|
|
6
|
+
import { BaseError as Y } from "./index38.js";
|
|
7
|
+
import { encodeFunctionData as Z } from "./index177.js";
|
|
8
|
+
import { createAccessList as _ } from "./index59.js";
|
|
9
|
+
import { simulateBlocks as ss } from "./index85.js";
|
|
10
|
+
import { hexToBigInt as A } from "./index182.js";
|
|
11
|
+
const es = "0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";
|
|
12
|
+
async function us(O, r) {
|
|
13
|
+
const { blockNumber: N, blockTag: w, calls: C, stateOverrides: B, traceAssetChanges: a, traceTransfers: P, validation: T } = r, t = r.account ? S(r.account) : void 0;
|
|
14
|
+
if (a && !t)
|
|
15
|
+
throw new Y("`account` is required when `traceAssetChanges` is true");
|
|
16
|
+
const v = t ? K(M("constructor(bytes, bytes)"), {
|
|
17
|
+
bytecode: X,
|
|
18
18
|
args: [
|
|
19
|
-
|
|
20
|
-
Q(c("function getBalance(address)"), [
|
|
19
|
+
es,
|
|
20
|
+
Q(c("function getBalance(address)"), [t.address])
|
|
21
21
|
]
|
|
22
22
|
}) : void 0, n = a ? await Promise.all(r.calls.map(async (s) => {
|
|
23
23
|
if (!s.data && !s.abi)
|
|
24
24
|
return;
|
|
25
|
-
const { accessList: e } = await
|
|
26
|
-
account:
|
|
25
|
+
const { accessList: e } = await _(O, {
|
|
26
|
+
account: t.address,
|
|
27
27
|
...s,
|
|
28
|
-
data: s.abi ?
|
|
28
|
+
data: s.abi ? Z(s) : s.data
|
|
29
29
|
});
|
|
30
|
-
return e.map(({ address: o, storageKeys:
|
|
31
|
-
})).then((s) => s.flat().filter(Boolean)) : [],
|
|
32
|
-
|
|
33
|
-
nonce: 0
|
|
34
|
-
} : s), l = await es(B, {
|
|
35
|
-
blockNumber: v,
|
|
30
|
+
return e.map(({ address: o, storageKeys: d }) => d.length > 0 ? o : null);
|
|
31
|
+
})).then((s) => s.flat().filter(Boolean)) : [], i = await ss(O, {
|
|
32
|
+
blockNumber: N,
|
|
36
33
|
blockTag: w,
|
|
37
34
|
blocks: [
|
|
38
35
|
...a ? [
|
|
39
36
|
// ETH pre balances
|
|
40
37
|
{
|
|
41
|
-
calls: [{ data:
|
|
42
|
-
stateOverrides:
|
|
38
|
+
calls: [{ data: v }],
|
|
39
|
+
stateOverrides: B
|
|
43
40
|
},
|
|
44
41
|
// Asset pre balances
|
|
45
42
|
{
|
|
@@ -48,31 +45,30 @@ async function bs(B, r) {
|
|
|
48
45
|
c("function balanceOf(address) returns (uint256)")
|
|
49
46
|
],
|
|
50
47
|
functionName: "balanceOf",
|
|
51
|
-
args: [
|
|
48
|
+
args: [t.address],
|
|
52
49
|
to: s,
|
|
53
|
-
from:
|
|
50
|
+
from: f,
|
|
54
51
|
nonce: e
|
|
55
52
|
})),
|
|
56
53
|
stateOverrides: [
|
|
57
54
|
{
|
|
58
|
-
address:
|
|
55
|
+
address: f,
|
|
59
56
|
nonce: 0
|
|
60
57
|
}
|
|
61
58
|
]
|
|
62
59
|
}
|
|
63
60
|
] : [],
|
|
64
61
|
{
|
|
65
|
-
calls: [...C, {}].map((s
|
|
62
|
+
calls: [...C, {}].map((s) => ({
|
|
66
63
|
...s,
|
|
67
|
-
from:
|
|
68
|
-
nonce: e
|
|
64
|
+
from: t == null ? void 0 : t.address
|
|
69
65
|
})),
|
|
70
|
-
stateOverrides:
|
|
66
|
+
stateOverrides: B
|
|
71
67
|
},
|
|
72
68
|
...a ? [
|
|
73
69
|
// ETH post balances
|
|
74
70
|
{
|
|
75
|
-
calls: [{ data:
|
|
71
|
+
calls: [{ data: v }]
|
|
76
72
|
},
|
|
77
73
|
// Asset post balances
|
|
78
74
|
{
|
|
@@ -81,14 +77,14 @@ async function bs(B, r) {
|
|
|
81
77
|
c("function balanceOf(address) returns (uint256)")
|
|
82
78
|
],
|
|
83
79
|
functionName: "balanceOf",
|
|
84
|
-
args: [
|
|
80
|
+
args: [t.address],
|
|
85
81
|
to: s,
|
|
86
|
-
from:
|
|
82
|
+
from: f,
|
|
87
83
|
nonce: e
|
|
88
84
|
})),
|
|
89
85
|
stateOverrides: [
|
|
90
86
|
{
|
|
91
|
-
address:
|
|
87
|
+
address: f,
|
|
92
88
|
nonce: 0
|
|
93
89
|
}
|
|
94
90
|
]
|
|
@@ -101,12 +97,12 @@ async function bs(B, r) {
|
|
|
101
97
|
c("function decimals() returns (uint256)")
|
|
102
98
|
],
|
|
103
99
|
functionName: "decimals",
|
|
104
|
-
from:
|
|
100
|
+
from: f,
|
|
105
101
|
nonce: e
|
|
106
102
|
})),
|
|
107
103
|
stateOverrides: [
|
|
108
104
|
{
|
|
109
|
-
address:
|
|
105
|
+
address: f,
|
|
110
106
|
nonce: 0
|
|
111
107
|
}
|
|
112
108
|
]
|
|
@@ -120,12 +116,12 @@ async function bs(B, r) {
|
|
|
120
116
|
],
|
|
121
117
|
functionName: "tokenURI",
|
|
122
118
|
args: [0n],
|
|
123
|
-
from:
|
|
119
|
+
from: f,
|
|
124
120
|
nonce: e
|
|
125
121
|
})),
|
|
126
122
|
stateOverrides: [
|
|
127
123
|
{
|
|
128
|
-
address:
|
|
124
|
+
address: f,
|
|
129
125
|
nonce: 0
|
|
130
126
|
}
|
|
131
127
|
]
|
|
@@ -136,12 +132,12 @@ async function bs(B, r) {
|
|
|
136
132
|
to: s,
|
|
137
133
|
abi: [c("function symbol() returns (string)")],
|
|
138
134
|
functionName: "symbol",
|
|
139
|
-
from:
|
|
135
|
+
from: f,
|
|
140
136
|
nonce: e
|
|
141
137
|
})),
|
|
142
138
|
stateOverrides: [
|
|
143
139
|
{
|
|
144
|
-
address:
|
|
140
|
+
address: f,
|
|
145
141
|
nonce: 0
|
|
146
142
|
}
|
|
147
143
|
]
|
|
@@ -150,22 +146,22 @@ async function bs(B, r) {
|
|
|
150
146
|
],
|
|
151
147
|
traceTransfers: P,
|
|
152
148
|
validation: T
|
|
153
|
-
}),
|
|
154
|
-
for (const [s, e] of
|
|
155
|
-
const o =
|
|
149
|
+
}), I = a ? i[2] : i[0], [l, u, , b, m, p, g, y] = a ? i : [], { calls: D, ...R } = I, U = D.slice(0, -1) ?? [], E = (l == null ? void 0 : l.calls) ?? [], L = (u == null ? void 0 : u.calls) ?? [], q = [...E, ...L].map((s) => s.status === "success" ? A(s.data) : null), z = (b == null ? void 0 : b.calls) ?? [], F = (m == null ? void 0 : m.calls) ?? [], H = [...z, ...F].map((s) => s.status === "success" ? A(s.data) : null), V = ((p == null ? void 0 : p.calls) ?? []).map((s) => s.status === "success" ? s.result : null), $ = ((y == null ? void 0 : y.calls) ?? []).map((s) => s.status === "success" ? s.result : null), j = ((g == null ? void 0 : g.calls) ?? []).map((s) => s.status === "success" ? s.result : null), h = [];
|
|
150
|
+
for (const [s, e] of H.entries()) {
|
|
151
|
+
const o = q[s];
|
|
156
152
|
if (typeof e != "bigint" || typeof o != "bigint")
|
|
157
153
|
continue;
|
|
158
|
-
const
|
|
159
|
-
address:
|
|
154
|
+
const d = V[s - 1], x = $[s - 1], G = j[s - 1], k = s === 0 ? {
|
|
155
|
+
address: W,
|
|
160
156
|
decimals: 18,
|
|
161
157
|
symbol: "ETH"
|
|
162
158
|
} : {
|
|
163
159
|
address: n[s - 1],
|
|
164
|
-
decimals: G ||
|
|
160
|
+
decimals: G || d ? Number(d ?? 1) : void 0,
|
|
165
161
|
symbol: x ?? void 0
|
|
166
162
|
};
|
|
167
|
-
|
|
168
|
-
token:
|
|
163
|
+
h.some((J) => J.token.address === k.address) || h.push({
|
|
164
|
+
token: k,
|
|
169
165
|
value: {
|
|
170
166
|
pre: o,
|
|
171
167
|
post: e,
|
|
@@ -174,11 +170,11 @@ async function bs(B, r) {
|
|
|
174
170
|
});
|
|
175
171
|
}
|
|
176
172
|
return {
|
|
177
|
-
assetChanges:
|
|
178
|
-
block:
|
|
179
|
-
results:
|
|
173
|
+
assetChanges: h,
|
|
174
|
+
block: R,
|
|
175
|
+
results: U
|
|
180
176
|
};
|
|
181
177
|
}
|
|
182
178
|
export {
|
|
183
|
-
|
|
179
|
+
us as simulateCalls
|
|
184
180
|
};
|
package/dist/index88.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index223.cjs"),y=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index223.cjs"),y=require("./index250.cjs");async function f(e,{address:s,message:a,factory:r,factoryData:t,signature:i,...o}){const c=n.hashMessage(a);return y.verifyHash(e,{address:s,factory:r,factoryData:t,hash:c,signature:i,...o})}exports.verifyMessage=f;
|
package/dist/index88.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hashMessage as h } from "./index223.js";
|
|
2
|
-
import { verifyHash as i } from "./
|
|
2
|
+
import { verifyHash as i } from "./index250.js";
|
|
3
3
|
async function m(r, { address: a, message: o, factory: s, factoryData: t, signature: e, ...f }) {
|
|
4
4
|
const c = h(o);
|
|
5
5
|
return i(r, {
|
package/dist/index89.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index187.cjs"),h=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index187.cjs"),h=require("./index250.cjs");async function p(a,e){const{address:t,factory:r,factoryData:s,signature:y,message:o,primaryType:c,types:i,domain:n,...f}=e,d=u.hashTypedData({message:o,primaryType:c,types:i,domain:n});return h.verifyHash(a,{address:t,factory:r,factoryData:s,hash:d,signature:y,...f})}exports.verifyTypedData=p;
|
package/dist/index89.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hashTypedData as m } from "./index187.js";
|
|
2
|
-
import { verifyHash as d } from "./
|
|
2
|
+
import { verifyHash as d } from "./index250.js";
|
|
3
3
|
async function D(a, t) {
|
|
4
4
|
const { address: r, factory: e, factoryData: o, signature: s, message: y, primaryType: c, types: f, domain: i, ...n } = t, p = m({ message: y, primaryType: c, types: f, domain: i });
|
|
5
5
|
return d(a, {
|
package/dist/index90.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./index126.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./index126.cjs"),R=require("./index135.cjs"),g=require("./index29.cjs"),O=require("./index39.cjs"),S=require("./index41.cjs"),h=require("./index216.cjs"),$=require("./index42.cjs"),P=require("./index68.cjs"),W=require("./index81.cjs"),m=require("./index20.cjs"),x=require("./index91.cjs");async function z(n,{confirmations:c=1,hash:p,onReplaced:B,pollingInterval:F=n.pollingInterval,retryCount:N=6,retryDelay:v=({count:d})=>~~(1<<d)*200,timeout:y=18e4}){const d=$.stringify(["waitForTransactionReceipt",n.uid,p]);let a,o,e,i=!1,f,T;const{promise:A,resolve:j,reject:q}=S.withResolvers(),E=y?setTimeout(()=>{T(),f(),q(new R.WaitForTransactionReceiptTimeoutError({hash:p}))},y):void 0;return f=O.observe(d,{onReplaced:B,resolve:j,reject:q},r=>{T=g.getAction(n,x.watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:F,async onBlockNumber(_){const u=b=>{clearTimeout(E),T(),b(),f()};let l=_;if(!i)try{if(e){if(c>1&&(!e.blockNumber||l-e.blockNumber+1n<c))return;u(()=>r.resolve(e));return}if(a||(i=!0,await h.withRetry(async()=>{a=await g.getAction(n,W.getTransaction,"getTransaction")({hash:p}),a.blockNumber&&(l=a.blockNumber)},{delay:v,retryCount:N}),i=!1),e=await g.getAction(n,m.getTransactionReceipt,"getTransactionReceipt")({hash:p}),c>1&&(!e.blockNumber||l-e.blockNumber+1n<c))return;u(()=>r.resolve(e))}catch(b){if(b instanceof R.TransactionNotFoundError||b instanceof R.TransactionReceiptNotFoundError){if(!a){i=!1;return}try{o=a,i=!0;const k=await h.withRetry(()=>g.getAction(n,P.getBlock,"getBlock")({blockNumber:l,includeTransactions:!0}),{delay:v,retryCount:N,shouldRetry:({error:s})=>s instanceof M.BlockNotFoundError});i=!1;const t=k.transactions.find(({from:s,nonce:I})=>s===o.from&&I===o.nonce);if(!t||(e=await g.getAction(n,m.getTransactionReceipt,"getTransactionReceipt")({hash:t.hash}),c>1&&(!e.blockNumber||l-e.blockNumber+1n<c)))return;let w="replaced";t.to===o.to&&t.value===o.value&&t.input===o.input?w="repriced":t.from===t.to&&t.value===0n&&(w="cancelled"),u(()=>{var s;(s=r.onReplaced)==null||s.call(r,{reason:w,replacedTransaction:o,transaction:t,transactionReceipt:e}),r.resolve(e)})}catch(k){u(()=>r.reject(k))}}else u(()=>r.reject(b))}}})}),A}exports.waitForTransactionReceipt=z;
|