@fileverse-dev/ddoc 2.2.5-patch-2 → 2.2.5-patch-3
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.
@@ -1,19 +1,19 @@
|
|
1
|
-
import { B as
|
2
|
-
class
|
3
|
-
constructor({ callbackSelector: r, cause: a, data:
|
4
|
-
var
|
1
|
+
import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-Chp-aMeU.mjs";
|
2
|
+
class S extends p {
|
3
|
+
constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
|
4
|
+
var o;
|
5
5
|
super(a.shortMessage || "An error occurred while fetching for an offchain result.", {
|
6
6
|
cause: a,
|
7
7
|
metaMessages: [
|
8
8
|
...a.metaMessages || [],
|
9
|
-
(
|
9
|
+
(o = a.metaMessages) != null && o.length ? "" : [],
|
10
10
|
"Offchain Gateway Call:",
|
11
11
|
t && [
|
12
12
|
" Gateway URL(s):",
|
13
|
-
...t.map((
|
13
|
+
...t.map((d) => ` ${m(d)}`)
|
14
14
|
],
|
15
|
-
` Sender: ${
|
16
|
-
` Data: ${
|
15
|
+
` Sender: ${f}`,
|
16
|
+
` Data: ${n}`,
|
17
17
|
` Callback selector: ${r}`,
|
18
18
|
` Extra data: ${i}`
|
19
19
|
].flat(),
|
@@ -21,18 +21,18 @@ class M extends l {
|
|
21
21
|
});
|
22
22
|
}
|
23
23
|
}
|
24
|
-
class
|
24
|
+
class $ extends p {
|
25
25
|
constructor({ result: r, url: a }) {
|
26
26
|
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
27
27
|
metaMessages: [
|
28
28
|
`Gateway URL: ${m(a)}`,
|
29
|
-
`Response: ${
|
29
|
+
`Response: ${w(r)}`
|
30
30
|
],
|
31
31
|
name: "OffchainLookupResponseMalformedError"
|
32
32
|
});
|
33
33
|
}
|
34
34
|
}
|
35
|
-
class
|
35
|
+
class q extends p {
|
36
36
|
constructor({ sender: r, to: a }) {
|
37
37
|
super("Reverted sender address does not match target contract address (`to`).", {
|
38
38
|
metaMessages: [
|
@@ -43,7 +43,7 @@ class S extends l {
|
|
43
43
|
});
|
44
44
|
}
|
45
45
|
}
|
46
|
-
const
|
46
|
+
const A = "0x556f1830", T = {
|
47
47
|
name: "OffchainLookup",
|
48
48
|
type: "error",
|
49
49
|
inputs: [
|
@@ -69,59 +69,62 @@ const C = "0x556f1830", $ = {
|
|
69
69
|
}
|
70
70
|
]
|
71
71
|
};
|
72
|
-
async function
|
73
|
-
const { args:
|
74
|
-
data:
|
75
|
-
abi: [
|
76
|
-
}), [t,
|
72
|
+
async function D(c, { blockNumber: r, blockTag: a, data: n, to: i }) {
|
73
|
+
const { args: f } = k({
|
74
|
+
data: n,
|
75
|
+
abi: [T]
|
76
|
+
}), [t, o, d, l, s] = f, { ccipRead: e } = c, h = e && typeof (e == null ? void 0 : e.request) == "function" ? e.request : C;
|
77
77
|
try {
|
78
78
|
if (!b(i, t))
|
79
|
-
throw new
|
80
|
-
const
|
79
|
+
throw new q({ sender: t, to: i });
|
80
|
+
const u = o.includes(L) ? await O({
|
81
|
+
data: d,
|
82
|
+
ccipRequest: h
|
83
|
+
}) : await h({ data: d, sender: t, urls: o }), { data: g } = await E(c, {
|
81
84
|
blockNumber: r,
|
82
85
|
blockTag: a,
|
83
|
-
data:
|
84
|
-
|
85
|
-
|
86
|
+
data: x([
|
87
|
+
l,
|
88
|
+
R([{ type: "bytes" }, { type: "bytes" }], [u, s])
|
86
89
|
]),
|
87
90
|
to: i
|
88
91
|
});
|
89
92
|
return g;
|
90
|
-
} catch (
|
91
|
-
throw new
|
92
|
-
callbackSelector:
|
93
|
-
cause:
|
94
|
-
data:
|
93
|
+
} catch (u) {
|
94
|
+
throw new S({
|
95
|
+
callbackSelector: l,
|
96
|
+
cause: u,
|
97
|
+
data: n,
|
95
98
|
extraData: s,
|
96
99
|
sender: t,
|
97
|
-
urls:
|
100
|
+
urls: o
|
98
101
|
});
|
99
102
|
}
|
100
103
|
}
|
101
|
-
async function
|
104
|
+
async function C({ data: c, sender: r, urls: a }) {
|
102
105
|
var i;
|
103
|
-
let
|
104
|
-
for (let
|
105
|
-
const t = a[
|
106
|
+
let n = new Error("An unknown error occurred.");
|
107
|
+
for (let f = 0; f < a.length; f++) {
|
108
|
+
const t = a[f], o = t.includes("{data}") ? "GET" : "POST", d = o === "POST" ? { data: c, sender: r } : void 0, l = o === "POST" ? { "Content-Type": "application/json" } : {};
|
106
109
|
try {
|
107
110
|
const s = await fetch(t.replace("{sender}", r.toLowerCase()).replace("{data}", c), {
|
108
|
-
body: JSON.stringify(
|
109
|
-
headers:
|
110
|
-
method:
|
111
|
+
body: JSON.stringify(d),
|
112
|
+
headers: l,
|
113
|
+
method: o
|
111
114
|
});
|
112
115
|
let e;
|
113
116
|
if ((i = s.headers.get("Content-Type")) != null && i.startsWith("application/json") ? e = (await s.json()).data : e = await s.text(), !s.ok) {
|
114
|
-
|
115
|
-
body:
|
116
|
-
details: e != null && e.error ?
|
117
|
+
n = new y({
|
118
|
+
body: d,
|
119
|
+
details: e != null && e.error ? w(e.error) : s.statusText,
|
117
120
|
headers: s.headers,
|
118
121
|
status: s.status,
|
119
122
|
url: t
|
120
123
|
});
|
121
124
|
continue;
|
122
125
|
}
|
123
|
-
if (!
|
124
|
-
|
126
|
+
if (!M(e)) {
|
127
|
+
n = new $({
|
125
128
|
result: e,
|
126
129
|
url: t
|
127
130
|
});
|
@@ -129,18 +132,18 @@ async function T({ data: c, sender: r, urls: a }) {
|
|
129
132
|
}
|
130
133
|
return e;
|
131
134
|
} catch (s) {
|
132
|
-
|
133
|
-
body:
|
135
|
+
n = new y({
|
136
|
+
body: d,
|
134
137
|
details: s.message,
|
135
138
|
url: t
|
136
139
|
});
|
137
140
|
}
|
138
141
|
}
|
139
|
-
throw
|
142
|
+
throw n;
|
140
143
|
}
|
141
144
|
export {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
145
|
+
C as ccipRequest,
|
146
|
+
D as offchainLookup,
|
147
|
+
T as offchainLookupAbiItem,
|
148
|
+
A as offchainLookupSignature
|
146
149
|
};
|