@gardenfi/utils 2.1.3-beta.1 → 2.1.3-beta.11

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 (149) 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 +71 -42
  5. package/dist/index108.cjs +1 -1
  6. package/dist/index108.js +2 -2
  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/index15.cjs +1 -1
  18. package/dist/index15.js +4 -4
  19. package/dist/index166.cjs +1 -1
  20. package/dist/index166.js +36 -34
  21. package/dist/index192.cjs +1 -1
  22. package/dist/index192.js +15 -18
  23. package/dist/index222.cjs +1 -1
  24. package/dist/index222.js +2 -2
  25. package/dist/index225.cjs +1 -1
  26. package/dist/index225.js +43 -43
  27. package/dist/index226.cjs +1 -1
  28. package/dist/index226.js +3 -113
  29. package/dist/index23.cjs +1 -1
  30. package/dist/index23.js +13 -31
  31. package/dist/index231.cjs +1 -1
  32. package/dist/index231.js +1 -1
  33. package/dist/index232.cjs +1 -1
  34. package/dist/index232.js +1 -1
  35. package/dist/index233.cjs +1 -1
  36. package/dist/index233.js +2 -2
  37. package/dist/index24.cjs +1 -1
  38. package/dist/index24.js +58 -32
  39. package/dist/index245.cjs +1 -1
  40. package/dist/index245.js +3 -3
  41. package/dist/index246.cjs +1 -1
  42. package/dist/index246.js +3 -3
  43. package/dist/index247.cjs +1 -2
  44. package/dist/index247.js +13 -24
  45. package/dist/index248.cjs +1 -1
  46. package/dist/index248.js +15 -13
  47. package/dist/index249.cjs +2 -1
  48. package/dist/index249.js +23 -14
  49. package/dist/index25.cjs +16 -1
  50. package/dist/index25.js +113 -11
  51. package/dist/index26.cjs +1 -1
  52. package/dist/index26.js +32 -58
  53. package/dist/index266.cjs +1 -1
  54. package/dist/index266.js +1 -1
  55. package/dist/index27.cjs +1 -1
  56. package/dist/index27.js +31 -13
  57. package/dist/index277.cjs +1 -1
  58. package/dist/index277.js +103 -16
  59. package/dist/index278.cjs +1 -1
  60. package/dist/index278.js +13 -220
  61. package/dist/index279.cjs +1 -1
  62. package/dist/index279.js +214 -6
  63. package/dist/index28.cjs +1 -16
  64. package/dist/index28.js +11 -113
  65. package/dist/index280.cjs +1 -1
  66. package/dist/index280.js +7 -7
  67. package/dist/index281.cjs +1 -1
  68. package/dist/index281.js +7 -27
  69. package/dist/index282.cjs +1 -1
  70. package/dist/index282.js +26 -34
  71. package/dist/index283.cjs +1 -1
  72. package/dist/index283.js +13 -12
  73. package/dist/index284.cjs +1 -1
  74. package/dist/index284.js +89 -51
  75. package/dist/index285.cjs +1 -1
  76. package/dist/index285.js +3 -67
  77. package/dist/index286.cjs +1 -1
  78. package/dist/index286.js +140 -3
  79. package/dist/index287.cjs +1 -1
  80. package/dist/index287.js +143 -128
  81. package/dist/index288.cjs +1 -1
  82. package/dist/index288.js +9 -155
  83. package/dist/index289.cjs +1 -1
  84. package/dist/index289.js +111 -7
  85. package/dist/index290.cjs +2 -1
  86. package/dist/index290.js +116 -95
  87. package/dist/index291.cjs +1 -2
  88. package/dist/index291.js +8 -131
  89. package/dist/index292.cjs +1 -1
  90. package/dist/index292.js +19 -40
  91. package/dist/index293.cjs +1 -1
  92. package/dist/index293.js +43 -2
  93. package/dist/index294.cjs +1 -1
  94. package/dist/index294.js +74 -202
  95. package/dist/index295.cjs +1 -1
  96. package/dist/index295.js +2 -69
  97. package/dist/index296.cjs +1 -1
  98. package/dist/index296.js +68 -11
  99. package/dist/index297.cjs +1 -1
  100. package/dist/index297.js +656 -18
  101. package/dist/index298.cjs +1 -1
  102. package/dist/index298.js +197 -633
  103. package/dist/index299.cjs +1 -1
  104. package/dist/index299.js +78 -73
  105. package/dist/index300.cjs +2 -2
  106. package/dist/index300.js +7 -7
  107. package/dist/index302.cjs +1 -1
  108. package/dist/index302.js +1 -1
  109. package/dist/index303.cjs +1 -1
  110. package/dist/index303.js +2 -2
  111. package/dist/index305.cjs +1 -1
  112. package/dist/index305.js +1 -1
  113. package/dist/index307.cjs +1 -1
  114. package/dist/index307.js +2 -2
  115. package/dist/index308.cjs +1 -1
  116. package/dist/index308.js +1 -1
  117. package/dist/index310.cjs +1 -1
  118. package/dist/index310.js +1 -1
  119. package/dist/index311.cjs +1 -1
  120. package/dist/index311.js +5 -105
  121. package/dist/index312.cjs +1 -1
  122. package/dist/index312.js +2 -5
  123. package/dist/index313.cjs +1 -1
  124. package/dist/index313.js +22 -2
  125. package/dist/index36.cjs +1 -1
  126. package/dist/index36.js +1 -1
  127. package/dist/index43.cjs +1 -1
  128. package/dist/index43.js +40 -21
  129. package/dist/index44.cjs +1 -1
  130. package/dist/index44.js +24 -24
  131. package/dist/index58.cjs +1 -1
  132. package/dist/index58.js +98 -97
  133. package/dist/index79.cjs +1 -1
  134. package/dist/index79.js +1 -1
  135. package/dist/index84.cjs +1 -1
  136. package/dist/index84.js +53 -51
  137. package/dist/index9.cjs +1 -1
  138. package/dist/index9.js +4 -4
  139. package/dist/index90.cjs +1 -1
  140. package/dist/index90.js +44 -42
  141. package/dist/index92.cjs +1 -1
  142. package/dist/index92.js +15 -15
  143. package/package.json +1 -1
  144. package/dist/index314.cjs +0 -1
  145. package/dist/index314.js +0 -22
  146. package/dist/index315.cjs +0 -1
  147. package/dist/index315.js +0 -74
  148. package/dist/index316.cjs +0 -1
  149. package/dist/index316.js +0 -24
