@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.
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +1 -1
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +71 -42
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +2 -2
- 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/index15.cjs +1 -1
- package/dist/index15.js +4 -4
- package/dist/index166.cjs +1 -1
- package/dist/index166.js +36 -34
- package/dist/index192.cjs +1 -1
- package/dist/index192.js +15 -18
- 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/index23.cjs +1 -1
- package/dist/index23.js +13 -31
- package/dist/index231.cjs +1 -1
- package/dist/index231.js +1 -1
- package/dist/index232.cjs +1 -1
- package/dist/index232.js +1 -1
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +2 -2
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +58 -32
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +3 -3
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +3 -3
- package/dist/index247.cjs +1 -2
- package/dist/index247.js +13 -24
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +15 -13
- package/dist/index249.cjs +2 -1
- package/dist/index249.js +23 -14
- package/dist/index25.cjs +16 -1
- package/dist/index25.js +113 -11
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +32 -58
- package/dist/index266.cjs +1 -1
- package/dist/index266.js +1 -1
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +31 -13
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +103 -16
- package/dist/index278.cjs +1 -1
- package/dist/index278.js +13 -220
- package/dist/index279.cjs +1 -1
- package/dist/index279.js +214 -6
- package/dist/index28.cjs +1 -16
- package/dist/index28.js +11 -113
- 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 +89 -51
- package/dist/index285.cjs +1 -1
- package/dist/index285.js +3 -67
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +140 -3
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +143 -128
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +9 -155
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +111 -7
- package/dist/index290.cjs +2 -1
- package/dist/index290.js +116 -95
- package/dist/index291.cjs +1 -2
- package/dist/index291.js +8 -131
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +19 -40
- package/dist/index293.cjs +1 -1
- package/dist/index293.js +43 -2
- package/dist/index294.cjs +1 -1
- package/dist/index294.js +74 -202
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +2 -69
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +68 -11
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +656 -18
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +197 -633
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +78 -73
- package/dist/index300.cjs +2 -2
- package/dist/index300.js +7 -7
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +1 -1
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +2 -2
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +1 -1
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +2 -2
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +1 -1
- 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/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- 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/index58.cjs +1 -1
- package/dist/index58.js +98 -97
- 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/index9.cjs +1 -1
- package/dist/index9.js +4 -4
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +44 -42
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +15 -15
- 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/index43.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 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 {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
...
|
|
13
|
-
atomic:
|
|
31
|
+
...i,
|
|
32
|
+
atomic: l,
|
|
14
33
|
// @ts-expect-error: for backwards compatibility
|
|
15
|
-
chainId:
|
|
16
|
-
receipts: (
|
|
17
|
-
...
|
|
18
|
-
blockNumber:
|
|
19
|
-
gasUsed:
|
|
20
|
-
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:
|
|
23
|
-
status:
|
|
24
|
-
version:
|
|
41
|
+
statusCode: g,
|
|
42
|
+
status: p,
|
|
43
|
+
version: d
|
|
25
44
|
};
|
|
26
45
|
}
|
|
27
46
|
export {
|
|
28
|
-
|
|
47
|
+
M as getCallsStatus
|
|
29
48
|
};
|
package/dist/index44.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 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
|
|
2
|
-
import { uid as
|
|
1
|
+
import { parseAccount as I } from "./index45.js";
|
|
2
|
+
import { uid as M } from "./index46.js";
|
|
3
3
|
function O(n) {
|
|
4
|
-
const { batch:
|
|
5
|
-
chain:
|
|
6
|
-
pollingInterval:
|
|
7
|
-
}), v = { ...
|
|
8
|
-
account:
|
|
9
|
-
batch:
|
|
10
|
-
cacheTime:
|
|
11
|
-
ccipRead:
|
|
12
|
-
chain:
|
|
13
|
-
key:
|
|
14
|
-
name:
|
|
15
|
-
pollingInterval:
|
|
16
|
-
request:
|
|
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:
|
|
19
|
-
uid:
|
|
18
|
+
type: f,
|
|
19
|
+
uid: M()
|
|
20
20
|
};
|
|
21
21
|
function o(i) {
|
|
22
|
-
return (
|
|
23
|
-
const
|
|
24
|
-
for (const
|
|
25
|
-
delete
|
|
26
|
-
const
|
|
27
|
-
return Object.assign(
|
|
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(
|
|
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
|
|
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
|
|
2
|
-
import { parseAccount as
|
|
3
|
-
import { multicall3Abi as
|
|
4
|
-
import { aggregate3Signature as
|
|
5
|
-
import { deploylessCallViaBytecodeBytecode as
|
|
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
|
|
8
|
-
import { CounterfactualDeploymentFailedError as
|
|
9
|
-
import { decodeFunctionResult as
|
|
10
|
-
import { encodeDeployData as
|
|
11
|
-
import { encodeFunctionData as
|
|
12
|
-
import { getChainContractAddress as
|
|
13
|
-
import { numberToHex as
|
|
14
|
-
import { getCallError as
|
|
15
|
-
import { extract as
|
|
16
|
-
import { formatTransactionRequest as
|
|
17
|
-
import { createBatchScheduler as
|
|
18
|
-
import { serializeStateOverride as
|
|
19
|
-
import { assertRequest as
|
|
20
|
-
import { parseAbi as
|
|
21
|
-
async function
|
|
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,
|
|
24
|
-
if (
|
|
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 (
|
|
26
|
+
if (b && o)
|
|
27
27
|
throw new R("Cannot provide both `code` & `to` as parameters.");
|
|
28
|
-
const S =
|
|
29
|
-
code:
|
|
30
|
-
data:
|
|
31
|
-
}) : A ?
|
|
32
|
-
data:
|
|
33
|
-
factory:
|
|
34
|
-
factoryData:
|
|
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
|
-
}) :
|
|
36
|
+
}) : n;
|
|
37
37
|
try {
|
|
38
|
-
|
|
39
|
-
const c = (typeof
|
|
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
|
-
...
|
|
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:
|
|
46
|
-
gas:
|
|
47
|
-
gasPrice:
|
|
48
|
-
maxFeePerBlobGas:
|
|
49
|
-
maxFeePerGas:
|
|
50
|
-
maxPriorityFeePerGas:
|
|
51
|
-
nonce:
|
|
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:
|
|
54
|
+
value: M
|
|
54
55
|
});
|
|
55
|
-
if (
|
|
56
|
+
if (r && dt({ request: N }) && !d && !u)
|
|
56
57
|
try {
|
|
57
|
-
return await
|
|
58
|
+
return await ft(t, {
|
|
58
59
|
...N,
|
|
59
|
-
blockNumber:
|
|
60
|
-
blockTag:
|
|
60
|
+
blockNumber: p,
|
|
61
|
+
blockTag: C
|
|
61
62
|
});
|
|
62
63
|
} catch (s) {
|
|
63
|
-
if (!(s instanceof
|
|
64
|
+
if (!(s instanceof L) && !(s instanceof Z))
|
|
64
65
|
throw s;
|
|
65
66
|
}
|
|
66
|
-
const
|
|
67
|
+
const J = (() => {
|
|
67
68
|
const s = [
|
|
68
69
|
N,
|
|
69
70
|
c
|
|
70
71
|
];
|
|
71
|
-
return
|
|
72
|
-
})(),
|
|
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:
|
|
75
|
+
params: J
|
|
75
76
|
});
|
|
76
|
-
return
|
|
77
|
+
return z === "0x" ? { data: void 0 } : { data: z };
|
|
77
78
|
} catch (v) {
|
|
78
|
-
const c =
|
|
79
|
-
if (t.ccipRead !== !1 && (c == null ? void 0 : c.slice(0, 10)) ===
|
|
80
|
-
return { data: await
|
|
81
|
-
throw q && (c == null ? void 0 : c.slice(0, 10)) === "0x101bb98d" ? new
|
|
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(
|
|
91
|
+
return !(!a || a.startsWith(U) || !e || Object.values(i).filter((r) => typeof r < "u").length > 0);
|
|
91
92
|
}
|
|
92
|
-
async function
|
|
93
|
-
var
|
|
94
|
-
const { batchSize: e = 1024, wait: i = 0 } = typeof ((
|
|
95
|
-
let
|
|
96
|
-
if (!
|
|
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
|
|
99
|
-
|
|
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
|
|
106
|
-
id: `${t.uid}.${
|
|
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(
|
|
109
|
-
return
|
|
109
|
+
shouldSplitBatch(h) {
|
|
110
|
+
return h.reduce((g, { data: w }) => g + (w.length - 2), 0) > e * 2;
|
|
110
111
|
},
|
|
111
|
-
fn: async (
|
|
112
|
-
const
|
|
112
|
+
fn: async (h) => {
|
|
113
|
+
const y = h.map((o) => ({
|
|
113
114
|
allowFailure: !0,
|
|
114
|
-
callData:
|
|
115
|
-
target:
|
|
116
|
-
})),
|
|
117
|
-
abi:
|
|
118
|
-
args: [
|
|
115
|
+
callData: o.data,
|
|
116
|
+
target: o.to
|
|
117
|
+
})), g = rt({
|
|
118
|
+
abi: H,
|
|
119
|
+
args: [y],
|
|
119
120
|
functionName: "aggregate3"
|
|
120
|
-
}),
|
|
121
|
+
}), w = await t.request({
|
|
121
122
|
method: "eth_call",
|
|
122
123
|
params: [
|
|
123
124
|
{
|
|
124
|
-
data:
|
|
125
|
-
to:
|
|
125
|
+
data: g,
|
|
126
|
+
to: f
|
|
126
127
|
},
|
|
127
|
-
|
|
128
|
+
n
|
|
128
129
|
]
|
|
129
130
|
});
|
|
130
|
-
return
|
|
131
|
-
abi:
|
|
132
|
-
args: [
|
|
131
|
+
return et({
|
|
132
|
+
abi: H,
|
|
133
|
+
args: [y],
|
|
133
134
|
functionName: "aggregate3",
|
|
134
|
-
data:
|
|
135
|
+
data: w || "0x"
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
|
-
}), [{ returnData:
|
|
138
|
+
}), [{ returnData: l, success: F }] = await m({ data: C, to: B });
|
|
138
139
|
if (!F)
|
|
139
|
-
throw new
|
|
140
|
-
return
|
|
140
|
+
throw new at({ data: l });
|
|
141
|
+
return l === "0x" ? { data: void 0 } : { data: l };
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function mt(t) {
|
|
143
144
|
const { code: a, data: e } = t;
|
|
144
|
-
return
|
|
145
|
-
abi:
|
|
146
|
-
bytecode:
|
|
145
|
+
return T({
|
|
146
|
+
abi: G(["constructor(bytes, bytes)"]),
|
|
147
|
+
bytecode: X,
|
|
147
148
|
args: [a, e]
|
|
148
149
|
});
|
|
149
150
|
}
|
|
150
|
-
function
|
|
151
|
+
function pt(t) {
|
|
151
152
|
const { data: a, factory: e, factoryData: i, to: r } = t;
|
|
152
|
-
return
|
|
153
|
-
abi:
|
|
154
|
-
bytecode:
|
|
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
|
|
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
|
-
|
|
167
|
-
|
|
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("./
|
|
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 "./
|
|
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
|
|
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=$;
|