@cartridge/controller 0.8.0 → 0.9.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/.turbo/turbo-build$colon$deps.log +51 -49
- package/.turbo/turbo-build.log +47 -45
- package/dist/account.d.ts +2 -3
- package/dist/controller.d.ts +1 -1
- package/dist/iframe/keychain.d.ts +4 -2
- package/dist/index.js +179 -180
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +2 -2
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +2 -2
- package/dist/node/index.js.map +1 -1
- package/dist/{provider-ClUbos7A.js → provider-B9Ikz5hr.js} +2 -2
- package/dist/provider-B9Ikz5hr.js.map +1 -0
- package/dist/provider.d.ts +1 -1
- package/dist/session.js +10 -10
- package/dist/session.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/wallets/bridge.d.ts +2 -2
- package/dist/wallets/metamask/index.d.ts +2 -2
- package/dist/wallets/rabby/index.d.ts +1 -1
- package/dist/wallets/types.d.ts +2 -2
- package/package.json +6 -6
- package/src/account.ts +5 -8
- package/src/controller.ts +2 -2
- package/src/iframe/keychain.ts +14 -2
- package/src/node/account.ts +1 -1
- package/src/provider.ts +9 -9
- package/src/session/account.ts +1 -2
- package/src/types.ts +0 -1
- package/src/wallets/bridge.ts +5 -18
- package/src/wallets/metamask/index.ts +9 -13
- package/src/wallets/rabby/index.ts +9 -4
- package/src/wallets/types.ts +5 -2
- package/.turbo/turbo-format$colon$check.log +0 -7
- package/.turbo/turbo-format.log +0 -44
- package/dist/provider-ClUbos7A.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { WalletAccount as
|
|
2
|
-
import { R as v, t as
|
|
3
|
-
import { F as nr, h as or, n as sr, a as ar, b as ir } from "./provider-
|
|
4
|
-
import { connect as
|
|
5
|
-
import { InjectedConnector as
|
|
6
|
-
import { MetaMaskSDK as
|
|
7
|
-
import { Transaction as
|
|
8
|
-
class H extends
|
|
9
|
-
address;
|
|
1
|
+
import { WalletAccount as ye, constants as $, shortString as W, num as be } from "starknet";
|
|
2
|
+
import { R as v, t as we, K as _e, P as ke, B as Ae, v as Ie, N as b, p as ve, A as Ee } from "./provider-B9Ikz5hr.js";
|
|
3
|
+
import { F as nr, h as or, n as sr, a as ar, b as ir } from "./provider-B9Ikz5hr.js";
|
|
4
|
+
import { connect as xe } from "starknetkit";
|
|
5
|
+
import { InjectedConnector as Ce } from "starknetkit/injected";
|
|
6
|
+
import { MetaMaskSDK as Pe } from "@metamask/sdk";
|
|
7
|
+
import { Transaction as Re } from "@solana/web3.js";
|
|
8
|
+
class H extends ye {
|
|
10
9
|
keychain;
|
|
11
10
|
modal;
|
|
12
11
|
options;
|
|
13
12
|
constructor(e, t, n, o, s, a) {
|
|
14
|
-
super({ nodeUrl: t }, e
|
|
13
|
+
super({ nodeUrl: t }, e, n), this.keychain = o, this.options = s, this.modal = a;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Invoke execute function in account contract
|
|
@@ -26,7 +25,7 @@ class H extends ge {
|
|
|
26
25
|
* @returns response from addTransaction
|
|
27
26
|
*/
|
|
28
27
|
async execute(e) {
|
|
29
|
-
return e =
|
|
28
|
+
return e = we(e), new Promise(async (t, n) => {
|
|
30
29
|
const o = await this.keychain.execute(
|
|
31
30
|
e,
|
|
32
31
|
void 0,
|
|
@@ -98,7 +97,7 @@ var A;
|
|
|
98
97
|
(function(r) {
|
|
99
98
|
r.Message = "message";
|
|
100
99
|
})(A || (A = {}));
|
|
101
|
-
const
|
|
100
|
+
const Se = (r, e) => {
|
|
102
101
|
const t = [];
|
|
103
102
|
let n = !1;
|
|
104
103
|
return {
|
|
@@ -111,27 +110,27 @@ const Re = (r, e) => {
|
|
|
111
110
|
n ? o() : t.push(o);
|
|
112
111
|
}
|
|
113
112
|
};
|
|
114
|
-
},
|
|
113
|
+
}, Ne = (r) => (...e) => {
|
|
115
114
|
r && console.log("[Penpal]", ...e);
|
|
116
|
-
},
|
|
115
|
+
}, De = {
|
|
117
116
|
"http:": "80",
|
|
118
117
|
"https:": "443"
|
|
119
|
-
},
|
|
120
|
-
if (r &&
|
|
118
|
+
}, Me = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, Be = ["file:", "data:"], Ue = (r) => {
|
|
119
|
+
if (r && Be.find((i) => r.startsWith(i)))
|
|
121
120
|
return "null";
|
|
122
|
-
const e = document.location, t =
|
|
121
|
+
const e = document.location, t = Me.exec(r);
|
|
123
122
|
let n, o, s;
|
|
124
123
|
t ? (n = t[1] ? t[1] : e.protocol, o = t[2], s = t[4]) : (n = e.protocol, o = e.hostname, s = e.port);
|
|
125
|
-
const a = s && s !==
|
|
124
|
+
const a = s && s !== De[n] ? `:${s}` : "";
|
|
126
125
|
return `${n}//${o}${a}`;
|
|
127
126
|
}, K = ({ name: r, message: e, stack: t }) => ({
|
|
128
127
|
name: r,
|
|
129
128
|
message: e,
|
|
130
129
|
stack: t
|
|
131
|
-
}),
|
|
130
|
+
}), Qe = (r) => {
|
|
132
131
|
const e = new Error();
|
|
133
132
|
return Object.keys(r).forEach((t) => e[t] = r[t]), e;
|
|
134
|
-
},
|
|
133
|
+
}, Te = (r, e, t) => {
|
|
135
134
|
const { localName: n, local: o, remote: s, originForSending: a, originForReceiving: i } = r;
|
|
136
135
|
let c = !1;
|
|
137
136
|
const d = (l) => {
|
|
@@ -177,25 +176,25 @@ const Re = (r, e) => {
|
|
|
177
176
|
c = !0, o.removeEventListener(A.Message, d);
|
|
178
177
|
};
|
|
179
178
|
};
|
|
180
|
-
let
|
|
181
|
-
const
|
|
179
|
+
let $e = 0;
|
|
180
|
+
const ze = () => ++$e, re = ".", ne = (r) => r ? r.split(re) : [], Oe = (r) => r.join(re), Le = (r, e) => {
|
|
182
181
|
const t = ne(e || "");
|
|
183
|
-
return t.push(r),
|
|
184
|
-
},
|
|
182
|
+
return t.push(r), Oe(t);
|
|
183
|
+
}, Ye = (r, e, t) => {
|
|
185
184
|
const n = ne(e);
|
|
186
185
|
return n.reduce((o, s, a) => (typeof o[s] > "u" && (o[s] = {}), a === n.length - 1 && (o[s] = t), o[s]), r), r;
|
|
187
186
|
}, oe = (r, e) => {
|
|
188
187
|
const t = {};
|
|
189
188
|
return Object.keys(r).forEach((n) => {
|
|
190
|
-
const o = r[n], s =
|
|
189
|
+
const o = r[n], s = Le(n, e);
|
|
191
190
|
typeof o == "object" && Object.assign(t, oe(o, s)), typeof o == "function" && (t[s] = o);
|
|
192
191
|
}), t;
|
|
193
|
-
},
|
|
192
|
+
}, Fe = (r) => {
|
|
194
193
|
const e = {};
|
|
195
194
|
for (const t in r)
|
|
196
|
-
|
|
195
|
+
Ye(e, t, r[t]);
|
|
197
196
|
return e;
|
|
198
|
-
},
|
|
197
|
+
}, We = (r, e, t, n, o) => {
|
|
199
198
|
const { localName: s, local: a, remote: i, originForSending: c, originForReceiving: d } = e;
|
|
200
199
|
let l = !1;
|
|
201
200
|
o(`${s}: Connecting call sender`);
|
|
@@ -212,7 +211,7 @@ const $e = () => ++Te, re = ".", ne = (r) => r ? r.split(re) : [], ze = (r) => r
|
|
|
212
211
|
throw y.code = D.ConnectionDestroyed, y;
|
|
213
212
|
}
|
|
214
213
|
return new Promise((y, I) => {
|
|
215
|
-
const _ =
|
|
214
|
+
const _ = ze(), u = (C) => {
|
|
216
215
|
if (C.source !== i || C.data.penpal !== w.Reply || C.data.id !== _)
|
|
217
216
|
return;
|
|
218
217
|
if (d !== "*" && C.origin !== d) {
|
|
@@ -222,7 +221,7 @@ const $e = () => ++Te, re = ".", ne = (r) => r ? r.split(re) : [], ze = (r) => r
|
|
|
222
221
|
const Q = C.data;
|
|
223
222
|
o(`${s}: Received ${f}() reply`), a.removeEventListener(A.Message, u);
|
|
224
223
|
let T = Q.returnValue;
|
|
225
|
-
Q.returnValueIsError && (T =
|
|
224
|
+
Q.returnValueIsError && (T = Qe(T)), (Q.resolution === E.Fulfilled ? y : I)(T);
|
|
226
225
|
};
|
|
227
226
|
a.addEventListener(A.Message, u);
|
|
228
227
|
const x = {
|
|
@@ -234,10 +233,10 @@ const $e = () => ++Te, re = ".", ne = (r) => r ? r.split(re) : [], ze = (r) => r
|
|
|
234
233
|
i.postMessage(x, c);
|
|
235
234
|
});
|
|
236
235
|
}, p = t.reduce((f, g) => (f[g] = h(g), f), {});
|
|
237
|
-
return Object.assign(r,
|
|
236
|
+
return Object.assign(r, Fe(p)), () => {
|
|
238
237
|
l = !0;
|
|
239
238
|
};
|
|
240
|
-
},
|
|
239
|
+
}, He = (r, e, t, n, o) => {
|
|
241
240
|
const { destroy: s, onDestroy: a } = n;
|
|
242
241
|
let i, c;
|
|
243
242
|
const d = {};
|
|
@@ -254,13 +253,13 @@ const $e = () => ++Te, re = ".", ne = (r) => r ? r.split(re) : [], ze = (r) => r
|
|
|
254
253
|
originForSending: t,
|
|
255
254
|
originForReceiving: e
|
|
256
255
|
};
|
|
257
|
-
i && i(), i =
|
|
256
|
+
i && i(), i = Te(h, r, o), a(i), c && c.forEach((f) => {
|
|
258
257
|
delete d[f];
|
|
259
258
|
}), c = l.data.methodNames;
|
|
260
|
-
const p =
|
|
259
|
+
const p = We(d, h, c, s, o);
|
|
261
260
|
return a(p), d;
|
|
262
261
|
};
|
|
263
|
-
},
|
|
262
|
+
}, Ke = (r, e, t, n) => (o) => {
|
|
264
263
|
if (!o.source)
|
|
265
264
|
return;
|
|
266
265
|
if (t !== "*" && o.origin !== t) {
|
|
@@ -273,14 +272,14 @@ const $e = () => ++Te, re = ".", ne = (r) => r ? r.split(re) : [], ze = (r) => r
|
|
|
273
272
|
methodNames: Object.keys(e)
|
|
274
273
|
};
|
|
275
274
|
o.source.postMessage(s, n);
|
|
276
|
-
},
|
|
275
|
+
}, je = 6e4, qe = (r, e) => {
|
|
277
276
|
const { destroy: t, onDestroy: n } = e, o = setInterval(() => {
|
|
278
277
|
r.isConnected || (clearInterval(o), t());
|
|
279
|
-
},
|
|
278
|
+
}, je);
|
|
280
279
|
n(() => {
|
|
281
280
|
clearInterval(o);
|
|
282
281
|
});
|
|
283
|
-
},
|
|
282
|
+
}, Xe = (r, e) => {
|
|
284
283
|
let t;
|
|
285
284
|
return r !== void 0 && (t = window.setTimeout(() => {
|
|
286
285
|
const n = new Error(`Connection timed out after ${r}ms`);
|
|
@@ -288,19 +287,19 @@ const $e = () => ++Te, re = ".", ne = (r) => r ? r.split(re) : [], ze = (r) => r
|
|
|
288
287
|
}, r)), () => {
|
|
289
288
|
clearTimeout(t);
|
|
290
289
|
};
|
|
291
|
-
},
|
|
290
|
+
}, Ge = (r) => {
|
|
292
291
|
if (!r.src && !r.srcdoc) {
|
|
293
292
|
const e = new Error("Iframe must have src or srcdoc property defined.");
|
|
294
293
|
throw e.code = D.NoIframeSrc, e;
|
|
295
294
|
}
|
|
296
|
-
},
|
|
295
|
+
}, Ve = (r) => {
|
|
297
296
|
let { iframe: e, methods: t = {}, childOrigin: n, timeout: o, debug: s = !1 } = r;
|
|
298
|
-
const a =
|
|
299
|
-
n || (
|
|
300
|
-
const l = n === "null" ? "*" : n, h = oe(t), p =
|
|
297
|
+
const a = Ne(s), i = Se("Parent", a), { onDestroy: c, destroy: d } = i;
|
|
298
|
+
n || (Ge(e), n = Ue(e.src));
|
|
299
|
+
const l = n === "null" ? "*" : n, h = oe(t), p = Ke(a, h, n, l), f = He(h, n, l, i, a);
|
|
301
300
|
return {
|
|
302
301
|
promise: new Promise((k, y) => {
|
|
303
|
-
const I =
|
|
302
|
+
const I = Xe(o, d), _ = (u) => {
|
|
304
303
|
if (!(u.source !== e.contentWindow || !u.data)) {
|
|
305
304
|
if (u.data.penpal === w.Syn) {
|
|
306
305
|
p(u);
|
|
@@ -313,7 +312,7 @@ const $e = () => ++Te, re = ".", ne = (r) => r ? r.split(re) : [], ze = (r) => r
|
|
|
313
312
|
}
|
|
314
313
|
}
|
|
315
314
|
};
|
|
316
|
-
window.addEventListener(A.Message, _), a("Parent: Awaiting handshake"),
|
|
315
|
+
window.addEventListener(A.Message, _), a("Parent: Awaiting handshake"), qe(e, i), c((u) => {
|
|
317
316
|
window.removeEventListener(A.Message, _), u && y(u);
|
|
318
317
|
});
|
|
319
318
|
}),
|
|
@@ -344,7 +343,7 @@ class se {
|
|
|
344
343
|
const c = document.createElement("div");
|
|
345
344
|
c.id = "controller", c.style.position = "fixed", c.style.height = "100%", c.style.width = "100%", c.style.top = "0", c.style.left = "0", c.style.zIndex = "10000", c.style.backgroundColor = "rgba(0,0,0,0.6)", c.style.display = "flex", c.style.alignItems = "center", c.style.justifyContent = "center", c.style.visibility = "hidden", c.style.opacity = "0", c.style.transition = "opacity 0.2s ease", c.style.pointerEvents = "auto", c.appendChild(i), c.addEventListener("click", (h) => {
|
|
346
345
|
h.target === c && (e === "controller-keychain" && this.child && this.child.reset?.().catch((p) => console.error("Error resetting context:", p)), this.close());
|
|
347
|
-
}), this.iframe = i, this.container = c,
|
|
346
|
+
}), this.iframe = i, this.container = c, Ve({
|
|
348
347
|
iframe: this.iframe,
|
|
349
348
|
methods: {
|
|
350
349
|
close: (h) => () => this.close(),
|
|
@@ -396,7 +395,7 @@ class se {
|
|
|
396
395
|
}
|
|
397
396
|
}
|
|
398
397
|
}
|
|
399
|
-
const
|
|
398
|
+
const Je = "6.13.7";
|
|
400
399
|
function j(r, e, t) {
|
|
401
400
|
for (let n in e) {
|
|
402
401
|
let o = e[n];
|
|
@@ -434,7 +433,7 @@ function P(r) {
|
|
|
434
433
|
}
|
|
435
434
|
return "[ COULD NOT SERIALIZE ]";
|
|
436
435
|
}
|
|
437
|
-
function
|
|
436
|
+
function Ze(r, e, t) {
|
|
438
437
|
let n = r;
|
|
439
438
|
{
|
|
440
439
|
const s = [];
|
|
@@ -448,7 +447,7 @@ function Je(r, e, t) {
|
|
|
448
447
|
s.push(a + "=" + P(i));
|
|
449
448
|
}
|
|
450
449
|
}
|
|
451
|
-
s.push(`code=${e}`), s.push(`version=${
|
|
450
|
+
s.push(`code=${e}`), s.push(`version=${Je}`), s.length && (r += " (" + s.join(", ") + ")");
|
|
452
451
|
}
|
|
453
452
|
let o;
|
|
454
453
|
switch (e) {
|
|
@@ -464,12 +463,12 @@ function Je(r, e, t) {
|
|
|
464
463
|
}
|
|
465
464
|
return j(o, { code: e }), t && Object.assign(o, t), o.shortMessage == null && j(o, { shortMessage: n }), o;
|
|
466
465
|
}
|
|
467
|
-
function
|
|
466
|
+
function et(r, e, t, n) {
|
|
468
467
|
if (!r)
|
|
469
|
-
throw
|
|
468
|
+
throw Ze(e, t, n);
|
|
470
469
|
}
|
|
471
470
|
function N(r, e, t, n) {
|
|
472
|
-
|
|
471
|
+
et(r, e, "INVALID_ARGUMENT", { argument: t, value: n });
|
|
473
472
|
}
|
|
474
473
|
["NFD", "NFC", "NFKD", "NFKC"].reduce((r, e) => {
|
|
475
474
|
try {
|
|
@@ -482,7 +481,7 @@ function N(r, e, t, n) {
|
|
|
482
481
|
}
|
|
483
482
|
return r;
|
|
484
483
|
}, []);
|
|
485
|
-
function
|
|
484
|
+
function tt(r, e, t) {
|
|
486
485
|
if (r instanceof Uint8Array)
|
|
487
486
|
return r;
|
|
488
487
|
if (typeof r == "string" && r.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
|
|
@@ -495,10 +494,10 @@ function et(r, e, t) {
|
|
|
495
494
|
N(!1, "invalid BytesLike value", e || "value", r);
|
|
496
495
|
}
|
|
497
496
|
function O(r, e) {
|
|
498
|
-
return
|
|
497
|
+
return tt(r, e);
|
|
499
498
|
}
|
|
500
499
|
const q = "0123456789abcdef";
|
|
501
|
-
function
|
|
500
|
+
function rt(r) {
|
|
502
501
|
const e = O(r);
|
|
503
502
|
let t = "0x";
|
|
504
503
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -523,58 +522,58 @@ function G(r, e = !0) {
|
|
|
523
522
|
if (e && r.finished)
|
|
524
523
|
throw new Error("Hash#digest() has already been called");
|
|
525
524
|
}
|
|
526
|
-
function
|
|
525
|
+
function nt(r, e) {
|
|
527
526
|
ae(r);
|
|
528
527
|
const t = e.outputLen;
|
|
529
528
|
if (r.length < t)
|
|
530
529
|
throw new Error(`digestInto() expects output buffer of length at least ${t}`);
|
|
531
530
|
}
|
|
532
531
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
533
|
-
const
|
|
534
|
-
if (!
|
|
532
|
+
const ot = (r) => r instanceof Uint8Array, st = (r) => new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4)), at = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
533
|
+
if (!at)
|
|
535
534
|
throw new Error("Non little-endian hardware is not supported");
|
|
536
|
-
function
|
|
535
|
+
function it(r) {
|
|
537
536
|
if (typeof r != "string")
|
|
538
537
|
throw new Error(`utf8ToBytes expected string, got ${typeof r}`);
|
|
539
538
|
return new Uint8Array(new TextEncoder().encode(r));
|
|
540
539
|
}
|
|
541
540
|
function ie(r) {
|
|
542
|
-
if (typeof r == "string" && (r =
|
|
541
|
+
if (typeof r == "string" && (r = it(r)), !ot(r))
|
|
543
542
|
throw new Error(`expected Uint8Array, got ${typeof r}`);
|
|
544
543
|
return r;
|
|
545
544
|
}
|
|
546
|
-
class
|
|
545
|
+
class ct {
|
|
547
546
|
// Safe version that clones internal state
|
|
548
547
|
clone() {
|
|
549
548
|
return this._cloneInto();
|
|
550
549
|
}
|
|
551
550
|
}
|
|
552
|
-
function
|
|
551
|
+
function lt(r) {
|
|
553
552
|
const e = (n) => r().update(ie(n)).digest(), t = r();
|
|
554
553
|
return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => r(), e;
|
|
555
554
|
}
|
|
556
555
|
const B = /* @__PURE__ */ BigInt(2 ** 32 - 1), V = /* @__PURE__ */ BigInt(32);
|
|
557
|
-
function
|
|
556
|
+
function dt(r, e = !1) {
|
|
558
557
|
return e ? { h: Number(r & B), l: Number(r >> V & B) } : { h: Number(r >> V & B) | 0, l: Number(r & B) | 0 };
|
|
559
558
|
}
|
|
560
|
-
function
|
|
559
|
+
function ht(r, e = !1) {
|
|
561
560
|
let t = new Uint32Array(r.length), n = new Uint32Array(r.length);
|
|
562
561
|
for (let o = 0; o < r.length; o++) {
|
|
563
|
-
const { h: s, l: a } =
|
|
562
|
+
const { h: s, l: a } = dt(r[o], e);
|
|
564
563
|
[t[o], n[o]] = [s, a];
|
|
565
564
|
}
|
|
566
565
|
return [t, n];
|
|
567
566
|
}
|
|
568
|
-
const
|
|
567
|
+
const ft = (r, e, t) => r << t | e >>> 32 - t, ut = (r, e, t) => e << t | r >>> 32 - t, pt = (r, e, t) => e << t - 32 | r >>> 64 - t, mt = (r, e, t) => r << t - 32 | e >>> 64 - t, [ce, le, de] = [[], [], []], gt = /* @__PURE__ */ BigInt(0), S = /* @__PURE__ */ BigInt(1), yt = /* @__PURE__ */ BigInt(2), bt = /* @__PURE__ */ BigInt(7), wt = /* @__PURE__ */ BigInt(256), _t = /* @__PURE__ */ BigInt(113);
|
|
569
568
|
for (let r = 0, e = S, t = 1, n = 0; r < 24; r++) {
|
|
570
569
|
[t, n] = [n, (2 * t + 3 * n) % 5], ce.push(2 * (5 * n + t)), le.push((r + 1) * (r + 2) / 2 % 64);
|
|
571
|
-
let o =
|
|
570
|
+
let o = gt;
|
|
572
571
|
for (let s = 0; s < 7; s++)
|
|
573
|
-
e = (e << S ^ (e >>
|
|
572
|
+
e = (e << S ^ (e >> bt) * _t) % wt, e & yt && (o ^= S << (S << /* @__PURE__ */ BigInt(s)) - S);
|
|
574
573
|
de.push(o);
|
|
575
574
|
}
|
|
576
|
-
const [
|
|
577
|
-
function
|
|
575
|
+
const [kt, At] = /* @__PURE__ */ ht(de, !0), J = (r, e, t) => t > 32 ? pt(r, e, t) : ft(r, e, t), Z = (r, e, t) => t > 32 ? mt(r, e, t) : ut(r, e, t);
|
|
576
|
+
function It(r, e = 24) {
|
|
578
577
|
const t = new Uint32Array(10);
|
|
579
578
|
for (let n = 24 - e; n < 24; n++) {
|
|
580
579
|
for (let a = 0; a < 10; a++)
|
|
@@ -595,19 +594,19 @@ function At(r, e = 24) {
|
|
|
595
594
|
for (let i = 0; i < 10; i++)
|
|
596
595
|
r[a + i] ^= ~t[(i + 2) % 10] & t[(i + 4) % 10];
|
|
597
596
|
}
|
|
598
|
-
r[0] ^=
|
|
597
|
+
r[0] ^= kt[n], r[1] ^= At[n];
|
|
599
598
|
}
|
|
600
599
|
t.fill(0);
|
|
601
600
|
}
|
|
602
|
-
class L extends
|
|
601
|
+
class L extends ct {
|
|
603
602
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
604
603
|
constructor(e, t, n, o = !1, s = 24) {
|
|
605
604
|
if (super(), this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = o, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, X(n), 0 >= this.blockLen || this.blockLen >= 200)
|
|
606
605
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
607
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
606
|
+
this.state = new Uint8Array(200), this.state32 = st(this.state);
|
|
608
607
|
}
|
|
609
608
|
keccak() {
|
|
610
|
-
|
|
609
|
+
It(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
|
|
611
610
|
}
|
|
612
611
|
update(e) {
|
|
613
612
|
G(this);
|
|
@@ -648,7 +647,7 @@ class L extends it {
|
|
|
648
647
|
return X(e), this.xofInto(new Uint8Array(e));
|
|
649
648
|
}
|
|
650
649
|
digestInto(e) {
|
|
651
|
-
if (
|
|
650
|
+
if (nt(e, this), this.finished)
|
|
652
651
|
throw new Error("digest() was already called");
|
|
653
652
|
return this.writeInto(e), this.destroy(), e;
|
|
654
653
|
}
|
|
@@ -663,15 +662,15 @@ class L extends it {
|
|
|
663
662
|
return e || (e = new L(t, n, o, a, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = o, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
664
663
|
}
|
|
665
664
|
}
|
|
666
|
-
const
|
|
665
|
+
const vt = (r, e, t) => lt(() => new L(e, r, t)), Et = /* @__PURE__ */ vt(1, 136, 256 / 8);
|
|
667
666
|
let he = !1;
|
|
668
667
|
const fe = function(r) {
|
|
669
|
-
return
|
|
668
|
+
return Et(r);
|
|
670
669
|
};
|
|
671
670
|
let ue = fe;
|
|
672
671
|
function M(r) {
|
|
673
672
|
const e = O(r, "data");
|
|
674
|
-
return
|
|
673
|
+
return rt(ue(e));
|
|
675
674
|
}
|
|
676
675
|
M._ = fe;
|
|
677
676
|
M.lock = function() {
|
|
@@ -683,7 +682,7 @@ M.register = function(r) {
|
|
|
683
682
|
ue = r;
|
|
684
683
|
};
|
|
685
684
|
Object.freeze(M);
|
|
686
|
-
const
|
|
685
|
+
const xt = BigInt(0), Ct = BigInt(36);
|
|
687
686
|
function ee(r) {
|
|
688
687
|
r = r.toLowerCase();
|
|
689
688
|
const e = r.substring(2).split(""), t = new Uint8Array(40);
|
|
@@ -700,7 +699,7 @@ for (let r = 0; r < 10; r++)
|
|
|
700
699
|
for (let r = 0; r < 26; r++)
|
|
701
700
|
Y[String.fromCharCode(65 + r)] = String(10 + r);
|
|
702
701
|
const te = 15;
|
|
703
|
-
function
|
|
702
|
+
function Pt(r) {
|
|
704
703
|
r = r.toUpperCase(), r = r.substring(4) + r.substring(0, 2) + "00";
|
|
705
704
|
let e = r.split("").map((n) => Y[n]).join("");
|
|
706
705
|
for (; e.length >= te; ) {
|
|
@@ -712,7 +711,7 @@ function Ct(r) {
|
|
|
712
711
|
t = "0" + t;
|
|
713
712
|
return t;
|
|
714
713
|
}
|
|
715
|
-
const
|
|
714
|
+
const Rt = function() {
|
|
716
715
|
const r = {};
|
|
717
716
|
for (let e = 0; e < 36; e++) {
|
|
718
717
|
const t = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
|
|
@@ -720,11 +719,11 @@ const Pt = function() {
|
|
|
720
719
|
}
|
|
721
720
|
return r;
|
|
722
721
|
}();
|
|
723
|
-
function
|
|
722
|
+
function St(r) {
|
|
724
723
|
r = r.toLowerCase();
|
|
725
|
-
let e =
|
|
724
|
+
let e = xt;
|
|
726
725
|
for (let t = 0; t < r.length; t++)
|
|
727
|
-
e = e *
|
|
726
|
+
e = e * Ct + Rt[r[t]];
|
|
728
727
|
return e;
|
|
729
728
|
}
|
|
730
729
|
function m(r) {
|
|
@@ -734,15 +733,15 @@ function m(r) {
|
|
|
734
733
|
return N(!r.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || e === r, "bad address checksum", "address", r), e;
|
|
735
734
|
}
|
|
736
735
|
if (r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
737
|
-
N(r.substring(2, 4) ===
|
|
738
|
-
let e =
|
|
736
|
+
N(r.substring(2, 4) === Pt(r), "bad icap checksum", "address", r);
|
|
737
|
+
let e = St(r.substring(4)).toString(16);
|
|
739
738
|
for (; e.length < 40; )
|
|
740
739
|
e = "0" + e;
|
|
741
740
|
return ee("0x" + e);
|
|
742
741
|
}
|
|
743
742
|
N(!1, "invalid address", "address", r);
|
|
744
743
|
}
|
|
745
|
-
class
|
|
744
|
+
class Nt {
|
|
746
745
|
type = "argent";
|
|
747
746
|
platform = "starknet";
|
|
748
747
|
wallet = void 0;
|
|
@@ -768,8 +767,8 @@ class St {
|
|
|
768
767
|
try {
|
|
769
768
|
if (!this.isAvailable())
|
|
770
769
|
throw new Error("Argent is not available");
|
|
771
|
-
const { wallet: e, connectorData: t } = await
|
|
772
|
-
connectors: [new
|
|
770
|
+
const { wallet: e, connectorData: t } = await xe({
|
|
771
|
+
connectors: [new Ce({ options: { id: "argentX" } })]
|
|
773
772
|
});
|
|
774
773
|
if (!e)
|
|
775
774
|
throw new Error("No wallet found");
|
|
@@ -832,7 +831,7 @@ class St {
|
|
|
832
831
|
}
|
|
833
832
|
}
|
|
834
833
|
}
|
|
835
|
-
function
|
|
834
|
+
function Dt(r) {
|
|
836
835
|
if (typeof window > "u")
|
|
837
836
|
return;
|
|
838
837
|
const e = (t) => r(t.detail);
|
|
@@ -841,7 +840,7 @@ function Nt(r) {
|
|
|
841
840
|
function pe() {
|
|
842
841
|
const r = /* @__PURE__ */ new Set();
|
|
843
842
|
let e = [];
|
|
844
|
-
const t = () =>
|
|
843
|
+
const t = () => Dt((o) => {
|
|
845
844
|
e.some(({ info: s }) => s.uuid === o.info.uuid) || (e = [...e, o], r.forEach((s) => s(e, { added: [o] })));
|
|
846
845
|
});
|
|
847
846
|
let n = t();
|
|
@@ -869,7 +868,7 @@ function pe() {
|
|
|
869
868
|
}
|
|
870
869
|
};
|
|
871
870
|
}
|
|
872
|
-
class
|
|
871
|
+
class Mt {
|
|
873
872
|
type = "metamask";
|
|
874
873
|
platform = "ethereum";
|
|
875
874
|
MMSDK;
|
|
@@ -877,7 +876,7 @@ class Dt {
|
|
|
877
876
|
account = void 0;
|
|
878
877
|
connectedAccounts = [];
|
|
879
878
|
constructor() {
|
|
880
|
-
this.MMSDK = new
|
|
879
|
+
this.MMSDK = new Pe({
|
|
881
880
|
dappMetadata: {
|
|
882
881
|
name: "Cartridge Controller",
|
|
883
882
|
url: window.location.href
|
|
@@ -886,13 +885,9 @@ class Dt {
|
|
|
886
885
|
this.MMSDK.getProvider()?.request({
|
|
887
886
|
method: "eth_accounts"
|
|
888
887
|
}).then((e) => {
|
|
889
|
-
e && e.length > 0 && (this.account = m(e[0]), this.connectedAccounts = e.map(
|
|
890
|
-
(t) => m(t)
|
|
891
|
-
));
|
|
888
|
+
e && e.length > 0 && (this.account = m(e[0]), this.connectedAccounts = e.map(m));
|
|
892
889
|
}), this.MMSDK.getProvider()?.on("accountsChanged", (e) => {
|
|
893
|
-
Array.isArray(e) &&
|
|
894
|
-
(t) => m(t)
|
|
895
|
-
));
|
|
890
|
+
Array.isArray(e) && e.length > 0 && (this.account = m(e?.[0]), this.connectedAccounts = e.map(m));
|
|
896
891
|
});
|
|
897
892
|
});
|
|
898
893
|
}
|
|
@@ -911,23 +906,23 @@ class Dt {
|
|
|
911
906
|
connectedAccounts: this.connectedAccounts
|
|
912
907
|
};
|
|
913
908
|
}
|
|
914
|
-
async connect(
|
|
915
|
-
if (
|
|
909
|
+
async connect() {
|
|
910
|
+
if (this.account)
|
|
916
911
|
return { success: !0, wallet: this.type, account: this.account };
|
|
917
912
|
try {
|
|
918
913
|
if (!this.isAvailable())
|
|
919
914
|
throw new Error("MetaMask is not available");
|
|
920
|
-
const
|
|
921
|
-
if (
|
|
922
|
-
return this.account = m(
|
|
923
|
-
(
|
|
915
|
+
const e = await this.MMSDK.connect();
|
|
916
|
+
if (e && e.length > 0)
|
|
917
|
+
return this.account = m(e[0]), this.connectedAccounts = e.map(
|
|
918
|
+
(t) => m(t)
|
|
924
919
|
), { success: !0, wallet: this.type, account: this.account };
|
|
925
920
|
throw new Error("No accounts found");
|
|
926
|
-
} catch (
|
|
927
|
-
return console.error("Error connecting to MetaMask:",
|
|
921
|
+
} catch (e) {
|
|
922
|
+
return console.error("Error connecting to MetaMask:", e), {
|
|
928
923
|
success: !1,
|
|
929
924
|
wallet: this.type,
|
|
930
|
-
error:
|
|
925
|
+
error: e.message || "Unknown error"
|
|
931
926
|
};
|
|
932
927
|
}
|
|
933
928
|
}
|
|
@@ -954,20 +949,20 @@ class Dt {
|
|
|
954
949
|
};
|
|
955
950
|
}
|
|
956
951
|
}
|
|
957
|
-
async signMessage(e) {
|
|
952
|
+
async signMessage(e, t) {
|
|
958
953
|
try {
|
|
959
954
|
if (!this.isAvailable() || !this.account)
|
|
960
955
|
throw new Error("MetaMask is not connected");
|
|
961
|
-
const
|
|
956
|
+
const n = await this.MMSDK.getProvider()?.request({
|
|
962
957
|
method: "personal_sign",
|
|
963
|
-
params: [this.account, e]
|
|
958
|
+
params: [t || this.account, e]
|
|
964
959
|
});
|
|
965
|
-
return { success: !0, wallet: this.type, result:
|
|
966
|
-
} catch (
|
|
967
|
-
return console.error("Error signing message with MetaMask:",
|
|
960
|
+
return { success: !0, wallet: this.type, result: n };
|
|
961
|
+
} catch (n) {
|
|
962
|
+
return console.error("Error signing message with MetaMask:", n), {
|
|
968
963
|
success: !1,
|
|
969
964
|
wallet: this.type,
|
|
970
|
-
error:
|
|
965
|
+
error: n.message || "Unknown error"
|
|
971
966
|
};
|
|
972
967
|
}
|
|
973
968
|
}
|
|
@@ -1046,7 +1041,7 @@ class Dt {
|
|
|
1046
1041
|
}
|
|
1047
1042
|
}
|
|
1048
1043
|
}
|
|
1049
|
-
class
|
|
1044
|
+
class Bt {
|
|
1050
1045
|
type = "phantom";
|
|
1051
1046
|
platform = "solana";
|
|
1052
1047
|
account = void 0;
|
|
@@ -1114,7 +1109,7 @@ class Mt {
|
|
|
1114
1109
|
if (!this.isAvailable() || !this.account)
|
|
1115
1110
|
throw new Error("Phantom is not connected");
|
|
1116
1111
|
try {
|
|
1117
|
-
const t =
|
|
1112
|
+
const t = Re.from(e), o = await this.getProvider().signAndSendTransaction(t);
|
|
1118
1113
|
return {
|
|
1119
1114
|
success: !0,
|
|
1120
1115
|
wallet: this.type,
|
|
@@ -1149,8 +1144,8 @@ class Mt {
|
|
|
1149
1144
|
}
|
|
1150
1145
|
}
|
|
1151
1146
|
}
|
|
1152
|
-
const
|
|
1153
|
-
class
|
|
1147
|
+
const Ut = "io.rabby";
|
|
1148
|
+
class Qt {
|
|
1154
1149
|
type = "rabby";
|
|
1155
1150
|
platform = "ethereum";
|
|
1156
1151
|
account = void 0;
|
|
@@ -1158,10 +1153,10 @@ class Ut {
|
|
|
1158
1153
|
provider;
|
|
1159
1154
|
connectedAccounts = [];
|
|
1160
1155
|
constructor() {
|
|
1161
|
-
this.provider = this.store.getProviders().find((e) => e.info.rdns ===
|
|
1156
|
+
this.provider = this.store.getProviders().find((e) => e.info.rdns === Ut), this.provider?.provider.request({
|
|
1162
1157
|
method: "eth_accounts"
|
|
1163
1158
|
}).then((e) => {
|
|
1164
|
-
this.connectedAccounts = e;
|
|
1159
|
+
this.connectedAccounts = e.map(m), e.length > 0 && (this.account = m(e?.[0]));
|
|
1165
1160
|
}), this.provider?.provider?.on("accountsChanged", (e) => {
|
|
1166
1161
|
e && (this.connectedAccounts = e.map((t) => m(t)), this.account = m(e?.[0]));
|
|
1167
1162
|
});
|
|
@@ -1191,7 +1186,7 @@ class Ut {
|
|
|
1191
1186
|
method: "eth_requestAccounts"
|
|
1192
1187
|
});
|
|
1193
1188
|
if (t && t.length > 0)
|
|
1194
|
-
return this.account = t[0], this.connectedAccounts = t, { success: !0, wallet: this.type, account: this.account };
|
|
1189
|
+
return this.account = m(t[0]), this.connectedAccounts = t.map(m), { success: !0, wallet: this.type, account: this.account };
|
|
1195
1190
|
throw new Error("No accounts found");
|
|
1196
1191
|
} catch (t) {
|
|
1197
1192
|
return console.error("Error connecting to Rabby:", t), {
|
|
@@ -1224,20 +1219,20 @@ class Ut {
|
|
|
1224
1219
|
};
|
|
1225
1220
|
}
|
|
1226
1221
|
}
|
|
1227
|
-
async signMessage(e) {
|
|
1222
|
+
async signMessage(e, t) {
|
|
1228
1223
|
try {
|
|
1229
1224
|
if (!this.isAvailable() || !this.account)
|
|
1230
1225
|
throw new Error("Rabby is not connected");
|
|
1231
|
-
const
|
|
1226
|
+
const n = await this.provider?.provider.request({
|
|
1232
1227
|
method: "personal_sign",
|
|
1233
|
-
params: [this.account, e]
|
|
1228
|
+
params: [t || this.account, e]
|
|
1234
1229
|
});
|
|
1235
|
-
return { success: !0, wallet: this.type, result:
|
|
1236
|
-
} catch (
|
|
1237
|
-
return console.error("Error signing message with Rabby:",
|
|
1230
|
+
return { success: !0, wallet: this.type, result: n };
|
|
1231
|
+
} catch (n) {
|
|
1232
|
+
return console.error("Error signing message with Rabby:", n), {
|
|
1238
1233
|
success: !1,
|
|
1239
1234
|
wallet: this.type,
|
|
1240
|
-
error:
|
|
1235
|
+
error: n.message || "Unknown error"
|
|
1241
1236
|
};
|
|
1242
1237
|
}
|
|
1243
1238
|
}
|
|
@@ -1316,24 +1311,24 @@ class Ut {
|
|
|
1316
1311
|
}
|
|
1317
1312
|
}
|
|
1318
1313
|
}
|
|
1319
|
-
class
|
|
1314
|
+
class Tt {
|
|
1320
1315
|
walletAdapters;
|
|
1321
1316
|
constructor() {
|
|
1322
1317
|
if (this.walletAdapters = /* @__PURE__ */ new Map(), typeof window > "u")
|
|
1323
1318
|
return;
|
|
1324
|
-
const e = new
|
|
1319
|
+
const e = new Mt();
|
|
1325
1320
|
e.isAvailable() && this.walletAdapters.set("metamask", e);
|
|
1326
|
-
const t = new
|
|
1321
|
+
const t = new Bt();
|
|
1327
1322
|
t.isAvailable() && this.walletAdapters.set("phantom", t);
|
|
1328
|
-
const n = new
|
|
1323
|
+
const n = new Nt();
|
|
1329
1324
|
n.isAvailable() && this.walletAdapters.set("argent", n);
|
|
1330
|
-
const o = new
|
|
1325
|
+
const o = new Qt();
|
|
1331
1326
|
o.isAvailable() && this.walletAdapters.set("rabby", o), window.wallet_bridge = this;
|
|
1332
1327
|
}
|
|
1333
1328
|
getIFrameMethods() {
|
|
1334
1329
|
return {
|
|
1335
1330
|
externalDetectWallets: (e) => () => this.detectWallets(),
|
|
1336
|
-
externalConnectWallet: (e) => (t
|
|
1331
|
+
externalConnectWallet: (e) => (t) => this.connectWallet(t),
|
|
1337
1332
|
externalSignMessage: (e) => (t, n) => this.signMessage(t, n),
|
|
1338
1333
|
externalSignTypedData: (e) => (t, n) => this.signTypedData(t, n),
|
|
1339
1334
|
externalSendTransaction: (e) => (t, n) => this.sendTransaction(t, n),
|
|
@@ -1365,36 +1360,34 @@ class Qt {
|
|
|
1365
1360
|
error: s
|
|
1366
1361
|
};
|
|
1367
1362
|
}
|
|
1368
|
-
async connectWallet(e
|
|
1363
|
+
async connectWallet(e) {
|
|
1369
1364
|
try {
|
|
1370
|
-
const
|
|
1371
|
-
if (
|
|
1365
|
+
const n = await this.getWalletAdapterByType(e).connect();
|
|
1366
|
+
if (n.success && n.account)
|
|
1372
1367
|
console.log(
|
|
1373
|
-
`Wallet ${e} connected with address ${
|
|
1368
|
+
`Wallet ${e} connected with address ${n.account}`
|
|
1374
1369
|
);
|
|
1375
|
-
else if (
|
|
1370
|
+
else if (n.success && !n.account)
|
|
1376
1371
|
return console.error(
|
|
1377
1372
|
`Wallet ${e} connected successfully but did not provide an address.`
|
|
1378
1373
|
), {
|
|
1379
|
-
...
|
|
1374
|
+
...n,
|
|
1380
1375
|
success: !1,
|
|
1381
1376
|
error: "Wallet connected but address not found."
|
|
1382
1377
|
};
|
|
1383
|
-
return
|
|
1384
|
-
} catch (
|
|
1385
|
-
return this.handleError(e,
|
|
1378
|
+
return n;
|
|
1379
|
+
} catch (t) {
|
|
1380
|
+
return this.handleError(e, t, "connecting to");
|
|
1386
1381
|
}
|
|
1387
1382
|
}
|
|
1388
1383
|
getConnectedWalletAdapter(e) {
|
|
1389
1384
|
let t;
|
|
1390
1385
|
if (typeof e == "string") {
|
|
1391
1386
|
const n = m(e);
|
|
1392
|
-
t = this.walletAdapters.values().find((o) => o.getConnectedAccounts().includes(n)
|
|
1387
|
+
t = this.walletAdapters.values().find((o) => o.getConnectedAccounts().includes(n));
|
|
1393
1388
|
} else
|
|
1394
1389
|
t = this.walletAdapters.get(e);
|
|
1395
|
-
if (!t
|
|
1396
|
-
(n) => n.getConnectedAccounts().includes(m(e))
|
|
1397
|
-
)), !t)
|
|
1390
|
+
if (!t)
|
|
1398
1391
|
throw new Error(
|
|
1399
1392
|
`Wallet with identifier ${e} is not connected or supported`
|
|
1400
1393
|
);
|
|
@@ -1407,7 +1400,7 @@ class Qt {
|
|
|
1407
1400
|
throw new Error(
|
|
1408
1401
|
`Wallet type ${n.type} (identifier: ${e}) does not support signing messages`
|
|
1409
1402
|
);
|
|
1410
|
-
return await n.signMessage(t);
|
|
1403
|
+
return await n.signMessage(t, e);
|
|
1411
1404
|
} catch (o) {
|
|
1412
1405
|
return this.handleError(
|
|
1413
1406
|
e,
|
|
@@ -1461,25 +1454,30 @@ class Qt {
|
|
|
1461
1454
|
}
|
|
1462
1455
|
}
|
|
1463
1456
|
}
|
|
1464
|
-
class
|
|
1457
|
+
class $t extends se {
|
|
1465
1458
|
walletBridge;
|
|
1466
|
-
constructor({
|
|
1467
|
-
|
|
1468
|
-
t
|
|
1459
|
+
constructor({
|
|
1460
|
+
url: e,
|
|
1461
|
+
policies: t,
|
|
1462
|
+
version: n,
|
|
1463
|
+
...o
|
|
1464
|
+
}) {
|
|
1465
|
+
const s = new URL(e ?? _e), a = new Tt();
|
|
1466
|
+
t && s.searchParams.set(
|
|
1469
1467
|
"policies",
|
|
1470
1468
|
encodeURIComponent(JSON.stringify(t))
|
|
1471
|
-
), super({
|
|
1472
|
-
...
|
|
1469
|
+
), n && s.searchParams.set("v", encodeURIComponent(n)), super({
|
|
1470
|
+
...o,
|
|
1473
1471
|
id: "controller-keychain",
|
|
1474
|
-
url:
|
|
1475
|
-
methods:
|
|
1476
|
-
}), this.walletBridge =
|
|
1472
|
+
url: s,
|
|
1473
|
+
methods: a.getIFrameMethods()
|
|
1474
|
+
}), this.walletBridge = a, typeof window < "u" && (window.external_wallets = this.walletBridge);
|
|
1477
1475
|
}
|
|
1478
1476
|
getWalletBridge() {
|
|
1479
1477
|
return this.walletBridge;
|
|
1480
1478
|
}
|
|
1481
1479
|
}
|
|
1482
|
-
class
|
|
1480
|
+
class zt extends se {
|
|
1483
1481
|
constructor({
|
|
1484
1482
|
profileUrl: e,
|
|
1485
1483
|
rpcUrl: t,
|
|
@@ -1490,7 +1488,7 @@ class $t extends se {
|
|
|
1490
1488
|
tokens: i,
|
|
1491
1489
|
...c
|
|
1492
1490
|
}) {
|
|
1493
|
-
const d = (e ||
|
|
1491
|
+
const d = (e || ke).replace(/\/$/, "");
|
|
1494
1492
|
let l = new URL(
|
|
1495
1493
|
s ? `${d}/account/${o}/slot/${s}` : `${d}/account/${o}`
|
|
1496
1494
|
);
|
|
@@ -1504,7 +1502,7 @@ class $t extends se {
|
|
|
1504
1502
|
});
|
|
1505
1503
|
}
|
|
1506
1504
|
}
|
|
1507
|
-
class jt extends
|
|
1505
|
+
class jt extends Ae {
|
|
1508
1506
|
keychain;
|
|
1509
1507
|
profile;
|
|
1510
1508
|
options;
|
|
@@ -1514,19 +1512,20 @@ class jt extends ke {
|
|
|
1514
1512
|
isReady() {
|
|
1515
1513
|
return !!this.keychain;
|
|
1516
1514
|
}
|
|
1517
|
-
constructor(e) {
|
|
1515
|
+
constructor(e = {}) {
|
|
1518
1516
|
super();
|
|
1519
1517
|
const n = [...[
|
|
1520
1518
|
{ rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia" },
|
|
1521
1519
|
{ rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet" }
|
|
1522
1520
|
], ...e.chains || []], o = e.defaultChainId || $.StarknetChainId.SN_MAIN;
|
|
1523
1521
|
this.selectedChain = o, this.chains = /* @__PURE__ */ new Map(), this.iframes = {
|
|
1524
|
-
keychain: new
|
|
1522
|
+
keychain: new $t({
|
|
1525
1523
|
...e,
|
|
1526
1524
|
onClose: this.keychain?.reset,
|
|
1527
1525
|
onConnect: (s) => {
|
|
1528
1526
|
this.keychain = s;
|
|
1529
|
-
}
|
|
1527
|
+
},
|
|
1528
|
+
version: Ie
|
|
1530
1529
|
})
|
|
1531
1530
|
}, this.options = { ...e, chains: n, defaultChainId: o }, this.initializeChains(n), typeof window < "u" && (window.starknet_controller = this);
|
|
1532
1531
|
}
|
|
@@ -1566,7 +1565,7 @@ class jt extends ke {
|
|
|
1566
1565
|
}
|
|
1567
1566
|
if (!this.iframes.profile) {
|
|
1568
1567
|
const e = await this.keychain.username();
|
|
1569
|
-
this.iframes.profile = new
|
|
1568
|
+
this.iframes.profile = new zt({
|
|
1570
1569
|
...this.options,
|
|
1571
1570
|
onConnect: (t) => {
|
|
1572
1571
|
this.profile = t;
|
|
@@ -1600,8 +1599,7 @@ class jt extends ke {
|
|
|
1600
1599
|
// 3. Otherwise, use provided policies or empty object
|
|
1601
1600
|
this.options.shouldOverridePresetPolicies && this.options.policies ? this.options.policies : this.options.preset ? {} : this.options.policies || {},
|
|
1602
1601
|
this.rpcUrl(),
|
|
1603
|
-
this.options.signupOptions
|
|
1604
|
-
Ae
|
|
1602
|
+
this.options.signupOptions
|
|
1605
1603
|
);
|
|
1606
1604
|
if (e.code !== v.SUCCESS)
|
|
1607
1605
|
throw new Error(e.message);
|
|
@@ -1748,7 +1746,7 @@ class jt extends ke {
|
|
|
1748
1746
|
initializeChains(e) {
|
|
1749
1747
|
for (const t of e)
|
|
1750
1748
|
try {
|
|
1751
|
-
const n = new URL(t.rpcUrl), o =
|
|
1749
|
+
const n = new URL(t.rpcUrl), o = ve(n), s = o === $.StarknetChainId.SN_MAIN, a = o === $.StarknetChainId.SN_SEPOLIA, i = n.hostname === "api.cartridge.gg", c = n.hostname === "localhost" || n.hostname === "127.0.0.1";
|
|
1752
1750
|
if ((s || a) && !(i || c))
|
|
1753
1751
|
throw new Error(
|
|
1754
1752
|
`Only Cartridge RPC providers are allowed for ${s ? "mainnet" : "sepolia"}. Please use: https://api.cartridge.gg/x/starknet/${s ? "mainnet" : "sepolia"}`
|
|
@@ -1780,7 +1778,7 @@ const R = /* @__PURE__ */ new Map();
|
|
|
1780
1778
|
async function me(r) {
|
|
1781
1779
|
if (!r.addresses?.length && !r.usernames?.length)
|
|
1782
1780
|
return { results: [] };
|
|
1783
|
-
const e = await fetch(`${
|
|
1781
|
+
const e = await fetch(`${Ee}/lookup`, {
|
|
1784
1782
|
method: "POST",
|
|
1785
1783
|
headers: {
|
|
1786
1784
|
"Content-Type": "application/json"
|
|
@@ -1800,7 +1798,7 @@ async function qt(r) {
|
|
|
1800
1798
|
);
|
|
1801
1799
|
}
|
|
1802
1800
|
async function Xt(r) {
|
|
1803
|
-
r = r.map(
|
|
1801
|
+
r = r.map(be.toHex);
|
|
1804
1802
|
const e = r.filter((t) => !R.has(t));
|
|
1805
1803
|
return e.length > 0 && (await me({
|
|
1806
1804
|
addresses: e
|
|
@@ -1810,7 +1808,7 @@ async function Xt(r) {
|
|
|
1810
1808
|
r.map((t) => [t, R.get(t)]).filter((t) => t[1] !== void 0)
|
|
1811
1809
|
);
|
|
1812
1810
|
}
|
|
1813
|
-
var
|
|
1811
|
+
var Ot = [
|
|
1814
1812
|
{
|
|
1815
1813
|
name: "Wrapped BTC",
|
|
1816
1814
|
symbol: "WBTC",
|
|
@@ -2374,7 +2372,7 @@ var zt = [
|
|
|
2374
2372
|
total_supply: null,
|
|
2375
2373
|
logo_url: "https://assets.underware.gg/pistols/fame.svg"
|
|
2376
2374
|
}
|
|
2377
|
-
],
|
|
2375
|
+
], ge = {
|
|
2378
2376
|
theme: {
|
|
2379
2377
|
name: "Cartridge",
|
|
2380
2378
|
icon: "icon.svg"
|
|
@@ -2441,16 +2439,17 @@ async function Jt() {
|
|
|
2441
2439
|
})
|
|
2442
2440
|
), n;
|
|
2443
2441
|
}
|
|
2444
|
-
|
|
2442
|
+
ge.theme.icon = "https://static.cartridge.gg/presets/cartridge/icon.svg";
|
|
2443
|
+
var Zt = Ot, er = ge.theme;
|
|
2445
2444
|
export {
|
|
2446
|
-
|
|
2445
|
+
Nt as ArgentWallet,
|
|
2447
2446
|
nr as FeeSource,
|
|
2448
|
-
|
|
2447
|
+
Mt as MetaMaskWallet,
|
|
2449
2448
|
b as NotReadyToConnect,
|
|
2450
|
-
|
|
2451
|
-
|
|
2449
|
+
Bt as PhantomWallet,
|
|
2450
|
+
Qt as RabbyWallet,
|
|
2452
2451
|
v as ResponseCodes,
|
|
2453
|
-
|
|
2452
|
+
Tt as WalletBridge,
|
|
2454
2453
|
jt as default,
|
|
2455
2454
|
er as defaultTheme,
|
|
2456
2455
|
Zt as erc20Metadata,
|
|
@@ -2462,8 +2461,8 @@ export {
|
|
|
2462
2461
|
Xt as lookupAddresses,
|
|
2463
2462
|
qt as lookupUsernames,
|
|
2464
2463
|
sr as normalizeCalls,
|
|
2465
|
-
|
|
2466
|
-
|
|
2464
|
+
ve as parseChainId,
|
|
2465
|
+
we as toArray,
|
|
2467
2466
|
ar as toSessionPolicies,
|
|
2468
2467
|
ir as toWasmPolicies
|
|
2469
2468
|
};
|