package/dist/index43.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index182.cjs"),l=require("./index183.cjs");async function f(a,r){const{atomic:i=!1,chainId:n,receipts:e,version:o="2.0.0",...u}=await a.request({method:"wallet_getCallsStatus",params:[r.id]}),[c,d]=(()=>{const t=u.status;return t>=100&&t<200?["pending",t]:t>=200&&t<300?["success",t]:t>=300&&t<700?["failure",t]:t==="CONFIRMED"?["success",200]:t==="PENDING"?["pending",100]:[void 0,t]})();return{...u,atomic:i,chainId:n?s.hexToNumber(n):void 0,receipts:(e==null?void 0:e.map(t=>({...t,blockNumber:s.hexToBigInt(t.blockNumber),gasUsed:s.hexToBigInt(t.gasUsed),status:l.receiptStatuses[t.status]})))??[],statusCode:d,status:c,version:o}}exports.getCallsStatus=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index161.cjs"),I=require("./index162.cjs"),n=require("./index182.cjs"),T=require("./index183.cjs"),o=require("./index107.cjs");async function q(r,l){async function d(e){if(e.endsWith(o.fallbackMagicIdentifier.slice(2))){const p=I.trim(c.sliceHex(e,-64,-32)),b=c.sliceHex(e,0,-64).slice(2).match(/.{1,64}/g),s=await Promise.all(b.map(t=>o.fallbackTransactionErrorMagicIdentifier.slice(2)!==t?r.request({method:"eth_getTransactionReceipt",params:[`0x${t}`]},{dedupe:!0}):void 0)),x=s.some(t=>t===null)?100:s.every(t=>(t==null?void 0:t.status)==="0x1")?200:s.every(t=>(t==null?void 0:t.status)==="0x0")?500:600;return{atomic:!1,chainId:n.hexToNumber(p),receipts:s.filter(Boolean),status:x,version:"2.0.0"}}return r.request({method:"wallet_getCallsStatus",params:[e]})}const{atomic:f=!1,chainId:i,receipts:a,version:m="2.0.0",...u}=await d(l.id),[g,h]=(()=>{const e=u.status;return e>=100&&e<200?["pending",e]:e>=200&&e<300?["success",e]:e>=300&&e<700?["failure",e]:e==="CONFIRMED"?["success",200]:e==="PENDING"?["pending",100]:[void 0,e]})();return{...u,atomic:f,chainId:i?n.hexToNumber(i):void 0,receipts:(a==null?void 0:a.map(e=>({...e,blockNumber:n.hexToBigInt(e.blockNumber),gasUsed:n.hexToBigInt(e.gasUsed),status:T.receiptStatuses[e.status]})))??[],statusCode:h,status:g,version:m}}exports.getCallsStatus=q;
package/dist/index43.js CHANGED
@@ -1,29 +1,48 @@
1
- import { hexToNumber as f, hexToBigInt as u } from "./index182.js";
2
- import { receiptStatuses as m } from "./index183.js";
3
- async function p(a, r) {
4
- const { atomic: o = !1, chainId: e, receipts: t, version: i = "2.0.0", ...n } = await a.request({
5
- method: "wallet_getCallsStatus",
6
- params: [r.id]
7
- }), [d, c] = (() => {
8
- const s = n.status;
9
- return s >= 100 && s < 200 ? ["pending", s] : s >= 200 && s < 300 ? ["success", s] : s >= 300 && s < 700 ? ["failure", s] : s === "CONFIRMED" ? ["success", 200] : s === "PENDING" ? ["pending", 100] : [void 0, s];
1
+ import { sliceHex as o } from "./index161.js";
2
+ import { trim as x } from "./index162.js";
3
+ import { hexToNumber as u, hexToBigInt as c } from "./index182.js";
4
+ import { receiptStatuses as N } from "./index183.js";
5
+ import { fallbackMagicIdentifier as T, fallbackTransactionErrorMagicIdentifier as C } from "./index107.js";
6
+ async function M(a, f) {
7
+ async function m(t) {
8
+ if (t.endsWith(T.slice(2))) {
9
+ const h = x(o(t, -64, -32)), I = o(t, 0, -64).slice(2).match(/.{1,64}/g), s = await Promise.all(I.map((e) => C.slice(2) !== e ? a.request({
10
+ method: "eth_getTransactionReceipt",
11
+ params: [`0x${e}`]
12
+ }, { dedupe: !0 }) : void 0)), b = s.some((e) => e === null) ? 100 : s.every((e) => (e == null ? void 0 : e.status) === "0x1") ? 200 : s.every((e) => (e == null ? void 0 : e.status) === "0x0") ? 500 : 600;
13
+ return {
14
+ atomic: !1,
15
+ chainId: u(h),
16
+ receipts: s.filter(Boolean),
17
+ status: b,
18
+ version: "2.0.0"
19
+ };
20
+ }
21
+ return a.request({
22
+ method: "wallet_getCallsStatus",
23
+ params: [t]
24
+ });
25
+ }
26
+ const { atomic: l = !1, chainId: r, receipts: n, version: d = "2.0.0", ...i } = await m(f.id), [p, g] = (() => {
27
+ const t = i.status;
28
+ return t >= 100 && t < 200 ? ["pending", t] : t >= 200 && t < 300 ? ["success", t] : t >= 300 && t < 700 ? ["failure", t] : t === "CONFIRMED" ? ["success", 200] : t === "PENDING" ? ["pending", 100] : [void 0, t];
10
29
  })();
11
30
  return {
12
- ...n,
13
- atomic: o,
31
+ ...i,
32
+ atomic: l,
14
33
  // @ts-expect-error: for backwards compatibility
15
- chainId: e ? f(e) : void 0,
16
- receipts: (t == null ? void 0 : t.map((s) => ({
17
- ...s,
18
- blockNumber: u(s.blockNumber),
19
- gasUsed: u(s.gasUsed),
20
- status: m[s.status]
34
+ chainId: r ? u(r) : void 0,
35
+ receipts: (n == null ? void 0 : n.map((t) => ({
36
+ ...t,
37
+ blockNumber: c(t.blockNumber),
38
+ gasUsed: c(t.gasUsed),
39
+ status: N[t.status]
21
40
  }))) ?? [],
22
- statusCode: c,
23
- status: d,
24
- version: i
41
+ statusCode: g,
42
+ status: p,
43
+ version: d
25
44
  };
26
45
  }
27
46
  export {
28
- p as getCallsStatus
47
+ M as getCallsStatus
29
48
  };
package/dist/index44.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./index45.cjs"),C=require("./index46.cjs");function O(n){const{batch:r,cacheTime:d=n.pollingInterval??4e3,ccipRead:l,key:a="base",name:b="Base Client",pollingInterval:t=4e3,type:g="base"}=n,c=n.chain,f=n.account?q.parseAccount(n.account):void 0,{config:y,request:h,value:p}=n.transport({chain:c,pollingInterval:t}),v={...y,...p},e={account:f,batch:r,cacheTime:d,ccipRead:l,chain:c,key:a,name:b,pollingInterval:t,request:h,transport:v,type:g,uid:C.uid()};function o(i){return x=>{const u=x(i);for(const j in e)delete u[j];const s={...i,...u};return Object.assign(s,{extend:o(s)})}}return Object.assign(e,{extend:o(e)})}exports.createClient=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./index45.cjs"),j=require("./index46.cjs");function q(n){const{batch:u,chain:t,ccipRead:a,key:r="base",name:d="Base Client",type:b="base"}=n,f=(t==null?void 0:t.blockTime)??12e3,g=Math.min(Math.max(Math.floor(f/2),500),4e3),e=n.pollingInterval??g,h=n.cacheTime??e,v=n.account?M.parseAccount(n.account):void 0,{config:x,request:y,value:T}=n.transport({chain:t,pollingInterval:e}),k={...x,...T},c={account:v,batch:u,cacheTime:h,ccipRead:a,chain:t,key:r,name:d,pollingInterval:e,request:y,transport:k,type:b,uid:j.uid()};function o(i){return m=>{const l=m(i);for(const p in c)delete l[p];const s={...i,...l};return Object.assign(s,{extend:o(s)})}}return Object.assign(c,{extend:o(c)})}exports.createClient=q;
package/dist/index44.js CHANGED
@@ -1,33 +1,33 @@
1
- import { parseAccount as k } from "./index45.js";
2
- import { uid as m } from "./index46.js";
1
+ import { parseAccount as I } from "./index45.js";
2
+ import { uid as M } from "./index46.js";
3
3
  function O(n) {
4
- const { batch: d, cacheTime: l = n.pollingInterval ?? 4e3, ccipRead: r, key: a = "base", name: f = "Base Client", pollingInterval: c = 4e3, type: b = "base" } = n, e = n.chain, g = n.account ? k(n.account) : void 0, { config: p, request: x, value: h } = n.transport({
5
- chain: e,
6
- pollingInterval: c
7
- }), v = { ...p, ...h }, t = {
8
- account: g,
9
- batch: d,
10
- cacheTime: l,
11
- ccipRead: r,
12
- chain: e,
13
- key: a,
14
- name: f,
15
- pollingInterval: c,
16
- request: x,
4
+ const { batch: u, chain: t, ccipRead: a, key: d = "base", name: r = "Base Client", type: f = "base" } = n, b = (t == null ? void 0 : t.blockTime) ?? 12e3, m = Math.min(Math.max(Math.floor(b / 2), 500), 4e3), e = n.pollingInterval ?? m, g = n.cacheTime ?? e, x = n.account ? I(n.account) : void 0, { config: h, request: p, value: k } = n.transport({
5
+ chain: t,
6
+ pollingInterval: e
7
+ }), v = { ...h, ...k }, c = {
8
+ account: x,
9
+ batch: u,
10
+ cacheTime: g,
11
+ ccipRead: a,
12
+ chain: t,
13
+ key: d,
14
+ name: r,
15
+ pollingInterval: e,
16
+ request: p,
17
17
  transport: v,
18
- type: b,
19
- uid: m()
18
+ type: f,
19
+ uid: M()
20
20
  };
21
21
  function o(i) {
22
- return (y) => {
23
- const s = y(i);
24
- for (const j in t)
25
- delete s[j];
26
- const u = { ...i, ...s };
27
- return Object.assign(u, { extend: o(u) });
22
+ return (T) => {
23
+ const l = T(i);
24
+ for (const y in c)
25
+ delete l[y];
26
+ const s = { ...i, ...l };
27
+ return Object.assign(s, { extend: o(s) });
28
28
  };
29
29
  }
30
- return Object.assign(t, { extend: o(t) });
30
+ return Object.assign(c, { extend: o(c) });
31
31
  }
32
32
  export {
33
33
  O as createClient
package/dist/index58.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./index233.cjs"),X=require("./index45.cjs"),j=require("./index21.cjs"),Y=require("./index234.cjs"),z=require("./index118.cjs"),A=require("./index38.cjs"),R=require("./index139.cjs"),$=require("./index127.cjs"),Z=require("./index170.cjs"),G=require("./index174.cjs"),ee=require("./index177.cjs"),te=require("./index214.cjs"),L=require("./index150.cjs"),ae=require("./index235.cjs"),re=require("./index236.cjs"),oe=require("./index184.cjs"),ce=require("./index49.cjs"),ne=require("./index237.cjs"),se=require("./index197.cjs"),M=require("./index238.cjs");async function ie(e,t){var O,P,H,T;const{account:a=e.account,batch:i=!!((O=e.batch)!=null&&O.multicall),blockNumber:r,blockTag:g="latest",accessList:k,blobs:v,blockOverrides:q,code:n,data:f,factory:u,factoryData:b,gas:h,gasPrice:x,maxFeePerBlobGas:C,maxFeePerGas:y,maxPriorityFeePerGas:m,nonce:p,to:o,value:w,stateOverride:I,...J}=t,D=a?X.parseAccount(a):void 0;if(n&&(u||b))throw new A.BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(n&&o)throw new A.BaseError("Cannot provide both `code` & `to` as parameters.");const E=n&&f,N=u&&b&&o&&f,S=E||N,K=E?de({code:n,data:f}):N?fe({data:f,factory:u,factoryData:b,to:o}):f;try{se.assertRequest(t);const c=(typeof r=="bigint"?L.numberToHex(r):void 0)||g,l=q?U.toRpc(q):void 0,d=ne.serializeStateOverride(I),V=(T=(H=(P=e.chain)==null?void 0:P.formatters)==null?void 0:H.transactionRequest)==null?void 0:T.format,F=(V||oe.formatTransactionRequest)({...re.extract(J,{format:V}),from:D==null?void 0:D.address,accessList:k,blobs:v,data:K,gas:h,gasPrice:x,maxFeePerBlobGas:C,maxFeePerGas:y,maxPriorityFeePerGas:m,nonce:p,to:S?void 0:o,value:w});if(i&&ue({request:F})&&!d&&!l)try{return await le(e,{...F,blockNumber:r,blockTag:g})}catch(s){if(!(s instanceof R.ClientChainNotConfiguredError)&&!(s instanceof R.ChainDoesNotSupportContract))throw s}const Q=(()=>{const s=[F,c];return d&&l?[...s,d,l]:d?[...s,d]:l?[...s,{},l]:s})(),_=await e.request({method:"eth_call",params:Q});return _==="0x"?{data:void 0}:{data:_}}catch(B){const c=W(B),{offchainLookup:l,offchainLookupSignature:d}=await Promise.resolve().then(()=>require("./index201.cjs"));if(e.ccipRead!==!1&&(c==null?void 0:c.slice(0,10))===d&&o)return{data:await l(e,{data:c,to:o})};throw S&&(c==null?void 0:c.slice(0,10))==="0x101bb98d"?new $.CounterfactualDeploymentFailedError({factory:u}):ae.getCallError(B,{...t,account:D,chain:e.chain})}}function ue({request:e}){const{data:t,to:a,...i}=e;return!(!t||t.startsWith(Y.aggregate3Signature)||!a||Object.values(i).filter(r=>typeof r<"u").length>0)}async function le(e,t){var C;const{batchSize:a=1024,wait:i=0}=typeof((C=e.batch)==null?void 0:C.multicall)=="object"?e.batch.multicall:{},{blockNumber:r,blockTag:g="latest",data:k,multicallAddress:v,to:q}=t;let n=v;if(!n){if(!e.chain)throw new R.ClientChainNotConfiguredError;n=te.getChainContractAddress({blockNumber:r,chain:e.chain,contract:"multicall3"})}const u=(typeof r=="bigint"?L.numberToHex(r):void 0)||g,{schedule:b}=ce.createBatchScheduler({id:`${e.uid}.${u}`,wait:i,shouldSplitBatch(y){return y.reduce((p,{data:o})=>p+(o.length-2),0)>a*2},fn:async y=>{const m=y.map(w=>({allowFailure:!0,callData:w.data,target:w.to})),p=ee.encodeFunctionData({abi:j.multicall3Abi,args:[m],functionName:"aggregate3"}),o=await e.request({method:"eth_call",params:[{data:p,to:n},u]});return Z.decodeFunctionResult({abi:j.multicall3Abi,args:[m],functionName:"aggregate3",data:o||"0x"})}}),[{returnData:h,success:x}]=await b({data:k,to:q});if(!x)throw new $.RawContractError({data:h});return h==="0x"?{data:void 0}:{data:h}}function de(e){const{code:t,data:a}=e;return G.encodeDeployData({abi:M.parseAbi(["constructor(bytes, bytes)"]),bytecode:z.deploylessCallViaBytecodeBytecode,args:[t,a]})}function fe(e){const{data:t,factory:a,factoryData:i,to:r}=e;return G.encodeDeployData({abi:M.parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:z.deploylessCallViaFactoryBytecode,args:[r,t,a,i]})}function W(e){var a;if(!(e instanceof A.BaseError))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(a=t.data)==null?void 0:a.data:t.data}exports.call=ie;exports.getRevertErrorData=W;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("./index233.cjs"),Y=require("./index45.cjs"),z=require("./index21.cjs"),Z=require("./index234.cjs"),j=require("./index118.cjs"),A=require("./index38.cjs"),R=require("./index139.cjs"),L=require("./index127.cjs"),ee=require("./index170.cjs"),$=require("./index174.cjs"),te=require("./index177.cjs"),ae=require("./index214.cjs"),G=require("./index150.cjs"),re=require("./index235.cjs"),oe=require("./index236.cjs"),ce=require("./index184.cjs"),ne=require("./index49.cjs"),se=require("./index237.cjs"),ie=require("./index197.cjs"),M=require("./index238.cjs");async function ue(e,t){var O,P,H,T;const{account:a=e.account,authorizationList:i,batch:r=!!((O=e.batch)!=null&&O.multicall),blockNumber:h,blockTag:C="latest",accessList:k,blobs:v,blockOverrides:f,code:y,data:n,factory:b,factoryData:u,gas:x,gasPrice:w,maxFeePerBlobGas:m,maxFeePerGas:p,maxPriorityFeePerGas:g,nonce:q,to:o,value:I,stateOverride:J,...K}=t,D=a?Y.parseAccount(a):void 0;if(y&&(b||u))throw new A.BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(y&&o)throw new A.BaseError("Cannot provide both `code` & `to` as parameters.");const E=y&&n,N=b&&u&&o&&n,S=E||N,Q=E?fe({code:y,data:n}):N?be({data:n,factory:b,factoryData:u,to:o}):n;try{ie.assertRequest(t);const c=(typeof h=="bigint"?G.numberToHex(h):void 0)||C,l=f?X.toRpc(f):void 0,d=se.serializeStateOverride(J),V=(T=(H=(P=e.chain)==null?void 0:P.formatters)==null?void 0:H.transactionRequest)==null?void 0:T.format,F=(V||ce.formatTransactionRequest)({...oe.extract(K,{format:V}),from:D==null?void 0:D.address,accessList:k,authorizationList:i,blobs:v,data:Q,gas:x,gasPrice:w,maxFeePerBlobGas:m,maxFeePerGas:p,maxPriorityFeePerGas:g,nonce:q,to:S?void 0:o,value:I});if(r&&le({request:F})&&!d&&!l)try{return await de(e,{...F,blockNumber:h,blockTag:C})}catch(s){if(!(s instanceof R.ClientChainNotConfiguredError)&&!(s instanceof R.ChainDoesNotSupportContract))throw s}const U=(()=>{const s=[F,c];return d&&l?[...s,d,l]:d?[...s,d]:l?[...s,{},l]:s})(),_=await e.request({method:"eth_call",params:U});return _==="0x"?{data:void 0}:{data:_}}catch(B){const c=W(B),{offchainLookup:l,offchainLookupSignature:d}=await Promise.resolve().then(()=>require("./index201.cjs"));if(e.ccipRead!==!1&&(c==null?void 0:c.slice(0,10))===d&&o)return{data:await l(e,{data:c,to:o})};throw S&&(c==null?void 0:c.slice(0,10))==="0x101bb98d"?new L.CounterfactualDeploymentFailedError({factory:b}):re.getCallError(B,{...t,account:D,chain:e.chain})}}function le({request:e}){const{data:t,to:a,...i}=e;return!(!t||t.startsWith(Z.aggregate3Signature)||!a||Object.values(i).filter(r=>typeof r<"u").length>0)}async function de(e,t){var w;const{batchSize:a=1024,wait:i=0}=typeof((w=e.batch)==null?void 0:w.multicall)=="object"?e.batch.multicall:{},{blockNumber:r,blockTag:h="latest",data:C,multicallAddress:k,to:v}=t;let f=k;if(!f){if(!e.chain)throw new R.ClientChainNotConfiguredError;f=ae.getChainContractAddress({blockNumber:r,chain:e.chain,contract:"multicall3"})}const n=(typeof r=="bigint"?G.numberToHex(r):void 0)||h,{schedule:b}=ne.createBatchScheduler({id:`${e.uid}.${n}`,wait:i,shouldSplitBatch(m){return m.reduce((g,{data:q})=>g+(q.length-2),0)>a*2},fn:async m=>{const p=m.map(o=>({allowFailure:!0,callData:o.data,target:o.to})),g=te.encodeFunctionData({abi:z.multicall3Abi,args:[p],functionName:"aggregate3"}),q=await e.request({method:"eth_call",params:[{data:g,to:f},n]});return ee.decodeFunctionResult({abi:z.multicall3Abi,args:[p],functionName:"aggregate3",data:q||"0x"})}}),[{returnData:u,success:x}]=await b({data:C,to:v});if(!x)throw new L.RawContractError({data:u});return u==="0x"?{data:void 0}:{data:u}}function fe(e){const{code:t,data:a}=e;return $.encodeDeployData({abi:M.parseAbi(["constructor(bytes, bytes)"]),bytecode:j.deploylessCallViaBytecodeBytecode,args:[t,a]})}function be(e){const{data:t,factory:a,factoryData:i,to:r}=e;return $.encodeDeployData({abi:M.parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:j.deploylessCallViaFactoryBytecode,args:[r,t,a,i]})}function W(e){var a;if(!(e instanceof A.BaseError))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(a=t.data)==null?void 0:a.data:t.data}exports.call=ue;exports.getRevertErrorData=W;
package/dist/index58.js CHANGED
@@ -1,84 +1,85 @@
1
- import { toRpc as J } from "./index233.js";
2
- import { parseAccount as K } from "./index45.js";
3
- import { multicall3Abi as z } from "./index21.js";
4
- import { aggregate3Signature as Q } from "./index234.js";
5
- import { deploylessCallViaBytecodeBytecode as U, deploylessCallViaFactoryBytecode as X } from "./index118.js";
1
+ import { toRpc as K } from "./index233.js";
2
+ import { parseAccount as Q } from "./index45.js";
3
+ import { multicall3Abi as H } from "./index21.js";
4
+ import { aggregate3Signature as U } from "./index234.js";
5
+ import { deploylessCallViaBytecodeBytecode as X, deploylessCallViaFactoryBytecode as Y } from "./index118.js";
6
6
  import { BaseError as R } from "./index38.js";
7
- import { ClientChainNotConfiguredError as T, ChainDoesNotSupportContract as Y } from "./index139.js";
8
- import { CounterfactualDeploymentFailedError as Z, RawContractError as tt } from "./index127.js";
9
- import { decodeFunctionResult as at } from "./index170.js";
10
- import { encodeDeployData as j } from "./index174.js";
11
- import { encodeFunctionData as et } from "./index177.js";
12
- import { getChainContractAddress as rt } from "./index214.js";
13
- import { numberToHex as G } from "./index150.js";
14
- import { getCallError as ot } from "./index235.js";
15
- import { extract as ct } from "./index236.js";
16
- import { formatTransactionRequest as nt } from "./index184.js";
17
- import { createBatchScheduler as st } from "./index49.js";
18
- import { serializeStateOverride as it } from "./index237.js";
19
- import { assertRequest as lt } from "./index197.js";
20
- import { parseAbi as L } from "./index238.js";
21
- async function _t(t, a) {
7
+ import { ClientChainNotConfiguredError as L, ChainDoesNotSupportContract as Z } from "./index139.js";
8
+ import { CounterfactualDeploymentFailedError as tt, RawContractError as at } from "./index127.js";
9
+ import { decodeFunctionResult as et } from "./index170.js";
10
+ import { encodeDeployData as T } from "./index174.js";
11
+ import { encodeFunctionData as rt } from "./index177.js";
12
+ import { getChainContractAddress as ot } from "./index214.js";
13
+ import { numberToHex as j } from "./index150.js";
14
+ import { getCallError as ct } from "./index235.js";
15
+ import { extract as nt } from "./index236.js";
16
+ import { formatTransactionRequest as st } from "./index184.js";
17
+ import { createBatchScheduler as it } from "./index49.js";
18
+ import { serializeStateOverride as lt } from "./index237.js";
19
+ import { assertRequest as ut } from "./index197.js";
20
+ import { parseAbi as G } from "./index238.js";
21
+ async function zt(t, a) {
22
22
  var E, O, P, V;
23
- const { account: e = t.account, batch: i = !!((E = t.batch) != null && E.multicall), blockNumber: r, blockTag: g = "latest", accessList: x, blobs: B, blockOverrides: w, code: n, data: f, factory: l, factoryData: m, gas: p, gasPrice: F, maxFeePerBlobGas: C, maxFeePerGas: b, maxPriorityFeePerGas: h, nonce: y, to: o, value: k, stateOverride: M, ...$ } = a, D = e ? K(e) : void 0;
24
- if (n && (l || m))
23
+ const { account: e = t.account, authorizationList: i, batch: r = !!((E = t.batch) != null && E.multicall), blockNumber: p, blockTag: C = "latest", accessList: x, blobs: B, blockOverrides: f, code: b, data: n, factory: m, factoryData: l, gas: F, gasPrice: k, maxFeePerBlobGas: h, maxFeePerGas: y, maxPriorityFeePerGas: g, nonce: w, to: o, value: M, stateOverride: $, ...W } = a, D = e ? Q(e) : void 0;
24
+ if (b && (m || l))
25
25
  throw new R("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
26
- if (n && o)
26
+ if (b && o)
27
27
  throw new R("Cannot provide both `code` & `to` as parameters.");
28
- const S = n && f, A = l && m && o && f, q = S || A, W = S ? ft({
29
- code: n,
30
- data: f
31
- }) : A ? mt({
32
- data: f,
33
- factory: l,
34
- factoryData: m,
28
+ const S = b && n, A = m && l && o && n, q = S || A, I = S ? mt({
29
+ code: b,
30
+ data: n
31
+ }) : A ? pt({
32
+ data: n,
33
+ factory: m,
34
+ factoryData: l,
35
35
  to: o
36
- }) : f;
36
+ }) : n;
37
37
  try {
38
- lt(a);
39
- const c = (typeof r == "bigint" ? G(r) : void 0) || g, d = w ? J(w) : void 0, u = it(M), _ = (V = (P = (O = t.chain) == null ? void 0 : O.formatters) == null ? void 0 : P.transactionRequest) == null ? void 0 : V.format, N = (_ || nt)({
38
+ ut(a);
39
+ const c = (typeof p == "bigint" ? j(p) : void 0) || C, u = f ? K(f) : void 0, d = lt($), _ = (V = (P = (O = t.chain) == null ? void 0 : O.formatters) == null ? void 0 : P.transactionRequest) == null ? void 0 : V.format, N = (_ || st)({
40
40
  // Pick out extra data that might exist on the chain's transaction request type.
41
- ...ct($, { format: _ }),
41
+ ...nt(W, { format: _ }),
42
42
  from: D == null ? void 0 : D.address,
43
43
  accessList: x,
44
+ authorizationList: i,
44
45
  blobs: B,
45
- data: W,
46
- gas: p,
47
- gasPrice: F,
48
- maxFeePerBlobGas: C,
49
- maxFeePerGas: b,
50
- maxPriorityFeePerGas: h,
51
- nonce: y,
46
+ data: I,
47
+ gas: F,
48
+ gasPrice: k,
49
+ maxFeePerBlobGas: h,
50
+ maxFeePerGas: y,
51
+ maxPriorityFeePerGas: g,
52
+ nonce: w,
52
53
  to: q ? void 0 : o,
53
- value: k
54
+ value: M
54
55
  });
55
- if (i && dt({ request: N }) && !u && !d)
56
+ if (r && dt({ request: N }) && !d && !u)
56
57
  try {
57
- return await ut(t, {
58
+ return await ft(t, {
58
59
  ...N,
59
- blockNumber: r,
60
- blockTag: g
60
+ blockNumber: p,
61
+ blockTag: C
61
62
  });
62
63
  } catch (s) {
63
- if (!(s instanceof T) && !(s instanceof Y))
64
+ if (!(s instanceof L) && !(s instanceof Z))
64
65
  throw s;
65
66
  }
66
- const I = (() => {
67
+ const J = (() => {
67
68
  const s = [
68
69
  N,
69
70
  c
70
71
  ];
71
- return u && d ? [...s, u, d] : u ? [...s, u] : d ? [...s, {}, d] : s;
72
- })(), H = await t.request({
72
+ return d && u ? [...s, d, u] : d ? [...s, d] : u ? [...s, {}, u] : s;
73
+ })(), z = await t.request({
73
74
  method: "eth_call",
74
- params: I
75
+ params: J
75
76
  });
76
- return H === "0x" ? { data: void 0 } : { data: H };
77
+ return z === "0x" ? { data: void 0 } : { data: z };
77
78
  } catch (v) {
78
- const c = pt(v), { offchainLookup: d, offchainLookupSignature: u } = await import("./index201.js");
79
- if (t.ccipRead !== !1 && (c == null ? void 0 : c.slice(0, 10)) === u && o)
80
- return { data: await d(t, { data: c, to: o }) };
81
- throw q && (c == null ? void 0 : c.slice(0, 10)) === "0x101bb98d" ? new Z({ factory: l }) : ot(v, {
79
+ const c = bt(v), { offchainLookup: u, offchainLookupSignature: d } = await import("./index201.js");
80
+ if (t.ccipRead !== !1 && (c == null ? void 0 : c.slice(0, 10)) === d && o)
81
+ return { data: await u(t, { data: c, to: o }) };
82
+ throw q && (c == null ? void 0 : c.slice(0, 10)) === "0x101bb98d" ? new tt({ factory: m }) : ct(v, {
82
83
  ...a,
83
84
  account: D,
84
85
  chain: t.chain
@@ -87,75 +88,75 @@ async function _t(t, a) {
87
88
  }
88
89
  function dt({ request: t }) {
89
90
  const { data: a, to: e, ...i } = t;
90
- return !(!a || a.startsWith(Q) || !e || Object.values(i).filter((r) => typeof r < "u").length > 0);
91
+ return !(!a || a.startsWith(U) || !e || Object.values(i).filter((r) => typeof r < "u").length > 0);
91
92
  }
92
- async function ut(t, a) {
93
- var C;
94
- const { batchSize: e = 1024, wait: i = 0 } = typeof ((C = t.batch) == null ? void 0 : C.multicall) == "object" ? t.batch.multicall : {}, { blockNumber: r, blockTag: g = "latest", data: x, multicallAddress: B, to: w } = a;
95
- let n = B;
96
- if (!n) {
93
+ async function ft(t, a) {
94
+ var k;
95
+ const { batchSize: e = 1024, wait: i = 0 } = typeof ((k = t.batch) == null ? void 0 : k.multicall) == "object" ? t.batch.multicall : {}, { blockNumber: r, blockTag: p = "latest", data: C, multicallAddress: x, to: B } = a;
96
+ let f = x;
97
+ if (!f) {
97
98
  if (!t.chain)
98
- throw new T();
99
- n = rt({
99
+ throw new L();
100
+ f = ot({
100
101
  blockNumber: r,
101
102
  chain: t.chain,
102
103
  contract: "multicall3"
103
104
  });
104
105
  }
105
- const l = (typeof r == "bigint" ? G(r) : void 0) || g, { schedule: m } = st({
106
- id: `${t.uid}.${l}`,
106
+ const n = (typeof r == "bigint" ? j(r) : void 0) || p, { schedule: m } = it({
107
+ id: `${t.uid}.${n}`,
107
108
  wait: i,
108
- shouldSplitBatch(b) {
109
- return b.reduce((y, { data: o }) => y + (o.length - 2), 0) > e * 2;
109
+ shouldSplitBatch(h) {
110
+ return h.reduce((g, { data: w }) => g + (w.length - 2), 0) > e * 2;
110
111
  },
111
- fn: async (b) => {
112
- const h = b.map((k) => ({
112
+ fn: async (h) => {
113
+ const y = h.map((o) => ({
113
114
  allowFailure: !0,
114
- callData: k.data,
115
- target: k.to
116
- })), y = et({
117
- abi: z,
118
- args: [h],
115
+ callData: o.data,
116
+ target: o.to
117
+ })), g = rt({
118
+ abi: H,
119
+ args: [y],
119
120
  functionName: "aggregate3"
120
- }), o = await t.request({
121
+ }), w = await t.request({
121
122
  method: "eth_call",
122
123
  params: [
123
124
  {
124
- data: y,
125
- to: n
125
+ data: g,
126
+ to: f
126
127
  },
127
- l
128
+ n
128
129
  ]
129
130
  });
130
- return at({
131
- abi: z,
132
- args: [h],
131
+ return et({
132
+ abi: H,
133
+ args: [y],
133
134
  functionName: "aggregate3",
134
- data: o || "0x"
135
+ data: w || "0x"
135
136
  });
136
137
  }
137
- }), [{ returnData: p, success: F }] = await m({ data: x, to: w });
138
+ }), [{ returnData: l, success: F }] = await m({ data: C, to: B });
138
139
  if (!F)
139
- throw new tt({ data: p });
140
- return p === "0x" ? { data: void 0 } : { data: p };
140
+ throw new at({ data: l });
141
+ return l === "0x" ? { data: void 0 } : { data: l };
141
142
  }
142
- function ft(t) {
143
+ function mt(t) {
143
144
  const { code: a, data: e } = t;
144
- return j({
145
- abi: L(["constructor(bytes, bytes)"]),
146
- bytecode: U,
145
+ return T({
146
+ abi: G(["constructor(bytes, bytes)"]),
147
+ bytecode: X,
147
148
  args: [a, e]
148
149
  });
149
150
  }
150
- function mt(t) {
151
+ function pt(t) {
151
152
  const { data: a, factory: e, factoryData: i, to: r } = t;
152
- return j({
153
- abi: L(["constructor(address, bytes, address, bytes)"]),
154
- bytecode: X,
153
+ return T({
154
+ abi: G(["constructor(address, bytes, address, bytes)"]),
155
+ bytecode: Y,
155
156
  args: [r, a, e, i]
156
157
  });
157
158
  }
158
- function pt(t) {
159
+ function bt(t) {
159
160
  var e;
160
161
  if (!(t instanceof R))
161
162
  return;
@@ -163,6 +164,6 @@ function pt(t) {
163
164
  return typeof (a == null ? void 0 : a.data) == "object" ? (e = a.data) == null ? void 0 : e.data : a.data;
164
165
  }
165
166
  export {
166
- _t as call,
167
- pt as getRevertErrorData
167
+ zt as call,
168
+ bt as getRevertErrorData
168
169
  };
package/dist/index79.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index150.cjs"),u=require("./index249.cjs");async function i(o,{address:t,blockNumber:e,blockTag:r,storageKeys:n}){const a=r??"latest",c=e!==void 0?s.numberToHex(e):void 0,f=await o.request({method:"eth_getProof",params:[t,n,c||a]});return u.formatProof(f)}exports.getProof=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index150.cjs"),u=require("./index248.cjs");async function i(o,{address:t,blockNumber:e,blockTag:r,storageKeys:n}){const a=r??"latest",c=e!==void 0?s.numberToHex(e):void 0,f=await o.request({method:"eth_getProof",params:[t,n,c||a]});return u.formatProof(f)}exports.getProof=i;
package/dist/index79.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { numberToHex as c } from "./index150.js";
2
- import { formatProof as s } from "./index249.js";
2
+ import { formatProof as s } from "./index248.js";
3
3
  async function d(t, { address: e, blockNumber: o, blockTag: r, storageKeys: n }) {
4
4
  const f = r ?? "latest", a = o !== void 0 ? c(o) : void 0, m = await t.request({
5
5
  method: "eth_getProof",
package/dist/index84.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index21.cjs"),P=require("./index122.cjs"),v=require("./index38.cjs"),_=require("./index127.cjs"),x=require("./index170.cjs"),O=require("./index177.cjs"),T=require("./index214.cjs"),y=require("./index221.cjs"),B=require("./index29.cjs"),M=require("./index33.cjs");async function Z(l,m){var A;const{allowFailure:u=!0,batchSize:j,blockNumber:w,blockTag:k,multicallAddress:p,stateOverride:z}=m,d=m.contracts,C=j??(typeof((A=l.batch)==null?void 0:A.multicall)=="object"&&l.batch.multicall.batchSize||1024);let g=p;if(!g){if(!l.chain)throw new Error("client chain not configured. multicallAddress is required.");g=T.getChainContractAddress({blockNumber:w,chain:l.chain,contract:"multicall3"})}const r=[[]];let a=0,f=0;for(let t=0;t<d.length;t++){const{abi:c,address:s,args:e,functionName:i}=d[t];try{const n=O.encodeFunctionData({abi:c,args:e,functionName:i});f+=(n.length-2)/2,C>0&&f>C&&r[a].length>0&&(a++,f=(n.length-2)/2,r[a]=[]),r[a]=[...r[a],{allowFailure:!0,callData:n,target:s}]}catch(n){const b=y.getContractError(n,{abi:c,address:s,args:e,docsPath:"/docs/contract/multicall",functionName:i});if(!u)throw b;r[a]=[...r[a],{allowFailure:!0,callData:"0x",target:s}]}}const q=await Promise.allSettled(r.map(t=>B.getAction(l,M.readContract,"readContract")({abi:N.multicall3Abi,address:g,args:[t],blockNumber:w,blockTag:k,functionName:"aggregate3",stateOverride:z}))),o=[];for(let t=0;t<q.length;t++){const c=q[t];if(c.status==="rejected"){if(!u)throw c.reason;for(let e=0;e<r[t].length;e++)o.push({status:"failure",error:c.reason,result:void 0});continue}const s=c.value;for(let e=0;e<s.length;e++){const{returnData:i,success:n}=s[e],{callData:b}=r[t][e],{abi:D,address:R,functionName:S,args:E}=d[o.length];try{if(b==="0x")throw new P.AbiDecodingZeroDataError;if(!n)throw new _.RawContractError({data:i});const h=x.decodeFunctionResult({abi:D,args:E,data:i,functionName:S});o.push(u?{result:h,status:"success"}:h)}catch(h){const F=y.getContractError(h,{abi:D,address:R,args:E,docsPath:"/docs/contract/multicall",functionName:S});if(!u)throw F;o.push({error:F,result:void 0,status:"failure"})}}}if(o.length!==d.length)throw new v.BaseError("multicall results mismatch");return o}exports.multicall=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./index21.cjs"),v=require("./index122.cjs"),_=require("./index38.cjs"),x=require("./index127.cjs"),O=require("./index170.cjs"),T=require("./index177.cjs"),B=require("./index214.cjs"),j=require("./index221.cjs"),M=require("./index29.cjs"),Z=require("./index33.cjs");async function $(l,m){var D;const{account:w,allowFailure:u=!0,batchSize:k,blockNumber:C,blockTag:p,multicallAddress:z,stateOverride:R}=m,d=m.contracts,q=k??(typeof((D=l.batch)==null?void 0:D.multicall)=="object"&&l.batch.multicall.batchSize||1024);let g=z;if(!g){if(!l.chain)throw new Error("client chain not configured. multicallAddress is required.");g=B.getChainContractAddress({blockNumber:C,chain:l.chain,contract:"multicall3"})}const r=[[]];let a=0,f=0;for(let t=0;t<d.length;t++){const{abi:c,address:s,args:e,functionName:i}=d[t];try{const n=T.encodeFunctionData({abi:c,args:e,functionName:i});f+=(n.length-2)/2,q>0&&f>q&&r[a].length>0&&(a++,f=(n.length-2)/2,r[a]=[]),r[a]=[...r[a],{allowFailure:!0,callData:n,target:s}]}catch(n){const b=j.getContractError(n,{abi:c,address:s,args:e,docsPath:"/docs/contract/multicall",functionName:i,sender:w});if(!u)throw b;r[a]=[...r[a],{allowFailure:!0,callData:"0x",target:s}]}}const A=await Promise.allSettled(r.map(t=>M.getAction(l,Z.readContract,"readContract")({abi:P.multicall3Abi,account:w,address:g,args:[t],blockNumber:C,blockTag:p,functionName:"aggregate3",stateOverride:R}))),o=[];for(let t=0;t<A.length;t++){const c=A[t];if(c.status==="rejected"){if(!u)throw c.reason;for(let e=0;e<r[t].length;e++)o.push({status:"failure",error:c.reason,result:void 0});continue}const s=c.value;for(let e=0;e<s.length;e++){const{returnData:i,success:n}=s[e],{callData:b}=r[t][e],{abi:S,address:N,functionName:E,args:F}=d[o.length];try{if(b==="0x")throw new v.AbiDecodingZeroDataError;if(!n)throw new x.RawContractError({data:i});const h=O.decodeFunctionResult({abi:S,args:F,data:i,functionName:E});o.push(u?{result:h,status:"success"}:h)}catch(h){const y=j.getContractError(h,{abi:S,address:N,args:F,docsPath:"/docs/contract/multicall",functionName:E});if(!u)throw y;o.push({error:y,result:void 0,status:"failure"})}}}if(o.length!==d.length)throw new _.BaseError("multicall results mismatch");return o}exports.multicall=$;