@cartridge/controller 0.10.0 → 0.10.2
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 +13 -13
- package/.turbo/turbo-build.log +12 -12
- package/dist/controller.d.ts +2 -2
- package/dist/index.js +215 -193
- 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.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/{provider-Bsw_spHR.js → provider-D-5qL7QC.js} +45 -44
- package/dist/provider-D-5qL7QC.js.map +1 -0
- package/dist/session.js +24 -24
- package/dist/session.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +20 -1
- package/dist/wallets/argent/index.d.ts +4 -0
- package/dist/wallets/braavos/index.d.ts +4 -0
- package/dist/wallets/types.d.ts +1 -0
- package/package.json +3 -3
- package/src/controller.ts +8 -13
- package/src/types.ts +23 -1
- package/src/wallets/argent/index.ts +36 -0
- package/src/wallets/braavos/index.ts +36 -0
- package/src/wallets/types.ts +1 -0
- package/dist/provider-Bsw_spHR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletAccount as Nt, constants as V, num as rt, shortString as Oe } from "starknet";
|
|
2
|
-
import { R as
|
|
3
|
-
import { F as qn,
|
|
4
|
-
class
|
|
2
|
+
import { R as Q, t as Rt, K as Tt, B as Ut, N as v, p as zt, v as Dt, A as Ot } from "./provider-D-5qL7QC.js";
|
|
3
|
+
import { F as qn, S as Gn, h as Xn, n as Jn, a as Zn, b as es } from "./provider-D-5qL7QC.js";
|
|
4
|
+
class Le extends Nt {
|
|
5
5
|
keychain;
|
|
6
6
|
modal;
|
|
7
7
|
options;
|
|
@@ -33,11 +33,11 @@ class Me extends Nt {
|
|
|
33
33
|
!1,
|
|
34
34
|
this.options?.feeSource
|
|
35
35
|
);
|
|
36
|
-
if (s.code ===
|
|
36
|
+
if (s.code === Q.SUCCESS) {
|
|
37
37
|
r(s);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (this.options?.propagateSessionErrors && s.code !==
|
|
40
|
+
if (this.options?.propagateSessionErrors && s.code !== Q.USER_INTERACTION_REQUIRED) {
|
|
41
41
|
n(s.error);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
@@ -49,7 +49,7 @@ class Me extends Nt {
|
|
|
49
49
|
!0,
|
|
50
50
|
s.error
|
|
51
51
|
);
|
|
52
|
-
if (o.code ===
|
|
52
|
+
if (o.code === Q.SUCCESS) {
|
|
53
53
|
r(o), this.modal.close();
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
@@ -77,10 +77,10 @@ class Me extends Nt {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
var
|
|
80
|
+
var P;
|
|
81
81
|
(function(t) {
|
|
82
82
|
t.Call = "call", t.Reply = "reply", t.Syn = "syn", t.SynAck = "synAck", t.Ack = "ack";
|
|
83
|
-
})(
|
|
83
|
+
})(P || (P = {}));
|
|
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 Lt = (t, e) => {
|
|
101
101
|
const r = [];
|
|
102
102
|
let n = !1;
|
|
103
103
|
return {
|
|
@@ -110,9 +110,9 @@ const Mt = (t, e) => {
|
|
|
110
110
|
n ? s() : r.push(s);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
},
|
|
113
|
+
}, Mt = (t) => (...e) => {
|
|
114
114
|
t && console.log("[Penpal]", ...e);
|
|
115
|
-
},
|
|
115
|
+
}, Qt = {
|
|
116
116
|
"http:": "80",
|
|
117
117
|
"https:": "443"
|
|
118
118
|
}, Ft = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, jt = ["file:", "data:"], Wt = (t) => {
|
|
@@ -121,9 +121,9 @@ const Mt = (t, e) => {
|
|
|
121
121
|
const e = document.location, r = Ft.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 !== Qt[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
|
|
@@ -134,13 +134,13 @@ const Mt = (t, e) => {
|
|
|
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 !== P.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}`);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
const h = d.data, { methodName: f, args: u, id:
|
|
143
|
+
const h = d.data, { methodName: f, args: u, id: w } = h;
|
|
144
144
|
r(`${n}: Received ${f}() call`);
|
|
145
145
|
const k = (m) => (S) => {
|
|
146
146
|
if (r(`${n}: Sending ${f}() reply`), l) {
|
|
@@ -148,21 +148,21 @@ const Mt = (t, e) => {
|
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
const _ = {
|
|
151
|
-
penpal:
|
|
152
|
-
id:
|
|
151
|
+
penpal: P.Reply,
|
|
152
|
+
id: w,
|
|
153
153
|
resolution: m,
|
|
154
154
|
returnValue: S
|
|
155
155
|
};
|
|
156
|
-
m === z.Rejected && S instanceof Error && (_.returnValue =
|
|
156
|
+
m === z.Rejected && S instanceof Error && (_.returnValue = Me(S), _.returnValueIsError = !0);
|
|
157
157
|
try {
|
|
158
158
|
o.postMessage(_, a);
|
|
159
159
|
} catch (p) {
|
|
160
160
|
if (p.name === be.DataCloneError) {
|
|
161
161
|
const E = {
|
|
162
|
-
penpal:
|
|
163
|
-
id:
|
|
162
|
+
penpal: P.Reply,
|
|
163
|
+
id: w,
|
|
164
164
|
resolution: z.Rejected,
|
|
165
|
-
returnValue:
|
|
165
|
+
returnValue: Me(p),
|
|
166
166
|
returnValueIsError: !0
|
|
167
167
|
};
|
|
168
168
|
o.postMessage(E, a);
|
|
@@ -198,7 +198,7 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
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
|
-
const h = (u) => (...
|
|
201
|
+
const h = (u) => (...w) => {
|
|
202
202
|
s(`${o}: Sending ${u}() call`);
|
|
203
203
|
let k;
|
|
204
204
|
try {
|
|
@@ -211,28 +211,28 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
211
211
|
throw m.code = G.ConnectionDestroyed, m;
|
|
212
212
|
}
|
|
213
213
|
return new Promise((m, S) => {
|
|
214
|
-
const _ = Vt(), p = (
|
|
215
|
-
if (
|
|
214
|
+
const _ = Vt(), p = (C) => {
|
|
215
|
+
if (C.source !== i || C.data.penpal !== P.Reply || C.data.id !== _)
|
|
216
216
|
return;
|
|
217
|
-
if (c !== "*" &&
|
|
218
|
-
s(`${o} received message from origin ${
|
|
217
|
+
if (c !== "*" && C.origin !== c) {
|
|
218
|
+
s(`${o} received message from origin ${C.origin} which did not match expected origin ${c}`);
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
|
-
const de =
|
|
221
|
+
const de = C.data;
|
|
222
222
|
s(`${o}: Received ${u}() reply`), a.removeEventListener(T.Message, p);
|
|
223
223
|
let he = de.returnValue;
|
|
224
224
|
de.returnValueIsError && (he = Yt(he)), (de.resolution === z.Fulfilled ? m : S)(he);
|
|
225
225
|
};
|
|
226
226
|
a.addEventListener(T.Message, p);
|
|
227
227
|
const E = {
|
|
228
|
-
penpal:
|
|
228
|
+
penpal: P.Call,
|
|
229
229
|
id: _,
|
|
230
230
|
methodName: u,
|
|
231
|
-
args:
|
|
231
|
+
args: w
|
|
232
232
|
};
|
|
233
233
|
i.postMessage(E, l);
|
|
234
234
|
});
|
|
235
|
-
}, f = r.reduce((u,
|
|
235
|
+
}, f = r.reduce((u, w) => (u[w] = h(w), u), {});
|
|
236
236
|
return Object.assign(t, Jt(f)), () => {
|
|
237
237
|
d = !0;
|
|
238
238
|
};
|
|
@@ -268,7 +268,7 @@ 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: P.SynAck,
|
|
272
272
|
methodNames: Object.keys(e)
|
|
273
273
|
};
|
|
274
274
|
s.source.postMessage(o, n);
|
|
@@ -294,18 +294,18 @@ const Vt = () => ++Kt, nt = ".", st = (t) => t ? t.split(nt) : [], qt = (t) => t
|
|
|
294
294
|
}
|
|
295
295
|
}, ir = (t) => {
|
|
296
296
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: o = !1 } = t;
|
|
297
|
-
const a =
|
|
297
|
+
const a = Mt(o), i = Lt("Parent", a), { onDestroy: l, destroy: c } = i;
|
|
298
298
|
n || (or(e), n = Wt(e.src));
|
|
299
299
|
const d = n === "null" ? "*" : n, h = ot(r), f = tr(a, h, n, d), u = er(h, n, d, i, a);
|
|
300
300
|
return {
|
|
301
301
|
promise: new Promise((k, m) => {
|
|
302
302
|
const S = sr(s, c), _ = (p) => {
|
|
303
303
|
if (!(p.source !== e.contentWindow || !p.data)) {
|
|
304
|
-
if (p.data.penpal ===
|
|
304
|
+
if (p.data.penpal === P.Syn) {
|
|
305
305
|
f(p);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
if (p.data.penpal ===
|
|
308
|
+
if (p.data.penpal === P.Ack) {
|
|
309
309
|
const E = u(p);
|
|
310
310
|
E && (S(), k(E));
|
|
311
311
|
return;
|
|
@@ -396,17 +396,17 @@ class ar {
|
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
const cr = "6.13.7";
|
|
399
|
-
function
|
|
399
|
+
function Qe(t, e, r) {
|
|
400
400
|
for (let n in e) {
|
|
401
401
|
let s = e[n];
|
|
402
402
|
Object.defineProperty(t, n, { enumerable: !0, value: s, writable: !1 });
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function M(t) {
|
|
406
406
|
if (t == null)
|
|
407
407
|
return "null";
|
|
408
408
|
if (Array.isArray(t))
|
|
409
|
-
return "[ " + t.map(
|
|
409
|
+
return "[ " + t.map(M).join(", ") + " ]";
|
|
410
410
|
if (t instanceof Uint8Array) {
|
|
411
411
|
const e = "0123456789abcdef";
|
|
412
412
|
let r = "0x";
|
|
@@ -415,7 +415,7 @@ function Q(t) {
|
|
|
415
415
|
return r;
|
|
416
416
|
}
|
|
417
417
|
if (typeof t == "object" && typeof t.toJSON == "function")
|
|
418
|
-
return
|
|
418
|
+
return M(t.toJSON());
|
|
419
419
|
switch (typeof t) {
|
|
420
420
|
case "boolean":
|
|
421
421
|
case "symbol":
|
|
@@ -428,7 +428,7 @@ function Q(t) {
|
|
|
428
428
|
return JSON.stringify(t);
|
|
429
429
|
case "object": {
|
|
430
430
|
const e = Object.keys(t);
|
|
431
|
-
return e.sort(), "{ " + e.map((r) => `${
|
|
431
|
+
return e.sort(), "{ " + e.map((r) => `${M(r)}: ${M(t[r])}`).join(", ") + " }";
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
return "[ COULD NOT SERIALIZE ]";
|
|
@@ -439,12 +439,12 @@ function lr(t, e, r) {
|
|
|
439
439
|
const o = [];
|
|
440
440
|
if (r) {
|
|
441
441
|
if ("message" in r || "code" in r || "name" in r)
|
|
442
|
-
throw new Error(`value will overwrite populated values: ${
|
|
442
|
+
throw new Error(`value will overwrite populated values: ${M(r)}`);
|
|
443
443
|
for (const a in r) {
|
|
444
444
|
if (a === "shortMessage")
|
|
445
445
|
continue;
|
|
446
446
|
const i = r[a];
|
|
447
|
-
o.push(a + "=" +
|
|
447
|
+
o.push(a + "=" + M(i));
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
o.push(`code=${e}`), o.push(`version=${cr}`), o.length && (t += " (" + o.join(", ") + ")");
|
|
@@ -461,7 +461,7 @@ function lr(t, e, r) {
|
|
|
461
461
|
default:
|
|
462
462
|
s = new Error(t);
|
|
463
463
|
}
|
|
464
|
-
return
|
|
464
|
+
return Qe(s, { code: e }), r && Object.assign(s, r), s.shortMessage == null && Qe(s, { shortMessage: n }), s;
|
|
465
465
|
}
|
|
466
466
|
function dr(t, e, r, n) {
|
|
467
467
|
if (!t)
|
|
@@ -526,13 +526,13 @@ function We(t, e = !0) {
|
|
|
526
526
|
if (e && t.finished)
|
|
527
527
|
throw new Error("Hash#digest() has already been called");
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function gr(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 wr(t) {
|
|
536
536
|
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
537
537
|
}
|
|
538
538
|
function it(...t) {
|
|
@@ -576,12 +576,12 @@ function Er(t, e = !1) {
|
|
|
576
576
|
}
|
|
577
577
|
return [n, s];
|
|
578
578
|
}
|
|
579
|
-
const vr = (t, e, r) => t << r | e >>> 32 - r, xr = (t, e, r) => e << r | t >>> 32 - r, $r = (t, e, r) => e << r - 32 | t >>> 64 - r, Ir = (t, e, r) => t << r - 32 | e >>> 64 - r, Sr = BigInt(0), W = BigInt(1),
|
|
579
|
+
const vr = (t, e, r) => t << r | e >>> 32 - r, xr = (t, e, r) => e << r | t >>> 32 - r, $r = (t, e, r) => e << r - 32 | t >>> 64 - r, Ir = (t, e, r) => t << r - 32 | e >>> 64 - r, Sr = BigInt(0), W = BigInt(1), Cr = BigInt(2), Br = BigInt(7), Pr = BigInt(256), Nr = BigInt(113), ct = [], lt = [], dt = [];
|
|
580
580
|
for (let t = 0, e = W, 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
582
|
let s = Sr;
|
|
583
583
|
for (let o = 0; o < 7; o++)
|
|
584
|
-
e = (e << W ^ (e >>
|
|
584
|
+
e = (e << W ^ (e >> Br) * Nr) % Pr, e & Cr && (s ^= W << (W << /* @__PURE__ */ BigInt(o)) - W);
|
|
585
585
|
dt.push(s);
|
|
586
586
|
}
|
|
587
587
|
const ht = Er(dt, !0), Rr = ht[0], Tr = ht[1], Ke = (t, e, r) => r > 32 ? $r(t, e, r) : vr(t, e, r), Ve = (t, e, r) => r > 32 ? Ir(t, e, r) : xr(t, e, r);
|
|
@@ -615,7 +615,7 @@ class $e extends kr {
|
|
|
615
615
|
constructor(e, r, n, s = !1, o = 24) {
|
|
616
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, je(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 = wr(this.state);
|
|
619
619
|
}
|
|
620
620
|
clone() {
|
|
621
621
|
return this._cloneInto();
|
|
@@ -660,7 +660,7 @@ class $e extends kr {
|
|
|
660
660
|
return je(e), this.xofInto(new Uint8Array(e));
|
|
661
661
|
}
|
|
662
662
|
digestInto(e) {
|
|
663
|
-
if (
|
|
663
|
+
if (gr(e, this), this.finished)
|
|
664
664
|
throw new Error("digest() was already called");
|
|
665
665
|
return this.writeInto(e), this.destroy(), e;
|
|
666
666
|
}
|
|
@@ -680,10 +680,10 @@ let ft = !1;
|
|
|
680
680
|
const ut = function(t) {
|
|
681
681
|
return Dr(t);
|
|
682
682
|
};
|
|
683
|
-
let
|
|
683
|
+
let gt = ut;
|
|
684
684
|
function X(t) {
|
|
685
685
|
const e = xe(t, "data");
|
|
686
|
-
return fr(
|
|
686
|
+
return fr(gt(e));
|
|
687
687
|
}
|
|
688
688
|
X._ = ut;
|
|
689
689
|
X.lock = function() {
|
|
@@ -692,10 +692,10 @@ X.lock = function() {
|
|
|
692
692
|
X.register = function(t) {
|
|
693
693
|
if (ft)
|
|
694
694
|
throw new TypeError("keccak256 is locked");
|
|
695
|
-
|
|
695
|
+
gt = t;
|
|
696
696
|
};
|
|
697
697
|
Object.freeze(X);
|
|
698
|
-
const Or = BigInt(0),
|
|
698
|
+
const Or = BigInt(0), Lr = BigInt(36);
|
|
699
699
|
function qe(t) {
|
|
700
700
|
t = t.toLowerCase();
|
|
701
701
|
const e = t.substring(2).split(""), r = new Uint8Array(40);
|
|
@@ -712,7 +712,7 @@ for (let t = 0; t < 10; t++)
|
|
|
712
712
|
for (let t = 0; t < 26; t++)
|
|
713
713
|
Ie[String.fromCharCode(65 + t)] = String(10 + t);
|
|
714
714
|
const Ge = 15;
|
|
715
|
-
function
|
|
715
|
+
function Mr(t) {
|
|
716
716
|
t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00";
|
|
717
717
|
let e = t.split("").map((n) => Ie[n]).join("");
|
|
718
718
|
for (; e.length >= Ge; ) {
|
|
@@ -724,7 +724,7 @@ function Qr(t) {
|
|
|
724
724
|
r = "0" + r;
|
|
725
725
|
return r;
|
|
726
726
|
}
|
|
727
|
-
const
|
|
727
|
+
const Qr = function() {
|
|
728
728
|
const t = {};
|
|
729
729
|
for (let e = 0; e < 36; e++) {
|
|
730
730
|
const r = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
|
|
@@ -736,7 +736,7 @@ function Fr(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 * Lr + Qr[t[r]];
|
|
740
740
|
return e;
|
|
741
741
|
}
|
|
742
742
|
function N(t) {
|
|
@@ -746,7 +746,7 @@ 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) ===
|
|
749
|
+
Y(t.substring(2, 4) === Mr(t), "bad icap checksum", "address", t);
|
|
750
750
|
let e = Fr(t.substring(4)).toString(16);
|
|
751
751
|
for (; e.length < 40; )
|
|
752
752
|
e = "0" + e;
|
|
@@ -760,6 +760,7 @@ class jr {
|
|
|
760
760
|
wallet = void 0;
|
|
761
761
|
account = void 0;
|
|
762
762
|
connectedAccounts = [];
|
|
763
|
+
accountChangeListener = void 0;
|
|
763
764
|
isAvailable() {
|
|
764
765
|
return typeof window < "u" && !!window.starknet_argentX;
|
|
765
766
|
}
|
|
@@ -789,7 +790,7 @@ class jr {
|
|
|
789
790
|
});
|
|
790
791
|
if (!r || r.length === 0)
|
|
791
792
|
throw new Error("No accounts found");
|
|
792
|
-
return this.wallet = e, this.account = r[0], this.connectedAccounts = r, { success: !0, wallet: this.type, account: this.account };
|
|
793
|
+
return this.removeAccountChangeListener(), this.wallet = e, this.account = r[0], this.connectedAccounts = r, this.setupAccountChangeListener(), { success: !0, wallet: this.type, account: this.account };
|
|
793
794
|
} catch (e) {
|
|
794
795
|
return console.error("Error connecting to Argent:", e), {
|
|
795
796
|
success: !1,
|
|
@@ -875,6 +876,17 @@ class jr {
|
|
|
875
876
|
error: "waitForTransaction not supported for Argent wallet"
|
|
876
877
|
};
|
|
877
878
|
}
|
|
879
|
+
setupAccountChangeListener() {
|
|
880
|
+
this.wallet && (this.accountChangeListener = (e) => {
|
|
881
|
+
e && e.length > 0 ? (this.account = e[0], this.connectedAccounts = e) : (this.account = void 0, this.connectedAccounts = []);
|
|
882
|
+
}, this.wallet.on("accountsChanged", this.accountChangeListener));
|
|
883
|
+
}
|
|
884
|
+
removeAccountChangeListener() {
|
|
885
|
+
this.wallet && this.accountChangeListener && (this.wallet.off("accountsChanged", this.accountChangeListener), this.accountChangeListener = void 0);
|
|
886
|
+
}
|
|
887
|
+
disconnect() {
|
|
888
|
+
this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
|
|
889
|
+
}
|
|
878
890
|
}
|
|
879
891
|
function Wr(t) {
|
|
880
892
|
if (typeof window > "u")
|
|
@@ -1204,11 +1216,11 @@ class Vr extends Se {
|
|
|
1204
1216
|
displayName = "MetaMask";
|
|
1205
1217
|
}
|
|
1206
1218
|
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1207
|
-
function
|
|
1219
|
+
function Ce(t) {
|
|
1208
1220
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1209
1221
|
}
|
|
1210
|
-
function
|
|
1211
|
-
if (!
|
|
1222
|
+
function wt(t, ...e) {
|
|
1223
|
+
if (!Ce(t))
|
|
1212
1224
|
throw new Error("Uint8Array expected");
|
|
1213
1225
|
if (e.length > 0 && !e.includes(t.length))
|
|
1214
1226
|
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
@@ -1243,12 +1255,12 @@ function yt(t, e) {
|
|
|
1243
1255
|
throw new Error(`${t}: array of numbers expected`);
|
|
1244
1256
|
}
|
|
1245
1257
|
// @__NO_SIDE_EFFECTS__
|
|
1246
|
-
function
|
|
1258
|
+
function Be(...t) {
|
|
1247
1259
|
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);
|
|
1248
1260
|
return { encode: n, decode: s };
|
|
1249
1261
|
}
|
|
1250
1262
|
// @__NO_SIDE_EFFECTS__
|
|
1251
|
-
function
|
|
1263
|
+
function Pe(t) {
|
|
1252
1264
|
const e = typeof t == "string" ? t.split("") : t, r = e.length;
|
|
1253
1265
|
se("alphabet", e);
|
|
1254
1266
|
const n = new Map(e.map((s, o) => [s, o]));
|
|
@@ -1319,11 +1331,11 @@ function Xe(t, e, r) {
|
|
|
1319
1331
|
throw new Error("convertRadix: carry overflow");
|
|
1320
1332
|
const u = f / r;
|
|
1321
1333
|
i = f % r;
|
|
1322
|
-
const
|
|
1323
|
-
if (o[c] =
|
|
1334
|
+
const w = Math.floor(u);
|
|
1335
|
+
if (o[c] = w, !Number.isSafeInteger(w) || w * r + i !== f)
|
|
1324
1336
|
throw new Error("convertRadix: carry overflow");
|
|
1325
1337
|
if (l)
|
|
1326
|
-
|
|
1338
|
+
w ? l = !1 : n = c;
|
|
1327
1339
|
else continue;
|
|
1328
1340
|
}
|
|
1329
1341
|
if (s.push(i), l)
|
|
@@ -1372,7 +1384,7 @@ function Jr(t) {
|
|
|
1372
1384
|
const e = 2 ** 8;
|
|
1373
1385
|
return {
|
|
1374
1386
|
encode: (r) => {
|
|
1375
|
-
if (!
|
|
1387
|
+
if (!Ce(r))
|
|
1376
1388
|
throw new Error("radix.encode input should be Uint8Array");
|
|
1377
1389
|
return Xe(Array.from(r), e, t);
|
|
1378
1390
|
},
|
|
@@ -1387,7 +1399,7 @@ function bt(t, e = !1) {
|
|
|
1387
1399
|
throw new Error("radix2: carry overflow");
|
|
1388
1400
|
return {
|
|
1389
1401
|
encode: (r) => {
|
|
1390
|
-
if (!
|
|
1402
|
+
if (!Ce(r))
|
|
1391
1403
|
throw new Error("radix2.encode input should be Uint8Array");
|
|
1392
1404
|
return Je(Array.from(r), 8, t, !e);
|
|
1393
1405
|
},
|
|
@@ -1396,22 +1408,22 @@ function bt(t, e = !1) {
|
|
|
1396
1408
|
}
|
|
1397
1409
|
const Zr = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", en = Zr ? {
|
|
1398
1410
|
encode(t) {
|
|
1399
|
-
return
|
|
1411
|
+
return wt(t), t.toBase64();
|
|
1400
1412
|
},
|
|
1401
1413
|
decode(t) {
|
|
1402
1414
|
return j("base64", t), Uint8Array.fromBase64(t, { lastChunkHandling: "strict" });
|
|
1403
1415
|
}
|
|
1404
|
-
} : /* @__PURE__ */
|
|
1416
|
+
} : /* @__PURE__ */ Be(/* @__PURE__ */ bt(6), /* @__PURE__ */ Pe("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ Gr(6), /* @__PURE__ */ Ne("")), tn = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ Be(/* @__PURE__ */ Jr(58), /* @__PURE__ */ Pe(t), /* @__PURE__ */ Ne("")), ke = /* @__PURE__ */ tn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), rn = {
|
|
1405
1417
|
encode: (t) => new TextDecoder().decode(t),
|
|
1406
1418
|
decode: (t) => new TextEncoder().encode(t)
|
|
1407
1419
|
}, nn = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", sn = {
|
|
1408
1420
|
encode(t) {
|
|
1409
|
-
return
|
|
1421
|
+
return wt(t), t.toHex();
|
|
1410
1422
|
},
|
|
1411
1423
|
decode(t) {
|
|
1412
1424
|
return j("hex", t), Uint8Array.fromHex(t);
|
|
1413
1425
|
}
|
|
1414
|
-
},
|
|
1426
|
+
}, ge = nn ? sn : /* @__PURE__ */ Be(/* @__PURE__ */ bt(4), /* @__PURE__ */ Pe("0123456789abcdef"), /* @__PURE__ */ Ne(""), /* @__PURE__ */ Xr((t) => {
|
|
1415
1427
|
if (typeof t != "string" || t.length % 2 !== 0)
|
|
1416
1428
|
throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);
|
|
1417
1429
|
return t.toLowerCase();
|
|
@@ -1428,14 +1440,14 @@ function R(t) {
|
|
|
1428
1440
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1429
1441
|
}
|
|
1430
1442
|
const kt = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
1431
|
-
function
|
|
1443
|
+
function L(t) {
|
|
1432
1444
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
1433
1445
|
}
|
|
1434
|
-
function
|
|
1446
|
+
function B(t) {
|
|
1435
1447
|
return Number.isSafeInteger(t);
|
|
1436
1448
|
}
|
|
1437
1449
|
const _t = (t) => {
|
|
1438
|
-
if (t !== null && typeof t != "string" && !I(t) && !R(t) && !
|
|
1450
|
+
if (t !== null && typeof t != "string" && !I(t) && !R(t) && !B(t))
|
|
1439
1451
|
throw new Error(`lengthCoder: expected null | number | Uint8Array | CoderType, got ${t} (${typeof t})`);
|
|
1440
1452
|
return {
|
|
1441
1453
|
encodeStream(e, r) {
|
|
@@ -1591,17 +1603,17 @@ class Re {
|
|
|
1591
1603
|
finish() {
|
|
1592
1604
|
if (!this.opts.allowUnreadBytes) {
|
|
1593
1605
|
if (this.bitPos)
|
|
1594
|
-
throw this.err(`${this.bitPos} bits left after unpack: ${
|
|
1606
|
+
throw this.err(`${this.bitPos} bits left after unpack: ${ge.encode(this.data.slice(this.pos))}`);
|
|
1595
1607
|
if (this.bs && !this.parent) {
|
|
1596
1608
|
const e = A.indices(this.bs, this.data.length, !0);
|
|
1597
1609
|
if (e.length) {
|
|
1598
|
-
const r = A.range(e).map(({ pos: n, length: s }) => `(${n}/${s})[${
|
|
1610
|
+
const r = A.range(e).map(({ pos: n, length: s }) => `(${n}/${s})[${ge.encode(this.data.subarray(n, n + s))}]`).join(", ");
|
|
1599
1611
|
throw this.err(`unread byte ranges: ${r} (total=${this.data.length})`);
|
|
1600
1612
|
} else
|
|
1601
1613
|
return;
|
|
1602
1614
|
}
|
|
1603
1615
|
if (!this.isEnd())
|
|
1604
|
-
throw this.err(`${this.leftBytes} bytes ${this.bitPos} bits left after unpack: ${
|
|
1616
|
+
throw this.err(`${this.leftBytes} bytes ${this.bitPos} bits left after unpack: ${ge.encode(this.data.slice(this.pos))}`);
|
|
1605
1617
|
}
|
|
1606
1618
|
}
|
|
1607
1619
|
// User methods
|
|
@@ -1677,7 +1689,7 @@ class on {
|
|
|
1677
1689
|
writeView(e, r) {
|
|
1678
1690
|
if (this.finished)
|
|
1679
1691
|
throw this.err("buffer: finished");
|
|
1680
|
-
if (!
|
|
1692
|
+
if (!B(e) || e > 8)
|
|
1681
1693
|
throw new Error(`wrong writeView length=${e}`);
|
|
1682
1694
|
r(this.view), this.bytes(this.viewBuf.slice(0, e)), this.viewBuf.fill(0);
|
|
1683
1695
|
}
|
|
@@ -1788,9 +1800,9 @@ function Et(t, e) {
|
|
|
1788
1800
|
const x = (t) => {
|
|
1789
1801
|
const e = At(t);
|
|
1790
1802
|
return t.validate ? Et(e, t.validate) : e;
|
|
1791
|
-
}, ce = (t) =>
|
|
1803
|
+
}, ce = (t) => L(t) && typeof t.decode == "function" && typeof t.encode == "function";
|
|
1792
1804
|
function I(t) {
|
|
1793
|
-
return
|
|
1805
|
+
return L(t) && ce(t) && typeof t.encodeStream == "function" && typeof t.decodeStream == "function" && (t.size === void 0 || B(t.size));
|
|
1794
1806
|
}
|
|
1795
1807
|
function cn() {
|
|
1796
1808
|
return {
|
|
@@ -1809,7 +1821,7 @@ function cn() {
|
|
|
1809
1821
|
return e;
|
|
1810
1822
|
},
|
|
1811
1823
|
decode: (t) => {
|
|
1812
|
-
if (!
|
|
1824
|
+
if (!L(t))
|
|
1813
1825
|
throw new Error(`expected plain object, got ${t}`);
|
|
1814
1826
|
return Object.entries(t);
|
|
1815
1827
|
}
|
|
@@ -1824,17 +1836,17 @@ const ln = {
|
|
|
1824
1836
|
return Number(t);
|
|
1825
1837
|
},
|
|
1826
1838
|
decode: (t) => {
|
|
1827
|
-
if (!
|
|
1839
|
+
if (!B(t))
|
|
1828
1840
|
throw new Error("element is not a safe integer");
|
|
1829
1841
|
return BigInt(t);
|
|
1830
1842
|
}
|
|
1831
1843
|
};
|
|
1832
1844
|
function dn(t) {
|
|
1833
|
-
if (!
|
|
1845
|
+
if (!L(t))
|
|
1834
1846
|
throw new Error("plain object expected");
|
|
1835
1847
|
return {
|
|
1836
1848
|
encode: (e) => {
|
|
1837
|
-
if (!
|
|
1849
|
+
if (!B(e) || !(e in t))
|
|
1838
1850
|
throw new Error(`wrong value ${e}`);
|
|
1839
1851
|
return t[e];
|
|
1840
1852
|
},
|
|
@@ -1846,7 +1858,7 @@ function dn(t) {
|
|
|
1846
1858
|
};
|
|
1847
1859
|
}
|
|
1848
1860
|
function hn(t, e = !1) {
|
|
1849
|
-
if (!
|
|
1861
|
+
if (!B(t))
|
|
1850
1862
|
throw new Error(`decimal/precision: wrong value ${t}`);
|
|
1851
1863
|
if (typeof e != "boolean")
|
|
1852
1864
|
throw new Error(`decimal/round: expected boolean, got ${typeof e}`);
|
|
@@ -1910,8 +1922,8 @@ const un = (t) => {
|
|
|
1910
1922
|
if (!ce(t))
|
|
1911
1923
|
throw new Error("BaseCoder expected");
|
|
1912
1924
|
return { encode: t.decode, decode: t.encode };
|
|
1913
|
-
}, H = { dict: cn, numberBigint: ln, tsEnum: dn, decimal: hn, match: fn, reverse: un },
|
|
1914
|
-
if (!
|
|
1925
|
+
}, H = { dict: cn, numberBigint: ln, tsEnum: dn, decimal: hn, match: fn, reverse: un }, gn = (t, e = !1, r = !1, n = !0) => {
|
|
1926
|
+
if (!B(t))
|
|
1915
1927
|
throw new Error(`bigint/size: wrong value ${t}`);
|
|
1916
1928
|
if (typeof e != "boolean")
|
|
1917
1929
|
throw new Error(`bigint/le: expected boolean, got ${typeof e}`);
|
|
@@ -1949,7 +1961,7 @@ const un = (t) => {
|
|
|
1949
1961
|
return an(a, 8n * s, !!r), a;
|
|
1950
1962
|
}
|
|
1951
1963
|
});
|
|
1952
|
-
}, b = /* @__PURE__ */
|
|
1964
|
+
}, b = /* @__PURE__ */ gn(8, !0), wn = (t, e) => x({
|
|
1953
1965
|
size: t,
|
|
1954
1966
|
encodeStream: (r, n) => r.writeView(t, (s) => e.write(s, n)),
|
|
1955
1967
|
decodeStream: (r) => r.readView(t, e.read),
|
|
@@ -1960,17 +1972,17 @@ const un = (t) => {
|
|
|
1960
1972
|
}
|
|
1961
1973
|
}), vt = (t, e, r) => {
|
|
1962
1974
|
const n = t * 8, s = 2 ** (n - 1), o = (l) => {
|
|
1963
|
-
if (!
|
|
1975
|
+
if (!B(l))
|
|
1964
1976
|
throw new Error(`sintView: value is not safe integer: ${l}`);
|
|
1965
1977
|
if (l < -s || l >= s)
|
|
1966
1978
|
throw new Error(`sintView: value out of bounds. Expected ${-s} <= ${l} < ${s}`);
|
|
1967
1979
|
}, a = 2 ** n, i = (l) => {
|
|
1968
|
-
if (!
|
|
1980
|
+
if (!B(l))
|
|
1969
1981
|
throw new Error(`uintView: value is not safe integer: ${l}`);
|
|
1970
1982
|
if (0 > l || l >= a)
|
|
1971
1983
|
throw new Error(`uintView: value out of bounds. Expected 0 <= ${l} < ${a}`);
|
|
1972
1984
|
};
|
|
1973
|
-
return
|
|
1985
|
+
return wn(t, {
|
|
1974
1986
|
write: r.write,
|
|
1975
1987
|
read: r.read,
|
|
1976
1988
|
validate: e ? o : i
|
|
@@ -2081,14 +2093,14 @@ function bn(t) {
|
|
|
2081
2093
|
for (const r of t) {
|
|
2082
2094
|
if (r.size === void 0)
|
|
2083
2095
|
return;
|
|
2084
|
-
if (!
|
|
2096
|
+
if (!B(r.size))
|
|
2085
2097
|
throw new Error(`sizeof: wrong element size=${e}`);
|
|
2086
2098
|
e += r.size;
|
|
2087
2099
|
}
|
|
2088
2100
|
return e;
|
|
2089
2101
|
}
|
|
2090
|
-
function
|
|
2091
|
-
if (!
|
|
2102
|
+
function g(t) {
|
|
2103
|
+
if (!L(t))
|
|
2092
2104
|
throw new Error(`struct: expected plain object, got ${t}`);
|
|
2093
2105
|
for (const e in t)
|
|
2094
2106
|
if (!I(t[e]))
|
|
@@ -2170,7 +2182,7 @@ function te(t, e) {
|
|
|
2170
2182
|
function Te(t, e) {
|
|
2171
2183
|
if (!I(t))
|
|
2172
2184
|
throw new Error(`map: invalid inner value ${t}`);
|
|
2173
|
-
if (!
|
|
2185
|
+
if (!L(e))
|
|
2174
2186
|
throw new Error("map: variants should be plain object");
|
|
2175
2187
|
const r = /* @__PURE__ */ new Map();
|
|
2176
2188
|
for (const n in e)
|
|
@@ -2196,7 +2208,7 @@ function Te(t, e) {
|
|
|
2196
2208
|
function kn(t, e) {
|
|
2197
2209
|
if (!I(t))
|
|
2198
2210
|
throw new Error(`tag: invalid tag value ${t}`);
|
|
2199
|
-
if (!
|
|
2211
|
+
if (!L(e))
|
|
2200
2212
|
throw new Error("tag: variants should be plain object");
|
|
2201
2213
|
for (const r in e)
|
|
2202
2214
|
if (!I(e[r]))
|
|
@@ -2222,29 +2234,29 @@ function kn(t, e) {
|
|
|
2222
2234
|
});
|
|
2223
2235
|
}
|
|
2224
2236
|
const _n = (t) => 0;
|
|
2225
|
-
function
|
|
2237
|
+
function we(t, e) {
|
|
2226
2238
|
return e % t === 0 ? 0 : t - e % t;
|
|
2227
2239
|
}
|
|
2228
2240
|
function xt(t, e, r) {
|
|
2229
2241
|
if (!I(e))
|
|
2230
2242
|
throw new Error(`padRight: invalid inner value ${e}`);
|
|
2231
|
-
if (!
|
|
2243
|
+
if (!B(t) || t <= 0)
|
|
2232
2244
|
throw new Error(`padLeft: wrong blockSize=${t}`);
|
|
2233
2245
|
if (r !== void 0 && typeof r != "function")
|
|
2234
2246
|
throw new Error(`padRight: wrong padFn=${typeof r}`);
|
|
2235
2247
|
const n = r || _n;
|
|
2236
2248
|
return x({
|
|
2237
|
-
size: e.size ? e.size +
|
|
2249
|
+
size: e.size ? e.size + we(t, e.size) : void 0,
|
|
2238
2250
|
encodeStream: (s, o) => {
|
|
2239
2251
|
const a = s, i = a.pos;
|
|
2240
2252
|
e.encodeStream(s, o);
|
|
2241
|
-
const l =
|
|
2253
|
+
const l = we(t, a.pos - i);
|
|
2242
2254
|
for (let c = 0; c < l; c++)
|
|
2243
2255
|
s.byte(n(c));
|
|
2244
2256
|
},
|
|
2245
2257
|
decodeStream: (s) => {
|
|
2246
2258
|
const o = s.pos, a = e.decodeStream(s);
|
|
2247
|
-
return s.bytes(
|
|
2259
|
+
return s.bytes(we(t, s.pos - o)), a;
|
|
2248
2260
|
}
|
|
2249
2261
|
});
|
|
2250
2262
|
}
|
|
@@ -2271,13 +2283,13 @@ const An = 9, pe = H.decimal(An), K = x({
|
|
|
2271
2283
|
encodeStream: (e, r) => t.encodeStream(e, ke.decode(r)),
|
|
2272
2284
|
decodeStream: (e) => ke.encode(t.decodeStream(e))
|
|
2273
2285
|
});
|
|
2274
|
-
}, y = En(), vn =
|
|
2286
|
+
}, y = En(), vn = g({
|
|
2275
2287
|
requiredSignatures: $,
|
|
2276
2288
|
readSigned: $,
|
|
2277
2289
|
readUnsigned: $,
|
|
2278
2290
|
keys: te(K, y),
|
|
2279
2291
|
blockhash: y,
|
|
2280
|
-
instructions: te(K,
|
|
2292
|
+
instructions: te(K, g({ programIdx: $, keys: te(K, $), data: le(K) }))
|
|
2281
2293
|
});
|
|
2282
2294
|
function xn(t) {
|
|
2283
2295
|
if (ke.decode(t).length !== 32)
|
|
@@ -2286,14 +2298,14 @@ function xn(t) {
|
|
|
2286
2298
|
const $n = (t, e, r, n, s) => ({
|
|
2287
2299
|
sign: t < e,
|
|
2288
2300
|
write: t < e - r || t >= e && t < s - n
|
|
2289
|
-
}), Ze =
|
|
2301
|
+
}), Ze = g({
|
|
2290
2302
|
signatures: te(K, le(64)),
|
|
2291
2303
|
msg: vn
|
|
2292
2304
|
}), ve = x({
|
|
2293
2305
|
encodeStream: (t, e) => {
|
|
2294
2306
|
const { msg: r, signatures: n } = e, s = {}, o = (h, f, u) => {
|
|
2295
|
-
let
|
|
2296
|
-
|
|
2307
|
+
let w = s[h] || (s[h] = { sign: !1, write: !1 });
|
|
2308
|
+
w.write || (w.write = u), w.sign || (w.sign = f);
|
|
2297
2309
|
};
|
|
2298
2310
|
o(r.feePayer, !0, !0);
|
|
2299
2311
|
for (let h of r.instructions)
|
|
@@ -2370,10 +2382,10 @@ function Ue(t, e, r) {
|
|
|
2370
2382
|
if (f.length !== i.keys.length)
|
|
2371
2383
|
throw new Error("SOL.parseInstruction: Keys length mismatch");
|
|
2372
2384
|
for (let u = 0; u < f.length; u++) {
|
|
2373
|
-
const
|
|
2374
|
-
if (r[c].keys[
|
|
2375
|
-
if (r[c].keys[
|
|
2376
|
-
throw new Error(`SOL.parseInstruction(${t}/${c}): Invalid constant address for key exp=${r[c].keys[
|
|
2385
|
+
const w = f[u];
|
|
2386
|
+
if (r[c].keys[w].address) {
|
|
2387
|
+
if (r[c].keys[w].address !== i.keys[u].address)
|
|
2388
|
+
throw new Error(`SOL.parseInstruction(${t}/${c}): Invalid constant address for key exp=${r[c].keys[w].address} got=${i.keys[u].address}`);
|
|
2377
2389
|
continue;
|
|
2378
2390
|
}
|
|
2379
2391
|
h.info[f[u]] = i.keys[u].address;
|
|
@@ -2394,7 +2406,7 @@ function Ue(t, e, r) {
|
|
|
2394
2406
|
}
|
|
2395
2407
|
const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent111111111111111111111111111111111", $t = "11111111111111111111111111111111", It = Ue($t, ie, {
|
|
2396
2408
|
createAccount: {
|
|
2397
|
-
coder:
|
|
2409
|
+
coder: g({ lamports: b, space: b, owner: y }),
|
|
2398
2410
|
keys: {
|
|
2399
2411
|
source: { sign: !0, write: !0 },
|
|
2400
2412
|
newAccount: { sign: !0, write: !0 }
|
|
@@ -2402,17 +2414,17 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2402
2414
|
hint: (t) => `Create new account=${t.newAccount} with balance of ${pe.encode(t.lamports)} and owner program ${t.owner}, using funding account ${t.source}`
|
|
2403
2415
|
},
|
|
2404
2416
|
assign: {
|
|
2405
|
-
coder:
|
|
2417
|
+
coder: g({ owner: y }),
|
|
2406
2418
|
keys: { account: { sign: !0, write: !0 } },
|
|
2407
2419
|
hint: (t) => `Assign account=${t.account} to owner program=${t.owner}`
|
|
2408
2420
|
},
|
|
2409
2421
|
transfer: {
|
|
2410
|
-
coder:
|
|
2422
|
+
coder: g({ lamports: b }),
|
|
2411
2423
|
keys: { source: { sign: !0, write: !0 }, destination: { sign: !1, write: !0 } },
|
|
2412
2424
|
hint: (t) => `Transfer ${pe.encode(t.lamports)} SOL from ${t.source} to ${t.destination}`
|
|
2413
2425
|
},
|
|
2414
2426
|
createAccountWithSeed: {
|
|
2415
|
-
coder:
|
|
2427
|
+
coder: g({
|
|
2416
2428
|
base: y,
|
|
2417
2429
|
seed: ee,
|
|
2418
2430
|
lamports: b,
|
|
@@ -2426,7 +2438,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2426
2438
|
}
|
|
2427
2439
|
},
|
|
2428
2440
|
advanceNonce: {
|
|
2429
|
-
coder:
|
|
2441
|
+
coder: g({}),
|
|
2430
2442
|
keys: {
|
|
2431
2443
|
nonceAccount: { sign: !1, write: !0 },
|
|
2432
2444
|
_recent_bh: { address: ye, sign: !1, write: !1 },
|
|
@@ -2435,7 +2447,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2435
2447
|
hint: (t) => `Consume nonce in nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority})`
|
|
2436
2448
|
},
|
|
2437
2449
|
withdrawFromNonce: {
|
|
2438
|
-
coder:
|
|
2450
|
+
coder: g({ lamports: b }),
|
|
2439
2451
|
keys: {
|
|
2440
2452
|
nonceAccount: { sign: !1, write: !0 },
|
|
2441
2453
|
destination: { sign: !1, write: !0 },
|
|
@@ -2446,7 +2458,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2446
2458
|
hint: (t) => `Withdraw ${pe.encode(t.lamports)} SOL from nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority}) to ${t.destination}`
|
|
2447
2459
|
},
|
|
2448
2460
|
initializeNonce: {
|
|
2449
|
-
coder:
|
|
2461
|
+
coder: g({ nonceAuthority: y }),
|
|
2450
2462
|
keys: {
|
|
2451
2463
|
nonceAccount: { sign: !1, write: !0 },
|
|
2452
2464
|
_recent_bh: { address: ye, sign: !1, write: !1 },
|
|
@@ -2454,7 +2466,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2454
2466
|
}
|
|
2455
2467
|
},
|
|
2456
2468
|
authorizeNonce: {
|
|
2457
|
-
coder:
|
|
2469
|
+
coder: g({ newAuthorized: y }),
|
|
2458
2470
|
keys: {
|
|
2459
2471
|
nonceAccount: { sign: !1, write: !0 },
|
|
2460
2472
|
nonceAuthority: { sign: !0, write: !1 }
|
|
@@ -2462,13 +2474,13 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2462
2474
|
hint: (t) => `Change owner of nonce account=${t.nonceAccount} from ${t.nonceAuthority} to ${t.newAuthorized}`
|
|
2463
2475
|
},
|
|
2464
2476
|
allocate: {
|
|
2465
|
-
coder:
|
|
2477
|
+
coder: g({ space: b }),
|
|
2466
2478
|
keys: {
|
|
2467
2479
|
account: { sign: !0, write: !0 }
|
|
2468
2480
|
}
|
|
2469
2481
|
},
|
|
2470
2482
|
allocateWithSeed: {
|
|
2471
|
-
coder:
|
|
2483
|
+
coder: g({
|
|
2472
2484
|
base: y,
|
|
2473
2485
|
seed: ee,
|
|
2474
2486
|
space: b,
|
|
@@ -2480,7 +2492,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2480
2492
|
}
|
|
2481
2493
|
},
|
|
2482
2494
|
assignWithSeed: {
|
|
2483
|
-
coder:
|
|
2495
|
+
coder: g({
|
|
2484
2496
|
base: y,
|
|
2485
2497
|
seed: ee,
|
|
2486
2498
|
owner: y
|
|
@@ -2491,7 +2503,7 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", D = "SysvarRent1111111
|
|
|
2491
2503
|
}
|
|
2492
2504
|
},
|
|
2493
2505
|
transferWithSeed: {
|
|
2494
|
-
coder:
|
|
2506
|
+
coder: g({
|
|
2495
2507
|
lamports: b,
|
|
2496
2508
|
sourceSeed: ee,
|
|
2497
2509
|
sourceOwner: y
|
|
@@ -2511,10 +2523,10 @@ const In = Te($, {
|
|
|
2511
2523
|
FreezeAccount: 1,
|
|
2512
2524
|
AccountOwner: 2,
|
|
2513
2525
|
CloseAccount: 3
|
|
2514
|
-
}), U = (t, e) => e[t]?.symbol || t,
|
|
2515
|
-
Ue(
|
|
2526
|
+
}), U = (t, e) => e[t]?.symbol || t, Ct = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2527
|
+
Ue(Ct, $, {
|
|
2516
2528
|
initializeMint: {
|
|
2517
|
-
coder:
|
|
2529
|
+
coder: g({
|
|
2518
2530
|
decimals: $,
|
|
2519
2531
|
mintAuthority: y,
|
|
2520
2532
|
freezeAuthority: q(Ee, y, "11111111111111111111111111111111")
|
|
@@ -2525,7 +2537,7 @@ Ue(Bt, $, {
|
|
|
2525
2537
|
}
|
|
2526
2538
|
},
|
|
2527
2539
|
initializeAccount: {
|
|
2528
|
-
coder:
|
|
2540
|
+
coder: g({}),
|
|
2529
2541
|
keys: {
|
|
2530
2542
|
account: { sign: !1, write: !0 },
|
|
2531
2543
|
mint: { sign: !1, write: !1 },
|
|
@@ -2536,7 +2548,7 @@ Ue(Bt, $, {
|
|
|
2536
2548
|
},
|
|
2537
2549
|
// TODO: multisig support?
|
|
2538
2550
|
initializeMultisig: {
|
|
2539
|
-
coder:
|
|
2551
|
+
coder: g({ m: $ }),
|
|
2540
2552
|
keys: {
|
|
2541
2553
|
account: { sign: !1, write: !0 },
|
|
2542
2554
|
_rent: { address: D, sign: !1, write: !1 }
|
|
@@ -2544,7 +2556,7 @@ Ue(Bt, $, {
|
|
|
2544
2556
|
hint: (t, e) => `Initialize multi-sig token account=${t.account} with signatures=${t.m}`
|
|
2545
2557
|
},
|
|
2546
2558
|
transfer: {
|
|
2547
|
-
coder:
|
|
2559
|
+
coder: g({ amount: b }),
|
|
2548
2560
|
keys: {
|
|
2549
2561
|
source: { sign: !1, write: !0 },
|
|
2550
2562
|
destination: { sign: !1, write: !0 },
|
|
@@ -2553,7 +2565,7 @@ Ue(Bt, $, {
|
|
|
2553
2565
|
hint: (t, e) => `Transfer ${t.amount} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
|
|
2554
2566
|
},
|
|
2555
2567
|
approve: {
|
|
2556
|
-
coder:
|
|
2568
|
+
coder: g({ amount: b }),
|
|
2557
2569
|
keys: {
|
|
2558
2570
|
account: { sign: !1, write: !0 },
|
|
2559
2571
|
delegate: { sign: !1, write: !1 },
|
|
@@ -2562,7 +2574,7 @@ Ue(Bt, $, {
|
|
|
2562
2574
|
hint: (t, e) => `Approve authority of delegate=${t.delegate} over tokens on account=${t.account} on behalf of owner=${t.owner}`
|
|
2563
2575
|
},
|
|
2564
2576
|
revoke: {
|
|
2565
|
-
coder:
|
|
2577
|
+
coder: g({}),
|
|
2566
2578
|
keys: {
|
|
2567
2579
|
account: { sign: !1, write: !0 },
|
|
2568
2580
|
owner: { sign: !0, write: !1 }
|
|
@@ -2570,7 +2582,7 @@ Ue(Bt, $, {
|
|
|
2570
2582
|
hint: (t, e) => `Revoke delegate's authority over tokens on account=${t.account} on behalf of owner=${t.owner}`
|
|
2571
2583
|
},
|
|
2572
2584
|
setAuthority: {
|
|
2573
|
-
coder:
|
|
2585
|
+
coder: g({
|
|
2574
2586
|
authorityType: In,
|
|
2575
2587
|
newAuthority: q(Ee, y, "11111111111111111111111111111111")
|
|
2576
2588
|
}),
|
|
@@ -2581,7 +2593,7 @@ Ue(Bt, $, {
|
|
|
2581
2593
|
hint: (t, e) => `Sets a new authority=${t.newAuthority} of a mint or account=${t.account}. Current authority=${t.currentAuthority}. Authority Type: ${t.authorityType}`
|
|
2582
2594
|
},
|
|
2583
2595
|
mintTo: {
|
|
2584
|
-
coder:
|
|
2596
|
+
coder: g({ amount: b }),
|
|
2585
2597
|
keys: {
|
|
2586
2598
|
mint: { sign: !1, write: !0 },
|
|
2587
2599
|
dest: { sign: !1, write: !0 },
|
|
@@ -2589,7 +2601,7 @@ Ue(Bt, $, {
|
|
|
2589
2601
|
}
|
|
2590
2602
|
},
|
|
2591
2603
|
burn: {
|
|
2592
|
-
coder:
|
|
2604
|
+
coder: g({ amount: b }),
|
|
2593
2605
|
keys: {
|
|
2594
2606
|
account: { sign: !1, write: !0 },
|
|
2595
2607
|
mint: { sign: !1, write: !0 },
|
|
@@ -2598,7 +2610,7 @@ Ue(Bt, $, {
|
|
|
2598
2610
|
hint: (t, e) => `Burn ${t.amount} tokens from account=${t.account} of owner=${t.owner} mint=${t.mint}`
|
|
2599
2611
|
},
|
|
2600
2612
|
closeAccount: {
|
|
2601
|
-
coder:
|
|
2613
|
+
coder: g({}),
|
|
2602
2614
|
keys: {
|
|
2603
2615
|
account: { sign: !1, write: !0 },
|
|
2604
2616
|
dest: { sign: !1, write: !0 },
|
|
@@ -2607,7 +2619,7 @@ Ue(Bt, $, {
|
|
|
2607
2619
|
hint: (t, e) => `Close token account=${t.account} of owner=${t.owner}, transferring all its SOL to destionation account=${t.dest}`
|
|
2608
2620
|
},
|
|
2609
2621
|
freezeAccount: {
|
|
2610
|
-
coder:
|
|
2622
|
+
coder: g({}),
|
|
2611
2623
|
keys: {
|
|
2612
2624
|
account: { sign: !1, write: !0 },
|
|
2613
2625
|
mint: { sign: !1, write: !0 },
|
|
@@ -2616,7 +2628,7 @@ Ue(Bt, $, {
|
|
|
2616
2628
|
hint: (t, e) => `Freeze token account=${t.account} of mint=${t.mint} using freeze_authority=${t.authority}`
|
|
2617
2629
|
},
|
|
2618
2630
|
thawAccount: {
|
|
2619
|
-
coder:
|
|
2631
|
+
coder: g({}),
|
|
2620
2632
|
keys: {
|
|
2621
2633
|
account: { sign: !1, write: !0 },
|
|
2622
2634
|
mint: { sign: !1, write: !1 },
|
|
@@ -2625,7 +2637,7 @@ Ue(Bt, $, {
|
|
|
2625
2637
|
hint: (t, e) => `Thaw a frozne token account=${t.account} of mint=${t.mint} using freeze_authority=${t.authority}`
|
|
2626
2638
|
},
|
|
2627
2639
|
transferChecked: {
|
|
2628
|
-
coder:
|
|
2640
|
+
coder: g({ amount: b, decimals: $ }),
|
|
2629
2641
|
keys: {
|
|
2630
2642
|
source: { sign: !1, write: !0 },
|
|
2631
2643
|
mint: { sign: !1, write: !1 },
|
|
@@ -2635,7 +2647,7 @@ Ue(Bt, $, {
|
|
|
2635
2647
|
hint: (t, e) => `Transfer ${H.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
|
|
2636
2648
|
},
|
|
2637
2649
|
approveChecked: {
|
|
2638
|
-
coder:
|
|
2650
|
+
coder: g({ amount: b, decimals: $ }),
|
|
2639
2651
|
keys: {
|
|
2640
2652
|
source: { sign: !1, write: !0 },
|
|
2641
2653
|
mint: { sign: !1, write: !1 },
|
|
@@ -2645,7 +2657,7 @@ Ue(Bt, $, {
|
|
|
2645
2657
|
hint: (t, e) => `Approve delgate=${t.delegate} authority on behalf account=${t.source} owner=${t.owner} over ${H.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}`
|
|
2646
2658
|
},
|
|
2647
2659
|
mintToChecked: {
|
|
2648
|
-
coder:
|
|
2660
|
+
coder: g({ amount: b, decimals: $ }),
|
|
2649
2661
|
keys: {
|
|
2650
2662
|
mint: { sign: !1, write: !0 },
|
|
2651
2663
|
dest: { sign: !1, write: !0 },
|
|
@@ -2654,7 +2666,7 @@ Ue(Bt, $, {
|
|
|
2654
2666
|
hint: (t, e) => `Mint new tokens (${H.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}) to account=${t.dest} using authority=${t.authority}`
|
|
2655
2667
|
},
|
|
2656
2668
|
burnChecked: {
|
|
2657
|
-
coder:
|
|
2669
|
+
coder: g({ amount: b, decimals: $ }),
|
|
2658
2670
|
keys: {
|
|
2659
2671
|
mint: { sign: !1, write: !0 },
|
|
2660
2672
|
account: { sign: !1, write: !0 },
|
|
@@ -2663,7 +2675,7 @@ Ue(Bt, $, {
|
|
|
2663
2675
|
hint: (t, e) => `Burn tokens (${H.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}) on account=${t.account} of owner=${t.owner}`
|
|
2664
2676
|
},
|
|
2665
2677
|
initializeAccount2: {
|
|
2666
|
-
coder:
|
|
2678
|
+
coder: g({ owner: y }),
|
|
2667
2679
|
keys: {
|
|
2668
2680
|
account: { sign: !1, write: !0 },
|
|
2669
2681
|
mint: { sign: !1, write: !1 },
|
|
@@ -2672,12 +2684,12 @@ Ue(Bt, $, {
|
|
|
2672
2684
|
hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${U(t.mint, e)}`
|
|
2673
2685
|
},
|
|
2674
2686
|
syncNative: {
|
|
2675
|
-
coder:
|
|
2687
|
+
coder: g({}),
|
|
2676
2688
|
keys: { nativeAccount: { sign: !1, write: !0 } },
|
|
2677
2689
|
hint: (t) => `Sync SOL balance for wrapped account ${t.nativeAccount}`
|
|
2678
2690
|
}
|
|
2679
2691
|
});
|
|
2680
|
-
|
|
2692
|
+
g({
|
|
2681
2693
|
version: ie,
|
|
2682
2694
|
state: ie,
|
|
2683
2695
|
authority: y,
|
|
@@ -2687,21 +2699,21 @@ w({
|
|
|
2687
2699
|
const Sn = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
2688
2700
|
Ue(Sn, mn(0), {
|
|
2689
2701
|
create: {
|
|
2690
|
-
coder:
|
|
2702
|
+
coder: g({}),
|
|
2691
2703
|
keys: {
|
|
2692
2704
|
source: { sign: !0, write: !0 },
|
|
2693
2705
|
account: { sign: !1, write: !0 },
|
|
2694
2706
|
wallet: { sign: !1, write: !1 },
|
|
2695
2707
|
mint: { sign: !1, write: !1 },
|
|
2696
2708
|
_sys: { address: $t, sign: !1, write: !1 },
|
|
2697
|
-
_token: { address:
|
|
2709
|
+
_token: { address: Ct, sign: !1, write: !1 },
|
|
2698
2710
|
_rent: { address: D, sign: !1, write: !1 }
|
|
2699
2711
|
},
|
|
2700
2712
|
hint: (t, e) => `Initialize associated token account=${t.account} with owner=${t.wallet} for token=${U(t.mint, e)}, payed by ${t.source}`
|
|
2701
2713
|
}
|
|
2702
2714
|
});
|
|
2703
2715
|
const me = xt(4, Ee, () => 0);
|
|
2704
|
-
|
|
2716
|
+
g({
|
|
2705
2717
|
mint: y,
|
|
2706
2718
|
owner: y,
|
|
2707
2719
|
amount: b,
|
|
@@ -2723,7 +2735,7 @@ function tt(t, e, r) {
|
|
|
2723
2735
|
signatures: {}
|
|
2724
2736
|
}));
|
|
2725
2737
|
}
|
|
2726
|
-
function
|
|
2738
|
+
function Cn(t) {
|
|
2727
2739
|
if (t.length >= 255)
|
|
2728
2740
|
throw new TypeError("Alphabet too long");
|
|
2729
2741
|
const e = new Uint8Array(256);
|
|
@@ -2745,20 +2757,20 @@ function Bn(t) {
|
|
|
2745
2757
|
const u = c.length;
|
|
2746
2758
|
for (; f !== u && c[f] === 0; )
|
|
2747
2759
|
f++, d++;
|
|
2748
|
-
const
|
|
2760
|
+
const w = (u - f) * o + 1 >>> 0, k = new Uint8Array(w);
|
|
2749
2761
|
for (; f !== u; ) {
|
|
2750
2762
|
let _ = c[f], p = 0;
|
|
2751
|
-
for (let E =
|
|
2763
|
+
for (let E = w - 1; (_ !== 0 || p < h) && E !== -1; E--, p++)
|
|
2752
2764
|
_ += 256 * k[E] >>> 0, k[E] = _ % r >>> 0, _ = _ / r >>> 0;
|
|
2753
2765
|
if (_ !== 0)
|
|
2754
2766
|
throw new Error("Non-zero carry");
|
|
2755
2767
|
h = p, f++;
|
|
2756
2768
|
}
|
|
2757
|
-
let m =
|
|
2758
|
-
for (; m !==
|
|
2769
|
+
let m = w - h;
|
|
2770
|
+
for (; m !== w && k[m] === 0; )
|
|
2759
2771
|
m++;
|
|
2760
2772
|
let S = n.repeat(d);
|
|
2761
|
-
for (; m <
|
|
2773
|
+
for (; m < w; ++m)
|
|
2762
2774
|
S += t.charAt(k[m]);
|
|
2763
2775
|
return S;
|
|
2764
2776
|
}
|
|
@@ -2770,7 +2782,7 @@ function Bn(t) {
|
|
|
2770
2782
|
let d = 0, h = 0, f = 0;
|
|
2771
2783
|
for (; c[d] === n; )
|
|
2772
2784
|
h++, d++;
|
|
2773
|
-
const u = (c.length - d) * s + 1 >>> 0,
|
|
2785
|
+
const u = (c.length - d) * s + 1 >>> 0, w = new Uint8Array(u);
|
|
2774
2786
|
for (; d < c.length; ) {
|
|
2775
2787
|
const _ = c.charCodeAt(d);
|
|
2776
2788
|
if (_ > 255)
|
|
@@ -2779,19 +2791,19 @@ function Bn(t) {
|
|
|
2779
2791
|
if (p === 255)
|
|
2780
2792
|
return;
|
|
2781
2793
|
let E = 0;
|
|
2782
|
-
for (let
|
|
2783
|
-
p += r *
|
|
2794
|
+
for (let C = u - 1; (p !== 0 || E < f) && C !== -1; C--, E++)
|
|
2795
|
+
p += r * w[C] >>> 0, w[C] = p % 256 >>> 0, p = p / 256 >>> 0;
|
|
2784
2796
|
if (p !== 0)
|
|
2785
2797
|
throw new Error("Non-zero carry");
|
|
2786
2798
|
f = E, d++;
|
|
2787
2799
|
}
|
|
2788
2800
|
let k = u - f;
|
|
2789
|
-
for (; k !== u &&
|
|
2801
|
+
for (; k !== u && w[k] === 0; )
|
|
2790
2802
|
k++;
|
|
2791
2803
|
const m = new Uint8Array(h + (u - k));
|
|
2792
2804
|
let S = h;
|
|
2793
2805
|
for (; k !== u; )
|
|
2794
|
-
m[S++] =
|
|
2806
|
+
m[S++] = w[k++];
|
|
2795
2807
|
return m;
|
|
2796
2808
|
}
|
|
2797
2809
|
function l(c) {
|
|
@@ -2806,8 +2818,8 @@ function Bn(t) {
|
|
|
2806
2818
|
decode: l
|
|
2807
2819
|
};
|
|
2808
2820
|
}
|
|
2809
|
-
var
|
|
2810
|
-
Bn
|
|
2821
|
+
var Bn = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2822
|
+
Cn(Bn);
|
|
2811
2823
|
class ze {
|
|
2812
2824
|
_transaction;
|
|
2813
2825
|
signatures = [];
|
|
@@ -2847,7 +2859,7 @@ class ze {
|
|
|
2847
2859
|
return Buffer.from(e, "hex");
|
|
2848
2860
|
}
|
|
2849
2861
|
}
|
|
2850
|
-
class
|
|
2862
|
+
class Pn {
|
|
2851
2863
|
type = "phantom";
|
|
2852
2864
|
platform = "solana";
|
|
2853
2865
|
account = void 0;
|
|
@@ -2968,6 +2980,7 @@ class Rn {
|
|
|
2968
2980
|
wallet = void 0;
|
|
2969
2981
|
account = void 0;
|
|
2970
2982
|
connectedAccounts = [];
|
|
2983
|
+
accountChangeListener = void 0;
|
|
2971
2984
|
isAvailable() {
|
|
2972
2985
|
return typeof window < "u" && !!window.starknet_braavos;
|
|
2973
2986
|
}
|
|
@@ -2997,7 +3010,7 @@ class Rn {
|
|
|
2997
3010
|
});
|
|
2998
3011
|
if (!r || r.length === 0)
|
|
2999
3012
|
throw new Error("No accounts found");
|
|
3000
|
-
return this.wallet = e, this.account = r[0], this.connectedAccounts = r, { success: !0, wallet: this.type, account: this.account };
|
|
3013
|
+
return this.removeAccountChangeListener(), this.wallet = e, this.account = r[0], this.connectedAccounts = r, this.setupAccountChangeListener(), { success: !0, wallet: this.type, account: this.account };
|
|
3001
3014
|
} catch (e) {
|
|
3002
3015
|
return console.error("Error connecting to Braavos:", e), {
|
|
3003
3016
|
success: !1,
|
|
@@ -3083,6 +3096,17 @@ class Rn {
|
|
|
3083
3096
|
error: "waitForTransaction not supported for Braavos wallet"
|
|
3084
3097
|
};
|
|
3085
3098
|
}
|
|
3099
|
+
setupAccountChangeListener() {
|
|
3100
|
+
this.wallet && (this.accountChangeListener = (e) => {
|
|
3101
|
+
e && e.length > 0 ? (this.account = e[0], this.connectedAccounts = e) : (this.account = void 0, this.connectedAccounts = []);
|
|
3102
|
+
}, this.wallet.on("accountsChanged", this.accountChangeListener));
|
|
3103
|
+
}
|
|
3104
|
+
removeAccountChangeListener() {
|
|
3105
|
+
this.wallet && this.accountChangeListener && (this.wallet.off("accountsChanged", this.accountChangeListener), this.accountChangeListener = void 0);
|
|
3106
|
+
}
|
|
3107
|
+
disconnect() {
|
|
3108
|
+
this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
|
|
3109
|
+
}
|
|
3086
3110
|
}
|
|
3087
3111
|
class Tn {
|
|
3088
3112
|
walletAdapters;
|
|
@@ -3091,7 +3115,7 @@ class Tn {
|
|
|
3091
3115
|
return;
|
|
3092
3116
|
const e = new Vr();
|
|
3093
3117
|
e.isAvailable() && this.walletAdapters.set("metamask", e);
|
|
3094
|
-
const r = new
|
|
3118
|
+
const r = new Pn();
|
|
3095
3119
|
r.isAvailable() && this.walletAdapters.set("phantom", r);
|
|
3096
3120
|
const n = new jr();
|
|
3097
3121
|
n.isAvailable() && this.walletAdapters.set("argent", n);
|
|
@@ -3282,7 +3306,7 @@ class Un extends ar {
|
|
|
3282
3306
|
return this.walletBridge;
|
|
3283
3307
|
}
|
|
3284
3308
|
}
|
|
3285
|
-
class
|
|
3309
|
+
class Ln extends Ut {
|
|
3286
3310
|
keychain;
|
|
3287
3311
|
options;
|
|
3288
3312
|
iframes;
|
|
@@ -3325,7 +3349,7 @@ class Mn extends Ut {
|
|
|
3325
3349
|
}
|
|
3326
3350
|
const e = await this.keychain.probe(this.rpcUrl());
|
|
3327
3351
|
let r = e?.rpcUrl || this.rpcUrl();
|
|
3328
|
-
this.account = new
|
|
3352
|
+
this.account = new Le(
|
|
3329
3353
|
this,
|
|
3330
3354
|
r,
|
|
3331
3355
|
e.address,
|
|
@@ -3357,9 +3381,9 @@ class Mn extends Ut {
|
|
|
3357
3381
|
this.rpcUrl(),
|
|
3358
3382
|
this.options.signupOptions
|
|
3359
3383
|
);
|
|
3360
|
-
if (e.code !==
|
|
3384
|
+
if (e.code !== Q.SUCCESS)
|
|
3361
3385
|
throw new Error(e.message);
|
|
3362
|
-
return e = e, this.account = new
|
|
3386
|
+
return e = e, this.account = new Le(
|
|
3363
3387
|
this,
|
|
3364
3388
|
this.rpcUrl(),
|
|
3365
3389
|
e.address,
|
|
@@ -3376,12 +3400,11 @@ class Mn extends Ut {
|
|
|
3376
3400
|
async switchStarknetChain(e) {
|
|
3377
3401
|
if (!this.keychain || !this.iframes.keychain)
|
|
3378
3402
|
return console.error(new v().message), !1;
|
|
3403
|
+
const r = this.selectedChain;
|
|
3379
3404
|
try {
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
} catch (r) {
|
|
3384
|
-
return console.error(r), !1;
|
|
3405
|
+
this.selectedChain = e, await this.keychain.switchChain(this.rpcUrl());
|
|
3406
|
+
} catch (n) {
|
|
3407
|
+
return console.error(n), this.selectedChain = r, !1;
|
|
3385
3408
|
}
|
|
3386
3409
|
return this.emitNetworkChanged(e), !0;
|
|
3387
3410
|
}
|
|
@@ -3472,14 +3495,12 @@ class Mn extends Ut {
|
|
|
3472
3495
|
this.iframes.keychain?.open();
|
|
3473
3496
|
});
|
|
3474
3497
|
}
|
|
3475
|
-
openStarterPack(e) {
|
|
3498
|
+
async openStarterPack(e) {
|
|
3476
3499
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3477
3500
|
console.error(new v().message);
|
|
3478
3501
|
return;
|
|
3479
3502
|
}
|
|
3480
|
-
this.keychain.
|
|
3481
|
-
this.iframes.keychain?.open();
|
|
3482
|
-
});
|
|
3503
|
+
await this.keychain.openStarterPack(e), this.iframes.keychain?.open();
|
|
3483
3504
|
}
|
|
3484
3505
|
async openExecute(e, r) {
|
|
3485
3506
|
if (!this.keychain || !this.iframes.keychain) {
|
|
@@ -3490,7 +3511,7 @@ class Mn extends Ut {
|
|
|
3490
3511
|
r && this.switchStarknetChain(r), this.iframes.keychain.open();
|
|
3491
3512
|
const s = await this.keychain.execute(e, void 0, void 0, !0);
|
|
3492
3513
|
return this.iframes.keychain.close(), r && this.switchStarknetChain(n), {
|
|
3493
|
-
status: !(s && (s.code ===
|
|
3514
|
+
status: !(s && (s.code === Q.NOT_CONNECTED || s.code === Q.CANCELED)),
|
|
3494
3515
|
transactionHash: s?.transaction_hash
|
|
3495
3516
|
};
|
|
3496
3517
|
}
|
|
@@ -3539,7 +3560,7 @@ class Mn extends Ut {
|
|
|
3539
3560
|
}
|
|
3540
3561
|
}
|
|
3541
3562
|
const F = /* @__PURE__ */ new Map();
|
|
3542
|
-
async function
|
|
3563
|
+
async function Bt(t) {
|
|
3543
3564
|
if (!t.addresses?.length && !t.usernames?.length)
|
|
3544
3565
|
return { results: [] };
|
|
3545
3566
|
const e = await fetch(`${Ot}/lookup`, {
|
|
@@ -3553,18 +3574,18 @@ async function Pt(t) {
|
|
|
3553
3574
|
throw new Error(`HTTP error! status: ${e.status}`);
|
|
3554
3575
|
return e.json();
|
|
3555
3576
|
}
|
|
3556
|
-
async function
|
|
3577
|
+
async function Mn(t) {
|
|
3557
3578
|
const e = t.filter((r) => !F.has(r));
|
|
3558
|
-
return e.length > 0 && (await
|
|
3579
|
+
return e.length > 0 && (await Bt({ usernames: e })).results.forEach((n) => {
|
|
3559
3580
|
F.set(n.username, n.addresses[0]);
|
|
3560
3581
|
}), new Map(
|
|
3561
3582
|
t.map((r) => [r, F.get(r)]).filter((r) => r[1] !== void 0)
|
|
3562
3583
|
);
|
|
3563
3584
|
}
|
|
3564
|
-
async function
|
|
3585
|
+
async function Qn(t) {
|
|
3565
3586
|
t = t.map(rt.toHex);
|
|
3566
3587
|
const e = t.filter((r) => !F.has(r));
|
|
3567
|
-
return e.length > 0 && (await
|
|
3588
|
+
return e.length > 0 && (await Bt({
|
|
3568
3589
|
addresses: e
|
|
3569
3590
|
})).results.forEach((n) => {
|
|
3570
3591
|
F.set(n.addresses[0], n.username);
|
|
@@ -4136,7 +4157,7 @@ var zn = [
|
|
|
4136
4157
|
total_supply: null,
|
|
4137
4158
|
logo_url: "https://assets.underware.gg/pistols/fame.svg"
|
|
4138
4159
|
}
|
|
4139
|
-
],
|
|
4160
|
+
], Pt = {
|
|
4140
4161
|
theme: {
|
|
4141
4162
|
name: "Cartridge",
|
|
4142
4163
|
icon: "icon.svg"
|
|
@@ -4203,8 +4224,8 @@ async function Wn() {
|
|
|
4203
4224
|
})
|
|
4204
4225
|
), n;
|
|
4205
4226
|
}
|
|
4206
|
-
|
|
4207
|
-
var Yn = zn, Hn =
|
|
4227
|
+
Pt.theme.icon = "https://static.cartridge.gg/presets/cartridge/icon.svg";
|
|
4228
|
+
var Yn = zn, Hn = Pt.theme;
|
|
4208
4229
|
export {
|
|
4209
4230
|
jr as ArgentWallet,
|
|
4210
4231
|
Kr as BaseWallet,
|
|
@@ -4213,25 +4234,26 @@ export {
|
|
|
4213
4234
|
qn as FeeSource,
|
|
4214
4235
|
Vr as MetaMaskWallet,
|
|
4215
4236
|
v as NotReadyToConnect,
|
|
4216
|
-
|
|
4237
|
+
Pn as PhantomWallet,
|
|
4217
4238
|
Nn as RabbyWallet,
|
|
4218
|
-
|
|
4239
|
+
Q as ResponseCodes,
|
|
4240
|
+
Gn as StarterPackItemType,
|
|
4219
4241
|
Tn as WalletBridge,
|
|
4220
4242
|
fe as chainIdToPlatform,
|
|
4221
|
-
|
|
4243
|
+
Ln as default,
|
|
4222
4244
|
Hn as defaultTheme,
|
|
4223
4245
|
Yn as erc20Metadata,
|
|
4224
4246
|
Fn as getAvailableConfigs,
|
|
4225
4247
|
De as getConfigsIndex,
|
|
4226
|
-
|
|
4248
|
+
Xn as humanizeString,
|
|
4227
4249
|
Wn as loadAllConfigs,
|
|
4228
4250
|
jn as loadConfig,
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4251
|
+
Qn as lookupAddresses,
|
|
4252
|
+
Mn as lookupUsernames,
|
|
4253
|
+
Jn as normalizeCalls,
|
|
4232
4254
|
zt as parseChainId,
|
|
4233
4255
|
Rt as toArray,
|
|
4234
|
-
|
|
4235
|
-
|
|
4256
|
+
Zn as toSessionPolicies,
|
|
4257
|
+
es as toWasmPolicies
|
|
4236
4258
|
};
|
|
4237
4259
|
//# sourceMappingURL=index.js.map
|