@edgex-web/components 0.1.0-beta.7 → 0.1.0-beta.9
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/components/Deposit/index.d.ts +1 -1
- package/dist/components/Deposit/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
- package/dist/components/Deposit/src/evm/WalletView.d.ts +1 -0
- package/dist/components/Deposit/src/evm/WalletView.d.ts.map +1 -1
- package/dist/components/Deposit/src/evm/index.d.ts +8 -0
- package/dist/components/Deposit/src/evm/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts +31 -2
- package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts.map +1 -1
- package/dist/components/Deposit/src/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/mpc/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/walletAdapters.d.ts.map +1 -1
- package/dist/components/Deposit/types/index.d.ts +10 -0
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +6751 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +28 -64
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/ccip-1aCtQ0Wi.mjs +0 -240
- package/dist/ccip-1aCtQ0Wi.mjs.map +0 -1
- package/dist/index-CJsCUMB-.mjs +0 -12255
- package/dist/index-CJsCUMB-.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgex-web/components",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.9",
|
|
4
4
|
"description": "EdgeX Universal UI Components Library - Reusable React components for deposit, withdraw and other common UI patterns",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
package/dist/ccip-1aCtQ0Wi.mjs
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { i as b, I as E, s as A, t as x, f as F, A as I, d as C, g as M, a as R, b as D, e as w, c as G, h as k, j as T, k as H, l as m, m as v, B as y, n as N, o as P, p as j, q as B, r as U, H as L, u as _ } from "./index-CJsCUMB-.mjs";
|
|
2
|
-
function J(e, s) {
|
|
3
|
-
if (!b(e, { strict: !1 }))
|
|
4
|
-
throw new E({ address: e });
|
|
5
|
-
if (!b(s, { strict: !1 }))
|
|
6
|
-
throw new E({ address: s });
|
|
7
|
-
return e.toLowerCase() === s.toLowerCase();
|
|
8
|
-
}
|
|
9
|
-
function W(e) {
|
|
10
|
-
const { abi: s, data: a } = e, r = A(a, 0, 4), t = s.find((o) => o.type === "function" && r === x(F(o)));
|
|
11
|
-
if (!t)
|
|
12
|
-
throw new I(r, {
|
|
13
|
-
docsPath: "/docs/contract/decodeFunctionData"
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
functionName: t.name,
|
|
17
|
-
args: "inputs" in t && t.inputs && t.inputs.length > 0 ? C(t.inputs, A(a, 4)) : void 0
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const p = "/docs/contract/encodeErrorResult";
|
|
21
|
-
function O(e) {
|
|
22
|
-
const { abi: s, errorName: a, args: r } = e;
|
|
23
|
-
let t = s[0];
|
|
24
|
-
if (a) {
|
|
25
|
-
const u = M({ abi: s, args: r, name: a });
|
|
26
|
-
if (!u)
|
|
27
|
-
throw new R(a, { docsPath: p });
|
|
28
|
-
t = u;
|
|
29
|
-
}
|
|
30
|
-
if (t.type !== "error")
|
|
31
|
-
throw new R(void 0, { docsPath: p });
|
|
32
|
-
const o = F(t), n = x(o);
|
|
33
|
-
let c = "0x";
|
|
34
|
-
if (r && r.length > 0) {
|
|
35
|
-
if (!t.inputs)
|
|
36
|
-
throw new D(t.name, { docsPath: p });
|
|
37
|
-
c = w(t.inputs, r);
|
|
38
|
-
}
|
|
39
|
-
return G([n, c]);
|
|
40
|
-
}
|
|
41
|
-
const h = "/docs/contract/encodeFunctionResult";
|
|
42
|
-
function z(e) {
|
|
43
|
-
const { abi: s, functionName: a, result: r } = e;
|
|
44
|
-
let t = s[0];
|
|
45
|
-
if (a) {
|
|
46
|
-
const n = M({ abi: s, name: a });
|
|
47
|
-
if (!n)
|
|
48
|
-
throw new k(a, { docsPath: h });
|
|
49
|
-
t = n;
|
|
50
|
-
}
|
|
51
|
-
if (t.type !== "function")
|
|
52
|
-
throw new k(void 0, { docsPath: h });
|
|
53
|
-
if (!t.outputs)
|
|
54
|
-
throw new T(t.name, { docsPath: h });
|
|
55
|
-
const o = (() => {
|
|
56
|
-
if (t.outputs.length === 0)
|
|
57
|
-
return [];
|
|
58
|
-
if (t.outputs.length === 1)
|
|
59
|
-
return [r];
|
|
60
|
-
if (Array.isArray(r))
|
|
61
|
-
return r;
|
|
62
|
-
throw new H(r);
|
|
63
|
-
})();
|
|
64
|
-
return w(t.outputs, o);
|
|
65
|
-
}
|
|
66
|
-
const q = "x-batch-gateway:true";
|
|
67
|
-
async function S(e) {
|
|
68
|
-
const { data: s, ccipRequest: a } = e, { args: [r] } = W({ abi: m, data: s }), t = [], o = [];
|
|
69
|
-
return await Promise.all(r.map(async (n, c) => {
|
|
70
|
-
try {
|
|
71
|
-
o[c] = n.urls.includes(q) ? await S({ data: n.data, ccipRequest: a }) : await a(n), t[c] = !1;
|
|
72
|
-
} catch (u) {
|
|
73
|
-
t[c] = !0, o[c] = K(u);
|
|
74
|
-
}
|
|
75
|
-
})), z({
|
|
76
|
-
abi: m,
|
|
77
|
-
functionName: "query",
|
|
78
|
-
result: [t, o]
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function K(e) {
|
|
82
|
-
return e.name === "HttpRequestError" && e.status ? O({
|
|
83
|
-
abi: m,
|
|
84
|
-
errorName: "HttpError",
|
|
85
|
-
args: [e.status, e.shortMessage]
|
|
86
|
-
}) : O({
|
|
87
|
-
abi: [v],
|
|
88
|
-
errorName: "Error",
|
|
89
|
-
args: ["shortMessage" in e ? e.shortMessage : e.message]
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
class Q extends y {
|
|
93
|
-
constructor({ callbackSelector: s, cause: a, data: r, extraData: t, sender: o, urls: n }) {
|
|
94
|
-
var c;
|
|
95
|
-
super(a.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
96
|
-
cause: a,
|
|
97
|
-
metaMessages: [
|
|
98
|
-
...a.metaMessages || [],
|
|
99
|
-
(c = a.metaMessages) != null && c.length ? "" : [],
|
|
100
|
-
"Offchain Gateway Call:",
|
|
101
|
-
n && [
|
|
102
|
-
" Gateway URL(s):",
|
|
103
|
-
...n.map((u) => ` ${N(u)}`)
|
|
104
|
-
],
|
|
105
|
-
` Sender: ${o}`,
|
|
106
|
-
` Data: ${r}`,
|
|
107
|
-
` Callback selector: ${s}`,
|
|
108
|
-
` Extra data: ${t}`
|
|
109
|
-
].flat(),
|
|
110
|
-
name: "OffchainLookupError"
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
class V extends y {
|
|
115
|
-
constructor({ result: s, url: a }) {
|
|
116
|
-
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
117
|
-
metaMessages: [
|
|
118
|
-
`Gateway URL: ${N(a)}`,
|
|
119
|
-
`Response: ${P(s)}`
|
|
120
|
-
],
|
|
121
|
-
name: "OffchainLookupResponseMalformedError"
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
class X extends y {
|
|
126
|
-
constructor({ sender: s, to: a }) {
|
|
127
|
-
super("Reverted sender address does not match target contract address (`to`).", {
|
|
128
|
-
metaMessages: [
|
|
129
|
-
`Contract address: ${a}`,
|
|
130
|
-
`OffchainLookup sender address: ${s}`
|
|
131
|
-
],
|
|
132
|
-
name: "OffchainLookupSenderMismatchError"
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const et = "0x556f1830", Y = {
|
|
137
|
-
name: "OffchainLookup",
|
|
138
|
-
type: "error",
|
|
139
|
-
inputs: [
|
|
140
|
-
{
|
|
141
|
-
name: "sender",
|
|
142
|
-
type: "address"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "urls",
|
|
146
|
-
type: "string[]"
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
name: "callData",
|
|
150
|
-
type: "bytes"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: "callbackFunction",
|
|
154
|
-
type: "bytes4"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "extraData",
|
|
158
|
-
type: "bytes"
|
|
159
|
-
}
|
|
160
|
-
]
|
|
161
|
-
};
|
|
162
|
-
async function at(e, { blockNumber: s, blockTag: a, data: r, to: t }) {
|
|
163
|
-
const { args: o } = j({
|
|
164
|
-
data: r,
|
|
165
|
-
abi: [Y]
|
|
166
|
-
}), [n, c, u, f, d] = o, { ccipRead: i } = e, g = i && typeof (i == null ? void 0 : i.request) == "function" ? i.request : Z;
|
|
167
|
-
try {
|
|
168
|
-
if (!J(t, n))
|
|
169
|
-
throw new X({ sender: n, to: t });
|
|
170
|
-
const l = c.includes(q) ? await S({
|
|
171
|
-
data: u,
|
|
172
|
-
ccipRequest: g
|
|
173
|
-
}) : await g({ data: u, sender: n, urls: c }), { data: $ } = await B(e, {
|
|
174
|
-
blockNumber: s,
|
|
175
|
-
blockTag: a,
|
|
176
|
-
data: U([
|
|
177
|
-
f,
|
|
178
|
-
w([{ type: "bytes" }, { type: "bytes" }], [l, d])
|
|
179
|
-
]),
|
|
180
|
-
to: t
|
|
181
|
-
});
|
|
182
|
-
return $;
|
|
183
|
-
} catch (l) {
|
|
184
|
-
throw new Q({
|
|
185
|
-
callbackSelector: f,
|
|
186
|
-
cause: l,
|
|
187
|
-
data: r,
|
|
188
|
-
extraData: d,
|
|
189
|
-
sender: n,
|
|
190
|
-
urls: c
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async function Z({ data: e, sender: s, urls: a }) {
|
|
195
|
-
var t;
|
|
196
|
-
let r = new Error("An unknown error occurred.");
|
|
197
|
-
for (let o = 0; o < a.length; o++) {
|
|
198
|
-
const n = a[o], c = n.includes("{data}") ? "GET" : "POST", u = c === "POST" ? { data: e, sender: s } : void 0, f = c === "POST" ? { "Content-Type": "application/json" } : {};
|
|
199
|
-
try {
|
|
200
|
-
const d = await fetch(n.replace("{sender}", s.toLowerCase()).replace("{data}", e), {
|
|
201
|
-
body: JSON.stringify(u),
|
|
202
|
-
headers: f,
|
|
203
|
-
method: c
|
|
204
|
-
});
|
|
205
|
-
let i;
|
|
206
|
-
if ((t = d.headers.get("Content-Type")) != null && t.startsWith("application/json") ? i = (await d.json()).data : i = await d.text(), !d.ok) {
|
|
207
|
-
r = new L({
|
|
208
|
-
body: u,
|
|
209
|
-
details: i != null && i.error ? P(i.error) : d.statusText,
|
|
210
|
-
headers: d.headers,
|
|
211
|
-
status: d.status,
|
|
212
|
-
url: n
|
|
213
|
-
});
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
if (!_(i)) {
|
|
217
|
-
r = new V({
|
|
218
|
-
result: i,
|
|
219
|
-
url: n
|
|
220
|
-
});
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
return i;
|
|
224
|
-
} catch (d) {
|
|
225
|
-
r = new L({
|
|
226
|
-
body: u,
|
|
227
|
-
details: d.message,
|
|
228
|
-
url: n
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
throw r;
|
|
233
|
-
}
|
|
234
|
-
export {
|
|
235
|
-
Z as ccipRequest,
|
|
236
|
-
at as offchainLookup,
|
|
237
|
-
Y as offchainLookupAbiItem,
|
|
238
|
-
et as offchainLookupSignature
|
|
239
|
-
};
|
|
240
|
-
//# sourceMappingURL=ccip-1aCtQ0Wi.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ccip-1aCtQ0Wi.mjs","sources":["../node_modules/viem/_esm/utils/address/isAddressEqual.js","../node_modules/viem/_esm/utils/abi/decodeFunctionData.js","../node_modules/viem/_esm/utils/abi/encodeErrorResult.js","../node_modules/viem/_esm/utils/abi/encodeFunctionResult.js","../node_modules/viem/_esm/utils/ens/localBatchGatewayRequest.js","../node_modules/viem/_esm/errors/ccip.js","../node_modules/viem/_esm/utils/ccip.js"],"sourcesContent":["import { InvalidAddressError, } from '../../errors/address.js';\nimport { isAddress } from './isAddress.js';\nexport function isAddressEqual(a, b) {\n if (!isAddress(a, { strict: false }))\n throw new InvalidAddressError({ address: a });\n if (!isAddress(b, { strict: false }))\n throw new InvalidAddressError({ address: b });\n return a.toLowerCase() === b.toLowerCase();\n}\n//# sourceMappingURL=isAddressEqual.js.map","import { AbiFunctionSignatureNotFoundError } from '../../errors/abi.js';\nimport { slice } from '../data/slice.js';\nimport { toFunctionSelector, } from '../hash/toFunctionSelector.js';\nimport { decodeAbiParameters, } from './decodeAbiParameters.js';\nimport { formatAbiItem } from './formatAbiItem.js';\nexport function decodeFunctionData(parameters) {\n const { abi, data } = parameters;\n const signature = slice(data, 0, 4);\n const description = abi.find((x) => x.type === 'function' &&\n signature === toFunctionSelector(formatAbiItem(x)));\n if (!description)\n throw new AbiFunctionSignatureNotFoundError(signature, {\n docsPath: '/docs/contract/decodeFunctionData',\n });\n return {\n functionName: description.name,\n args: ('inputs' in description &&\n description.inputs &&\n description.inputs.length > 0\n ? decodeAbiParameters(description.inputs, slice(data, 4))\n : undefined),\n };\n}\n//# sourceMappingURL=decodeFunctionData.js.map","import { AbiErrorInputsNotFoundError, AbiErrorNotFoundError, } from '../../errors/abi.js';\nimport { concatHex } from '../data/concat.js';\nimport { toFunctionSelector, } from '../hash/toFunctionSelector.js';\nimport { encodeAbiParameters, } from './encodeAbiParameters.js';\nimport { formatAbiItem } from './formatAbiItem.js';\nimport { getAbiItem } from './getAbiItem.js';\nconst docsPath = '/docs/contract/encodeErrorResult';\nexport function encodeErrorResult(parameters) {\n const { abi, errorName, args } = parameters;\n let abiItem = abi[0];\n if (errorName) {\n const item = getAbiItem({ abi, args, name: errorName });\n if (!item)\n throw new AbiErrorNotFoundError(errorName, { docsPath });\n abiItem = item;\n }\n if (abiItem.type !== 'error')\n throw new AbiErrorNotFoundError(undefined, { docsPath });\n const definition = formatAbiItem(abiItem);\n const signature = toFunctionSelector(definition);\n let data = '0x';\n if (args && args.length > 0) {\n if (!abiItem.inputs)\n throw new AbiErrorInputsNotFoundError(abiItem.name, { docsPath });\n data = encodeAbiParameters(abiItem.inputs, args);\n }\n return concatHex([signature, data]);\n}\n//# sourceMappingURL=encodeErrorResult.js.map","import { AbiFunctionNotFoundError, AbiFunctionOutputsNotFoundError, InvalidArrayError, } from '../../errors/abi.js';\nimport { encodeAbiParameters, } from './encodeAbiParameters.js';\nimport { getAbiItem } from './getAbiItem.js';\nconst docsPath = '/docs/contract/encodeFunctionResult';\nexport function encodeFunctionResult(parameters) {\n const { abi, functionName, result } = parameters;\n let abiItem = abi[0];\n if (functionName) {\n const item = getAbiItem({ abi, name: functionName });\n if (!item)\n throw new AbiFunctionNotFoundError(functionName, { docsPath });\n abiItem = item;\n }\n if (abiItem.type !== 'function')\n throw new AbiFunctionNotFoundError(undefined, { docsPath });\n if (!abiItem.outputs)\n throw new AbiFunctionOutputsNotFoundError(abiItem.name, { docsPath });\n const values = (() => {\n if (abiItem.outputs.length === 0)\n return [];\n if (abiItem.outputs.length === 1)\n return [result];\n if (Array.isArray(result))\n return result;\n throw new InvalidArrayError(result);\n })();\n return encodeAbiParameters(abiItem.outputs, values);\n}\n//# sourceMappingURL=encodeFunctionResult.js.map","import { batchGatewayAbi } from '../../constants/abis.js';\nimport { solidityError } from '../../constants/solidity.js';\nimport { decodeFunctionData } from '../abi/decodeFunctionData.js';\nimport { encodeErrorResult } from '../abi/encodeErrorResult.js';\nimport { encodeFunctionResult } from '../abi/encodeFunctionResult.js';\nexport const localBatchGatewayUrl = 'x-batch-gateway:true';\nexport async function localBatchGatewayRequest(parameters) {\n const { data, ccipRequest } = parameters;\n const { args: [queries], } = decodeFunctionData({ abi: batchGatewayAbi, data });\n const failures = [];\n const responses = [];\n await Promise.all(queries.map(async (query, i) => {\n try {\n responses[i] = query.urls.includes(localBatchGatewayUrl)\n ? await localBatchGatewayRequest({ data: query.data, ccipRequest })\n : await ccipRequest(query);\n failures[i] = false;\n }\n catch (err) {\n failures[i] = true;\n responses[i] = encodeError(err);\n }\n }));\n return encodeFunctionResult({\n abi: batchGatewayAbi,\n functionName: 'query',\n result: [failures, responses],\n });\n}\nfunction encodeError(error) {\n if (error.name === 'HttpRequestError' && error.status)\n return encodeErrorResult({\n abi: batchGatewayAbi,\n errorName: 'HttpError',\n args: [error.status, error.shortMessage],\n });\n return encodeErrorResult({\n abi: [solidityError],\n errorName: 'Error',\n args: ['shortMessage' in error ? error.shortMessage : error.message],\n });\n}\n//# sourceMappingURL=localBatchGatewayRequest.js.map","import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class OffchainLookupError extends BaseError {\n constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {\n super(cause.shortMessage ||\n 'An error occurred while fetching for an offchain result.', {\n cause,\n metaMessages: [\n ...(cause.metaMessages || []),\n cause.metaMessages?.length ? '' : [],\n 'Offchain Gateway Call:',\n urls && [\n ' Gateway URL(s):',\n ...urls.map((url) => ` ${getUrl(url)}`),\n ],\n ` Sender: ${sender}`,\n ` Data: ${data}`,\n ` Callback selector: ${callbackSelector}`,\n ` Extra data: ${extraData}`,\n ].flat(),\n name: 'OffchainLookupError',\n });\n }\n}\nexport class OffchainLookupResponseMalformedError extends BaseError {\n constructor({ result, url }) {\n super('Offchain gateway response is malformed. Response data must be a hex value.', {\n metaMessages: [\n `Gateway URL: ${getUrl(url)}`,\n `Response: ${stringify(result)}`,\n ],\n name: 'OffchainLookupResponseMalformedError',\n });\n }\n}\nexport class OffchainLookupSenderMismatchError extends BaseError {\n constructor({ sender, to }) {\n super('Reverted sender address does not match target contract address (`to`).', {\n metaMessages: [\n `Contract address: ${to}`,\n `OffchainLookup sender address: ${sender}`,\n ],\n name: 'OffchainLookupSenderMismatchError',\n });\n }\n}\n//# sourceMappingURL=ccip.js.map","import { call } from '../actions/public/call.js';\nimport { OffchainLookupError, OffchainLookupResponseMalformedError, OffchainLookupSenderMismatchError, } from '../errors/ccip.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { decodeErrorResult } from './abi/decodeErrorResult.js';\nimport { encodeAbiParameters } from './abi/encodeAbiParameters.js';\nimport { isAddressEqual } from './address/isAddressEqual.js';\nimport { concat } from './data/concat.js';\nimport { isHex } from './data/isHex.js';\nimport { localBatchGatewayRequest, localBatchGatewayUrl, } from './ens/localBatchGatewayRequest.js';\nimport { stringify } from './stringify.js';\nexport const offchainLookupSignature = '0x556f1830';\nexport const offchainLookupAbiItem = {\n name: 'OffchainLookup',\n type: 'error',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'urls',\n type: 'string[]',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n {\n name: 'callbackFunction',\n type: 'bytes4',\n },\n {\n name: 'extraData',\n type: 'bytes',\n },\n ],\n};\nexport async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {\n const { args } = decodeErrorResult({\n data,\n abi: [offchainLookupAbiItem],\n });\n const [sender, urls, callData, callbackSelector, extraData] = args;\n const { ccipRead } = client;\n const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'\n ? ccipRead.request\n : ccipRequest;\n try {\n if (!isAddressEqual(to, sender))\n throw new OffchainLookupSenderMismatchError({ sender, to });\n const result = urls.includes(localBatchGatewayUrl)\n ? await localBatchGatewayRequest({\n data: callData,\n ccipRequest: ccipRequest_,\n })\n : await ccipRequest_({ data: callData, sender, urls });\n const { data: data_ } = await call(client, {\n blockNumber,\n blockTag,\n data: concat([\n callbackSelector,\n encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),\n ]),\n to,\n });\n return data_;\n }\n catch (err) {\n throw new OffchainLookupError({\n callbackSelector,\n cause: err,\n data,\n extraData,\n sender,\n urls,\n });\n }\n}\nexport async function ccipRequest({ data, sender, urls, }) {\n let error = new Error('An unknown error occurred.');\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n const method = url.includes('{data}') ? 'GET' : 'POST';\n const body = method === 'POST' ? { data, sender } : undefined;\n const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};\n try {\n const response = await fetch(url.replace('{sender}', sender.toLowerCase()).replace('{data}', data), {\n body: JSON.stringify(body),\n headers,\n method,\n });\n let result;\n if (response.headers.get('Content-Type')?.startsWith('application/json')) {\n result = (await response.json()).data;\n }\n else {\n result = (await response.text());\n }\n if (!response.ok) {\n error = new HttpRequestError({\n body,\n details: result?.error\n ? stringify(result.error)\n : response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n continue;\n }\n if (!isHex(result)) {\n error = new OffchainLookupResponseMalformedError({\n result,\n url,\n });\n continue;\n }\n return result;\n }\n catch (err) {\n error = new HttpRequestError({\n body,\n details: err.message,\n url,\n });\n }\n }\n throw error;\n}\n//# sourceMappingURL=ccip.js.map"],"names":["isAddressEqual","a","b","isAddress","InvalidAddressError","decodeFunctionData","parameters","abi","data","signature","slice","description","x","toFunctionSelector","formatAbiItem","AbiFunctionSignatureNotFoundError","decodeAbiParameters","docsPath","encodeErrorResult","errorName","args","abiItem","item","getAbiItem","AbiErrorNotFoundError","definition","AbiErrorInputsNotFoundError","encodeAbiParameters","concatHex","encodeFunctionResult","functionName","result","AbiFunctionNotFoundError","AbiFunctionOutputsNotFoundError","values","InvalidArrayError","localBatchGatewayUrl","localBatchGatewayRequest","ccipRequest","queries","batchGatewayAbi","failures","responses","query","i","err","encodeError","error","solidityError","OffchainLookupError","BaseError","callbackSelector","cause","extraData","sender","urls","_a","url","getUrl","OffchainLookupResponseMalformedError","stringify","OffchainLookupSenderMismatchError","to","offchainLookupSignature","offchainLookupAbiItem","offchainLookup","client","blockNumber","blockTag","decodeErrorResult","callData","ccipRead","ccipRequest_","data_","call","concat","method","body","headers","response","HttpRequestError","isHex"],"mappings":";AAEO,SAASA,EAAeC,GAAGC,GAAG;AACjC,MAAI,CAACC,EAAUF,GAAG,EAAE,QAAQ,GAAK,CAAE;AAC/B,UAAM,IAAIG,EAAoB,EAAE,SAASH,EAAC,CAAE;AAChD,MAAI,CAACE,EAAUD,GAAG,EAAE,QAAQ,GAAK,CAAE;AAC/B,UAAM,IAAIE,EAAoB,EAAE,SAASF,EAAC,CAAE;AAChD,SAAOD,EAAE,kBAAkBC,EAAE,YAAW;AAC5C;ACHO,SAASG,EAAmBC,GAAY;AAC3C,QAAM,EAAE,KAAAC,GAAK,MAAAC,EAAI,IAAKF,GAChBG,IAAYC,EAAMF,GAAM,GAAG,CAAC,GAC5BG,IAAcJ,EAAI,KAAK,CAACK,MAAMA,EAAE,SAAS,cAC3CH,MAAcI,EAAmBC,EAAcF,CAAC,CAAC,CAAC;AACtD,MAAI,CAACD;AACD,UAAM,IAAII,EAAkCN,GAAW;AAAA,MACnD,UAAU;AAAA,IACtB,CAAS;AACL,SAAO;AAAA,IACH,cAAcE,EAAY;AAAA,IAC1B,MAAO,YAAYA,KACfA,EAAY,UACZA,EAAY,OAAO,SAAS,IAC1BK,EAAoBL,EAAY,QAAQD,EAAMF,GAAM,CAAC,CAAC,IACtD;AAAA,EACd;AACA;AChBA,MAAMS,IAAW;AACV,SAASC,EAAkBZ,GAAY;AAC1C,QAAM,EAAE,KAAAC,GAAK,WAAAY,GAAW,MAAAC,EAAI,IAAKd;AACjC,MAAIe,IAAUd,EAAI,CAAC;AACnB,MAAIY,GAAW;AACX,UAAMG,IAAOC,EAAW,EAAE,KAAAhB,GAAK,MAAAa,GAAM,MAAMD,GAAW;AACtD,QAAI,CAACG;AACD,YAAM,IAAIE,EAAsBL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