@humanode-hyperlane/cli 0.0.0-stage → 30.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/LICENSE.md +193 -0
- package/README.md +149 -2
- package/bundle/100.index.js +1453 -0
- package/bundle/12.index.js +91 -0
- package/bundle/172.index.js +3065 -0
- package/bundle/213.index.js +901 -0
- package/bundle/214.index.js +5017 -0
- package/bundle/306.index.js +1037 -0
- package/bundle/30fb121a258f7502fa97.js +214 -0
- package/bundle/467.index.js +222 -0
- package/bundle/485.index.js +85430 -0
- package/bundle/515.index.js +5191 -0
- package/bundle/544.index.js +792 -0
- package/bundle/617.index.js +1612 -0
- package/bundle/660.index.js +223 -0
- package/bundle/688.index.js +232 -0
- package/bundle/756.index.js +8595 -0
- package/bundle/824.index.js +385 -0
- package/bundle/95.index.js +264 -0
- package/bundle/aleo_wasm.wasm +0 -0
- package/bundle/aleo_wasm1.wasm +0 -0
- package/bundle/file.js +12 -0
- package/bundle/index.js +4 -0
- package/bundle/package.json +3 -0
- package/bundle/prebuilds/linux-x64/node.napi.node +0 -0
- package/bundle/worker-pipeline.js +38 -0
- package/bundle/worker.js +54 -0
- package/bundle/worker1.js +171 -0
- package/bundle/worker2.js +14180 -0
- package/bundle/worker3.js +14180 -0
- package/examples/aleo/core-config.yaml +19 -0
- package/examples/ccip/ccip-warp-route.yaml +26 -0
- package/examples/ccip/multi-chain-ccip-warp-route.yaml +81 -0
- package/examples/chain-config.yaml +42 -0
- package/examples/contract-artifacts.yaml +20 -0
- package/examples/core-config.yaml +19 -0
- package/examples/cosmosnative/core-config.yaml +20 -0
- package/examples/cosmosnative/warp-route-deployment.yaml +21 -0
- package/examples/crosschain/README.md +31 -0
- package/examples/crosschain/cosmosnative/core-config.yaml +69 -0
- package/examples/crosschain/ethereum/core-config.yaml +70 -0
- package/examples/crosschain/radix/core-config.yaml +96 -0
- package/examples/fork/file-transactions.yaml +5 -0
- package/examples/fork/timelock-testing.yaml +36 -0
- package/examples/fork/warp-route-update.yaml +100 -0
- package/examples/hooks.yaml +70 -0
- package/examples/ism-advanced.yaml +33 -0
- package/examples/ism.yaml +13 -0
- package/examples/radix/core-config.yaml +29 -0
- package/examples/sealevel/core-config-apply.yaml +7 -0
- package/examples/sealevel/core-config.yaml +12 -0
- package/examples/starknet/core-config.yaml +20 -0
- package/examples/submit/strategy/file-strategy.yaml +8 -0
- package/examples/submit/strategy/gnosis-chain-strategy.yaml +10 -0
- package/examples/submit/strategy/gnosis-chain-tx-builder-strategy.yaml +6 -0
- package/examples/submit/strategy/gnosis-strategy-avalanche.yaml +4 -0
- package/examples/submit/strategy/gnosis-tx-builder-ica-strategy.yaml +20 -0
- package/examples/submit/strategy/ica-timelock-strategy.yaml +15 -0
- package/examples/submit/strategy/impersonated-account-strategy.yaml +4 -0
- package/examples/submit/strategy/json-rpc-chain-strategy.yaml +8 -0
- package/examples/submit/strategy/json-rpc-ica-strategy.yaml +13 -0
- package/examples/submit/strategy/json-rpc-strategy.yaml +3 -0
- package/examples/submit/strategy/json-rpc-timelock-strategy.yaml +17 -0
- package/examples/submit/strategy/starknet-json-rpc-chain-strategy.yaml +11 -0
- package/examples/submit/transactions/anvil-transactions.yaml +10 -0
- package/examples/submit/transactions/avalanche-transactions.json +8 -0
- package/examples/submit/transactions/sepolia-transactions.json +8 -0
- package/examples/tron-core-config.yaml +18 -0
- package/examples/warp-route-deployment.yaml +21 -0
- package/package.json +110 -3
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import 'core-js/proposals/json-parse-with-source.js';
|
|
2
|
+
import { webcrypto } from 'node:crypto';
|
|
3
|
+
import * as $fs from 'node:fs';
|
|
4
|
+
import $mime from 'mime/lite';
|
|
5
|
+
import $xmlhttprequest from 'xmlhttprequest-ssl';
|
|
6
|
+
import * as $worker from 'node:worker_threads';
|
|
7
|
+
import * as $os from 'node:os';
|
|
8
|
+
|
|
9
|
+
if (globalThis.crypto == null) {
|
|
10
|
+
globalThis.crypto = webcrypto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const oldFetch = globalThis.fetch;
|
|
14
|
+
let supports = null;
|
|
15
|
+
async function checkFetch() {
|
|
16
|
+
try {
|
|
17
|
+
await oldFetch(new URL("file:"));
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function supportsFetch() {
|
|
25
|
+
if (supports === null) {
|
|
26
|
+
supports = checkFetch();
|
|
27
|
+
}
|
|
28
|
+
return await supports;
|
|
29
|
+
}
|
|
30
|
+
// We always polyfill fetch because Node's fetch doesn't support file URLs.
|
|
31
|
+
globalThis.fetch = async function (resource, options) {
|
|
32
|
+
const request = new Request(resource, options);
|
|
33
|
+
const url = new URL(request.url);
|
|
34
|
+
if (!(await supportsFetch()) && url.protocol === "file:") {
|
|
35
|
+
const readStream = $fs.createReadStream(url);
|
|
36
|
+
const headers = {};
|
|
37
|
+
const type = $mime.getType(url.pathname);
|
|
38
|
+
if (type) {
|
|
39
|
+
headers["Content-Type"] = type;
|
|
40
|
+
}
|
|
41
|
+
return new Response(readStream, {
|
|
42
|
+
status: 200,
|
|
43
|
+
statusText: "OK",
|
|
44
|
+
headers,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return await oldFetch(request);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
if (globalThis.XMLHttpRequest == null) {
|
|
54
|
+
globalThis.XMLHttpRequest = class extends $xmlhttprequest.XMLHttpRequest {
|
|
55
|
+
constructor(opts) {
|
|
56
|
+
super({ syncPolicy: "enabled", ...opts });
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// This is technically not a part of the Worker polyfill,
|
|
62
|
+
// but Workers are used for multi-threading, so this is often
|
|
63
|
+
// needed when writing Worker code.
|
|
64
|
+
if (globalThis.navigator == null) {
|
|
65
|
+
globalThis.navigator = {
|
|
66
|
+
hardwareConcurrency: $os.cpus().length,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (globalThis.Worker == null) {
|
|
70
|
+
globalThis.Worker = class Worker extends EventTarget {
|
|
71
|
+
_worker;
|
|
72
|
+
constructor(url, options) {
|
|
73
|
+
super();
|
|
74
|
+
if (url instanceof URL) {
|
|
75
|
+
if (url.protocol !== "file:") {
|
|
76
|
+
throw new Error("Worker only supports file: URLs");
|
|
77
|
+
}
|
|
78
|
+
url = url.href;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error("Filepaths are unreliable, use `new URL(\"...\", import.meta.url)` instead.");
|
|
82
|
+
}
|
|
83
|
+
if (!options || options.type !== "module") {
|
|
84
|
+
throw new Error("Workers must use \`type: \"module\"\`");
|
|
85
|
+
}
|
|
86
|
+
const code = `
|
|
87
|
+
import("node:worker_threads")
|
|
88
|
+
.then(({ workerData }) => {
|
|
89
|
+
return import(workerData.polyfill)
|
|
90
|
+
.then(() => import(workerData.url))
|
|
91
|
+
})
|
|
92
|
+
.catch((e) => {
|
|
93
|
+
// TODO maybe it should send a message to the parent?
|
|
94
|
+
console.error(e.stack);
|
|
95
|
+
});
|
|
96
|
+
`;
|
|
97
|
+
this._worker = new $worker.Worker(code, {
|
|
98
|
+
eval: true,
|
|
99
|
+
workerData: {
|
|
100
|
+
url,
|
|
101
|
+
polyfill: new URL("node-polyfill.js", import.meta.url).href,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
this._worker.on("message", (data) => {
|
|
105
|
+
this.dispatchEvent(new MessageEvent("message", { data }));
|
|
106
|
+
});
|
|
107
|
+
this._worker.on("messageerror", (error) => {
|
|
108
|
+
throw new Error("UNIMPLEMENTED");
|
|
109
|
+
});
|
|
110
|
+
this._worker.on("error", (error) => {
|
|
111
|
+
// TODO attach the error to the event somehow
|
|
112
|
+
const event = new Event("error");
|
|
113
|
+
this.dispatchEvent(event);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
set onmessage(f) {
|
|
117
|
+
throw new Error("UNIMPLEMENTED");
|
|
118
|
+
}
|
|
119
|
+
set onmessageerror(f) {
|
|
120
|
+
throw new Error("UNIMPLEMENTED");
|
|
121
|
+
}
|
|
122
|
+
set onerror(f) {
|
|
123
|
+
throw new Error("UNIMPLEMENTED");
|
|
124
|
+
}
|
|
125
|
+
postMessage(value, transfer) {
|
|
126
|
+
this._worker.postMessage(value, transfer);
|
|
127
|
+
}
|
|
128
|
+
terminate() {
|
|
129
|
+
this._worker.terminate();
|
|
130
|
+
}
|
|
131
|
+
// This is Node-specific, it allows the process to exit
|
|
132
|
+
// even if the Worker is still running.
|
|
133
|
+
unref() {
|
|
134
|
+
this._worker.unref();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (!$worker.isMainThread) {
|
|
139
|
+
const globals = globalThis;
|
|
140
|
+
// This is used to create the onmessage, onmessageerror, and onerror setters
|
|
141
|
+
const makeSetter = (prop, event) => {
|
|
142
|
+
let oldvalue;
|
|
143
|
+
Object.defineProperty(globals, prop, {
|
|
144
|
+
get() {
|
|
145
|
+
return oldvalue;
|
|
146
|
+
},
|
|
147
|
+
set(value) {
|
|
148
|
+
if (oldvalue) {
|
|
149
|
+
globals.removeEventListener(event, oldvalue);
|
|
150
|
+
}
|
|
151
|
+
oldvalue = value;
|
|
152
|
+
if (oldvalue) {
|
|
153
|
+
globals.addEventListener(event, oldvalue);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
// This makes sure that `f` is only run once
|
|
159
|
+
const memoize = (f) => {
|
|
160
|
+
let run = false;
|
|
161
|
+
return () => {
|
|
162
|
+
if (!run) {
|
|
163
|
+
run = true;
|
|
164
|
+
f();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
// We only start listening for messages / errors when the worker calls addEventListener
|
|
169
|
+
const startOnMessage = memoize(() => {
|
|
170
|
+
$worker.parentPort.on("message", (data) => {
|
|
171
|
+
workerEvents.dispatchEvent(new MessageEvent("message", { data }));
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
const startOnMessageError = memoize(() => {
|
|
175
|
+
throw new Error("UNIMPLEMENTED");
|
|
176
|
+
});
|
|
177
|
+
const startOnError = memoize(() => {
|
|
178
|
+
$worker.parentPort.on("error", (data) => {
|
|
179
|
+
workerEvents.dispatchEvent(new Event("error"));
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
// Node workers don't have top-level events, so we have to make our own
|
|
183
|
+
const workerEvents = new EventTarget();
|
|
184
|
+
globals.close = () => {
|
|
185
|
+
process.exit();
|
|
186
|
+
};
|
|
187
|
+
globals.addEventListener = (type, callback, options) => {
|
|
188
|
+
workerEvents.addEventListener(type, callback, options);
|
|
189
|
+
if (type === "message") {
|
|
190
|
+
startOnMessage();
|
|
191
|
+
}
|
|
192
|
+
else if (type === "messageerror") {
|
|
193
|
+
startOnMessageError();
|
|
194
|
+
}
|
|
195
|
+
else if (type === "error") {
|
|
196
|
+
startOnError();
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
globals.removeEventListener = (type, callback, options) => {
|
|
200
|
+
workerEvents.removeEventListener(type, callback, options);
|
|
201
|
+
};
|
|
202
|
+
function postMessage(value, transfer) {
|
|
203
|
+
$worker.parentPort.postMessage(value, transfer);
|
|
204
|
+
}
|
|
205
|
+
globals.postMessage = postMessage;
|
|
206
|
+
makeSetter("onmessage", "message");
|
|
207
|
+
makeSetter("onmessageerror", "messageerror");
|
|
208
|
+
makeSetter("onerror", "error");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (!globalThis.self) {
|
|
212
|
+
globalThis.self = globalThis;
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=node-polyfill.js.map
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
export const id = 467;
|
|
2
|
+
export const ids = [467];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 53467:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// EXPORTS
|
|
10
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
offchainLookup: () => (/* binding */ offchainLookup),
|
|
12
|
+
offchainLookupSignature: () => (/* binding */ offchainLookupSignature)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// UNUSED EXPORTS: ccipRequest, offchainLookupAbiItem
|
|
16
|
+
|
|
17
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/public/call.js + 1 modules
|
|
18
|
+
var call = __webpack_require__(27599);
|
|
19
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/stringify.js
|
|
20
|
+
var stringify = __webpack_require__(48720);
|
|
21
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/base.js + 1 modules
|
|
22
|
+
var base = __webpack_require__(52516);
|
|
23
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/utils.js
|
|
24
|
+
var utils = __webpack_require__(72650);
|
|
25
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/ccip.js
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class OffchainLookupError extends base/* BaseError */.C {
|
|
30
|
+
constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {
|
|
31
|
+
super(cause.shortMessage ||
|
|
32
|
+
'An error occurred while fetching for an offchain result.', {
|
|
33
|
+
cause,
|
|
34
|
+
metaMessages: [
|
|
35
|
+
...(cause.metaMessages || []),
|
|
36
|
+
cause.metaMessages?.length ? '' : [],
|
|
37
|
+
'Offchain Gateway Call:',
|
|
38
|
+
urls && [
|
|
39
|
+
' Gateway URL(s):',
|
|
40
|
+
...urls.map((url) => ` ${(0,utils/* getUrl */.I)(url)}`),
|
|
41
|
+
],
|
|
42
|
+
` Sender: ${sender}`,
|
|
43
|
+
` Data: ${data}`,
|
|
44
|
+
` Callback selector: ${callbackSelector}`,
|
|
45
|
+
` Extra data: ${extraData}`,
|
|
46
|
+
].flat(),
|
|
47
|
+
name: 'OffchainLookupError',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class OffchainLookupResponseMalformedError extends base/* BaseError */.C {
|
|
52
|
+
constructor({ result, url }) {
|
|
53
|
+
super('Offchain gateway response is malformed. Response data must be a hex value.', {
|
|
54
|
+
metaMessages: [
|
|
55
|
+
`Gateway URL: ${(0,utils/* getUrl */.I)(url)}`,
|
|
56
|
+
`Response: ${(0,stringify/* stringify */.A)(result)}`,
|
|
57
|
+
],
|
|
58
|
+
name: 'OffchainLookupResponseMalformedError',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
class OffchainLookupSenderMismatchError extends base/* BaseError */.C {
|
|
63
|
+
constructor({ sender, to }) {
|
|
64
|
+
super('Reverted sender address does not match target contract address (`to`).', {
|
|
65
|
+
metaMessages: [
|
|
66
|
+
`Contract address: ${to}`,
|
|
67
|
+
`OffchainLookup sender address: ${sender}`,
|
|
68
|
+
],
|
|
69
|
+
name: 'OffchainLookupSenderMismatchError',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=ccip.js.map
|
|
74
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/request.js
|
|
75
|
+
var request = __webpack_require__(16742);
|
|
76
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/abi/decodeErrorResult.js
|
|
77
|
+
var decodeErrorResult = __webpack_require__(3809);
|
|
78
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
|
|
79
|
+
var encodeAbiParameters = __webpack_require__(40488);
|
|
80
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/address/isAddressEqual.js
|
|
81
|
+
var isAddressEqual = __webpack_require__(14936);
|
|
82
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/data/concat.js
|
|
83
|
+
var concat = __webpack_require__(96468);
|
|
84
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/data/isHex.js
|
|
85
|
+
var isHex = __webpack_require__(84435);
|
|
86
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/ens/localBatchGatewayRequest.js + 2 modules
|
|
87
|
+
var localBatchGatewayRequest = __webpack_require__(37354);
|
|
88
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@6.0.2_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/ccip.js
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const offchainLookupSignature = '0x556f1830';
|
|
100
|
+
const offchainLookupAbiItem = {
|
|
101
|
+
name: 'OffchainLookup',
|
|
102
|
+
type: 'error',
|
|
103
|
+
inputs: [
|
|
104
|
+
{
|
|
105
|
+
name: 'sender',
|
|
106
|
+
type: 'address',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'urls',
|
|
110
|
+
type: 'string[]',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'callData',
|
|
114
|
+
type: 'bytes',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'callbackFunction',
|
|
118
|
+
type: 'bytes4',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'extraData',
|
|
122
|
+
type: 'bytes',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
};
|
|
126
|
+
async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {
|
|
127
|
+
const { args } = (0,decodeErrorResult/* decodeErrorResult */.W)({
|
|
128
|
+
data,
|
|
129
|
+
abi: [offchainLookupAbiItem],
|
|
130
|
+
});
|
|
131
|
+
const [sender, urls, callData, callbackSelector, extraData] = args;
|
|
132
|
+
const { ccipRead } = client;
|
|
133
|
+
const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'
|
|
134
|
+
? ccipRead.request
|
|
135
|
+
: ccipRequest;
|
|
136
|
+
try {
|
|
137
|
+
if (!(0,isAddressEqual/* isAddressEqual */.h)(to, sender))
|
|
138
|
+
throw new OffchainLookupSenderMismatchError({ sender, to });
|
|
139
|
+
const result = urls.includes(localBatchGatewayRequest/* localBatchGatewayUrl */.J)
|
|
140
|
+
? await (0,localBatchGatewayRequest/* localBatchGatewayRequest */.X)({
|
|
141
|
+
data: callData,
|
|
142
|
+
ccipRequest: ccipRequest_,
|
|
143
|
+
})
|
|
144
|
+
: await ccipRequest_({ data: callData, sender, urls });
|
|
145
|
+
const { data: data_ } = await (0,call/* call */.T)(client, {
|
|
146
|
+
blockNumber,
|
|
147
|
+
blockTag,
|
|
148
|
+
data: (0,concat/* concat */.xW)([
|
|
149
|
+
callbackSelector,
|
|
150
|
+
(0,encodeAbiParameters/* encodeAbiParameters */.h)([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),
|
|
151
|
+
]),
|
|
152
|
+
to,
|
|
153
|
+
});
|
|
154
|
+
return data_;
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
throw new OffchainLookupError({
|
|
158
|
+
callbackSelector,
|
|
159
|
+
cause: err,
|
|
160
|
+
data,
|
|
161
|
+
extraData,
|
|
162
|
+
sender,
|
|
163
|
+
urls,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function ccipRequest({ data, sender, urls, }) {
|
|
168
|
+
let error = new Error('An unknown error occurred.');
|
|
169
|
+
for (let i = 0; i < urls.length; i++) {
|
|
170
|
+
const url = urls[i];
|
|
171
|
+
const method = url.includes('{data}') ? 'GET' : 'POST';
|
|
172
|
+
const body = method === 'POST' ? { data, sender } : undefined;
|
|
173
|
+
const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};
|
|
174
|
+
try {
|
|
175
|
+
const response = await fetch(url.replace('{sender}', sender.toLowerCase()).replace('{data}', data), {
|
|
176
|
+
body: JSON.stringify(body),
|
|
177
|
+
headers,
|
|
178
|
+
method,
|
|
179
|
+
});
|
|
180
|
+
let result;
|
|
181
|
+
if (response.headers.get('Content-Type')?.startsWith('application/json')) {
|
|
182
|
+
result = (await response.json()).data;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
result = (await response.text());
|
|
186
|
+
}
|
|
187
|
+
if (!response.ok) {
|
|
188
|
+
error = new request/* HttpRequestError */.Ci({
|
|
189
|
+
body,
|
|
190
|
+
details: result?.error
|
|
191
|
+
? (0,stringify/* stringify */.A)(result.error)
|
|
192
|
+
: response.statusText,
|
|
193
|
+
headers: response.headers,
|
|
194
|
+
status: response.status,
|
|
195
|
+
url,
|
|
196
|
+
});
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (!(0,isHex/* isHex */.q)(result)) {
|
|
200
|
+
error = new OffchainLookupResponseMalformedError({
|
|
201
|
+
result,
|
|
202
|
+
url,
|
|
203
|
+
});
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
error = new request/* HttpRequestError */.Ci({
|
|
210
|
+
body,
|
|
211
|
+
details: err.message,
|
|
212
|
+
url,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=ccip.js.map
|
|
219
|
+
|
|
220
|
+
/***/ })
|
|
221
|
+
|
|
222
|
+
};
|