@gardenfi/core 2.1.13 → 2.1.14
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-CQkMVqmN.cjs +1 -0
- package/dist/ccip-DgpQO1MZ.js +149 -0
- package/dist/index-BwOLJ71D.cjs +75 -0
- package/dist/index-CAqXP6qV.js +24196 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +20 -20
- package/package.json +2 -2
- package/dist/ccip-BopIsmm6.js +0 -232
- package/dist/ccip-CL6RUZeo.cjs +0 -1
- package/dist/index-CBKJdpVQ.js +0 -19741
- package/dist/index-CCzvHnk1.cjs +0 -71
- package/dist/secp256k1-CHT9yKLe.js +0 -1287
- package/dist/secp256k1-CTwfGMq7.cjs +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BwOLJ71D.cjs");exports.API=e.API;exports.BlockNumberFetcher=e.BlockNumberFetcher;exports.EvmRelay=e.EvmRelay;exports.Garden=e.Garden;exports.OrderActions=e.OrderActions;exports.OrderStatus=e.OrderStatus;exports.ParseOrderStatus=e.ParseOrderStatus;exports.ParseSwapStatus=e.ParseSwapStatus;exports.Quote=e.Quote;exports.STARKNET_CONFIG=e.STARKNET_CONFIG;exports.SecretManager=e.SecretManager;exports.StarknetHTLC=e.StarknetHTLC;exports.StarknetRelay=e.StarknetRelay;exports.SwapStatus=e.SwapStatus;exports.botanix=e.botanixMainnet;exports.constructOrderPair=e.constructOrderPair;exports.evmToViemChainMap=e.evmToViemChainMap;exports.filterDeadlineExpiredOrders=e.filterDeadlineExpiredOrders;exports.hyperliquid=e.hyperliquid;exports.hyperliquidTestnet=e.hyperliquidTestnet;exports.isExpired=e.isExpired;exports.parseAction=e.parseAction;exports.parseActionFromStatus=e.parseActionFromStatus;exports.resolveApiConfig=e.resolveApiConfig;exports.switchOrAddNetwork=e.switchOrAddNetwork;exports.toXOnly=e.toXOnly;exports.validateBTCAddress=e.validateBTCAddress;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as e, j as r, E as t, G as i, O as d, k as o, P as n, n as p, Q as S, I as u, t as l, h as c, S as A, m as O, D as m, u as h, y, q as C, C as T, A as k, o as v, p as w, r as x, x as E, z as P, w as F, v as N } from "./index-CAqXP6qV.js";
|
|
2
2
|
export {
|
|
3
3
|
e as API,
|
|
4
4
|
r as BlockNumberFetcher,
|
|
@@ -7,24 +7,24 @@ export {
|
|
|
7
7
|
d as OrderActions,
|
|
8
8
|
o as OrderStatus,
|
|
9
9
|
n as ParseOrderStatus,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
p as ParseSwapStatus,
|
|
11
|
+
S as Quote,
|
|
12
|
+
u as STARKNET_CONFIG,
|
|
13
|
+
l as SecretManager,
|
|
14
14
|
c as StarknetHTLC,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
A as StarknetRelay,
|
|
16
|
+
O as SwapStatus,
|
|
17
|
+
m as botanix,
|
|
18
|
+
h as constructOrderPair,
|
|
19
|
+
y as evmToViemChainMap,
|
|
20
|
+
C as filterDeadlineExpiredOrders,
|
|
21
|
+
T as hyperliquid,
|
|
22
|
+
k as hyperliquidTestnet,
|
|
23
|
+
v as isExpired,
|
|
24
|
+
w as parseAction,
|
|
25
|
+
x as parseActionFromStatus,
|
|
26
|
+
E as resolveApiConfig,
|
|
27
|
+
P as switchOrAddNetwork,
|
|
28
|
+
F as toXOnly,
|
|
29
|
+
N as validateBTCAddress
|
|
30
30
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gardenfi/core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "vite build",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@catalogfi/wallets": "^0.2.59",
|
|
30
|
-
"@gardenfi/orderbook": "2.1.
|
|
30
|
+
"@gardenfi/orderbook": "2.1.10",
|
|
31
31
|
"@gardenfi/utils": "2.1.3",
|
|
32
32
|
"bignumber.js": "^9.1.2",
|
|
33
33
|
"bitcoinjs-lib": "^6.1.6",
|
package/dist/ccip-BopIsmm6.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
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
|
-
const { abi: r, data: e } = a, s = b(e, 0, 4), t = r.find((o) => o.type === "function" && s === O(x(o)));
|
|
4
|
-
if (!t)
|
|
5
|
-
throw new N(s, {
|
|
6
|
-
docsPath: "/docs/contract/decodeFunctionData"
|
|
7
|
-
});
|
|
8
|
-
return {
|
|
9
|
-
functionName: t.name,
|
|
10
|
-
args: "inputs" in t && t.inputs && t.inputs.length > 0 ? P(t.inputs, b(e, 4)) : void 0
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const p = "/docs/contract/encodeErrorResult";
|
|
14
|
-
function k(a) {
|
|
15
|
-
const { abi: r, errorName: e, args: s } = a;
|
|
16
|
-
let t = r[0];
|
|
17
|
-
if (e) {
|
|
18
|
-
const u = F({ abi: r, args: s, name: e });
|
|
19
|
-
if (!u)
|
|
20
|
-
throw new E(e, { docsPath: p });
|
|
21
|
-
t = u;
|
|
22
|
-
}
|
|
23
|
-
if (t.type !== "error")
|
|
24
|
-
throw new E(void 0, { docsPath: p });
|
|
25
|
-
const o = x(t), n = O(o);
|
|
26
|
-
let c = "0x";
|
|
27
|
-
if (s && s.length > 0) {
|
|
28
|
-
if (!t.inputs)
|
|
29
|
-
throw new S(t.name, { docsPath: p });
|
|
30
|
-
c = w(t.inputs, s);
|
|
31
|
-
}
|
|
32
|
-
return $([n, c]);
|
|
33
|
-
}
|
|
34
|
-
const h = "/docs/contract/encodeFunctionResult";
|
|
35
|
-
function U(a) {
|
|
36
|
-
const { abi: r, functionName: e, result: s } = a;
|
|
37
|
-
let t = r[0];
|
|
38
|
-
if (e) {
|
|
39
|
-
const n = F({ abi: r, name: e });
|
|
40
|
-
if (!n)
|
|
41
|
-
throw new A(e, { docsPath: h });
|
|
42
|
-
t = n;
|
|
43
|
-
}
|
|
44
|
-
if (t.type !== "function")
|
|
45
|
-
throw new A(void 0, { docsPath: h });
|
|
46
|
-
if (!t.outputs)
|
|
47
|
-
throw new I(t.name, { docsPath: h });
|
|
48
|
-
const o = (() => {
|
|
49
|
-
if (t.outputs.length === 0)
|
|
50
|
-
return [];
|
|
51
|
-
if (t.outputs.length === 1)
|
|
52
|
-
return [s];
|
|
53
|
-
if (Array.isArray(s))
|
|
54
|
-
return s;
|
|
55
|
-
throw new D(s);
|
|
56
|
-
})();
|
|
57
|
-
return w(t.outputs, o);
|
|
58
|
-
}
|
|
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
|
-
return await Promise.all(s.map(async (n, c) => {
|
|
63
|
-
try {
|
|
64
|
-
o[c] = await e(n), t[c] = !1;
|
|
65
|
-
} catch (u) {
|
|
66
|
-
t[c] = !0, o[c] = W(u);
|
|
67
|
-
}
|
|
68
|
-
})), U({
|
|
69
|
-
abi: m,
|
|
70
|
-
functionName: "query",
|
|
71
|
-
result: [t, o]
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function W(a) {
|
|
75
|
-
return a.name === "HttpRequestError" && a.status ? k({
|
|
76
|
-
abi: m,
|
|
77
|
-
errorName: "HttpError",
|
|
78
|
-
args: [a.status, a.shortMessage]
|
|
79
|
-
}) : k({
|
|
80
|
-
abi: [G],
|
|
81
|
-
errorName: "Error",
|
|
82
|
-
args: ["shortMessage" in a ? a.shortMessage : a.message]
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
class z extends y {
|
|
86
|
-
constructor({ callbackSelector: r, cause: e, data: s, extraData: t, sender: o, urls: n }) {
|
|
87
|
-
var c;
|
|
88
|
-
super(e.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
89
|
-
cause: e,
|
|
90
|
-
metaMessages: [
|
|
91
|
-
...e.metaMessages || [],
|
|
92
|
-
(c = e.metaMessages) != null && c.length ? "" : [],
|
|
93
|
-
"Offchain Gateway Call:",
|
|
94
|
-
n && [
|
|
95
|
-
" Gateway URL(s):",
|
|
96
|
-
...n.map((u) => ` ${L(u)}`)
|
|
97
|
-
],
|
|
98
|
-
` Sender: ${o}`,
|
|
99
|
-
` Data: ${s}`,
|
|
100
|
-
` Callback selector: ${r}`,
|
|
101
|
-
` Extra data: ${t}`
|
|
102
|
-
].flat(),
|
|
103
|
-
name: "OffchainLookupError"
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
class K extends y {
|
|
108
|
-
constructor({ result: r, url: e }) {
|
|
109
|
-
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
110
|
-
metaMessages: [
|
|
111
|
-
`Gateway URL: ${L(e)}`,
|
|
112
|
-
`Response: ${q(r)}`
|
|
113
|
-
],
|
|
114
|
-
name: "OffchainLookupResponseMalformedError"
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
class Q extends y {
|
|
119
|
-
constructor({ sender: r, to: e }) {
|
|
120
|
-
super("Reverted sender address does not match target contract address (`to`).", {
|
|
121
|
-
metaMessages: [
|
|
122
|
-
`Contract address: ${e}`,
|
|
123
|
-
`OffchainLookup sender address: ${r}`
|
|
124
|
-
],
|
|
125
|
-
name: "OffchainLookupSenderMismatchError"
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const Z = "0x556f1830", V = {
|
|
130
|
-
name: "OffchainLookup",
|
|
131
|
-
type: "error",
|
|
132
|
-
inputs: [
|
|
133
|
-
{
|
|
134
|
-
name: "sender",
|
|
135
|
-
type: "address"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "urls",
|
|
139
|
-
type: "string[]"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: "callData",
|
|
143
|
-
type: "bytes"
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "callbackFunction",
|
|
147
|
-
type: "bytes4"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: "extraData",
|
|
151
|
-
type: "bytes"
|
|
152
|
-
}
|
|
153
|
-
]
|
|
154
|
-
};
|
|
155
|
-
async function tt(a, { blockNumber: r, blockTag: e, data: s, to: t }) {
|
|
156
|
-
const { args: o } = T({
|
|
157
|
-
data: s,
|
|
158
|
-
abi: [V]
|
|
159
|
-
}), [n, c, u, f, d] = o, { ccipRead: i } = a, g = i && typeof (i == null ? void 0 : i.request) == "function" ? i.request : X;
|
|
160
|
-
try {
|
|
161
|
-
if (!C(t, n))
|
|
162
|
-
throw new Q({ sender: n, to: t });
|
|
163
|
-
const l = c.includes(_) ? await J({
|
|
164
|
-
data: u,
|
|
165
|
-
ccipRequest: g
|
|
166
|
-
}) : await g({ data: u, sender: n, urls: c }), { data: M } = await H(a, {
|
|
167
|
-
blockNumber: r,
|
|
168
|
-
blockTag: e,
|
|
169
|
-
data: j([
|
|
170
|
-
f,
|
|
171
|
-
w([{ type: "bytes" }, { type: "bytes" }], [l, d])
|
|
172
|
-
]),
|
|
173
|
-
to: t
|
|
174
|
-
});
|
|
175
|
-
return M;
|
|
176
|
-
} catch (l) {
|
|
177
|
-
throw new z({
|
|
178
|
-
callbackSelector: f,
|
|
179
|
-
cause: l,
|
|
180
|
-
data: s,
|
|
181
|
-
extraData: d,
|
|
182
|
-
sender: n,
|
|
183
|
-
urls: c
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
async function X({ data: a, sender: r, urls: e }) {
|
|
188
|
-
var t;
|
|
189
|
-
let s = new Error("An unknown error occurred.");
|
|
190
|
-
for (let o = 0; o < e.length; o++) {
|
|
191
|
-
const n = e[o], c = n.includes("{data}") ? "GET" : "POST", u = c === "POST" ? { data: a, sender: r } : void 0, f = c === "POST" ? { "Content-Type": "application/json" } : {};
|
|
192
|
-
try {
|
|
193
|
-
const d = await fetch(n.replace("{sender}", r.toLowerCase()).replace("{data}", a), {
|
|
194
|
-
body: JSON.stringify(u),
|
|
195
|
-
headers: f,
|
|
196
|
-
method: c
|
|
197
|
-
});
|
|
198
|
-
let i;
|
|
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
|
-
s = new R({
|
|
201
|
-
body: u,
|
|
202
|
-
details: i != null && i.error ? q(i.error) : d.statusText,
|
|
203
|
-
headers: d.headers,
|
|
204
|
-
status: d.status,
|
|
205
|
-
url: n
|
|
206
|
-
});
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
if (!v(i)) {
|
|
210
|
-
s = new K({
|
|
211
|
-
result: i,
|
|
212
|
-
url: n
|
|
213
|
-
});
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
return i;
|
|
217
|
-
} catch (d) {
|
|
218
|
-
s = new R({
|
|
219
|
-
body: u,
|
|
220
|
-
details: d.message,
|
|
221
|
-
url: n
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
throw s;
|
|
226
|
-
}
|
|
227
|
-
export {
|
|
228
|
-
X as ccipRequest,
|
|
229
|
-
tt as offchainLookup,
|
|
230
|
-
V as offchainLookupAbiItem,
|
|
231
|
-
Z as offchainLookupSignature
|
|
232
|
-
};
|
package/dist/ccip-CL6RUZeo.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|