@gardenfi/core 2.1.13-beta.2 → 2.1.13
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/{ccip-Bi_7Mx9G.js → ccip-BopIsmm6.js} +24 -24
- package/dist/ccip-CL6RUZeo.cjs +1 -0
- package/dist/index-CBKJdpVQ.js +19741 -0
- package/dist/index-CCzvHnk1.cjs +71 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +22 -26
- package/dist/secp256k1-CHT9yKLe.js +1287 -0
- package/dist/secp256k1-CTwfGMq7.cjs +1 -0
- package/dist/src/index.d.ts +1 -4
- package/dist/src/lib/constants.d.ts +0 -6
- package/dist/src/lib/garden/garden.d.ts +1 -11
- package/dist/src/lib/garden/garden.types.d.ts +1 -12
- package/package.json +3 -5
- package/dist/ccip-BCmQ-ZNT.cjs +0 -1
- package/dist/index-BEY92n8B.cjs +0 -81
- package/dist/index-s-IB6Vxx.js +0 -22429
- package/dist/secp256k1-BXRxY-Ty.js +0 -1290
- package/dist/secp256k1-CS4jLSmJ.cjs +0 -1
- package/dist/src/lib/solana/htlc/ISolanaHTLC.d.ts +0 -28
- package/dist/src/lib/solana/htlc/solanaHTLC.d.ts +0 -56
- package/dist/src/lib/solana/idl/solana_native_swaps.d.ts +0 -299
- package/dist/src/lib/solana/idl/solana_native_swaps.json.d.ts +0 -296
- package/dist/src/lib/solana/relayer/solanaRelay.d.ts +0 -71
- package/dist/src/lib/solana/solanaTypes.d.ts +0 -31
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { s as b, t as O, f as x, A as
|
|
2
|
-
function
|
|
1
|
+
import { s as b, t as O, f as x, A as N, d as P, g as F, a as E, b as S, e as w, c as $, h as A, i as I, I as D, j as m, k as G, B as y, l as L, m as q, n as T, o as C, p as H, q as j, H as R, r as v } from "./index-CBKJdpVQ.js";
|
|
2
|
+
function B(a) {
|
|
3
3
|
const { abi: r, data: e } = a, s = b(e, 0, 4), t = r.find((o) => o.type === "function" && s === O(x(o)));
|
|
4
4
|
if (!t)
|
|
5
|
-
throw new
|
|
5
|
+
throw new N(s, {
|
|
6
6
|
docsPath: "/docs/contract/decodeFunctionData"
|
|
7
7
|
});
|
|
8
8
|
return {
|
|
9
9
|
functionName: t.name,
|
|
10
|
-
args: "inputs" in t && t.inputs && t.inputs.length > 0 ?
|
|
10
|
+
args: "inputs" in t && t.inputs && t.inputs.length > 0 ? P(t.inputs, b(e, 4)) : void 0
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
const p = "/docs/contract/encodeErrorResult";
|
|
@@ -26,13 +26,13 @@ function k(a) {
|
|
|
26
26
|
let c = "0x";
|
|
27
27
|
if (s && s.length > 0) {
|
|
28
28
|
if (!t.inputs)
|
|
29
|
-
throw new
|
|
29
|
+
throw new S(t.name, { docsPath: p });
|
|
30
30
|
c = w(t.inputs, s);
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return $([n, c]);
|
|
33
33
|
}
|
|
34
34
|
const h = "/docs/contract/encodeFunctionResult";
|
|
35
|
-
function
|
|
35
|
+
function U(a) {
|
|
36
36
|
const { abi: r, functionName: e, result: s } = a;
|
|
37
37
|
let t = r[0];
|
|
38
38
|
if (e) {
|
|
@@ -44,7 +44,7 @@ function J(a) {
|
|
|
44
44
|
if (t.type !== "function")
|
|
45
45
|
throw new A(void 0, { docsPath: h });
|
|
46
46
|
if (!t.outputs)
|
|
47
|
-
throw new
|
|
47
|
+
throw new I(t.name, { docsPath: h });
|
|
48
48
|
const o = (() => {
|
|
49
49
|
if (t.outputs.length === 0)
|
|
50
50
|
return [];
|
|
@@ -52,20 +52,20 @@ function J(a) {
|
|
|
52
52
|
return [s];
|
|
53
53
|
if (Array.isArray(s))
|
|
54
54
|
return s;
|
|
55
|
-
throw new
|
|
55
|
+
throw new D(s);
|
|
56
56
|
})();
|
|
57
57
|
return w(t.outputs, o);
|
|
58
58
|
}
|
|
59
|
-
const
|
|
60
|
-
async function
|
|
61
|
-
const { data: r, ccipRequest: e } = a, { args: [s] } =
|
|
59
|
+
const _ = "x-batch-gateway:true";
|
|
60
|
+
async function J(a) {
|
|
61
|
+
const { data: r, ccipRequest: e } = a, { args: [s] } = B({ abi: m, data: r }), t = [], o = [];
|
|
62
62
|
return await Promise.all(s.map(async (n, c) => {
|
|
63
63
|
try {
|
|
64
|
-
o[c] =
|
|
64
|
+
o[c] = await e(n), t[c] = !1;
|
|
65
65
|
} catch (u) {
|
|
66
66
|
t[c] = !0, o[c] = W(u);
|
|
67
67
|
}
|
|
68
|
-
})),
|
|
68
|
+
})), U({
|
|
69
69
|
abi: m,
|
|
70
70
|
functionName: "query",
|
|
71
71
|
result: [t, o]
|
|
@@ -77,7 +77,7 @@ function W(a) {
|
|
|
77
77
|
errorName: "HttpError",
|
|
78
78
|
args: [a.status, a.shortMessage]
|
|
79
79
|
}) : k({
|
|
80
|
-
abi: [
|
|
80
|
+
abi: [G],
|
|
81
81
|
errorName: "Error",
|
|
82
82
|
args: ["shortMessage" in a ? a.shortMessage : a.message]
|
|
83
83
|
});
|
|
@@ -109,7 +109,7 @@ class K extends y {
|
|
|
109
109
|
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
110
110
|
metaMessages: [
|
|
111
111
|
`Gateway URL: ${L(e)}`,
|
|
112
|
-
`Response: ${
|
|
112
|
+
`Response: ${q(r)}`
|
|
113
113
|
],
|
|
114
114
|
name: "OffchainLookupResponseMalformedError"
|
|
115
115
|
});
|
|
@@ -153,26 +153,26 @@ const Z = "0x556f1830", V = {
|
|
|
153
153
|
]
|
|
154
154
|
};
|
|
155
155
|
async function tt(a, { blockNumber: r, blockTag: e, data: s, to: t }) {
|
|
156
|
-
const { args: o } =
|
|
156
|
+
const { args: o } = T({
|
|
157
157
|
data: s,
|
|
158
158
|
abi: [V]
|
|
159
159
|
}), [n, c, u, f, d] = o, { ccipRead: i } = a, g = i && typeof (i == null ? void 0 : i.request) == "function" ? i.request : X;
|
|
160
160
|
try {
|
|
161
|
-
if (!
|
|
161
|
+
if (!C(t, n))
|
|
162
162
|
throw new Q({ sender: n, to: t });
|
|
163
|
-
const l = c.includes(
|
|
163
|
+
const l = c.includes(_) ? await J({
|
|
164
164
|
data: u,
|
|
165
165
|
ccipRequest: g
|
|
166
|
-
}) : await g({ data: u, sender: n, urls: c }), { data:
|
|
166
|
+
}) : await g({ data: u, sender: n, urls: c }), { data: M } = await H(a, {
|
|
167
167
|
blockNumber: r,
|
|
168
168
|
blockTag: e,
|
|
169
|
-
data:
|
|
169
|
+
data: j([
|
|
170
170
|
f,
|
|
171
171
|
w([{ type: "bytes" }, { type: "bytes" }], [l, d])
|
|
172
172
|
]),
|
|
173
173
|
to: t
|
|
174
174
|
});
|
|
175
|
-
return
|
|
175
|
+
return M;
|
|
176
176
|
} catch (l) {
|
|
177
177
|
throw new z({
|
|
178
178
|
callbackSelector: f,
|
|
@@ -199,14 +199,14 @@ async function X({ data: a, sender: r, urls: e }) {
|
|
|
199
199
|
if ((t = d.headers.get("Content-Type")) != null && t.startsWith("application/json") ? i = (await d.json()).data : i = await d.text(), !d.ok) {
|
|
200
200
|
s = new R({
|
|
201
201
|
body: u,
|
|
202
|
-
details: i != null && i.error ?
|
|
202
|
+
details: i != null && i.error ? q(i.error) : d.statusText,
|
|
203
203
|
headers: d.headers,
|
|
204
204
|
status: d.status,
|
|
205
205
|
url: n
|
|
206
206
|
});
|
|
207
207
|
continue;
|
|
208
208
|
}
|
|
209
|
-
if (!
|
|
209
|
+
if (!v(i)) {
|
|
210
210
|
s = new K({
|
|
211
211
|
result: i,
|
|
212
212
|
url: n
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CCzvHnk1.cjs");function A(a){const{abi:o,data:r}=a,n=e.slice(r,0,4),t=o.find(c=>c.type==="function"&&n===e.toFunctionSelector(e.formatAbiItem(c)));if(!t)throw new e.AbiFunctionSignatureNotFoundError(n,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:t.name,args:"inputs"in t&&t.inputs&&t.inputs.length>0?e.decodeAbiParameters(t.inputs,e.slice(r,4)):void 0}}const h="/docs/contract/encodeErrorResult";function b(a){const{abi:o,errorName:r,args:n}=a;let t=o[0];if(r){const d=e.getAbiItem({abi:o,args:n,name:r});if(!d)throw new e.AbiErrorNotFoundError(r,{docsPath:h});t=d}if(t.type!=="error")throw new e.AbiErrorNotFoundError(void 0,{docsPath:h});const c=e.formatAbiItem(t),s=e.toFunctionSelector(c);let i="0x";if(n&&n.length>0){if(!t.inputs)throw new e.AbiErrorInputsNotFoundError(t.name,{docsPath:h});i=e.encodeAbiParameters(t.inputs,n)}return e.concatHex([s,i])}const m="/docs/contract/encodeFunctionResult";function R(a){const{abi:o,functionName:r,result:n}=a;let t=o[0];if(r){const s=e.getAbiItem({abi:o,name:r});if(!s)throw new e.AbiFunctionNotFoundError(r,{docsPath:m});t=s}if(t.type!=="function")throw new e.AbiFunctionNotFoundError(void 0,{docsPath:m});if(!t.outputs)throw new e.AbiFunctionOutputsNotFoundError(t.name,{docsPath:m});const c=(()=>{if(t.outputs.length===0)return[];if(t.outputs.length===1)return[n];if(Array.isArray(n))return n;throw new e.InvalidArrayError(n)})();return e.encodeAbiParameters(t.outputs,c)}const k="x-batch-gateway:true";async function F(a){const{data:o,ccipRequest:r}=a,{args:[n]}=A({abi:e.batchGatewayAbi,data:o}),t=[],c=[];return await Promise.all(n.map(async(s,i)=>{try{c[i]=await r(s),t[i]=!1}catch(d){t[i]=!0,c[i]=L(d)}})),R({abi:e.batchGatewayAbi,functionName:"query",result:[t,c]})}function L(a){return a.name==="HttpRequestError"&&a.status?b({abi:e.batchGatewayAbi,errorName:"HttpError",args:[a.status,a.shortMessage]}):b({abi:[e.solidityError],errorName:"Error",args:["shortMessage"in a?a.shortMessage:a.message]})}class O extends e.BaseError{constructor({callbackSelector:o,cause:r,data:n,extraData:t,sender:c,urls:s}){var i;super(r.shortMessage||"An error occurred while fetching for an offchain result.",{cause:r,metaMessages:[...r.metaMessages||[],(i=r.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(d=>` ${e.getUrl(d)}`)],` Sender: ${c}`,` Data: ${n}`,` Callback selector: ${o}`,` Extra data: ${t}`].flat(),name:"OffchainLookupError"})}}class q extends e.BaseError{constructor({result:o,url:r}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(r)}`,`Response: ${e.stringify(o)}`],name:"OffchainLookupResponseMalformedError"})}}class P extends e.BaseError{constructor({sender:o,to:r}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${r}`,`OffchainLookup sender address: ${o}`],name:"OffchainLookupSenderMismatchError"})}}const S="0x556f1830",w={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function x(a,{blockNumber:o,blockTag:r,data:n,to:t}){const{args:c}=e.decodeErrorResult({data:n,abi:[w]}),[s,i,d,l,f]=c,{ccipRead:u}=a,y=u&&typeof(u==null?void 0:u.request)=="function"?u.request:g;try{if(!e.isAddressEqual(t,s))throw new P({sender:s,to:t});const p=i.includes(k)?await F({data:d,ccipRequest:y}):await y({data:d,sender:s,urls:i}),{data:E}=await e.call(a,{blockNumber:o,blockTag:r,data:e.concat([l,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[p,f])]),to:t});return E}catch(p){throw new O({callbackSelector:l,cause:p,data:n,extraData:f,sender:s,urls:i})}}async function g({data:a,sender:o,urls:r}){var t;let n=new Error("An unknown error occurred.");for(let c=0;c<r.length;c++){const s=r[c],i=s.includes("{data}")?"GET":"POST",d=i==="POST"?{data:a,sender:o}:void 0,l=i==="POST"?{"Content-Type":"application/json"}:{};try{const f=await fetch(s.replace("{sender}",o.toLowerCase()).replace("{data}",a),{body:JSON.stringify(d),headers:l,method:i});let u;if((t=f.headers.get("Content-Type"))!=null&&t.startsWith("application/json")?u=(await f.json()).data:u=await f.text(),!f.ok){n=new e.HttpRequestError({body:d,details:u!=null&&u.error?e.stringify(u.error):f.statusText,headers:f.headers,status:f.status,url:s});continue}if(!e.isHex(u)){n=new q({result:u,url:s});continue}return u}catch(f){n=new e.HttpRequestError({body:d,details:f.message,url:s})}}throw n}exports.ccipRequest=g;exports.offchainLookup=x;exports.offchainLookupAbiItem=w;exports.offchainLookupSignature=S;
|