@cartridge/controller 0.10.6 → 0.10.7
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/.turbo/turbo-build$colon$deps.log +16 -16
- package/.turbo/turbo-build.log +15 -15
- package/dist/index.js +322 -313
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +2 -1
- package/dist/node/index.d.ts +2 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/{provider-BgBI_LQl.js → provider-CN6AecRF.js} +139 -109
- package/dist/provider-CN6AecRF.js.map +1 -0
- package/dist/session/provider.d.ts +3 -1
- package/dist/session.js +101 -91
- package/dist/session.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +6 -2
- package/dist/utils.d.ts +2 -1
- package/dist/wallets/types.d.ts +6 -1
- package/package.json +3 -3
- package/src/session/provider.ts +14 -1
- package/src/types.ts +24 -8
- package/src/utils.ts +11 -3
- package/src/wallets/ethereum-base.ts +6 -1
- package/src/wallets/types.ts +18 -7
- package/dist/provider-BgBI_LQl.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WalletAccount as Nt, constants as V, num as rt, shortString as
|
|
2
|
-
import { R as Q, t as Rt,
|
|
3
|
-
import { F as
|
|
4
|
-
class
|
|
1
|
+
import { WalletAccount as Nt, constants as V, num as rt, shortString as De } from "starknet";
|
|
2
|
+
import { R as Q, t as Rt, i as Tt, K as Ut, B as zt, N as v, p as Lt, v as Dt, A as Ot } from "./provider-CN6AecRF.js";
|
|
3
|
+
import { a as Gn, d as Xn, E as Jn, f as Zn, e as es, F as ts, I as rs, S as ns, h as ss, n as os, b as is, c as as } from "./provider-CN6AecRF.js";
|
|
4
|
+
class Oe extends Nt {
|
|
5
5
|
keychain;
|
|
6
6
|
modal;
|
|
7
7
|
options;
|
|
@@ -77,10 +77,10 @@ class Le extends Nt {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
var
|
|
80
|
+
var B;
|
|
81
81
|
(function(t) {
|
|
82
82
|
t.Call = "call", t.Reply = "reply", t.Syn = "syn", t.SynAck = "synAck", t.Ack = "ack";
|
|
83
|
-
})(
|
|
83
|
+
})(B || (B = {}));
|
|
84
84
|
var z;
|
|
85
85
|
(function(t) {
|
|
86
86
|
t.Fulfilled = "fulfilled", t.Rejected = "rejected";
|
|
@@ -97,7 +97,7 @@ var T;
|
|
|
97
97
|
(function(t) {
|
|
98
98
|
t.Message = "message";
|
|
99
99
|
})(T || (T = {}));
|
|
100
|
-
const
|
|
100
|
+
const Mt = (t, e) => {
|
|
101
101
|
const r = [];
|
|
102
102
|
let n = !1;
|
|
103
103
|
return {
|
|
@@ -110,31 +110,31 @@ const Lt = (t, e) => {
|
|
|
110
110
|
n ? s() : r.push(s);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
},
|
|
113
|
+
}, Qt = (t) => (...e) => {
|
|
114
114
|
t && console.log("[Penpal]", ...e);
|
|
115
|
-
},
|
|
115
|
+
}, Ft = {
|
|
116
116
|
"http:": "80",
|
|
117
117
|
"https:": "443"
|
|
118
|
-
},
|
|
118
|
+
}, Wt = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, jt = ["file:", "data:"], Yt = (t) => {
|
|
119
119
|
if (t && jt.find((i) => t.startsWith(i)))
|
|
120
120
|
return "null";
|
|
121
|
-
const e = document.location, r =
|
|
121
|
+
const e = document.location, r = Wt.exec(t);
|
|
122
122
|
let n, s, o;
|
|
123
123
|
r ? (n = r[1] ? r[1] : e.protocol, s = r[2], o = r[4]) : (n = e.protocol, s = e.hostname, o = e.port);
|
|
124
|
-
const a = o && o !==
|
|
124
|
+
const a = o && o !== Ft[n] ? `:${o}` : "";
|
|
125
125
|
return `${n}//${s}${a}`;
|
|
126
126
|
}, Me = ({ name: t, message: e, stack: r }) => ({
|
|
127
127
|
name: t,
|
|
128
128
|
message: e,
|
|
129
129
|
stack: r
|
|
130
|
-
}),
|
|
130
|
+
}), Ht = (t) => {
|
|
131
131
|
const e = new Error();
|
|
132
132
|
return Object.keys(t).forEach((r) => e[r] = t[r]), e;
|
|
133
|
-
},
|
|
133
|
+
}, Kt = (t, e, r) => {
|
|
134
134
|
const { localName: n, local: s, remote: o, originForSending: a, originForReceiving: i } = t;
|
|
135
135
|
let l = !1;
|
|
136
136
|
const c = (d) => {
|
|
137
|
-
if (d.source !== o || d.data.penpal !==
|
|
137
|
+
if (d.source !== o || d.data.penpal !== B.Call)
|
|
138
138
|
return;
|
|
139
139
|
if (i !== "*" && d.origin !== i) {
|
|
140
140
|
r(`${n} received message from origin ${d.origin} which did not match expected origin ${i}`);
|
|
@@ -142,24 +142,24 @@ const Lt = (t, e) => {
|
|
|
142
142
|
}
|
|
143
143
|
const h = d.data, { methodName: f, args: u, id: w } = h;
|
|
144
144
|
r(`${n}: Received ${f}() call`);
|
|
145
|
-
const
|
|
145
|
+
const _ = (m) => (I) => {
|
|
146
146
|
if (r(`${n}: Sending ${f}() reply`), l) {
|
|
147
147
|
r(`${n}: Unable to send ${f}() reply due to destroyed connection`);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
const
|
|
151
|
-
penpal:
|
|
150
|
+
const k = {
|
|
151
|
+
penpal: B.Reply,
|
|
152
152
|
id: w,
|
|
153
153
|
resolution: m,
|
|
154
|
-
returnValue:
|
|
154
|
+
returnValue: I
|
|
155
155
|
};
|
|
156
|
-
m === z.Rejected &&
|
|
156
|
+
m === z.Rejected && I instanceof Error && (k.returnValue = Me(I), k.returnValueIsError = !0);
|
|
157
157
|
try {
|
|
158
|
-
o.postMessage(
|
|
158
|
+
o.postMessage(k, a);
|
|
159
159
|
} catch (p) {
|
|
160
160
|
if (p.name === be.DataCloneError) {
|
|
161
161
|
const E = {
|
|
162
|
-
penpal:
|
|
162
|
+
penpal: B.Reply,
|
|
163
163
|
id: w,
|
|
164
164
|
resolution: z.Rejected,
|
|
165
165
|
returnValue: Me(p),
|
|
@@ -170,49 +170,49 @@ const Lt = (t, e) => {
|
|
|
170
170
|
throw p;
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
new Promise((m) => m(e[f].call(e, d.origin).apply(e, u))).then(
|
|
173
|
+
new Promise((m) => m(e[f].call(e, d.origin).apply(e, u))).then(_(z.Fulfilled), _(z.Rejected));
|
|
174
174
|
};
|
|
175
175
|
return s.addEventListener(T.Message, c), () => {
|
|
176
176
|
l = !0, s.removeEventListener(T.Message, c);
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
let
|
|
180
|
-
const
|
|
179
|
+
let Vt = 0;
|
|
180
|
+
const qt = () => ++Vt, nt = ".", st = (t) => t ? t.split(nt) : [], Gt = (t) => t.join(nt), Xt = (t, e) => {
|
|
181
181
|
const r = st(e || "");
|
|
182
|
-
return r.push(t),
|
|
183
|
-
},
|
|
182
|
+
return r.push(t), Gt(r);
|
|
183
|
+
}, Jt = (t, e, r) => {
|
|
184
184
|
const n = st(e);
|
|
185
185
|
return n.reduce((s, o, a) => (typeof s[o] > "u" && (s[o] = {}), a === n.length - 1 && (s[o] = r), s[o]), t), t;
|
|
186
186
|
}, ot = (t, e) => {
|
|
187
187
|
const r = {};
|
|
188
188
|
return Object.keys(t).forEach((n) => {
|
|
189
|
-
const s = t[n], o =
|
|
189
|
+
const s = t[n], o = Xt(n, e);
|
|
190
190
|
typeof s == "object" && Object.assign(r, ot(s, o)), typeof s == "function" && (r[o] = s);
|
|
191
191
|
}), r;
|
|
192
|
-
},
|
|
192
|
+
}, Zt = (t) => {
|
|
193
193
|
const e = {};
|
|
194
194
|
for (const r in t)
|
|
195
|
-
|
|
195
|
+
Jt(e, r, t[r]);
|
|
196
196
|
return e;
|
|
197
|
-
},
|
|
197
|
+
}, er = (t, e, r, n, s) => {
|
|
198
198
|
const { localName: o, local: a, remote: i, originForSending: l, originForReceiving: c } = e;
|
|
199
199
|
let d = !1;
|
|
200
200
|
s(`${o}: Connecting call sender`);
|
|
201
201
|
const h = (u) => (...w) => {
|
|
202
202
|
s(`${o}: Sending ${u}() call`);
|
|
203
|
-
let
|
|
203
|
+
let _;
|
|
204
204
|
try {
|
|
205
|
-
i.closed && (
|
|
205
|
+
i.closed && (_ = !0);
|
|
206
206
|
} catch {
|
|
207
|
-
|
|
207
|
+
_ = !0;
|
|
208
208
|
}
|
|
209
|
-
if (
|
|
209
|
+
if (_ && n(), d) {
|
|
210
210
|
const m = new Error(`Unable to send ${u}() call due to destroyed connection`);
|
|
211
211
|
throw m.code = G.ConnectionDestroyed, m;
|
|
212
212
|
}
|
|
213
|
-
return new Promise((m,
|
|
214
|
-
const
|
|
215
|
-
if (C.source !== i || C.data.penpal !==
|
|
213
|
+
return new Promise((m, I) => {
|
|
214
|
+
const k = qt(), p = (C) => {
|
|
215
|
+
if (C.source !== i || C.data.penpal !== B.Reply || C.data.id !== k)
|
|
216
216
|
return;
|
|
217
217
|
if (c !== "*" && C.origin !== c) {
|
|
218
218
|
s(`${o} received message from origin ${C.origin} which did not match expected origin ${c}`);
|
|
@@ -221,22 +221,22 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
221
221
|
const de = C.data;
|
|
222
222
|
s(`${o}: Received ${u}() reply`), a.removeEventListener(T.Message, p);
|
|
223
223
|
let he = de.returnValue;
|
|
224
|
-
de.returnValueIsError && (he =
|
|
224
|
+
de.returnValueIsError && (he = Ht(he)), (de.resolution === z.Fulfilled ? m : I)(he);
|
|
225
225
|
};
|
|
226
226
|
a.addEventListener(T.Message, p);
|
|
227
227
|
const E = {
|
|
228
|
-
penpal:
|
|
229
|
-
id:
|
|
228
|
+
penpal: B.Call,
|
|
229
|
+
id: k,
|
|
230
230
|
methodName: u,
|
|
231
231
|
args: w
|
|
232
232
|
};
|
|
233
233
|
i.postMessage(E, l);
|
|
234
234
|
});
|
|
235
235
|
}, f = r.reduce((u, w) => (u[w] = h(w), u), {});
|
|
236
|
-
return Object.assign(t,
|
|
236
|
+
return Object.assign(t, Zt(f)), () => {
|
|
237
237
|
d = !0;
|
|
238
238
|
};
|
|
239
|
-
},
|
|
239
|
+
}, tr = (t, e, r, n, s) => {
|
|
240
240
|
const { destroy: o, onDestroy: a } = n;
|
|
241
241
|
let i, l;
|
|
242
242
|
const c = {};
|
|
@@ -253,13 +253,13 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
253
253
|
originForSending: r,
|
|
254
254
|
originForReceiving: e
|
|
255
255
|
};
|
|
256
|
-
i && i(), i =
|
|
256
|
+
i && i(), i = Kt(h, t, s), a(i), l && l.forEach((u) => {
|
|
257
257
|
delete c[u];
|
|
258
258
|
}), l = d.data.methodNames;
|
|
259
|
-
const f =
|
|
259
|
+
const f = er(c, h, l, o, s);
|
|
260
260
|
return a(f), c;
|
|
261
261
|
};
|
|
262
|
-
},
|
|
262
|
+
}, rr = (t, e, r, n) => (s) => {
|
|
263
263
|
if (!s.source)
|
|
264
264
|
return;
|
|
265
265
|
if (r !== "*" && s.origin !== r) {
|
|
@@ -268,18 +268,18 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
268
268
|
}
|
|
269
269
|
t("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
270
270
|
const o = {
|
|
271
|
-
penpal:
|
|
271
|
+
penpal: B.SynAck,
|
|
272
272
|
methodNames: Object.keys(e)
|
|
273
273
|
};
|
|
274
274
|
s.source.postMessage(o, n);
|
|
275
|
-
},
|
|
275
|
+
}, nr = 6e4, sr = (t, e) => {
|
|
276
276
|
const { destroy: r, onDestroy: n } = e, s = setInterval(() => {
|
|
277
277
|
t.isConnected || (clearInterval(s), r());
|
|
278
|
-
},
|
|
278
|
+
}, nr);
|
|
279
279
|
n(() => {
|
|
280
280
|
clearInterval(s);
|
|
281
281
|
});
|
|
282
|
-
},
|
|
282
|
+
}, or = (t, e) => {
|
|
283
283
|
let r;
|
|
284
284
|
return t !== void 0 && (r = window.setTimeout(() => {
|
|
285
285
|
const n = new Error(`Connection timed out after ${t}ms`);
|
|
@@ -287,33 +287,33 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
287
287
|
}, t)), () => {
|
|
288
288
|
clearTimeout(r);
|
|
289
289
|
};
|
|
290
|
-
},
|
|
290
|
+
}, ir = (t) => {
|
|
291
291
|
if (!t.src && !t.srcdoc) {
|
|
292
292
|
const e = new Error("Iframe must have src or srcdoc property defined.");
|
|
293
293
|
throw e.code = G.NoIframeSrc, e;
|
|
294
294
|
}
|
|
295
|
-
},
|
|
295
|
+
}, ar = (t) => {
|
|
296
296
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: o = !1 } = t;
|
|
297
|
-
const a =
|
|
298
|
-
n || (
|
|
299
|
-
const d = n === "null" ? "*" : n, h = ot(r), f =
|
|
297
|
+
const a = Qt(o), i = Mt("Parent", a), { onDestroy: l, destroy: c } = i;
|
|
298
|
+
n || (ir(e), n = Yt(e.src));
|
|
299
|
+
const d = n === "null" ? "*" : n, h = ot(r), f = rr(a, h, n, d), u = tr(h, n, d, i, a);
|
|
300
300
|
return {
|
|
301
|
-
promise: new Promise((
|
|
302
|
-
const
|
|
301
|
+
promise: new Promise((_, m) => {
|
|
302
|
+
const I = or(s, c), k = (p) => {
|
|
303
303
|
if (!(p.source !== e.contentWindow || !p.data)) {
|
|
304
|
-
if (p.data.penpal ===
|
|
304
|
+
if (p.data.penpal === B.Syn) {
|
|
305
305
|
f(p);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
if (p.data.penpal ===
|
|
308
|
+
if (p.data.penpal === B.Ack) {
|
|
309
309
|
const E = u(p);
|
|
310
|
-
E && (
|
|
310
|
+
E && (I(), _(E));
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
|
-
window.addEventListener(T.Message,
|
|
316
|
-
window.removeEventListener(T.Message,
|
|
315
|
+
window.addEventListener(T.Message, k), a("Parent: Awaiting handshake"), sr(e, i), l((p) => {
|
|
316
|
+
window.removeEventListener(T.Message, k), p && m(p);
|
|
317
317
|
});
|
|
318
318
|
}),
|
|
319
319
|
destroy() {
|
|
@@ -321,7 +321,7 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
};
|
|
324
|
-
class
|
|
324
|
+
class cr {
|
|
325
325
|
url;
|
|
326
326
|
iframe;
|
|
327
327
|
container;
|
|
@@ -344,7 +344,7 @@ class ar {
|
|
|
344
344
|
const l = document.createElement("div");
|
|
345
345
|
l.id = "controller", l.style.position = "fixed", l.style.height = "100%", l.style.width = "100%", l.style.top = "0", l.style.left = "0", l.style.zIndex = "10000", l.style.backgroundColor = "rgba(0,0,0,0.6)", l.style.display = "none", l.style.alignItems = "center", l.style.justifyContent = "center", l.style.transition = "opacity 0.2s ease", l.style.opacity = "0", l.style.pointerEvents = "auto", l.appendChild(i), l.addEventListener("click", (h) => {
|
|
346
346
|
h.target === l && (e === "controller-keychain" && this.child && this.child.reset?.().catch((f) => console.error("Error resetting context:", f)), this.close());
|
|
347
|
-
}), this.iframe = i, this.container = l,
|
|
347
|
+
}), this.iframe = i, this.container = l, ar({
|
|
348
348
|
iframe: this.iframe,
|
|
349
349
|
methods: {
|
|
350
350
|
close: (h) => () => this.close(),
|
|
@@ -395,7 +395,7 @@ class ar {
|
|
|
395
395
|
return this.container?.style.display !== "none";
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
const
|
|
398
|
+
const lr = "6.13.7";
|
|
399
399
|
function Qe(t, e, r) {
|
|
400
400
|
for (let n in e) {
|
|
401
401
|
let s = e[n];
|
|
@@ -433,7 +433,7 @@ function M(t) {
|
|
|
433
433
|
}
|
|
434
434
|
return "[ COULD NOT SERIALIZE ]";
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function dr(t, e, r) {
|
|
437
437
|
let n = t;
|
|
438
438
|
{
|
|
439
439
|
const o = [];
|
|
@@ -447,7 +447,7 @@ function lr(t, e, r) {
|
|
|
447
447
|
o.push(a + "=" + M(i));
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
o.push(`code=${e}`), o.push(`version=${
|
|
450
|
+
o.push(`code=${e}`), o.push(`version=${lr}`), o.length && (t += " (" + o.join(", ") + ")");
|
|
451
451
|
}
|
|
452
452
|
let s;
|
|
453
453
|
switch (e) {
|
|
@@ -463,12 +463,12 @@ function lr(t, e, r) {
|
|
|
463
463
|
}
|
|
464
464
|
return Qe(s, { code: e }), r && Object.assign(s, r), s.shortMessage == null && Qe(s, { shortMessage: n }), s;
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function hr(t, e, r, n) {
|
|
467
467
|
if (!t)
|
|
468
|
-
throw
|
|
468
|
+
throw dr(e, r, n);
|
|
469
469
|
}
|
|
470
470
|
function Y(t, e, r, n) {
|
|
471
|
-
|
|
471
|
+
hr(t, e, "INVALID_ARGUMENT", { argument: r, value: n });
|
|
472
472
|
}
|
|
473
473
|
["NFD", "NFC", "NFKD", "NFKC"].reduce((t, e) => {
|
|
474
474
|
try {
|
|
@@ -481,7 +481,7 @@ function Y(t, e, r, n) {
|
|
|
481
481
|
}
|
|
482
482
|
return t;
|
|
483
483
|
}, []);
|
|
484
|
-
function
|
|
484
|
+
function fr(t, e, r) {
|
|
485
485
|
if (t instanceof Uint8Array)
|
|
486
486
|
return t;
|
|
487
487
|
if (typeof t == "string" && t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
|
|
@@ -494,10 +494,10 @@ function hr(t, e, r) {
|
|
|
494
494
|
Y(!1, "invalid BytesLike value", e || "value", t);
|
|
495
495
|
}
|
|
496
496
|
function xe(t, e) {
|
|
497
|
-
return
|
|
497
|
+
return fr(t, e);
|
|
498
498
|
}
|
|
499
499
|
const Fe = "0123456789abcdef";
|
|
500
|
-
function
|
|
500
|
+
function ur(t) {
|
|
501
501
|
const e = xe(t);
|
|
502
502
|
let r = "0x";
|
|
503
503
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -507,85 +507,85 @@ function fr(t) {
|
|
|
507
507
|
return r;
|
|
508
508
|
}
|
|
509
509
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
510
|
-
function
|
|
510
|
+
function gr(t) {
|
|
511
511
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function We(t) {
|
|
514
514
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
515
515
|
throw new Error("positive integer expected, got " + t);
|
|
516
516
|
}
|
|
517
517
|
function re(t, ...e) {
|
|
518
|
-
if (!
|
|
518
|
+
if (!gr(t))
|
|
519
519
|
throw new Error("Uint8Array expected");
|
|
520
520
|
if (e.length > 0 && !e.includes(t.length))
|
|
521
521
|
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function je(t, e = !0) {
|
|
524
524
|
if (t.destroyed)
|
|
525
525
|
throw new Error("Hash instance has been destroyed");
|
|
526
526
|
if (e && t.finished)
|
|
527
527
|
throw new Error("Hash#digest() has already been called");
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function wr(t, e) {
|
|
530
530
|
re(t);
|
|
531
531
|
const r = e.outputLen;
|
|
532
532
|
if (t.length < r)
|
|
533
533
|
throw new Error("digestInto() expects output buffer of length at least " + r);
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function pr(t) {
|
|
536
536
|
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
537
537
|
}
|
|
538
538
|
function it(...t) {
|
|
539
539
|
for (let e = 0; e < t.length; e++)
|
|
540
540
|
t[e].fill(0);
|
|
541
541
|
}
|
|
542
|
-
const
|
|
543
|
-
function
|
|
542
|
+
const yr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
543
|
+
function mr(t) {
|
|
544
544
|
return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function br(t) {
|
|
547
547
|
for (let e = 0; e < t.length; e++)
|
|
548
|
-
t[e] =
|
|
548
|
+
t[e] = mr(t[e]);
|
|
549
549
|
return t;
|
|
550
550
|
}
|
|
551
|
-
const Ye =
|
|
552
|
-
function
|
|
551
|
+
const Ye = yr ? (t) => t : br;
|
|
552
|
+
function _r(t) {
|
|
553
553
|
if (typeof t != "string")
|
|
554
554
|
throw new Error("string expected");
|
|
555
555
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
556
556
|
}
|
|
557
557
|
function at(t) {
|
|
558
|
-
return typeof t == "string" && (t =
|
|
558
|
+
return typeof t == "string" && (t = _r(t)), re(t), t;
|
|
559
559
|
}
|
|
560
560
|
class kr {
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function Ar(t) {
|
|
563
563
|
const e = (n) => t().update(at(n)).digest(), r = t();
|
|
564
564
|
return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e;
|
|
565
565
|
}
|
|
566
566
|
const Z = /* @__PURE__ */ BigInt(2 ** 32 - 1), He = /* @__PURE__ */ BigInt(32);
|
|
567
|
-
function
|
|
567
|
+
function Er(t, e = !1) {
|
|
568
568
|
return e ? { h: Number(t & Z), l: Number(t >> He & Z) } : { h: Number(t >> He & Z) | 0, l: Number(t & Z) | 0 };
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function vr(t, e = !1) {
|
|
571
571
|
const r = t.length;
|
|
572
572
|
let n = new Uint32Array(r), s = new Uint32Array(r);
|
|
573
573
|
for (let o = 0; o < r; o++) {
|
|
574
|
-
const { h: a, l: i } =
|
|
574
|
+
const { h: a, l: i } = Er(t[o], e);
|
|
575
575
|
[n[o], s[o]] = [a, i];
|
|
576
576
|
}
|
|
577
577
|
return [n, s];
|
|
578
578
|
}
|
|
579
|
-
const
|
|
580
|
-
for (let t = 0, e =
|
|
579
|
+
const xr = (t, e, r) => t << r | e >>> 32 - r, $r = (t, e, r) => e << r | t >>> 32 - r, Sr = (t, e, r) => e << r - 32 | t >>> 64 - r, Ir = (t, e, r) => t << r - 32 | e >>> 64 - r, Cr = BigInt(0), j = BigInt(1), Pr = BigInt(2), Br = BigInt(7), Nr = BigInt(256), Rr = BigInt(113), ct = [], lt = [], dt = [];
|
|
580
|
+
for (let t = 0, e = j, r = 1, n = 0; t < 24; t++) {
|
|
581
581
|
[r, n] = [n, (2 * r + 3 * n) % 5], ct.push(2 * (5 * n + r)), lt.push((t + 1) * (t + 2) / 2 % 64);
|
|
582
|
-
let s =
|
|
582
|
+
let s = Cr;
|
|
583
583
|
for (let o = 0; o < 7; o++)
|
|
584
|
-
e = (e <<
|
|
584
|
+
e = (e << j ^ (e >> Br) * Rr) % Nr, e & Pr && (s ^= j << (j << /* @__PURE__ */ BigInt(o)) - j);
|
|
585
585
|
dt.push(s);
|
|
586
586
|
}
|
|
587
|
-
const ht =
|
|
588
|
-
function
|
|
587
|
+
const ht = vr(dt, !0), Tr = ht[0], Ur = ht[1], Ke = (t, e, r) => r > 32 ? Sr(t, e, r) : xr(t, e, r), Ve = (t, e, r) => r > 32 ? Ir(t, e, r) : $r(t, e, r);
|
|
588
|
+
function zr(t, e = 24) {
|
|
589
589
|
const r = new Uint32Array(10);
|
|
590
590
|
for (let n = 24 - e; n < 24; n++) {
|
|
591
591
|
for (let a = 0; a < 10; a++)
|
|
@@ -606,25 +606,25 @@ function Ur(t, e = 24) {
|
|
|
606
606
|
for (let i = 0; i < 10; i++)
|
|
607
607
|
t[a + i] ^= ~r[(i + 2) % 10] & r[(i + 4) % 10];
|
|
608
608
|
}
|
|
609
|
-
t[0] ^=
|
|
609
|
+
t[0] ^= Tr[n], t[1] ^= Ur[n];
|
|
610
610
|
}
|
|
611
611
|
it(r);
|
|
612
612
|
}
|
|
613
613
|
class $e extends kr {
|
|
614
614
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
615
615
|
constructor(e, r, n, s = !1, o = 24) {
|
|
616
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = s, this.rounds = o,
|
|
616
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = s, this.rounds = o, We(n), !(0 < e && e < 200))
|
|
617
617
|
throw new Error("only keccak-f1600 function is supported");
|
|
618
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
618
|
+
this.state = new Uint8Array(200), this.state32 = pr(this.state);
|
|
619
619
|
}
|
|
620
620
|
clone() {
|
|
621
621
|
return this._cloneInto();
|
|
622
622
|
}
|
|
623
623
|
keccak() {
|
|
624
|
-
Ye(this.state32),
|
|
624
|
+
Ye(this.state32), zr(this.state32, this.rounds), Ye(this.state32), this.posOut = 0, this.pos = 0;
|
|
625
625
|
}
|
|
626
626
|
update(e) {
|
|
627
|
-
|
|
627
|
+
je(this), e = at(e), re(e);
|
|
628
628
|
const { blockLen: r, state: n } = this, s = e.length;
|
|
629
629
|
for (let o = 0; o < s; ) {
|
|
630
630
|
const a = Math.min(r - this.pos, s - o);
|
|
@@ -642,7 +642,7 @@ class $e extends kr {
|
|
|
642
642
|
e[n] ^= r, (r & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
643
643
|
}
|
|
644
644
|
writeInto(e) {
|
|
645
|
-
|
|
645
|
+
je(this, !1), re(e), this.finish();
|
|
646
646
|
const r = this.state, { blockLen: n } = this;
|
|
647
647
|
for (let s = 0, o = e.length; s < o; ) {
|
|
648
648
|
this.posOut >= n && this.keccak();
|
|
@@ -657,10 +657,10 @@ class $e extends kr {
|
|
|
657
657
|
return this.writeInto(e);
|
|
658
658
|
}
|
|
659
659
|
xof(e) {
|
|
660
|
-
return
|
|
660
|
+
return We(e), this.xofInto(new Uint8Array(e));
|
|
661
661
|
}
|
|
662
662
|
digestInto(e) {
|
|
663
|
-
if (
|
|
663
|
+
if (wr(e, this), this.finished)
|
|
664
664
|
throw new Error("digest() was already called");
|
|
665
665
|
return this.writeInto(e), this.destroy(), e;
|
|
666
666
|
}
|
|
@@ -675,7 +675,7 @@ class $e extends kr {
|
|
|
675
675
|
return e || (e = new $e(r, n, s, a, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = n, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
const
|
|
678
|
+
const Lr = (t, e, r) => Ar(() => new $e(e, t, r)), Dr = Lr(1, 136, 256 / 8);
|
|
679
679
|
let ft = !1;
|
|
680
680
|
const ut = function(t) {
|
|
681
681
|
return Dr(t);
|
|
@@ -683,7 +683,7 @@ const ut = function(t) {
|
|
|
683
683
|
let gt = ut;
|
|
684
684
|
function X(t) {
|
|
685
685
|
const e = xe(t, "data");
|
|
686
|
-
return
|
|
686
|
+
return ur(gt(e));
|
|
687
687
|
}
|
|
688
688
|
X._ = ut;
|
|
689
689
|
X.lock = function() {
|
|
@@ -695,7 +695,7 @@ X.register = function(t) {
|
|
|
695
695
|
gt = t;
|
|
696
696
|
};
|
|
697
697
|
Object.freeze(X);
|
|
698
|
-
const Or = BigInt(0),
|
|
698
|
+
const Or = BigInt(0), Mr = BigInt(36);
|
|
699
699
|
function qe(t) {
|
|
700
700
|
t = t.toLowerCase();
|
|
701
701
|
const e = t.substring(2).split(""), r = new Uint8Array(40);
|
|
@@ -706,15 +706,15 @@ function qe(t) {
|
|
|
706
706
|
n[s >> 1] >> 4 >= 8 && (e[s] = e[s].toUpperCase()), (n[s >> 1] & 15) >= 8 && (e[s + 1] = e[s + 1].toUpperCase());
|
|
707
707
|
return "0x" + e.join("");
|
|
708
708
|
}
|
|
709
|
-
const
|
|
709
|
+
const Se = {};
|
|
710
710
|
for (let t = 0; t < 10; t++)
|
|
711
|
-
|
|
711
|
+
Se[String(t)] = String(t);
|
|
712
712
|
for (let t = 0; t < 26; t++)
|
|
713
|
-
|
|
713
|
+
Se[String.fromCharCode(65 + t)] = String(10 + t);
|
|
714
714
|
const Ge = 15;
|
|
715
|
-
function
|
|
715
|
+
function Qr(t) {
|
|
716
716
|
t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00";
|
|
717
|
-
let e = t.split("").map((n) =>
|
|
717
|
+
let e = t.split("").map((n) => Se[n]).join("");
|
|
718
718
|
for (; e.length >= Ge; ) {
|
|
719
719
|
let n = e.substring(0, Ge);
|
|
720
720
|
e = parseInt(n, 10) % 97 + e.substring(n.length);
|
|
@@ -724,7 +724,7 @@ function Mr(t) {
|
|
|
724
724
|
r = "0" + r;
|
|
725
725
|
return r;
|
|
726
726
|
}
|
|
727
|
-
const
|
|
727
|
+
const Fr = function() {
|
|
728
728
|
const t = {};
|
|
729
729
|
for (let e = 0; e < 36; e++) {
|
|
730
730
|
const r = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
|
|
@@ -732,11 +732,11 @@ const Qr = function() {
|
|
|
732
732
|
}
|
|
733
733
|
return t;
|
|
734
734
|
}();
|
|
735
|
-
function
|
|
735
|
+
function Wr(t) {
|
|
736
736
|
t = t.toLowerCase();
|
|
737
737
|
let e = Or;
|
|
738
738
|
for (let r = 0; r < t.length; r++)
|
|
739
|
-
e = e *
|
|
739
|
+
e = e * Mr + Fr[t[r]];
|
|
740
740
|
return e;
|
|
741
741
|
}
|
|
742
742
|
function N(t) {
|
|
@@ -746,8 +746,8 @@ function N(t) {
|
|
|
746
746
|
return Y(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || e === t, "bad address checksum", "address", t), e;
|
|
747
747
|
}
|
|
748
748
|
if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
749
|
-
Y(t.substring(2, 4) ===
|
|
750
|
-
let e =
|
|
749
|
+
Y(t.substring(2, 4) === Qr(t), "bad icap checksum", "address", t);
|
|
750
|
+
let e = Wr(t.substring(4)).toString(16);
|
|
751
751
|
for (; e.length < 40; )
|
|
752
752
|
e = "0" + e;
|
|
753
753
|
return qe("0x" + e);
|
|
@@ -888,16 +888,16 @@ class jr {
|
|
|
888
888
|
this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
|
-
function
|
|
891
|
+
function Yr(t) {
|
|
892
892
|
if (typeof window > "u")
|
|
893
893
|
return;
|
|
894
894
|
const e = (r) => t(r.detail);
|
|
895
895
|
return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new CustomEvent("eip6963:requestProvider")), () => window.removeEventListener("eip6963:announceProvider", e);
|
|
896
896
|
}
|
|
897
|
-
function
|
|
897
|
+
function Hr() {
|
|
898
898
|
const t = /* @__PURE__ */ new Set();
|
|
899
899
|
let e = [];
|
|
900
|
-
const r = () =>
|
|
900
|
+
const r = () => Yr((s) => {
|
|
901
901
|
e.some(({ info: o }) => o.uuid === s.info.uuid) || (e = [...e, s], t.forEach((o) => o(e, { added: [s] })));
|
|
902
902
|
});
|
|
903
903
|
let n = r();
|
|
@@ -925,7 +925,7 @@ function Yr() {
|
|
|
925
925
|
}
|
|
926
926
|
};
|
|
927
927
|
}
|
|
928
|
-
const
|
|
928
|
+
const Kr = {
|
|
929
929
|
"0x1": "ethereum",
|
|
930
930
|
// ethereum mainnet
|
|
931
931
|
"0xaa36a7": "ethereum",
|
|
@@ -945,13 +945,13 @@ const Hr = {
|
|
|
945
945
|
[V.StarknetChainId.SN_MAIN]: "starknet",
|
|
946
946
|
[V.StarknetChainId.SN_SEPOLIA]: "starknet"
|
|
947
947
|
}, fe = (t) => {
|
|
948
|
-
const e = rt.toHex(t), r =
|
|
948
|
+
const e = rt.toHex(t), r = Kr[e];
|
|
949
949
|
return r || console.warn(`Unknown chain ID: ${e}`), r;
|
|
950
950
|
};
|
|
951
|
-
class
|
|
951
|
+
class Ie {
|
|
952
952
|
platform;
|
|
953
953
|
account = void 0;
|
|
954
|
-
store =
|
|
954
|
+
store = Hr();
|
|
955
955
|
provider;
|
|
956
956
|
connectedAccounts = [];
|
|
957
957
|
constructor() {
|
|
@@ -985,6 +985,8 @@ class Se {
|
|
|
985
985
|
}));
|
|
986
986
|
}
|
|
987
987
|
isAvailable() {
|
|
988
|
+
if (Tt())
|
|
989
|
+
return !1;
|
|
988
990
|
const e = this.getProvider();
|
|
989
991
|
return !e && this.rdns === "io.metamask" && typeof window < "u" ? !!window.ethereum?.isMetaMask : (e && !this.initialized && this.initializeIfAvailable(), typeof window < "u" && !!e);
|
|
990
992
|
}
|
|
@@ -1205,12 +1207,12 @@ class Se {
|
|
|
1205
1207
|
}
|
|
1206
1208
|
}
|
|
1207
1209
|
}
|
|
1208
|
-
class
|
|
1210
|
+
class Vr extends Ie {
|
|
1209
1211
|
type = "base";
|
|
1210
1212
|
rdns = "com.coinbase.wallet";
|
|
1211
1213
|
displayName = "Base Wallet";
|
|
1212
1214
|
}
|
|
1213
|
-
class
|
|
1215
|
+
class qr extends Ie {
|
|
1214
1216
|
type = "metamask";
|
|
1215
1217
|
rdns = "io.metamask";
|
|
1216
1218
|
displayName = "MetaMask";
|
|
@@ -1228,12 +1230,12 @@ function wt(t, ...e) {
|
|
|
1228
1230
|
function pt(t, e) {
|
|
1229
1231
|
return Array.isArray(e) ? e.length === 0 ? !0 : t ? e.every((r) => typeof r == "string") : e.every((r) => Number.isSafeInteger(r)) : !1;
|
|
1230
1232
|
}
|
|
1231
|
-
function
|
|
1233
|
+
function Gr(t) {
|
|
1232
1234
|
if (typeof t != "function")
|
|
1233
1235
|
throw new Error("function expected");
|
|
1234
1236
|
return !0;
|
|
1235
1237
|
}
|
|
1236
|
-
function
|
|
1238
|
+
function W(t, e) {
|
|
1237
1239
|
if (typeof e != "string")
|
|
1238
1240
|
throw new Error(`${t}: string expected`);
|
|
1239
1241
|
return !0;
|
|
@@ -1255,12 +1257,12 @@ function yt(t, e) {
|
|
|
1255
1257
|
throw new Error(`${t}: array of numbers expected`);
|
|
1256
1258
|
}
|
|
1257
1259
|
// @__NO_SIDE_EFFECTS__
|
|
1258
|
-
function
|
|
1260
|
+
function Pe(...t) {
|
|
1259
1261
|
const e = (o) => o, r = (o, a) => (i) => o(a(i)), n = t.map((o) => o.encode).reduceRight(r, e), s = t.map((o) => o.decode).reduce(r, e);
|
|
1260
1262
|
return { encode: n, decode: s };
|
|
1261
1263
|
}
|
|
1262
1264
|
// @__NO_SIDE_EFFECTS__
|
|
1263
|
-
function
|
|
1265
|
+
function Be(t) {
|
|
1264
1266
|
const e = typeof t == "string" ? t.split("") : t, r = e.length;
|
|
1265
1267
|
se("alphabet", e);
|
|
1266
1268
|
const n = new Map(e.map((s, o) => [s, o]));
|
|
@@ -1271,7 +1273,7 @@ function Pe(t) {
|
|
|
1271
1273
|
return e[o];
|
|
1272
1274
|
})),
|
|
1273
1275
|
decode: (s) => (ne(s), s.map((o) => {
|
|
1274
|
-
|
|
1276
|
+
W("alphabet.decode", o);
|
|
1275
1277
|
const a = n.get(o);
|
|
1276
1278
|
if (a === void 0)
|
|
1277
1279
|
throw new Error(`Unknown letter: "${o}". Allowed: ${t}`);
|
|
@@ -1281,14 +1283,14 @@ function Pe(t) {
|
|
|
1281
1283
|
}
|
|
1282
1284
|
// @__NO_SIDE_EFFECTS__
|
|
1283
1285
|
function Ne(t = "") {
|
|
1284
|
-
return
|
|
1286
|
+
return W("join", t), {
|
|
1285
1287
|
encode: (e) => (se("join.decode", e), e.join(t)),
|
|
1286
|
-
decode: (e) => (
|
|
1288
|
+
decode: (e) => (W("join.decode", e), e.split(t))
|
|
1287
1289
|
};
|
|
1288
1290
|
}
|
|
1289
1291
|
// @__NO_SIDE_EFFECTS__
|
|
1290
|
-
function
|
|
1291
|
-
return J(t),
|
|
1292
|
+
function Xr(t, e = "=") {
|
|
1293
|
+
return J(t), W("padding", e), {
|
|
1292
1294
|
encode(r) {
|
|
1293
1295
|
for (se("padding.encode", r); r.length * t % 8; )
|
|
1294
1296
|
r.push(e);
|
|
@@ -1307,8 +1309,8 @@ function Gr(t, e = "=") {
|
|
|
1307
1309
|
};
|
|
1308
1310
|
}
|
|
1309
1311
|
// @__NO_SIDE_EFFECTS__
|
|
1310
|
-
function
|
|
1311
|
-
return
|
|
1312
|
+
function Jr(t) {
|
|
1313
|
+
return Gr(t), { encode: (e) => e, decode: (e) => t(e) };
|
|
1312
1314
|
}
|
|
1313
1315
|
function Xe(t, e, r) {
|
|
1314
1316
|
if (e < 2)
|
|
@@ -1379,7 +1381,7 @@ function Je(t, e, r, n) {
|
|
|
1379
1381
|
return n && o > 0 && l.push(s >>> 0), l;
|
|
1380
1382
|
}
|
|
1381
1383
|
// @__NO_SIDE_EFFECTS__
|
|
1382
|
-
function
|
|
1384
|
+
function Zr(t) {
|
|
1383
1385
|
J(t);
|
|
1384
1386
|
const e = 2 ** 8;
|
|
1385
1387
|
return {
|
|
@@ -1406,29 +1408,29 @@ function bt(t, e = !1) {
|
|
|
1406
1408
|
decode: (r) => (yt("radix2.decode", r), Uint8Array.from(Je(r, t, 8, e)))
|
|
1407
1409
|
};
|
|
1408
1410
|
}
|
|
1409
|
-
const
|
|
1411
|
+
const en = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", tn = en ? {
|
|
1410
1412
|
encode(t) {
|
|
1411
1413
|
return wt(t), t.toBase64();
|
|
1412
1414
|
},
|
|
1413
1415
|
decode(t) {
|
|
1414
|
-
return
|
|
1416
|
+
return W("base64", t), Uint8Array.fromBase64(t, { lastChunkHandling: "strict" });
|
|
1415
1417
|
}
|
|
1416
|
-
} : /* @__PURE__ */
|
|
1418
|
+
} : /* @__PURE__ */ Pe(/* @__PURE__ */ bt(6), /* @__PURE__ */ Be("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ Xr(6), /* @__PURE__ */ Ne("")), rn = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ Pe(/* @__PURE__ */ Zr(58), /* @__PURE__ */ Be(t), /* @__PURE__ */ Ne("")), _e = /* @__PURE__ */ rn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), nn = {
|
|
1417
1419
|
encode: (t) => new TextDecoder().decode(t),
|
|
1418
1420
|
decode: (t) => new TextEncoder().encode(t)
|
|
1419
|
-
},
|
|
1421
|
+
}, sn = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", on = {
|
|
1420
1422
|
encode(t) {
|
|
1421
1423
|
return wt(t), t.toHex();
|
|
1422
1424
|
},
|
|
1423
1425
|
decode(t) {
|
|
1424
|
-
return
|
|
1426
|
+
return W("hex", t), Uint8Array.fromHex(t);
|
|
1425
1427
|
}
|
|
1426
|
-
}, ge =
|
|
1428
|
+
}, ge = sn ? on : /* @__PURE__ */ Pe(/* @__PURE__ */ bt(4), /* @__PURE__ */ Be("0123456789abcdef"), /* @__PURE__ */ Ne(""), /* @__PURE__ */ Jr((t) => {
|
|
1427
1429
|
if (typeof t != "string" || t.length % 2 !== 0)
|
|
1428
1430
|
throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);
|
|
1429
1431
|
return t.toLowerCase();
|
|
1430
1432
|
}));
|
|
1431
|
-
function
|
|
1433
|
+
function ke(t, e) {
|
|
1432
1434
|
if (t.length !== e.length)
|
|
1433
1435
|
return !1;
|
|
1434
1436
|
for (let r = 0; r < t.length; r++)
|
|
@@ -1439,29 +1441,29 @@ function _e(t, e) {
|
|
|
1439
1441
|
function R(t) {
|
|
1440
1442
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1441
1443
|
}
|
|
1442
|
-
const
|
|
1443
|
-
function
|
|
1444
|
+
const _t = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
1445
|
+
function O(t) {
|
|
1444
1446
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
1445
1447
|
}
|
|
1446
|
-
function
|
|
1448
|
+
function P(t) {
|
|
1447
1449
|
return Number.isSafeInteger(t);
|
|
1448
1450
|
}
|
|
1449
|
-
const
|
|
1450
|
-
if (t !== null && typeof t != "string" && !
|
|
1451
|
+
const kt = (t) => {
|
|
1452
|
+
if (t !== null && typeof t != "string" && !S(t) && !R(t) && !P(t))
|
|
1451
1453
|
throw new Error(`lengthCoder: expected null | number | Uint8Array | CoderType, got ${t} (${typeof t})`);
|
|
1452
1454
|
return {
|
|
1453
1455
|
encodeStream(e, r) {
|
|
1454
1456
|
if (t === null)
|
|
1455
1457
|
return;
|
|
1456
|
-
if (
|
|
1458
|
+
if (S(t))
|
|
1457
1459
|
return t.encodeStream(e, r);
|
|
1458
1460
|
let n;
|
|
1459
|
-
if (typeof t == "number" ? n = t : typeof t == "string" && (n =
|
|
1461
|
+
if (typeof t == "number" ? n = t : typeof t == "string" && (n = D.resolve(e.stack, t)), typeof n == "bigint" && (n = Number(n)), n === void 0 || n !== r)
|
|
1460
1462
|
throw e.err(`Wrong length: ${n} len=${t} exp=${r} (${typeof r})`);
|
|
1461
1463
|
},
|
|
1462
1464
|
decodeStream(e) {
|
|
1463
1465
|
let r;
|
|
1464
|
-
if (
|
|
1466
|
+
if (S(t) ? r = Number(t.decodeStream(e)) : typeof t == "number" ? r = t : typeof t == "string" && (r = D.resolve(e.stack, t)), typeof r == "bigint" && (r = Number(r)), typeof r != "number")
|
|
1465
1467
|
throw e.err(`Wrong length: ${r}`);
|
|
1466
1468
|
return r;
|
|
1467
1469
|
}
|
|
@@ -1523,7 +1525,7 @@ const _t = (t) => {
|
|
|
1523
1525
|
return !1;
|
|
1524
1526
|
return !(c !== void 0 && i !== c && !A.set(t, c, o << a - l % a, s));
|
|
1525
1527
|
}
|
|
1526
|
-
},
|
|
1528
|
+
}, D = {
|
|
1527
1529
|
/**
|
|
1528
1530
|
* Internal method for handling stack of paths (debug, errors, dynamic fields via path)
|
|
1529
1531
|
* This is looks ugly (callback), but allows us to force stack cleaning by construction (.pop always after function).
|
|
@@ -1545,7 +1547,7 @@ const _t = (t) => {
|
|
|
1545
1547
|
return e.join("/");
|
|
1546
1548
|
},
|
|
1547
1549
|
err: (t, e, r) => {
|
|
1548
|
-
const n = new Error(`${t}(${
|
|
1550
|
+
const n = new Error(`${t}(${D.path(e)}): ${typeof r == "string" ? r : r.message}`);
|
|
1549
1551
|
return r instanceof Error && r.stack && (n.stack = r.stack), n;
|
|
1550
1552
|
},
|
|
1551
1553
|
resolve: (t, e) => {
|
|
@@ -1564,7 +1566,7 @@ const _t = (t) => {
|
|
|
1564
1566
|
};
|
|
1565
1567
|
class Re {
|
|
1566
1568
|
constructor(e, r = {}, n = [], s = void 0, o = 0) {
|
|
1567
|
-
this.pos = 0, this.bitBuf = 0, this.bitPos = 0, this.data = e, this.opts = r, this.stack = n, this.parent = s, this.parentOffset = o, this.view =
|
|
1569
|
+
this.pos = 0, this.bitBuf = 0, this.bitPos = 0, this.data = e, this.opts = r, this.stack = n, this.parent = s, this.parentOffset = o, this.view = _t(e);
|
|
1568
1570
|
}
|
|
1569
1571
|
/** Internal method for pointers. */
|
|
1570
1572
|
_enablePointers() {
|
|
@@ -1584,7 +1586,7 @@ class Re {
|
|
|
1584
1586
|
return n;
|
|
1585
1587
|
}
|
|
1586
1588
|
pushObj(e, r) {
|
|
1587
|
-
return
|
|
1589
|
+
return D.pushObj(this.stack, e, r);
|
|
1588
1590
|
}
|
|
1589
1591
|
readView(e, r) {
|
|
1590
1592
|
if (!Number.isFinite(e))
|
|
@@ -1618,7 +1620,7 @@ class Re {
|
|
|
1618
1620
|
}
|
|
1619
1621
|
// User methods
|
|
1620
1622
|
err(e) {
|
|
1621
|
-
return
|
|
1623
|
+
return D.err("Reader", this.stack, e);
|
|
1622
1624
|
}
|
|
1623
1625
|
offsetReader(e) {
|
|
1624
1626
|
if (e > this.data.length)
|
|
@@ -1674,22 +1676,22 @@ class Re {
|
|
|
1674
1676
|
for (let n = r; (n = this.data.indexOf(e[0], n)) !== -1; n++) {
|
|
1675
1677
|
if (n === -1 || this.data.length - n < e.length)
|
|
1676
1678
|
return;
|
|
1677
|
-
if (
|
|
1679
|
+
if (ke(e, this.data.subarray(n, n + e.length)))
|
|
1678
1680
|
return n;
|
|
1679
1681
|
}
|
|
1680
1682
|
}
|
|
1681
1683
|
}
|
|
1682
|
-
class
|
|
1684
|
+
class an {
|
|
1683
1685
|
constructor(e = []) {
|
|
1684
|
-
this.pos = 0, this.buffers = [], this.ptrs = [], this.bitBuf = 0, this.bitPos = 0, this.viewBuf = new Uint8Array(8), this.finished = !1, this.stack = e, this.view =
|
|
1686
|
+
this.pos = 0, this.buffers = [], this.ptrs = [], this.bitBuf = 0, this.bitPos = 0, this.viewBuf = new Uint8Array(8), this.finished = !1, this.stack = e, this.view = _t(this.viewBuf);
|
|
1685
1687
|
}
|
|
1686
1688
|
pushObj(e, r) {
|
|
1687
|
-
return
|
|
1689
|
+
return D.pushObj(this.stack, e, r);
|
|
1688
1690
|
}
|
|
1689
1691
|
writeView(e, r) {
|
|
1690
1692
|
if (this.finished)
|
|
1691
1693
|
throw this.err("buffer: finished");
|
|
1692
|
-
if (!
|
|
1694
|
+
if (!P(e) || e > 8)
|
|
1693
1695
|
throw new Error(`wrong writeView length=${e}`);
|
|
1694
1696
|
r(this.view), this.bytes(this.viewBuf.slice(0, e)), this.viewBuf.fill(0);
|
|
1695
1697
|
}
|
|
@@ -1697,7 +1699,7 @@ class on {
|
|
|
1697
1699
|
err(e) {
|
|
1698
1700
|
if (this.finished)
|
|
1699
1701
|
throw this.err("buffer: finished");
|
|
1700
|
-
return
|
|
1702
|
+
return D.err("Reader", this.stack, e);
|
|
1701
1703
|
}
|
|
1702
1704
|
bytes(e) {
|
|
1703
1705
|
if (this.finished)
|
|
@@ -1747,7 +1749,7 @@ class on {
|
|
|
1747
1749
|
}
|
|
1748
1750
|
}
|
|
1749
1751
|
const Ae = (t) => Uint8Array.from(t).reverse();
|
|
1750
|
-
function
|
|
1752
|
+
function cn(t, e, r) {
|
|
1751
1753
|
if (r) {
|
|
1752
1754
|
const n = 2n ** (e - 1n);
|
|
1753
1755
|
if (t < -n || t >= n)
|
|
@@ -1762,7 +1764,7 @@ function At(t) {
|
|
|
1762
1764
|
decodeStream: t.decodeStream,
|
|
1763
1765
|
size: t.size,
|
|
1764
1766
|
encode: (e) => {
|
|
1765
|
-
const r = new
|
|
1767
|
+
const r = new an();
|
|
1766
1768
|
return t.encodeStream(r, e), r.finish();
|
|
1767
1769
|
},
|
|
1768
1770
|
decode: (e, r = {}) => {
|
|
@@ -1772,7 +1774,7 @@ function At(t) {
|
|
|
1772
1774
|
};
|
|
1773
1775
|
}
|
|
1774
1776
|
function Et(t, e) {
|
|
1775
|
-
if (!
|
|
1777
|
+
if (!S(t))
|
|
1776
1778
|
throw new Error(`validate: invalid inner value ${t}`);
|
|
1777
1779
|
if (typeof e != "function")
|
|
1778
1780
|
throw new Error("validate: fn should be function");
|
|
@@ -1800,11 +1802,11 @@ function Et(t, e) {
|
|
|
1800
1802
|
const x = (t) => {
|
|
1801
1803
|
const e = At(t);
|
|
1802
1804
|
return t.validate ? Et(e, t.validate) : e;
|
|
1803
|
-
}, ce = (t) =>
|
|
1804
|
-
function
|
|
1805
|
-
return
|
|
1805
|
+
}, ce = (t) => O(t) && typeof t.decode == "function" && typeof t.encode == "function";
|
|
1806
|
+
function S(t) {
|
|
1807
|
+
return O(t) && ce(t) && typeof t.encodeStream == "function" && typeof t.decodeStream == "function" && (t.size === void 0 || P(t.size));
|
|
1806
1808
|
}
|
|
1807
|
-
function
|
|
1809
|
+
function ln() {
|
|
1808
1810
|
return {
|
|
1809
1811
|
encode: (t) => {
|
|
1810
1812
|
if (!Array.isArray(t))
|
|
@@ -1821,13 +1823,13 @@ function cn() {
|
|
|
1821
1823
|
return e;
|
|
1822
1824
|
},
|
|
1823
1825
|
decode: (t) => {
|
|
1824
|
-
if (!
|
|
1826
|
+
if (!O(t))
|
|
1825
1827
|
throw new Error(`expected plain object, got ${t}`);
|
|
1826
1828
|
return Object.entries(t);
|
|
1827
1829
|
}
|
|
1828
1830
|
};
|
|
1829
1831
|
}
|
|
1830
|
-
const
|
|
1832
|
+
const dn = {
|
|
1831
1833
|
encode: (t) => {
|
|
1832
1834
|
if (typeof t != "bigint")
|
|
1833
1835
|
throw new Error(`expected bigint, got ${typeof t}`);
|
|
@@ -1836,17 +1838,17 @@ const ln = {
|
|
|
1836
1838
|
return Number(t);
|
|
1837
1839
|
},
|
|
1838
1840
|
decode: (t) => {
|
|
1839
|
-
if (!
|
|
1841
|
+
if (!P(t))
|
|
1840
1842
|
throw new Error("element is not a safe integer");
|
|
1841
1843
|
return BigInt(t);
|
|
1842
1844
|
}
|
|
1843
1845
|
};
|
|
1844
|
-
function
|
|
1845
|
-
if (!
|
|
1846
|
+
function hn(t) {
|
|
1847
|
+
if (!O(t))
|
|
1846
1848
|
throw new Error("plain object expected");
|
|
1847
1849
|
return {
|
|
1848
1850
|
encode: (e) => {
|
|
1849
|
-
if (!
|
|
1851
|
+
if (!P(e) || !(e in t))
|
|
1850
1852
|
throw new Error(`wrong value ${e}`);
|
|
1851
1853
|
return t[e];
|
|
1852
1854
|
},
|
|
@@ -1857,8 +1859,8 @@ function dn(t) {
|
|
|
1857
1859
|
}
|
|
1858
1860
|
};
|
|
1859
1861
|
}
|
|
1860
|
-
function
|
|
1861
|
-
if (!
|
|
1862
|
+
function fn(t, e = !1) {
|
|
1863
|
+
if (!P(t))
|
|
1862
1864
|
throw new Error(`decimal/precision: wrong value ${t}`);
|
|
1863
1865
|
if (typeof e != "boolean")
|
|
1864
1866
|
throw new Error(`decimal/round: expected boolean, got ${typeof e}`);
|
|
@@ -1893,7 +1895,7 @@ function hn(t, e = !1) {
|
|
|
1893
1895
|
}
|
|
1894
1896
|
};
|
|
1895
1897
|
}
|
|
1896
|
-
function
|
|
1898
|
+
function un(t) {
|
|
1897
1899
|
if (!Array.isArray(t))
|
|
1898
1900
|
throw new Error(`expected array, got ${typeof t}`);
|
|
1899
1901
|
for (const e of t)
|
|
@@ -1918,12 +1920,12 @@ function fn(t) {
|
|
|
1918
1920
|
}
|
|
1919
1921
|
};
|
|
1920
1922
|
}
|
|
1921
|
-
const
|
|
1923
|
+
const gn = (t) => {
|
|
1922
1924
|
if (!ce(t))
|
|
1923
1925
|
throw new Error("BaseCoder expected");
|
|
1924
1926
|
return { encode: t.decode, decode: t.encode };
|
|
1925
|
-
}, H = { dict:
|
|
1926
|
-
if (!
|
|
1927
|
+
}, H = { dict: ln, numberBigint: dn, tsEnum: hn, decimal: fn, match: un, reverse: gn }, wn = (t, e = !1, r = !1, n = !0) => {
|
|
1928
|
+
if (!P(t))
|
|
1927
1929
|
throw new Error(`bigint/size: wrong value ${t}`);
|
|
1928
1930
|
if (typeof e != "boolean")
|
|
1929
1931
|
throw new Error(`bigint/le: expected boolean, got ${typeof e}`);
|
|
@@ -1958,10 +1960,10 @@ const un = (t) => {
|
|
|
1958
1960
|
validate: (a) => {
|
|
1959
1961
|
if (typeof a != "bigint")
|
|
1960
1962
|
throw new Error(`bigint: invalid value: ${a}`);
|
|
1961
|
-
return
|
|
1963
|
+
return cn(a, 8n * s, !!r), a;
|
|
1962
1964
|
}
|
|
1963
1965
|
});
|
|
1964
|
-
}, b = /* @__PURE__ */
|
|
1966
|
+
}, b = /* @__PURE__ */ wn(8, !0), pn = (t, e) => x({
|
|
1965
1967
|
size: t,
|
|
1966
1968
|
encodeStream: (r, n) => r.writeView(t, (s) => e.write(s, n)),
|
|
1967
1969
|
decodeStream: (r) => r.readView(t, e.read),
|
|
@@ -1972,17 +1974,17 @@ const un = (t) => {
|
|
|
1972
1974
|
}
|
|
1973
1975
|
}), vt = (t, e, r) => {
|
|
1974
1976
|
const n = t * 8, s = 2 ** (n - 1), o = (l) => {
|
|
1975
|
-
if (!
|
|
1977
|
+
if (!P(l))
|
|
1976
1978
|
throw new Error(`sintView: value is not safe integer: ${l}`);
|
|
1977
1979
|
if (l < -s || l >= s)
|
|
1978
1980
|
throw new Error(`sintView: value out of bounds. Expected ${-s} <= ${l} < ${s}`);
|
|
1979
1981
|
}, a = 2 ** n, i = (l) => {
|
|
1980
|
-
if (!
|
|
1982
|
+
if (!P(l))
|
|
1981
1983
|
throw new Error(`uintView: value is not safe integer: ${l}`);
|
|
1982
1984
|
if (0 > l || l >= a)
|
|
1983
1985
|
throw new Error(`uintView: value out of bounds. Expected 0 <= ${l} < ${a}`);
|
|
1984
1986
|
};
|
|
1985
|
-
return
|
|
1987
|
+
return pn(t, {
|
|
1986
1988
|
write: r.write,
|
|
1987
1989
|
read: r.read,
|
|
1988
1990
|
validate: e ? o : i
|
|
@@ -2010,7 +2012,7 @@ const un = (t) => {
|
|
|
2010
2012
|
}), le = (t, e = !1) => {
|
|
2011
2013
|
if (typeof e != "boolean")
|
|
2012
2014
|
throw new Error(`bytes/le: expected boolean, got ${typeof e}`);
|
|
2013
|
-
const r =
|
|
2015
|
+
const r = kt(t), n = R(t);
|
|
2014
2016
|
return x({
|
|
2015
2017
|
size: typeof t == "number" ? t : void 0,
|
|
2016
2018
|
encodeStream: (s, o) => {
|
|
@@ -2033,13 +2035,13 @@ const un = (t) => {
|
|
|
2033
2035
|
return s;
|
|
2034
2036
|
}
|
|
2035
2037
|
});
|
|
2036
|
-
},
|
|
2038
|
+
}, yn = (t, e = !1) => Et(mn(le(t, e), nn), (r) => {
|
|
2037
2039
|
if (typeof r != "string")
|
|
2038
2040
|
throw new Error(`expected string, got ${typeof r}`);
|
|
2039
2041
|
return r;
|
|
2040
2042
|
});
|
|
2041
|
-
function
|
|
2042
|
-
if (!
|
|
2043
|
+
function mn(t, e) {
|
|
2044
|
+
if (!S(t))
|
|
2043
2045
|
throw new Error(`apply: invalid inner value ${t}`);
|
|
2044
2046
|
if (!ce(e))
|
|
2045
2047
|
throw new Error(`apply: invalid base value ${t}`);
|
|
@@ -2065,7 +2067,7 @@ function yn(t, e) {
|
|
|
2065
2067
|
});
|
|
2066
2068
|
}
|
|
2067
2069
|
function q(t, e, r) {
|
|
2068
|
-
if (!
|
|
2070
|
+
if (!S(t) || !S(e))
|
|
2069
2071
|
throw new Error(`optional: invalid flag or inner value flag=${t} inner=${e}`);
|
|
2070
2072
|
return x({
|
|
2071
2073
|
size: r !== void 0 && t.size && e.size ? t.size + e.size : void 0,
|
|
@@ -2079,7 +2081,7 @@ function q(t, e, r) {
|
|
|
2079
2081
|
}
|
|
2080
2082
|
});
|
|
2081
2083
|
}
|
|
2082
|
-
function
|
|
2084
|
+
function bn(t) {
|
|
2083
2085
|
return x({
|
|
2084
2086
|
encodeStream: (e, r) => {
|
|
2085
2087
|
if (r !== t)
|
|
@@ -2088,25 +2090,25 @@ function mn(t) {
|
|
|
2088
2090
|
decodeStream: (e) => t
|
|
2089
2091
|
});
|
|
2090
2092
|
}
|
|
2091
|
-
function
|
|
2093
|
+
function _n(t) {
|
|
2092
2094
|
let e = 0;
|
|
2093
2095
|
for (const r of t) {
|
|
2094
2096
|
if (r.size === void 0)
|
|
2095
2097
|
return;
|
|
2096
|
-
if (!
|
|
2098
|
+
if (!P(r.size))
|
|
2097
2099
|
throw new Error(`sizeof: wrong element size=${e}`);
|
|
2098
2100
|
e += r.size;
|
|
2099
2101
|
}
|
|
2100
2102
|
return e;
|
|
2101
2103
|
}
|
|
2102
2104
|
function g(t) {
|
|
2103
|
-
if (!
|
|
2105
|
+
if (!O(t))
|
|
2104
2106
|
throw new Error(`struct: expected plain object, got ${t}`);
|
|
2105
2107
|
for (const e in t)
|
|
2106
|
-
if (!
|
|
2108
|
+
if (!S(t[e]))
|
|
2107
2109
|
throw new Error(`struct: field ${e} is not CoderType`);
|
|
2108
2110
|
return x({
|
|
2109
|
-
size:
|
|
2111
|
+
size: _n(Object.values(t)),
|
|
2110
2112
|
encodeStream: (e, r) => {
|
|
2111
2113
|
e.pushObj(r, (n) => {
|
|
2112
2114
|
for (const s in t)
|
|
@@ -2128,9 +2130,9 @@ function g(t) {
|
|
|
2128
2130
|
});
|
|
2129
2131
|
}
|
|
2130
2132
|
function te(t, e) {
|
|
2131
|
-
if (!
|
|
2133
|
+
if (!S(e))
|
|
2132
2134
|
throw new Error(`array: invalid inner value ${e}`);
|
|
2133
|
-
const r =
|
|
2135
|
+
const r = kt(typeof t == "string" ? `../${t}` : t);
|
|
2134
2136
|
return x({
|
|
2135
2137
|
size: typeof t == "number" && e.size ? t * e.size : void 0,
|
|
2136
2138
|
encodeStream: (n, s) => {
|
|
@@ -2144,7 +2146,7 @@ function te(t, e) {
|
|
|
2144
2146
|
if (t.length > o.pos - c)
|
|
2145
2147
|
return;
|
|
2146
2148
|
const d = o.finish(!1).subarray(c, o.pos);
|
|
2147
|
-
if (
|
|
2149
|
+
if (ke(d.subarray(0, t.length), t))
|
|
2148
2150
|
throw o.err(`array: inner element encoding same as separator. elm=${l} data=${d}`);
|
|
2149
2151
|
}
|
|
2150
2152
|
});
|
|
@@ -2158,7 +2160,7 @@ function te(t, e) {
|
|
|
2158
2160
|
;
|
|
2159
2161
|
else if (R(t))
|
|
2160
2162
|
for (let a = 0; ; a++) {
|
|
2161
|
-
if (
|
|
2163
|
+
if (ke(n.bytes(t.length, !0), t)) {
|
|
2162
2164
|
n.bytes(t.length);
|
|
2163
2165
|
break;
|
|
2164
2166
|
}
|
|
@@ -2180,9 +2182,9 @@ function te(t, e) {
|
|
|
2180
2182
|
});
|
|
2181
2183
|
}
|
|
2182
2184
|
function Te(t, e) {
|
|
2183
|
-
if (!
|
|
2185
|
+
if (!S(t))
|
|
2184
2186
|
throw new Error(`map: invalid inner value ${t}`);
|
|
2185
|
-
if (!
|
|
2187
|
+
if (!O(e))
|
|
2186
2188
|
throw new Error("map: variants should be plain object");
|
|
2187
2189
|
const r = /* @__PURE__ */ new Map();
|
|
2188
2190
|
for (const n in e)
|
|
@@ -2206,12 +2208,12 @@ function Te(t, e) {
|
|
|
2206
2208
|
});
|
|
2207
2209
|
}
|
|
2208
2210
|
function kn(t, e) {
|
|
2209
|
-
if (!
|
|
2211
|
+
if (!S(t))
|
|
2210
2212
|
throw new Error(`tag: invalid tag value ${t}`);
|
|
2211
|
-
if (!
|
|
2213
|
+
if (!O(e))
|
|
2212
2214
|
throw new Error("tag: variants should be plain object");
|
|
2213
2215
|
for (const r in e)
|
|
2214
|
-
if (!
|
|
2216
|
+
if (!S(e[r]))
|
|
2215
2217
|
throw new Error(`tag: variant ${r} is not CoderType`);
|
|
2216
2218
|
return x({
|
|
2217
2219
|
size: t.size,
|
|
@@ -2233,18 +2235,18 @@ function kn(t, e) {
|
|
|
2233
2235
|
}
|
|
2234
2236
|
});
|
|
2235
2237
|
}
|
|
2236
|
-
const
|
|
2238
|
+
const An = (t) => 0;
|
|
2237
2239
|
function we(t, e) {
|
|
2238
2240
|
return e % t === 0 ? 0 : t - e % t;
|
|
2239
2241
|
}
|
|
2240
2242
|
function xt(t, e, r) {
|
|
2241
|
-
if (!
|
|
2243
|
+
if (!S(e))
|
|
2242
2244
|
throw new Error(`padRight: invalid inner value ${e}`);
|
|
2243
|
-
if (!
|
|
2245
|
+
if (!P(t) || t <= 0)
|
|
2244
2246
|
throw new Error(`padLeft: wrong blockSize=${t}`);
|
|
2245
2247
|
if (r !== void 0 && typeof r != "function")
|
|
2246
2248
|
throw new Error(`padRight: wrong padFn=${typeof r}`);
|
|
2247
|
-
const n = r ||
|
|
2249
|
+
const n = r || An;
|
|
2248
2250
|
return x({
|
|
2249
2251
|
size: e.size ? e.size + we(t, e.size) : void 0,
|
|
2250
2252
|
encodeStream: (s, o) => {
|
|
@@ -2260,7 +2262,7 @@ function xt(t, e, r) {
|
|
|
2260
2262
|
}
|
|
2261
2263
|
});
|
|
2262
2264
|
}
|
|
2263
|
-
const
|
|
2265
|
+
const En = 9, pe = H.decimal(En), K = x({
|
|
2264
2266
|
encodeStream: (t, e) => {
|
|
2265
2267
|
if (!e)
|
|
2266
2268
|
return t.byte(0);
|
|
@@ -2276,14 +2278,14 @@ const An = 9, pe = H.decimal(An), K = x({
|
|
|
2276
2278
|
}
|
|
2277
2279
|
return e;
|
|
2278
2280
|
}
|
|
2279
|
-
}), ee =
|
|
2281
|
+
}), ee = yn(xt(8, ie, void 0)), vn = () => {
|
|
2280
2282
|
const t = le(32);
|
|
2281
2283
|
return x({
|
|
2282
2284
|
size: t.size,
|
|
2283
|
-
encodeStream: (e, r) => t.encodeStream(e,
|
|
2284
|
-
decodeStream: (e) =>
|
|
2285
|
+
encodeStream: (e, r) => t.encodeStream(e, _e.decode(r)),
|
|
2286
|
+
decodeStream: (e) => _e.encode(t.decodeStream(e))
|
|
2285
2287
|
});
|
|
2286
|
-
}, y =
|
|
2288
|
+
}, y = vn(), xn = g({
|
|
2287
2289
|
requiredSignatures: $,
|
|
2288
2290
|
readSigned: $,
|
|
2289
2291
|
readUnsigned: $,
|
|
@@ -2291,16 +2293,16 @@ const An = 9, pe = H.decimal(An), K = x({
|
|
|
2291
2293
|
blockhash: y,
|
|
2292
2294
|
instructions: te(K, g({ programIdx: $, keys: te(K, $), data: le(K) }))
|
|
2293
2295
|
});
|
|
2294
|
-
function
|
|
2295
|
-
if (
|
|
2296
|
+
function $n(t) {
|
|
2297
|
+
if (_e.decode(t).length !== 32)
|
|
2296
2298
|
throw new Error("Invalid Solana address");
|
|
2297
2299
|
}
|
|
2298
|
-
const
|
|
2300
|
+
const Sn = (t, e, r, n, s) => ({
|
|
2299
2301
|
sign: t < e,
|
|
2300
2302
|
write: t < e - r || t >= e && t < s - n
|
|
2301
2303
|
}), Ze = g({
|
|
2302
2304
|
signatures: te(K, le(64)),
|
|
2303
|
-
msg:
|
|
2305
|
+
msg: xn
|
|
2304
2306
|
}), ve = x({
|
|
2305
2307
|
encodeStream: (t, e) => {
|
|
2306
2308
|
const { msg: r, signatures: n } = e, s = {}, o = (h, f, u) => {
|
|
@@ -2353,7 +2355,7 @@ const $n = (t, e, r, n, s) => ({
|
|
|
2353
2355
|
for (let o = 0; o < r.keys.length; o++)
|
|
2354
2356
|
s.push({
|
|
2355
2357
|
address: r.keys[o],
|
|
2356
|
-
|
|
2358
|
+
...Sn(o, r.requiredSignatures, r.readSigned, r.readUnsigned, r.keys.length)
|
|
2357
2359
|
});
|
|
2358
2360
|
if (!s.length)
|
|
2359
2361
|
throw new Error("SOL.tx: empty accounts array");
|
|
@@ -2399,12 +2401,12 @@ function Ue(t, e, r) {
|
|
|
2399
2401
|
data: o.encode({ TAG: i, data: l }),
|
|
2400
2402
|
keys: Object.keys(r[i].keys).map((c) => {
|
|
2401
2403
|
let { sign: d, write: h, address: f } = r[i].keys[c];
|
|
2402
|
-
return f || (f = l[c]),
|
|
2404
|
+
return f || (f = l[c]), $n(f), { address: f, sign: d, write: h };
|
|
2403
2405
|
})
|
|
2404
2406
|
});
|
|
2405
2407
|
return a;
|
|
2406
2408
|
}
|
|
2407
|
-
const ye = "SysvarRecentB1ockHashes11111111111111111111",
|
|
2409
|
+
const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent111111111111111111111111111111111", $t = "11111111111111111111111111111111", St = Ue($t, ie, {
|
|
2408
2410
|
createAccount: {
|
|
2409
2411
|
coder: g({ lamports: b, space: b, owner: y }),
|
|
2410
2412
|
keys: {
|
|
@@ -2452,7 +2454,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2452
2454
|
nonceAccount: { sign: !1, write: !0 },
|
|
2453
2455
|
destination: { sign: !1, write: !0 },
|
|
2454
2456
|
_recent_bh: { address: ye, sign: !1, write: !1 },
|
|
2455
|
-
_rent: { address:
|
|
2457
|
+
_rent: { address: L, sign: !1, write: !1 },
|
|
2456
2458
|
nonceAuthority: { sign: !0, write: !1 }
|
|
2457
2459
|
},
|
|
2458
2460
|
hint: (t) => `Withdraw ${pe.encode(t.lamports)} SOL from nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority}) to ${t.destination}`
|
|
@@ -2462,7 +2464,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2462
2464
|
keys: {
|
|
2463
2465
|
nonceAccount: { sign: !1, write: !0 },
|
|
2464
2466
|
_recent_bh: { address: ye, sign: !1, write: !1 },
|
|
2465
|
-
_rent: { address:
|
|
2467
|
+
_rent: { address: L, sign: !1, write: !1 }
|
|
2466
2468
|
}
|
|
2467
2469
|
},
|
|
2468
2470
|
authorizeNonce: {
|
|
@@ -2514,10 +2516,10 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2514
2516
|
destination: { sign: !1, write: !0 }
|
|
2515
2517
|
}
|
|
2516
2518
|
}
|
|
2517
|
-
}),
|
|
2519
|
+
}), It = (t) => {
|
|
2518
2520
|
};
|
|
2519
|
-
St
|
|
2520
|
-
St
|
|
2521
|
+
It(St.transfer);
|
|
2522
|
+
It(St.advanceNonce);
|
|
2521
2523
|
const In = Te($, {
|
|
2522
2524
|
MintTokens: 0,
|
|
2523
2525
|
FreezeAccount: 1,
|
|
@@ -2533,7 +2535,7 @@ Ue(Ct, $, {
|
|
|
2533
2535
|
}),
|
|
2534
2536
|
keys: {
|
|
2535
2537
|
mint: { sign: !1, write: !0 },
|
|
2536
|
-
_rent: { address:
|
|
2538
|
+
_rent: { address: L, sign: !1, write: !1 }
|
|
2537
2539
|
}
|
|
2538
2540
|
},
|
|
2539
2541
|
initializeAccount: {
|
|
@@ -2542,7 +2544,7 @@ Ue(Ct, $, {
|
|
|
2542
2544
|
account: { sign: !1, write: !0 },
|
|
2543
2545
|
mint: { sign: !1, write: !1 },
|
|
2544
2546
|
owner: { sign: !1, write: !1 },
|
|
2545
|
-
_rent: { address:
|
|
2547
|
+
_rent: { address: L, sign: !1, write: !1 }
|
|
2546
2548
|
},
|
|
2547
2549
|
hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${U(t.mint, e)}`
|
|
2548
2550
|
},
|
|
@@ -2551,7 +2553,7 @@ Ue(Ct, $, {
|
|
|
2551
2553
|
coder: g({ m: $ }),
|
|
2552
2554
|
keys: {
|
|
2553
2555
|
account: { sign: !1, write: !0 },
|
|
2554
|
-
_rent: { address:
|
|
2556
|
+
_rent: { address: L, sign: !1, write: !1 }
|
|
2555
2557
|
},
|
|
2556
2558
|
hint: (t, e) => `Initialize multi-sig token account=${t.account} with signatures=${t.m}`
|
|
2557
2559
|
},
|
|
@@ -2679,7 +2681,7 @@ Ue(Ct, $, {
|
|
|
2679
2681
|
keys: {
|
|
2680
2682
|
account: { sign: !1, write: !0 },
|
|
2681
2683
|
mint: { sign: !1, write: !1 },
|
|
2682
|
-
_rent: { address:
|
|
2684
|
+
_rent: { address: L, sign: !1, write: !1 }
|
|
2683
2685
|
},
|
|
2684
2686
|
hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${U(t.mint, e)}`
|
|
2685
2687
|
},
|
|
@@ -2696,8 +2698,8 @@ g({
|
|
|
2696
2698
|
nonce: y,
|
|
2697
2699
|
lamportPerSignature: b
|
|
2698
2700
|
});
|
|
2699
|
-
const
|
|
2700
|
-
Ue(
|
|
2701
|
+
const Cn = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
2702
|
+
Ue(Cn, bn(0), {
|
|
2701
2703
|
create: {
|
|
2702
2704
|
coder: g({}),
|
|
2703
2705
|
keys: {
|
|
@@ -2707,7 +2709,7 @@ Ue(Sn, mn(0), {
|
|
|
2707
2709
|
mint: { sign: !1, write: !1 },
|
|
2708
2710
|
_sys: { address: $t, sign: !1, write: !1 },
|
|
2709
2711
|
_token: { address: Ct, sign: !1, write: !1 },
|
|
2710
|
-
_rent: { address:
|
|
2712
|
+
_rent: { address: L, sign: !1, write: !1 }
|
|
2711
2713
|
},
|
|
2712
2714
|
hint: (t, e) => `Initialize associated token account=${t.account} with owner=${t.wallet} for token=${U(t.mint, e)}, payed by ${t.source}`
|
|
2713
2715
|
}
|
|
@@ -2730,12 +2732,12 @@ g({
|
|
|
2730
2732
|
function tt(t, e, r) {
|
|
2731
2733
|
if (!e.length)
|
|
2732
2734
|
throw new Error("SOLPublic: empty instructions array");
|
|
2733
|
-
return
|
|
2735
|
+
return tn.encode(ve.encode({
|
|
2734
2736
|
msg: { feePayer: t, blockhash: r, instructions: e },
|
|
2735
2737
|
signatures: {}
|
|
2736
2738
|
}));
|
|
2737
2739
|
}
|
|
2738
|
-
function
|
|
2740
|
+
function Pn(t) {
|
|
2739
2741
|
if (t.length >= 255)
|
|
2740
2742
|
throw new TypeError("Alphabet too long");
|
|
2741
2743
|
const e = new Uint8Array(256);
|
|
@@ -2757,22 +2759,22 @@ function Cn(t) {
|
|
|
2757
2759
|
const u = c.length;
|
|
2758
2760
|
for (; f !== u && c[f] === 0; )
|
|
2759
2761
|
f++, d++;
|
|
2760
|
-
const w = (u - f) * o + 1 >>> 0,
|
|
2762
|
+
const w = (u - f) * o + 1 >>> 0, _ = new Uint8Array(w);
|
|
2761
2763
|
for (; f !== u; ) {
|
|
2762
|
-
let
|
|
2763
|
-
for (let E = w - 1; (
|
|
2764
|
-
|
|
2765
|
-
if (
|
|
2764
|
+
let k = c[f], p = 0;
|
|
2765
|
+
for (let E = w - 1; (k !== 0 || p < h) && E !== -1; E--, p++)
|
|
2766
|
+
k += 256 * _[E] >>> 0, _[E] = k % r >>> 0, k = k / r >>> 0;
|
|
2767
|
+
if (k !== 0)
|
|
2766
2768
|
throw new Error("Non-zero carry");
|
|
2767
2769
|
h = p, f++;
|
|
2768
2770
|
}
|
|
2769
2771
|
let m = w - h;
|
|
2770
|
-
for (; m !== w &&
|
|
2772
|
+
for (; m !== w && _[m] === 0; )
|
|
2771
2773
|
m++;
|
|
2772
|
-
let
|
|
2774
|
+
let I = n.repeat(d);
|
|
2773
2775
|
for (; m < w; ++m)
|
|
2774
|
-
|
|
2775
|
-
return
|
|
2776
|
+
I += t.charAt(_[m]);
|
|
2777
|
+
return I;
|
|
2776
2778
|
}
|
|
2777
2779
|
function i(c) {
|
|
2778
2780
|
if (typeof c != "string")
|
|
@@ -2784,10 +2786,10 @@ function Cn(t) {
|
|
|
2784
2786
|
h++, d++;
|
|
2785
2787
|
const u = (c.length - d) * s + 1 >>> 0, w = new Uint8Array(u);
|
|
2786
2788
|
for (; d < c.length; ) {
|
|
2787
|
-
const
|
|
2788
|
-
if (
|
|
2789
|
+
const k = c.charCodeAt(d);
|
|
2790
|
+
if (k > 255)
|
|
2789
2791
|
return;
|
|
2790
|
-
let p = e[
|
|
2792
|
+
let p = e[k];
|
|
2791
2793
|
if (p === 255)
|
|
2792
2794
|
return;
|
|
2793
2795
|
let E = 0;
|
|
@@ -2797,13 +2799,13 @@ function Cn(t) {
|
|
|
2797
2799
|
throw new Error("Non-zero carry");
|
|
2798
2800
|
f = E, d++;
|
|
2799
2801
|
}
|
|
2800
|
-
let
|
|
2801
|
-
for (;
|
|
2802
|
-
|
|
2803
|
-
const m = new Uint8Array(h + (u -
|
|
2804
|
-
let
|
|
2805
|
-
for (;
|
|
2806
|
-
m[
|
|
2802
|
+
let _ = u - f;
|
|
2803
|
+
for (; _ !== u && w[_] === 0; )
|
|
2804
|
+
_++;
|
|
2805
|
+
const m = new Uint8Array(h + (u - _));
|
|
2806
|
+
let I = h;
|
|
2807
|
+
for (; _ !== u; )
|
|
2808
|
+
m[I++] = w[_++];
|
|
2807
2809
|
return m;
|
|
2808
2810
|
}
|
|
2809
2811
|
function l(c) {
|
|
@@ -2819,7 +2821,7 @@ function Cn(t) {
|
|
|
2819
2821
|
};
|
|
2820
2822
|
}
|
|
2821
2823
|
var Bn = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2822
|
-
|
|
2824
|
+
Pn(Bn);
|
|
2823
2825
|
class ze {
|
|
2824
2826
|
_transaction;
|
|
2825
2827
|
signatures = [];
|
|
@@ -2859,7 +2861,7 @@ class ze {
|
|
|
2859
2861
|
return Buffer.from(e, "hex");
|
|
2860
2862
|
}
|
|
2861
2863
|
}
|
|
2862
|
-
class
|
|
2864
|
+
class Nn {
|
|
2863
2865
|
type = "phantom";
|
|
2864
2866
|
platform = "solana";
|
|
2865
2867
|
account = void 0;
|
|
@@ -2969,12 +2971,12 @@ class Pn {
|
|
|
2969
2971
|
};
|
|
2970
2972
|
}
|
|
2971
2973
|
}
|
|
2972
|
-
class
|
|
2974
|
+
class Rn extends Ie {
|
|
2973
2975
|
type = "rabby";
|
|
2974
2976
|
rdns = "io.rabby";
|
|
2975
2977
|
displayName = "Rabby";
|
|
2976
2978
|
}
|
|
2977
|
-
class
|
|
2979
|
+
class Tn {
|
|
2978
2980
|
type = "braavos";
|
|
2979
2981
|
platform = "starknet";
|
|
2980
2982
|
wallet = void 0;
|
|
@@ -3108,22 +3110,22 @@ class Rn {
|
|
|
3108
3110
|
this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
|
|
3109
3111
|
}
|
|
3110
3112
|
}
|
|
3111
|
-
class
|
|
3113
|
+
class Un {
|
|
3112
3114
|
walletAdapters;
|
|
3113
3115
|
constructor() {
|
|
3114
3116
|
if (this.walletAdapters = /* @__PURE__ */ new Map(), typeof window > "u")
|
|
3115
3117
|
return;
|
|
3116
|
-
const e = new
|
|
3118
|
+
const e = new qr();
|
|
3117
3119
|
this.walletAdapters.set("metamask", e);
|
|
3118
|
-
const r = new
|
|
3120
|
+
const r = new Nn();
|
|
3119
3121
|
this.walletAdapters.set("phantom", r);
|
|
3120
3122
|
const n = new jr();
|
|
3121
3123
|
this.walletAdapters.set("argent", n);
|
|
3122
|
-
const s = new
|
|
3124
|
+
const s = new Tn();
|
|
3123
3125
|
this.walletAdapters.set("braavos", s);
|
|
3124
|
-
const o = new
|
|
3126
|
+
const o = new Rn();
|
|
3125
3127
|
this.walletAdapters.set("rabby", o);
|
|
3126
|
-
const a = new
|
|
3128
|
+
const a = new Vr();
|
|
3127
3129
|
this.walletAdapters.set("base", a), window.wallet_bridge = this;
|
|
3128
3130
|
}
|
|
3129
3131
|
getIFrameMethods() {
|
|
@@ -3277,7 +3279,7 @@ class Tn {
|
|
|
3277
3279
|
}
|
|
3278
3280
|
}
|
|
3279
3281
|
}
|
|
3280
|
-
class
|
|
3282
|
+
class zn extends cr {
|
|
3281
3283
|
walletBridge;
|
|
3282
3284
|
constructor({
|
|
3283
3285
|
url: e,
|
|
@@ -3288,7 +3290,7 @@ class Un extends ar {
|
|
|
3288
3290
|
tokens: a,
|
|
3289
3291
|
...i
|
|
3290
3292
|
}) {
|
|
3291
|
-
const l = new URL(e ??
|
|
3293
|
+
const l = new URL(e ?? Ut), c = new Un();
|
|
3292
3294
|
r && l.searchParams.set(
|
|
3293
3295
|
"policies",
|
|
3294
3296
|
encodeURIComponent(JSON.stringify(r))
|
|
@@ -3306,7 +3308,7 @@ class Un extends ar {
|
|
|
3306
3308
|
return this.walletBridge;
|
|
3307
3309
|
}
|
|
3308
3310
|
}
|
|
3309
|
-
class
|
|
3311
|
+
class Mn extends zt {
|
|
3310
3312
|
keychain;
|
|
3311
3313
|
options;
|
|
3312
3314
|
iframes;
|
|
@@ -3349,7 +3351,7 @@ class Ln extends Ut {
|
|
|
3349
3351
|
}
|
|
3350
3352
|
const e = await this.keychain.probe(this.rpcUrl());
|
|
3351
3353
|
let r = e?.rpcUrl || this.rpcUrl();
|
|
3352
|
-
this.account = new
|
|
3354
|
+
this.account = new Oe(
|
|
3353
3355
|
this,
|
|
3354
3356
|
r,
|
|
3355
3357
|
e.address,
|
|
@@ -3383,7 +3385,7 @@ class Ln extends Ut {
|
|
|
3383
3385
|
);
|
|
3384
3386
|
if (e.code !== Q.SUCCESS)
|
|
3385
3387
|
throw new Error(e.message);
|
|
3386
|
-
return e = e, this.account = new
|
|
3388
|
+
return e = e, this.account = new Oe(
|
|
3387
3389
|
this,
|
|
3388
3390
|
this.rpcUrl(),
|
|
3389
3391
|
e.address,
|
|
@@ -3471,10 +3473,10 @@ class Ln extends Ut {
|
|
|
3471
3473
|
const e = this.chains.get(this.selectedChain);
|
|
3472
3474
|
if (!e) {
|
|
3473
3475
|
const r = Array.from(this.chains.keys()).map(
|
|
3474
|
-
(n) =>
|
|
3476
|
+
(n) => De.decodeShortString(n)
|
|
3475
3477
|
);
|
|
3476
3478
|
throw new Error(
|
|
3477
|
-
`Chain not found: ${
|
|
3479
|
+
`Chain not found: ${De.decodeShortString(this.selectedChain)}. Available chains: ${r.join(", ")}`
|
|
3478
3480
|
);
|
|
3479
3481
|
}
|
|
3480
3482
|
return e.rpcUrl;
|
|
@@ -3521,7 +3523,7 @@ class Ln extends Ut {
|
|
|
3521
3523
|
initializeChains(e) {
|
|
3522
3524
|
for (const r of e)
|
|
3523
3525
|
try {
|
|
3524
|
-
const n = new URL(r.rpcUrl), s =
|
|
3526
|
+
const n = new URL(r.rpcUrl), s = Lt(n), o = s === V.StarknetChainId.SN_MAIN, a = s === V.StarknetChainId.SN_SEPOLIA, i = n.hostname === "api.cartridge.gg", l = n.hostname === "localhost" || n.hostname === "127.0.0.1";
|
|
3525
3527
|
if ((o || a) && !(i || l))
|
|
3526
3528
|
throw new Error(
|
|
3527
3529
|
`Only Cartridge RPC providers are allowed for ${o ? "mainnet" : "sepolia"}. Please use: https://api.cartridge.gg/x/starknet/${o ? "mainnet" : "sepolia"}/rpc/v0_9`
|
|
@@ -3535,7 +3537,7 @@ class Ln extends Ut {
|
|
|
3535
3537
|
);
|
|
3536
3538
|
}
|
|
3537
3539
|
createKeychainIframe() {
|
|
3538
|
-
return new
|
|
3540
|
+
return new zn({
|
|
3539
3541
|
...this.options,
|
|
3540
3542
|
onClose: this.keychain?.reset,
|
|
3541
3543
|
onConnect: (e) => {
|
|
@@ -3560,7 +3562,7 @@ class Ln extends Ut {
|
|
|
3560
3562
|
}
|
|
3561
3563
|
}
|
|
3562
3564
|
const F = /* @__PURE__ */ new Map();
|
|
3563
|
-
async function
|
|
3565
|
+
async function Pt(t) {
|
|
3564
3566
|
if (!t.addresses?.length && !t.usernames?.length)
|
|
3565
3567
|
return { results: [] };
|
|
3566
3568
|
const e = await fetch(`${Ot}/lookup`, {
|
|
@@ -3574,18 +3576,18 @@ async function Bt(t) {
|
|
|
3574
3576
|
throw new Error(`HTTP error! status: ${e.status}`);
|
|
3575
3577
|
return e.json();
|
|
3576
3578
|
}
|
|
3577
|
-
async function
|
|
3579
|
+
async function Qn(t) {
|
|
3578
3580
|
const e = t.filter((r) => !F.has(r));
|
|
3579
|
-
return e.length > 0 && (await
|
|
3581
|
+
return e.length > 0 && (await Pt({ usernames: e })).results.forEach((n) => {
|
|
3580
3582
|
F.set(n.username, n.addresses[0]);
|
|
3581
3583
|
}), new Map(
|
|
3582
3584
|
t.map((r) => [r, F.get(r)]).filter((r) => r[1] !== void 0)
|
|
3583
3585
|
);
|
|
3584
3586
|
}
|
|
3585
|
-
async function
|
|
3587
|
+
async function Fn(t) {
|
|
3586
3588
|
t = t.map(rt.toHex);
|
|
3587
3589
|
const e = t.filter((r) => !F.has(r));
|
|
3588
|
-
return e.length > 0 && (await
|
|
3590
|
+
return e.length > 0 && (await Pt({
|
|
3589
3591
|
addresses: e
|
|
3590
3592
|
})).results.forEach((n) => {
|
|
3591
3593
|
F.set(n.addresses[0], n.username);
|
|
@@ -3593,7 +3595,7 @@ async function Qn(t) {
|
|
|
3593
3595
|
t.map((r) => [r, F.get(r)]).filter((r) => r[1] !== void 0)
|
|
3594
3596
|
);
|
|
3595
3597
|
}
|
|
3596
|
-
var
|
|
3598
|
+
var Ln = [
|
|
3597
3599
|
{
|
|
3598
3600
|
name: "Wrapped BTC",
|
|
3599
3601
|
symbol: "WBTC",
|
|
@@ -4166,13 +4168,13 @@ var zn = [
|
|
|
4166
4168
|
total_supply: null,
|
|
4167
4169
|
logo_url: "https://lootsurvivor.io/images/survivor_token.png"
|
|
4168
4170
|
}
|
|
4169
|
-
],
|
|
4171
|
+
], Bt = {
|
|
4170
4172
|
theme: {
|
|
4171
4173
|
name: "Cartridge",
|
|
4172
4174
|
icon: "icon.svg"
|
|
4173
4175
|
}
|
|
4174
4176
|
}, ae = "https://static.cartridge.gg/presets";
|
|
4175
|
-
async function
|
|
4177
|
+
async function Le() {
|
|
4176
4178
|
try {
|
|
4177
4179
|
const t = await fetch(`${ae}/index.json`);
|
|
4178
4180
|
if (!t.ok)
|
|
@@ -4182,12 +4184,12 @@ async function De() {
|
|
|
4182
4184
|
return console.error("Error loading configs index:", t), { configs: [], baseUrl: ae };
|
|
4183
4185
|
}
|
|
4184
4186
|
}
|
|
4185
|
-
async function
|
|
4186
|
-
return (await
|
|
4187
|
+
async function Wn() {
|
|
4188
|
+
return (await Le()).configs;
|
|
4187
4189
|
}
|
|
4188
4190
|
async function jn(t) {
|
|
4189
4191
|
try {
|
|
4190
|
-
const n = `${(await
|
|
4192
|
+
const n = `${(await Le()).baseUrl || ae}/${t}`, s = await fetch(`${n}/config.json`);
|
|
4191
4193
|
if (!s.ok)
|
|
4192
4194
|
throw new Error(
|
|
4193
4195
|
`Failed to load config ${t}: ${s.statusText}`
|
|
@@ -4217,8 +4219,8 @@ async function jn(t) {
|
|
|
4217
4219
|
return console.error(`Error loading config ${t}:`, e), null;
|
|
4218
4220
|
}
|
|
4219
4221
|
}
|
|
4220
|
-
async function
|
|
4221
|
-
const t = await
|
|
4222
|
+
async function Yn() {
|
|
4223
|
+
const t = await Le(), e = t.configs, r = t.baseUrl || ae, n = {};
|
|
4222
4224
|
return await Promise.all(
|
|
4223
4225
|
e.map(async (s) => {
|
|
4224
4226
|
try {
|
|
@@ -4233,36 +4235,43 @@ async function Wn() {
|
|
|
4233
4235
|
})
|
|
4234
4236
|
), n;
|
|
4235
4237
|
}
|
|
4236
|
-
|
|
4237
|
-
var
|
|
4238
|
+
Bt.theme.icon = "https://static.cartridge.gg/presets/cartridge/icon.svg";
|
|
4239
|
+
var Hn = Ln, Kn = Bt.theme;
|
|
4238
4240
|
export {
|
|
4241
|
+
Gn as ALL_AUTH_OPTIONS,
|
|
4242
|
+
Xn as AUTH_EXTERNAL_WALLETS,
|
|
4239
4243
|
jr as ArgentWallet,
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4244
|
+
Vr as BaseWallet,
|
|
4245
|
+
Tn as BraavosWallet,
|
|
4246
|
+
Jn as EMBEDDED_WALLETS,
|
|
4247
|
+
Zn as EXTERNAL_WALLETS,
|
|
4248
|
+
es as EXTRA_EXTERNAL_WALLETS,
|
|
4249
|
+
Ie as EthereumWalletBase,
|
|
4250
|
+
ts as FeeSource,
|
|
4251
|
+
rs as IMPLEMENTED_AUTH_OPTIONS,
|
|
4252
|
+
qr as MetaMaskWallet,
|
|
4245
4253
|
v as NotReadyToConnect,
|
|
4246
|
-
|
|
4247
|
-
|
|
4254
|
+
Nn as PhantomWallet,
|
|
4255
|
+
Rn as RabbyWallet,
|
|
4248
4256
|
Q as ResponseCodes,
|
|
4249
|
-
|
|
4250
|
-
|
|
4257
|
+
ns as StarterPackItemType,
|
|
4258
|
+
Un as WalletBridge,
|
|
4251
4259
|
fe as chainIdToPlatform,
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4260
|
+
Mn as default,
|
|
4261
|
+
Kn as defaultTheme,
|
|
4262
|
+
Hn as erc20Metadata,
|
|
4263
|
+
Wn as getAvailableConfigs,
|
|
4264
|
+
Le as getConfigsIndex,
|
|
4265
|
+
ss as humanizeString,
|
|
4266
|
+
Tt as isMobile,
|
|
4267
|
+
Yn as loadAllConfigs,
|
|
4259
4268
|
jn as loadConfig,
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4269
|
+
Fn as lookupAddresses,
|
|
4270
|
+
Qn as lookupUsernames,
|
|
4271
|
+
os as normalizeCalls,
|
|
4272
|
+
Lt as parseChainId,
|
|
4264
4273
|
Rt as toArray,
|
|
4265
|
-
|
|
4266
|
-
|
|
4274
|
+
is as toSessionPolicies,
|
|
4275
|
+
as as toWasmPolicies
|
|
4267
4276
|
};
|
|
4268
4277
|
//# sourceMappingURL=index.js.map
|