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