@weave-sdk/widget 1.0.0
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-ZZjAsw8k.mjs +150 -0
- package/dist/clsx.m-DCYaa4RU.mjs +20 -0
- package/dist/index-CaXmH9yb.mjs +16061 -0
- package/dist/index-DK7aQNEB.mjs +14571 -0
- package/dist/index-VBc0Sv4o.mjs +14265 -0
- package/dist/index.mjs +5 -0
- package/dist/index.umd.js +131 -0
- package/dist/isAddressEqual-BH-X8wV-.mjs +97 -0
- package/dist/secp256k1-Cg0dVJ09.mjs +1302 -0
- package/dist/style.css +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { a3 as l, bI as g, P as E, bJ as F, Y as N, N as A, bK as w, bL as P, R as y, a5 as I, bM as b, bN as R, bO as q, bP as f, bQ as M, a6 as h, a7 as m } from "./index-CaXmH9yb.mjs";
|
|
2
|
+
function v(e) {
|
|
3
|
+
const { abi: n, data: s } = e, a = l(s, 0, 4), t = n.find((r) => r.type === "function" && a === g(E(r)));
|
|
4
|
+
if (!t)
|
|
5
|
+
throw new F(a, {
|
|
6
|
+
docsPath: "/docs/contract/decodeFunctionData"
|
|
7
|
+
});
|
|
8
|
+
return {
|
|
9
|
+
functionName: t.name,
|
|
10
|
+
args: "inputs" in t && t.inputs && t.inputs.length > 0 ? N(t.inputs, l(s, 4)) : void 0
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const u = "/docs/contract/encodeErrorResult";
|
|
14
|
+
function p(e) {
|
|
15
|
+
const { abi: n, errorName: s, args: a } = e;
|
|
16
|
+
let t = n[0];
|
|
17
|
+
if (s) {
|
|
18
|
+
const c = A({ abi: n, args: a, name: s });
|
|
19
|
+
if (!c)
|
|
20
|
+
throw new w(s, { docsPath: u });
|
|
21
|
+
t = c;
|
|
22
|
+
}
|
|
23
|
+
if (t.type !== "error")
|
|
24
|
+
throw new w(void 0, { docsPath: u });
|
|
25
|
+
const r = E(t), o = g(r);
|
|
26
|
+
let i = "0x";
|
|
27
|
+
if (a && a.length > 0) {
|
|
28
|
+
if (!t.inputs)
|
|
29
|
+
throw new P(t.name, { docsPath: u });
|
|
30
|
+
i = y(t.inputs, a);
|
|
31
|
+
}
|
|
32
|
+
return I([o, i]);
|
|
33
|
+
}
|
|
34
|
+
const d = "/docs/contract/encodeFunctionResult";
|
|
35
|
+
function x(e) {
|
|
36
|
+
const { abi: n, functionName: s, result: a } = e;
|
|
37
|
+
let t = n[0];
|
|
38
|
+
if (s) {
|
|
39
|
+
const o = A({ abi: n, name: s });
|
|
40
|
+
if (!o)
|
|
41
|
+
throw new b(s, { docsPath: d });
|
|
42
|
+
t = o;
|
|
43
|
+
}
|
|
44
|
+
if (t.type !== "function")
|
|
45
|
+
throw new b(void 0, { docsPath: d });
|
|
46
|
+
if (!t.outputs)
|
|
47
|
+
throw new R(t.name, { docsPath: d });
|
|
48
|
+
const r = (() => {
|
|
49
|
+
if (t.outputs.length === 0)
|
|
50
|
+
return [];
|
|
51
|
+
if (t.outputs.length === 1)
|
|
52
|
+
return [a];
|
|
53
|
+
if (Array.isArray(a))
|
|
54
|
+
return a;
|
|
55
|
+
throw new q(a);
|
|
56
|
+
})();
|
|
57
|
+
return y(t.outputs, r);
|
|
58
|
+
}
|
|
59
|
+
const G = "x-batch-gateway:true";
|
|
60
|
+
async function H(e) {
|
|
61
|
+
const { data: n, ccipRequest: s } = e, { args: [a] } = v({ abi: f, data: n }), t = [], r = [];
|
|
62
|
+
return await Promise.all(a.map(async (o, i) => {
|
|
63
|
+
try {
|
|
64
|
+
r[i] = o.urls.includes(G) ? await H({ data: o.data, ccipRequest: s }) : await s(o), t[i] = !1;
|
|
65
|
+
} catch (c) {
|
|
66
|
+
t[i] = !0, r[i] = L(c);
|
|
67
|
+
}
|
|
68
|
+
})), x({
|
|
69
|
+
abi: f,
|
|
70
|
+
functionName: "query",
|
|
71
|
+
result: [t, r]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function L(e) {
|
|
75
|
+
return e.name === "HttpRequestError" && e.status ? p({
|
|
76
|
+
abi: f,
|
|
77
|
+
errorName: "HttpError",
|
|
78
|
+
args: [e.status, e.shortMessage]
|
|
79
|
+
}) : p({
|
|
80
|
+
abi: [M],
|
|
81
|
+
errorName: "Error",
|
|
82
|
+
args: ["shortMessage" in e ? e.shortMessage : e.message]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function C(e, n) {
|
|
86
|
+
if (!h(e, { strict: !1 }))
|
|
87
|
+
throw new m({ address: e });
|
|
88
|
+
if (!h(n, { strict: !1 }))
|
|
89
|
+
throw new m({ address: n });
|
|
90
|
+
return e.toLowerCase() === n.toLowerCase();
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
H as a,
|
|
94
|
+
v as d,
|
|
95
|
+
C as i,
|
|
96
|
+
G as l
|
|
97
|
+
};
|