@cartridge/controller 0.8.0 → 0.9.1
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 +2 -3
- package/dist/iframe/base.d.ts +1 -0
- package/dist/iframe/index.d.ts +0 -1
- package/dist/iframe/keychain.d.ts +4 -2
- package/dist/index.js +466 -518
- 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-iltRv2Q1.js} +21 -22
- package/dist/provider-iltRv2Q1.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 +4 -8
- 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 +7 -6
- package/src/account.ts +5 -8
- package/src/controller.ts +32 -74
- package/src/iframe/base.ts +6 -24
- package/src/iframe/index.ts +0 -1
- package/src/iframe/keychain.ts +32 -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 +3 -11
- 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/iframe/profile.d.ts +0 -12
- package/dist/provider-ClUbos7A.js.map +0 -1
- package/src/iframe/profile.ts +0 -59
package/dist/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { WalletAccount as
|
|
2
|
-
import { R
|
|
3
|
-
import { F as
|
|
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 me, constants as $, shortString as W, num as ye } from "starknet";
|
|
2
|
+
import { R, t as be, K as we, B as _e, v as ke, N as p, p as Ae, A as Ie } from "./provider-iltRv2Q1.js";
|
|
3
|
+
import { F as tr, h as rr, n as nr, a as sr, b as or } from "./provider-iltRv2Q1.js";
|
|
4
|
+
import { connect as ve } from "starknetkit";
|
|
5
|
+
import { InjectedConnector as Ee } from "starknetkit/injected";
|
|
6
|
+
import { MetaMaskSDK as xe } from "@metamask/sdk";
|
|
7
|
+
import { Transaction as Ce } from "@solana/web3.js";
|
|
8
|
+
class H extends me {
|
|
10
9
|
keychain;
|
|
11
10
|
modal;
|
|
12
11
|
options;
|
|
13
|
-
constructor(e, t, n,
|
|
14
|
-
super({ nodeUrl: t }, e
|
|
12
|
+
constructor(e, t, n, s, o, a) {
|
|
13
|
+
super({ nodeUrl: t }, e, n), this.keychain = s, this.options = o, this.modal = a;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Invoke execute function in account contract
|
|
@@ -27,34 +26,34 @@ class H extends ge {
|
|
|
27
26
|
*/
|
|
28
27
|
async execute(e) {
|
|
29
28
|
return e = be(e), new Promise(async (t, n) => {
|
|
30
|
-
const
|
|
29
|
+
const s = await this.keychain.execute(
|
|
31
30
|
e,
|
|
32
31
|
void 0,
|
|
33
32
|
void 0,
|
|
34
33
|
!1,
|
|
35
34
|
this.options?.feeSource
|
|
36
35
|
);
|
|
37
|
-
if (
|
|
38
|
-
t(
|
|
36
|
+
if (s.code === R.SUCCESS) {
|
|
37
|
+
t(s);
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
41
|
-
if (this.options?.propagateSessionErrors &&
|
|
42
|
-
n(
|
|
40
|
+
if (this.options?.propagateSessionErrors && s.code !== R.USER_INTERACTION_REQUIRED) {
|
|
41
|
+
n(s.error);
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
44
|
this.modal.open();
|
|
46
|
-
const
|
|
45
|
+
const o = await this.keychain.execute(
|
|
47
46
|
e,
|
|
48
47
|
void 0,
|
|
49
48
|
void 0,
|
|
50
49
|
!0,
|
|
51
|
-
|
|
50
|
+
s.error
|
|
52
51
|
);
|
|
53
|
-
if (
|
|
54
|
-
t(
|
|
52
|
+
if (o.code === R.SUCCESS) {
|
|
53
|
+
t(o), this.modal.close();
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
|
-
n(
|
|
56
|
+
n(o.error);
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
/**
|
|
@@ -67,29 +66,29 @@ class H extends ge {
|
|
|
67
66
|
*/
|
|
68
67
|
async signMessage(e) {
|
|
69
68
|
return new Promise(async (t, n) => {
|
|
70
|
-
const
|
|
71
|
-
if (!("code" in
|
|
72
|
-
t(
|
|
69
|
+
const s = await this.keychain.signMessage(e, "", !0);
|
|
70
|
+
if (!("code" in s)) {
|
|
71
|
+
t(s);
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
75
74
|
this.modal.open();
|
|
76
|
-
const
|
|
77
|
-
"code" in
|
|
75
|
+
const o = await this.keychain.signMessage(e, "", !1);
|
|
76
|
+
"code" in o ? n(o.error) : t(o), this.modal.close();
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
var
|
|
80
|
+
var b;
|
|
82
81
|
(function(r) {
|
|
83
82
|
r.Call = "call", r.Reply = "reply", r.Syn = "syn", r.SynAck = "synAck", r.Ack = "ack";
|
|
84
|
-
})(
|
|
85
|
-
var
|
|
83
|
+
})(b || (b = {}));
|
|
84
|
+
var v;
|
|
86
85
|
(function(r) {
|
|
87
86
|
r.Fulfilled = "fulfilled", r.Rejected = "rejected";
|
|
88
|
-
})(
|
|
89
|
-
var
|
|
87
|
+
})(v || (v = {}));
|
|
88
|
+
var N;
|
|
90
89
|
(function(r) {
|
|
91
90
|
r.ConnectionDestroyed = "ConnectionDestroyed", r.ConnectionTimeout = "ConnectionTimeout", r.NoIframeSrc = "NoIframeSrc";
|
|
92
|
-
})(
|
|
91
|
+
})(N || (N = {}));
|
|
93
92
|
var z;
|
|
94
93
|
(function(r) {
|
|
95
94
|
r.DataCloneError = "DataCloneError";
|
|
@@ -102,227 +101,227 @@ const Re = (r, e) => {
|
|
|
102
101
|
const t = [];
|
|
103
102
|
let n = !1;
|
|
104
103
|
return {
|
|
105
|
-
destroy(
|
|
106
|
-
n || (n = !0, e(`${r}: Destroying connection`), t.forEach((
|
|
107
|
-
s
|
|
104
|
+
destroy(s) {
|
|
105
|
+
n || (n = !0, e(`${r}: Destroying connection`), t.forEach((o) => {
|
|
106
|
+
o(s);
|
|
108
107
|
}));
|
|
109
108
|
},
|
|
110
|
-
onDestroy(
|
|
111
|
-
n ?
|
|
109
|
+
onDestroy(s) {
|
|
110
|
+
n ? s() : t.push(s);
|
|
112
111
|
}
|
|
113
112
|
};
|
|
114
113
|
}, Se = (r) => (...e) => {
|
|
115
114
|
r && console.log("[Penpal]", ...e);
|
|
116
|
-
},
|
|
115
|
+
}, Pe = {
|
|
117
116
|
"http:": "80",
|
|
118
117
|
"https:": "443"
|
|
119
|
-
}, De = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/,
|
|
120
|
-
if (r &&
|
|
118
|
+
}, De = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, Ne = ["file:", "data:"], Me = (r) => {
|
|
119
|
+
if (r && Ne.find((i) => r.startsWith(i)))
|
|
121
120
|
return "null";
|
|
122
121
|
const e = document.location, t = De.exec(r);
|
|
123
|
-
let n,
|
|
124
|
-
t ? (n = t[1] ? t[1] : e.protocol,
|
|
125
|
-
const a =
|
|
126
|
-
return `${n}//${
|
|
122
|
+
let n, s, o;
|
|
123
|
+
t ? (n = t[1] ? t[1] : e.protocol, s = t[2], o = t[4]) : (n = e.protocol, s = e.hostname, o = e.port);
|
|
124
|
+
const a = o && o !== Pe[n] ? `:${o}` : "";
|
|
125
|
+
return `${n}//${s}${a}`;
|
|
127
126
|
}, K = ({ name: r, message: e, stack: t }) => ({
|
|
128
127
|
name: r,
|
|
129
128
|
message: e,
|
|
130
129
|
stack: t
|
|
131
|
-
}),
|
|
130
|
+
}), Be = (r) => {
|
|
132
131
|
const e = new Error();
|
|
133
132
|
return Object.keys(r).forEach((t) => e[t] = r[t]), e;
|
|
134
133
|
}, Qe = (r, e, t) => {
|
|
135
|
-
const { localName: n, local:
|
|
134
|
+
const { localName: n, local: s, remote: o, originForSending: a, originForReceiving: i } = r;
|
|
136
135
|
let c = !1;
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
136
|
+
const l = (d) => {
|
|
137
|
+
if (d.source !== o || d.data.penpal !== b.Call)
|
|
139
138
|
return;
|
|
140
|
-
if (i !== "*" &&
|
|
141
|
-
t(`${n} received message from origin ${
|
|
139
|
+
if (i !== "*" && d.origin !== i) {
|
|
140
|
+
t(`${n} received message from origin ${d.origin} which did not match expected origin ${i}`);
|
|
142
141
|
return;
|
|
143
142
|
}
|
|
144
|
-
const h =
|
|
145
|
-
t(`${n}: Received ${
|
|
143
|
+
const h = d.data, { methodName: m, args: u, id: _ } = h;
|
|
144
|
+
t(`${n}: Received ${m}() call`);
|
|
146
145
|
const k = (y) => (I) => {
|
|
147
|
-
if (t(`${n}: Sending ${
|
|
148
|
-
t(`${n}: Unable to send ${
|
|
146
|
+
if (t(`${n}: Sending ${m}() reply`), c) {
|
|
147
|
+
t(`${n}: Unable to send ${m}() reply due to destroyed connection`);
|
|
149
148
|
return;
|
|
150
149
|
}
|
|
151
|
-
const
|
|
152
|
-
penpal:
|
|
153
|
-
id:
|
|
150
|
+
const w = {
|
|
151
|
+
penpal: b.Reply,
|
|
152
|
+
id: _,
|
|
154
153
|
resolution: y,
|
|
155
154
|
returnValue: I
|
|
156
155
|
};
|
|
157
|
-
y ===
|
|
156
|
+
y === v.Rejected && I instanceof Error && (w.returnValue = K(I), w.returnValueIsError = !0);
|
|
158
157
|
try {
|
|
159
|
-
|
|
160
|
-
} catch (
|
|
161
|
-
if (
|
|
162
|
-
const
|
|
163
|
-
penpal:
|
|
164
|
-
id:
|
|
165
|
-
resolution:
|
|
166
|
-
returnValue: K(
|
|
158
|
+
o.postMessage(w, a);
|
|
159
|
+
} catch (f) {
|
|
160
|
+
if (f.name === z.DataCloneError) {
|
|
161
|
+
const E = {
|
|
162
|
+
penpal: b.Reply,
|
|
163
|
+
id: _,
|
|
164
|
+
resolution: v.Rejected,
|
|
165
|
+
returnValue: K(f),
|
|
167
166
|
returnValueIsError: !0
|
|
168
167
|
};
|
|
169
|
-
|
|
168
|
+
o.postMessage(E, a);
|
|
170
169
|
}
|
|
171
|
-
throw
|
|
170
|
+
throw f;
|
|
172
171
|
}
|
|
173
172
|
};
|
|
174
|
-
new Promise((y) => y(e[
|
|
173
|
+
new Promise((y) => y(e[m].call(e, d.origin).apply(e, u))).then(k(v.Fulfilled), k(v.Rejected));
|
|
175
174
|
};
|
|
176
|
-
return
|
|
177
|
-
c = !0,
|
|
175
|
+
return s.addEventListener(A.Message, l), () => {
|
|
176
|
+
c = !0, s.removeEventListener(A.Message, l);
|
|
178
177
|
};
|
|
179
178
|
};
|
|
180
|
-
let
|
|
181
|
-
const
|
|
179
|
+
let Ue = 0;
|
|
180
|
+
const Te = () => ++Ue, re = ".", ne = (r) => r ? r.split(re) : [], $e = (r) => r.join(re), ze = (r, e) => {
|
|
182
181
|
const t = ne(e || "");
|
|
183
|
-
return t.push(r),
|
|
184
|
-
},
|
|
182
|
+
return t.push(r), $e(t);
|
|
183
|
+
}, Oe = (r, e, t) => {
|
|
185
184
|
const n = ne(e);
|
|
186
|
-
return n.reduce((
|
|
187
|
-
},
|
|
185
|
+
return n.reduce((s, o, a) => (typeof s[o] > "u" && (s[o] = {}), a === n.length - 1 && (s[o] = t), s[o]), r), r;
|
|
186
|
+
}, se = (r, e) => {
|
|
188
187
|
const t = {};
|
|
189
188
|
return Object.keys(r).forEach((n) => {
|
|
190
|
-
const
|
|
191
|
-
typeof
|
|
189
|
+
const s = r[n], o = ze(n, e);
|
|
190
|
+
typeof s == "object" && Object.assign(t, se(s, o)), typeof s == "function" && (t[o] = s);
|
|
192
191
|
}), t;
|
|
193
|
-
},
|
|
192
|
+
}, Le = (r) => {
|
|
194
193
|
const e = {};
|
|
195
194
|
for (const t in r)
|
|
196
|
-
|
|
195
|
+
Oe(e, t, r[t]);
|
|
197
196
|
return e;
|
|
198
|
-
},
|
|
199
|
-
const { localName:
|
|
200
|
-
let
|
|
201
|
-
|
|
202
|
-
const h = (
|
|
203
|
-
|
|
197
|
+
}, Ye = (r, e, t, n, s) => {
|
|
198
|
+
const { localName: o, local: a, remote: i, originForSending: c, originForReceiving: l } = e;
|
|
199
|
+
let d = !1;
|
|
200
|
+
s(`${o}: Connecting call sender`);
|
|
201
|
+
const h = (u) => (..._) => {
|
|
202
|
+
s(`${o}: Sending ${u}() call`);
|
|
204
203
|
let k;
|
|
205
204
|
try {
|
|
206
205
|
i.closed && (k = !0);
|
|
207
206
|
} catch {
|
|
208
207
|
k = !0;
|
|
209
208
|
}
|
|
210
|
-
if (k && n(),
|
|
211
|
-
const y = new Error(`Unable to send ${
|
|
212
|
-
throw y.code =
|
|
209
|
+
if (k && n(), d) {
|
|
210
|
+
const y = new Error(`Unable to send ${u}() call due to destroyed connection`);
|
|
211
|
+
throw y.code = N.ConnectionDestroyed, y;
|
|
213
212
|
}
|
|
214
213
|
return new Promise((y, I) => {
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
214
|
+
const w = Te(), f = (x) => {
|
|
215
|
+
if (x.source !== i || x.data.penpal !== b.Reply || x.data.id !== w)
|
|
217
216
|
return;
|
|
218
|
-
if (
|
|
219
|
-
|
|
217
|
+
if (l !== "*" && x.origin !== l) {
|
|
218
|
+
s(`${o} received message from origin ${x.origin} which did not match expected origin ${l}`);
|
|
220
219
|
return;
|
|
221
220
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
let T =
|
|
225
|
-
|
|
221
|
+
const U = x.data;
|
|
222
|
+
s(`${o}: Received ${u}() reply`), a.removeEventListener(A.Message, f);
|
|
223
|
+
let T = U.returnValue;
|
|
224
|
+
U.returnValueIsError && (T = Be(T)), (U.resolution === v.Fulfilled ? y : I)(T);
|
|
226
225
|
};
|
|
227
|
-
a.addEventListener(A.Message,
|
|
228
|
-
const
|
|
229
|
-
penpal:
|
|
230
|
-
id:
|
|
231
|
-
methodName:
|
|
232
|
-
args:
|
|
226
|
+
a.addEventListener(A.Message, f);
|
|
227
|
+
const E = {
|
|
228
|
+
penpal: b.Call,
|
|
229
|
+
id: w,
|
|
230
|
+
methodName: u,
|
|
231
|
+
args: _
|
|
233
232
|
};
|
|
234
|
-
i.postMessage(
|
|
233
|
+
i.postMessage(E, c);
|
|
235
234
|
});
|
|
236
|
-
},
|
|
237
|
-
return Object.assign(r,
|
|
238
|
-
|
|
235
|
+
}, m = t.reduce((u, _) => (u[_] = h(_), u), {});
|
|
236
|
+
return Object.assign(r, Le(m)), () => {
|
|
237
|
+
d = !0;
|
|
239
238
|
};
|
|
240
|
-
},
|
|
241
|
-
const { destroy:
|
|
239
|
+
}, Fe = (r, e, t, n, s) => {
|
|
240
|
+
const { destroy: o, onDestroy: a } = n;
|
|
242
241
|
let i, c;
|
|
243
|
-
const
|
|
244
|
-
return (
|
|
245
|
-
if (e !== "*" &&
|
|
246
|
-
|
|
242
|
+
const l = {};
|
|
243
|
+
return (d) => {
|
|
244
|
+
if (e !== "*" && d.origin !== e) {
|
|
245
|
+
s(`Parent: Handshake - Received ACK message from origin ${d.origin} which did not match expected origin ${e}`);
|
|
247
246
|
return;
|
|
248
247
|
}
|
|
249
|
-
|
|
248
|
+
s("Parent: Handshake - Received ACK");
|
|
250
249
|
const h = {
|
|
251
250
|
localName: "Parent",
|
|
252
251
|
local: window,
|
|
253
|
-
remote:
|
|
252
|
+
remote: d.source,
|
|
254
253
|
originForSending: t,
|
|
255
254
|
originForReceiving: e
|
|
256
255
|
};
|
|
257
|
-
i && i(), i = Qe(h, r,
|
|
258
|
-
delete
|
|
259
|
-
}), c =
|
|
260
|
-
const
|
|
261
|
-
return a(
|
|
256
|
+
i && i(), i = Qe(h, r, s), a(i), c && c.forEach((u) => {
|
|
257
|
+
delete l[u];
|
|
258
|
+
}), c = d.data.methodNames;
|
|
259
|
+
const m = Ye(l, h, c, o, s);
|
|
260
|
+
return a(m), l;
|
|
262
261
|
};
|
|
263
|
-
},
|
|
264
|
-
if (!
|
|
262
|
+
}, We = (r, e, t, n) => (s) => {
|
|
263
|
+
if (!s.source)
|
|
265
264
|
return;
|
|
266
|
-
if (t !== "*" &&
|
|
267
|
-
r(`Parent: Handshake - Received SYN message from origin ${
|
|
265
|
+
if (t !== "*" && s.origin !== t) {
|
|
266
|
+
r(`Parent: Handshake - Received SYN message from origin ${s.origin} which did not match expected origin ${t}`);
|
|
268
267
|
return;
|
|
269
268
|
}
|
|
270
269
|
r("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
271
|
-
const
|
|
272
|
-
penpal:
|
|
270
|
+
const o = {
|
|
271
|
+
penpal: b.SynAck,
|
|
273
272
|
methodNames: Object.keys(e)
|
|
274
273
|
};
|
|
275
|
-
|
|
276
|
-
},
|
|
277
|
-
const { destroy: t, onDestroy: n } = e,
|
|
278
|
-
r.isConnected || (clearInterval(
|
|
279
|
-
},
|
|
274
|
+
s.source.postMessage(o, n);
|
|
275
|
+
}, He = 6e4, Ke = (r, e) => {
|
|
276
|
+
const { destroy: t, onDestroy: n } = e, s = setInterval(() => {
|
|
277
|
+
r.isConnected || (clearInterval(s), t());
|
|
278
|
+
}, He);
|
|
280
279
|
n(() => {
|
|
281
|
-
clearInterval(
|
|
280
|
+
clearInterval(s);
|
|
282
281
|
});
|
|
283
|
-
},
|
|
282
|
+
}, je = (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`);
|
|
287
|
-
n.code =
|
|
286
|
+
n.code = N.ConnectionTimeout, e(n);
|
|
288
287
|
}, r)), () => {
|
|
289
288
|
clearTimeout(t);
|
|
290
289
|
};
|
|
291
|
-
},
|
|
290
|
+
}, qe = (r) => {
|
|
292
291
|
if (!r.src && !r.srcdoc) {
|
|
293
292
|
const e = new Error("Iframe must have src or srcdoc property defined.");
|
|
294
|
-
throw e.code =
|
|
293
|
+
throw e.code = N.NoIframeSrc, e;
|
|
295
294
|
}
|
|
296
|
-
},
|
|
297
|
-
let { iframe: e, methods: t = {}, childOrigin: n, timeout:
|
|
298
|
-
const a = Se(
|
|
299
|
-
n || (
|
|
300
|
-
const
|
|
295
|
+
}, Xe = (r) => {
|
|
296
|
+
let { iframe: e, methods: t = {}, childOrigin: n, timeout: s, debug: o = !1 } = r;
|
|
297
|
+
const a = Se(o), i = Re("Parent", a), { onDestroy: c, destroy: l } = i;
|
|
298
|
+
n || (qe(e), n = Me(e.src));
|
|
299
|
+
const d = n === "null" ? "*" : n, h = se(t), m = We(a, h, n, d), u = Fe(h, n, d, i, a);
|
|
301
300
|
return {
|
|
302
301
|
promise: new Promise((k, y) => {
|
|
303
|
-
const I =
|
|
304
|
-
if (!(
|
|
305
|
-
if (
|
|
306
|
-
|
|
302
|
+
const I = je(s, l), w = (f) => {
|
|
303
|
+
if (!(f.source !== e.contentWindow || !f.data)) {
|
|
304
|
+
if (f.data.penpal === b.Syn) {
|
|
305
|
+
m(f);
|
|
307
306
|
return;
|
|
308
307
|
}
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
311
|
-
|
|
308
|
+
if (f.data.penpal === b.Ack) {
|
|
309
|
+
const E = u(f);
|
|
310
|
+
E && (I(), k(E));
|
|
312
311
|
return;
|
|
313
312
|
}
|
|
314
313
|
}
|
|
315
314
|
};
|
|
316
|
-
window.addEventListener(A.Message,
|
|
317
|
-
window.removeEventListener(A.Message,
|
|
315
|
+
window.addEventListener(A.Message, w), a("Parent: Awaiting handshake"), Ke(e, i), c((f) => {
|
|
316
|
+
window.removeEventListener(A.Message, w), f && y(f);
|
|
318
317
|
});
|
|
319
318
|
}),
|
|
320
319
|
destroy() {
|
|
321
|
-
|
|
320
|
+
l();
|
|
322
321
|
}
|
|
323
322
|
};
|
|
324
323
|
};
|
|
325
|
-
class
|
|
324
|
+
class Ge {
|
|
326
325
|
url;
|
|
327
326
|
iframe;
|
|
328
327
|
container;
|
|
@@ -332,8 +331,8 @@ class se {
|
|
|
332
331
|
id: e,
|
|
333
332
|
url: t,
|
|
334
333
|
preset: n,
|
|
335
|
-
onClose:
|
|
336
|
-
onConnect:
|
|
334
|
+
onClose: s,
|
|
335
|
+
onConnect: o,
|
|
337
336
|
methods: a = {}
|
|
338
337
|
}) {
|
|
339
338
|
if (typeof document > "u" || typeof window > "u")
|
|
@@ -343,36 +342,28 @@ class se {
|
|
|
343
342
|
i.src = t.toString(), i.id = e, i.style.border = "none", i.sandbox.add("allow-forms"), i.sandbox.add("allow-popups"), i.sandbox.add("allow-popups-to-escape-sandbox"), i.sandbox.add("allow-scripts"), i.sandbox.add("allow-same-origin"), i.allow = "publickey-credentials-create *; publickey-credentials-get *; clipboard-write", document.hasStorageAccess && i.sandbox.add("allow-storage-access-by-user-activation");
|
|
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
|
-
h.target === c && (e === "controller-keychain" && this.child && this.child.reset?.().catch((
|
|
347
|
-
}), this.iframe = i, this.container = c,
|
|
345
|
+
h.target === c && (e === "controller-keychain" && this.child && this.child.reset?.().catch((m) => console.error("Error resetting context:", m)), this.close());
|
|
346
|
+
}), this.iframe = i, this.container = c, Xe({
|
|
348
347
|
iframe: this.iframe,
|
|
349
348
|
methods: {
|
|
350
349
|
close: (h) => () => this.close(),
|
|
351
|
-
closeAll: (h) => () => {
|
|
352
|
-
document.querySelectorAll(
|
|
353
|
-
'iframe[id^="controller-"]'
|
|
354
|
-
).forEach((f) => {
|
|
355
|
-
const g = f.parentElement;
|
|
356
|
-
g && (g.style.visibility = "hidden", g.style.opacity = "0");
|
|
357
|
-
}), document.body && (document.body.style.overflow = "auto");
|
|
358
|
-
},
|
|
359
350
|
reload: (h) => () => window.location.reload(),
|
|
360
351
|
...a
|
|
361
352
|
}
|
|
362
353
|
}).promise.then((h) => {
|
|
363
|
-
this.child = h,
|
|
354
|
+
this.child = h, o(h);
|
|
364
355
|
}), this.resize(), window.addEventListener("resize", () => this.resize());
|
|
365
|
-
const
|
|
356
|
+
const l = new MutationObserver(() => {
|
|
366
357
|
if (typeof document > "u") return;
|
|
367
358
|
const h = document.getElementById("controller");
|
|
368
|
-
document.body &&
|
|
359
|
+
document.body && e === "controller-keychain" && !h && (document.body.appendChild(c), l.disconnect());
|
|
369
360
|
});
|
|
370
|
-
|
|
361
|
+
l.observe(document.documentElement, {
|
|
371
362
|
childList: !0,
|
|
372
363
|
subtree: !0
|
|
373
364
|
});
|
|
374
|
-
const
|
|
375
|
-
document.body &&
|
|
365
|
+
const d = document.getElementById("controller");
|
|
366
|
+
document.body && e === "controller-keychain" && !d && document.body.appendChild(c), this.onClose = s;
|
|
376
367
|
}
|
|
377
368
|
open() {
|
|
378
369
|
!this.container || typeof document > "u" || !document.body || (document.body.style.overflow = "hidden", this.container.style.visibility = "visible", this.container.style.opacity = "1");
|
|
@@ -395,19 +386,22 @@ class se {
|
|
|
395
386
|
this.iframe.style.height = "600px", this.iframe.style.width = "432px", this.iframe.style.borderRadius = "8px";
|
|
396
387
|
}
|
|
397
388
|
}
|
|
389
|
+
isOpen() {
|
|
390
|
+
return this.iframe?.style.display !== "none";
|
|
391
|
+
}
|
|
398
392
|
}
|
|
399
393
|
const Ve = "6.13.7";
|
|
400
394
|
function j(r, e, t) {
|
|
401
395
|
for (let n in e) {
|
|
402
|
-
let
|
|
403
|
-
Object.defineProperty(r, n, { enumerable: !0, value:
|
|
396
|
+
let s = e[n];
|
|
397
|
+
Object.defineProperty(r, n, { enumerable: !0, value: s, writable: !1 });
|
|
404
398
|
}
|
|
405
399
|
}
|
|
406
|
-
function
|
|
400
|
+
function C(r) {
|
|
407
401
|
if (r == null)
|
|
408
402
|
return "null";
|
|
409
403
|
if (Array.isArray(r))
|
|
410
|
-
return "[ " + r.map(
|
|
404
|
+
return "[ " + r.map(C).join(", ") + " ]";
|
|
411
405
|
if (r instanceof Uint8Array) {
|
|
412
406
|
const e = "0123456789abcdef";
|
|
413
407
|
let t = "0x";
|
|
@@ -416,7 +410,7 @@ function P(r) {
|
|
|
416
410
|
return t;
|
|
417
411
|
}
|
|
418
412
|
if (typeof r == "object" && typeof r.toJSON == "function")
|
|
419
|
-
return
|
|
413
|
+
return C(r.toJSON());
|
|
420
414
|
switch (typeof r) {
|
|
421
415
|
case "boolean":
|
|
422
416
|
case "symbol":
|
|
@@ -429,7 +423,7 @@ function P(r) {
|
|
|
429
423
|
return JSON.stringify(r);
|
|
430
424
|
case "object": {
|
|
431
425
|
const e = Object.keys(r);
|
|
432
|
-
return e.sort(), "{ " + e.map((t) => `${
|
|
426
|
+
return e.sort(), "{ " + e.map((t) => `${C(t)}: ${C(r[t])}`).join(", ") + " }";
|
|
433
427
|
}
|
|
434
428
|
}
|
|
435
429
|
return "[ COULD NOT SERIALIZE ]";
|
|
@@ -437,38 +431,38 @@ function P(r) {
|
|
|
437
431
|
function Je(r, e, t) {
|
|
438
432
|
let n = r;
|
|
439
433
|
{
|
|
440
|
-
const
|
|
434
|
+
const o = [];
|
|
441
435
|
if (t) {
|
|
442
436
|
if ("message" in t || "code" in t || "name" in t)
|
|
443
|
-
throw new Error(`value will overwrite populated values: ${
|
|
437
|
+
throw new Error(`value will overwrite populated values: ${C(t)}`);
|
|
444
438
|
for (const a in t) {
|
|
445
439
|
if (a === "shortMessage")
|
|
446
440
|
continue;
|
|
447
441
|
const i = t[a];
|
|
448
|
-
|
|
442
|
+
o.push(a + "=" + C(i));
|
|
449
443
|
}
|
|
450
444
|
}
|
|
451
|
-
|
|
445
|
+
o.push(`code=${e}`), o.push(`version=${Ve}`), o.length && (r += " (" + o.join(", ") + ")");
|
|
452
446
|
}
|
|
453
|
-
let
|
|
447
|
+
let s;
|
|
454
448
|
switch (e) {
|
|
455
449
|
case "INVALID_ARGUMENT":
|
|
456
|
-
|
|
450
|
+
s = new TypeError(r);
|
|
457
451
|
break;
|
|
458
452
|
case "NUMERIC_FAULT":
|
|
459
453
|
case "BUFFER_OVERRUN":
|
|
460
|
-
|
|
454
|
+
s = new RangeError(r);
|
|
461
455
|
break;
|
|
462
456
|
default:
|
|
463
|
-
|
|
457
|
+
s = new Error(r);
|
|
464
458
|
}
|
|
465
|
-
return j(
|
|
459
|
+
return j(s, { code: e }), t && Object.assign(s, t), s.shortMessage == null && j(s, { shortMessage: n }), s;
|
|
466
460
|
}
|
|
467
461
|
function Ze(r, e, t, n) {
|
|
468
462
|
if (!r)
|
|
469
463
|
throw Je(e, t, n);
|
|
470
464
|
}
|
|
471
|
-
function
|
|
465
|
+
function D(r, e, t, n) {
|
|
472
466
|
Ze(r, e, "INVALID_ARGUMENT", { argument: t, value: n });
|
|
473
467
|
}
|
|
474
468
|
["NFD", "NFC", "NFKD", "NFKC"].reduce((r, e) => {
|
|
@@ -487,12 +481,12 @@ function et(r, e, t) {
|
|
|
487
481
|
return r;
|
|
488
482
|
if (typeof r == "string" && r.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
|
|
489
483
|
const n = new Uint8Array((r.length - 2) / 2);
|
|
490
|
-
let
|
|
491
|
-
for (let
|
|
492
|
-
n[
|
|
484
|
+
let s = 2;
|
|
485
|
+
for (let o = 0; o < n.length; o++)
|
|
486
|
+
n[o] = parseInt(r.substring(s, s + 2), 16), s += 2;
|
|
493
487
|
return n;
|
|
494
488
|
}
|
|
495
|
-
|
|
489
|
+
D(!1, "invalid BytesLike value", e || "value", r);
|
|
496
490
|
}
|
|
497
491
|
function O(r, e) {
|
|
498
492
|
return et(r, e);
|
|
@@ -502,8 +496,8 @@ function tt(r) {
|
|
|
502
496
|
const e = O(r);
|
|
503
497
|
let t = "0x";
|
|
504
498
|
for (let n = 0; n < e.length; n++) {
|
|
505
|
-
const
|
|
506
|
-
t += q[(
|
|
499
|
+
const s = e[n];
|
|
500
|
+
t += q[(s & 240) >> 4] + q[s & 15];
|
|
507
501
|
}
|
|
508
502
|
return t;
|
|
509
503
|
}
|
|
@@ -511,7 +505,7 @@ function X(r) {
|
|
|
511
505
|
if (!Number.isSafeInteger(r) || r < 0)
|
|
512
506
|
throw new Error(`Wrong positive integer: ${r}`);
|
|
513
507
|
}
|
|
514
|
-
function
|
|
508
|
+
function oe(r, ...e) {
|
|
515
509
|
if (!(r instanceof Uint8Array))
|
|
516
510
|
throw new Error("Expected Uint8Array");
|
|
517
511
|
if (e.length > 0 && !e.includes(r.length))
|
|
@@ -524,21 +518,21 @@ function G(r, e = !0) {
|
|
|
524
518
|
throw new Error("Hash#digest() has already been called");
|
|
525
519
|
}
|
|
526
520
|
function rt(r, e) {
|
|
527
|
-
|
|
521
|
+
oe(r);
|
|
528
522
|
const t = e.outputLen;
|
|
529
523
|
if (r.length < t)
|
|
530
524
|
throw new Error(`digestInto() expects output buffer of length at least ${t}`);
|
|
531
525
|
}
|
|
532
526
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
533
|
-
const nt = (r) => r instanceof Uint8Array,
|
|
534
|
-
if (!
|
|
527
|
+
const nt = (r) => r instanceof Uint8Array, st = (r) => new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4)), ot = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
528
|
+
if (!ot)
|
|
535
529
|
throw new Error("Non little-endian hardware is not supported");
|
|
536
530
|
function at(r) {
|
|
537
531
|
if (typeof r != "string")
|
|
538
532
|
throw new Error(`utf8ToBytes expected string, got ${typeof r}`);
|
|
539
533
|
return new Uint8Array(new TextEncoder().encode(r));
|
|
540
534
|
}
|
|
541
|
-
function
|
|
535
|
+
function ae(r) {
|
|
542
536
|
if (typeof r == "string" && (r = at(r)), !nt(r))
|
|
543
537
|
throw new Error(`expected Uint8Array, got ${typeof r}`);
|
|
544
538
|
return r;
|
|
@@ -550,7 +544,7 @@ class it {
|
|
|
550
544
|
}
|
|
551
545
|
}
|
|
552
546
|
function ct(r) {
|
|
553
|
-
const e = (n) => r().update(
|
|
547
|
+
const e = (n) => r().update(ae(n)).digest(), t = r();
|
|
554
548
|
return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => r(), e;
|
|
555
549
|
}
|
|
556
550
|
const B = /* @__PURE__ */ BigInt(2 ** 32 - 1), V = /* @__PURE__ */ BigInt(32);
|
|
@@ -559,35 +553,35 @@ function lt(r, e = !1) {
|
|
|
559
553
|
}
|
|
560
554
|
function dt(r, e = !1) {
|
|
561
555
|
let t = new Uint32Array(r.length), n = new Uint32Array(r.length);
|
|
562
|
-
for (let
|
|
563
|
-
const { h:
|
|
564
|
-
[t[
|
|
556
|
+
for (let s = 0; s < r.length; s++) {
|
|
557
|
+
const { h: o, l: a } = lt(r[s], e);
|
|
558
|
+
[t[s], n[s]] = [o, a];
|
|
565
559
|
}
|
|
566
560
|
return [t, n];
|
|
567
561
|
}
|
|
568
|
-
const ht = (r, e, t) => r << t | e >>> 32 - t,
|
|
569
|
-
for (let r = 0, e =
|
|
570
|
-
[t, n] = [n, (2 * t + 3 * n) % 5],
|
|
571
|
-
let
|
|
572
|
-
for (let
|
|
573
|
-
e = (e <<
|
|
574
|
-
|
|
562
|
+
const ht = (r, e, t) => r << t | e >>> 32 - t, ut = (r, e, t) => e << t | r >>> 32 - t, ft = (r, e, t) => e << t - 32 | r >>> 64 - t, pt = (r, e, t) => r << t - 32 | e >>> 64 - t, [ie, ce, le] = [[], [], []], gt = /* @__PURE__ */ BigInt(0), P = /* @__PURE__ */ BigInt(1), mt = /* @__PURE__ */ BigInt(2), yt = /* @__PURE__ */ BigInt(7), bt = /* @__PURE__ */ BigInt(256), wt = /* @__PURE__ */ BigInt(113);
|
|
563
|
+
for (let r = 0, e = P, t = 1, n = 0; r < 24; r++) {
|
|
564
|
+
[t, n] = [n, (2 * t + 3 * n) % 5], ie.push(2 * (5 * n + t)), ce.push((r + 1) * (r + 2) / 2 % 64);
|
|
565
|
+
let s = gt;
|
|
566
|
+
for (let o = 0; o < 7; o++)
|
|
567
|
+
e = (e << P ^ (e >> yt) * wt) % bt, e & mt && (s ^= P << (P << /* @__PURE__ */ BigInt(o)) - P);
|
|
568
|
+
le.push(s);
|
|
575
569
|
}
|
|
576
|
-
const [_t, kt] = /* @__PURE__ */ dt(
|
|
570
|
+
const [_t, kt] = /* @__PURE__ */ dt(le, !0), J = (r, e, t) => t > 32 ? ft(r, e, t) : ht(r, e, t), Z = (r, e, t) => t > 32 ? pt(r, e, t) : ut(r, e, t);
|
|
577
571
|
function At(r, e = 24) {
|
|
578
572
|
const t = new Uint32Array(10);
|
|
579
573
|
for (let n = 24 - e; n < 24; n++) {
|
|
580
574
|
for (let a = 0; a < 10; a++)
|
|
581
575
|
t[a] = r[a] ^ r[a + 10] ^ r[a + 20] ^ r[a + 30] ^ r[a + 40];
|
|
582
576
|
for (let a = 0; a < 10; a += 2) {
|
|
583
|
-
const i = (a + 8) % 10, c = (a + 2) % 10,
|
|
584
|
-
for (let
|
|
585
|
-
r[a +
|
|
577
|
+
const i = (a + 8) % 10, c = (a + 2) % 10, l = t[c], d = t[c + 1], h = J(l, d, 1) ^ t[i], m = Z(l, d, 1) ^ t[i + 1];
|
|
578
|
+
for (let u = 0; u < 50; u += 10)
|
|
579
|
+
r[a + u] ^= h, r[a + u + 1] ^= m;
|
|
586
580
|
}
|
|
587
|
-
let
|
|
581
|
+
let s = r[2], o = r[3];
|
|
588
582
|
for (let a = 0; a < 24; a++) {
|
|
589
|
-
const i =
|
|
590
|
-
|
|
583
|
+
const i = ce[a], c = J(s, o, i), l = Z(s, o, i), d = ie[a];
|
|
584
|
+
s = r[d], o = r[d + 1], r[d] = c, r[d + 1] = l;
|
|
591
585
|
}
|
|
592
586
|
for (let a = 0; a < 50; a += 10) {
|
|
593
587
|
for (let i = 0; i < 10; i++)
|
|
@@ -601,10 +595,10 @@ function At(r, e = 24) {
|
|
|
601
595
|
}
|
|
602
596
|
class L extends it {
|
|
603
597
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
604
|
-
constructor(e, t, n,
|
|
605
|
-
if (super(), this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF =
|
|
598
|
+
constructor(e, t, n, s = !1, o = 24) {
|
|
599
|
+
if (super(), this.blockLen = e, this.suffix = t, this.outputLen = n, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, X(n), 0 >= this.blockLen || this.blockLen >= 200)
|
|
606
600
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
607
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
601
|
+
this.state = new Uint8Array(200), this.state32 = st(this.state);
|
|
608
602
|
}
|
|
609
603
|
keccak() {
|
|
610
604
|
At(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
|
|
@@ -612,12 +606,12 @@ class L extends it {
|
|
|
612
606
|
update(e) {
|
|
613
607
|
G(this);
|
|
614
608
|
const { blockLen: t, state: n } = this;
|
|
615
|
-
e =
|
|
616
|
-
const
|
|
617
|
-
for (let
|
|
618
|
-
const a = Math.min(t - this.pos,
|
|
609
|
+
e = ae(e);
|
|
610
|
+
const s = e.length;
|
|
611
|
+
for (let o = 0; o < s; ) {
|
|
612
|
+
const a = Math.min(t - this.pos, s - o);
|
|
619
613
|
for (let i = 0; i < a; i++)
|
|
620
|
-
n[this.pos++] ^= e[
|
|
614
|
+
n[this.pos++] ^= e[o++];
|
|
621
615
|
this.pos === t && this.keccak();
|
|
622
616
|
}
|
|
623
617
|
return this;
|
|
@@ -626,16 +620,16 @@ class L extends it {
|
|
|
626
620
|
if (this.finished)
|
|
627
621
|
return;
|
|
628
622
|
this.finished = !0;
|
|
629
|
-
const { state: e, suffix: t, pos: n, blockLen:
|
|
630
|
-
e[n] ^= t, (t & 128) !== 0 && n ===
|
|
623
|
+
const { state: e, suffix: t, pos: n, blockLen: s } = this;
|
|
624
|
+
e[n] ^= t, (t & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
631
625
|
}
|
|
632
626
|
writeInto(e) {
|
|
633
|
-
G(this, !1),
|
|
627
|
+
G(this, !1), oe(e), this.finish();
|
|
634
628
|
const t = this.state, { blockLen: n } = this;
|
|
635
|
-
for (let
|
|
629
|
+
for (let s = 0, o = e.length; s < o; ) {
|
|
636
630
|
this.posOut >= n && this.keccak();
|
|
637
|
-
const a = Math.min(n - this.posOut,
|
|
638
|
-
e.set(t.subarray(this.posOut, this.posOut + a),
|
|
631
|
+
const a = Math.min(n - this.posOut, o - s);
|
|
632
|
+
e.set(t.subarray(this.posOut, this.posOut + a), s), this.posOut += a, s += a;
|
|
639
633
|
}
|
|
640
634
|
return e;
|
|
641
635
|
}
|
|
@@ -659,26 +653,26 @@ class L extends it {
|
|
|
659
653
|
this.destroyed = !0, this.state.fill(0);
|
|
660
654
|
}
|
|
661
655
|
_cloneInto(e) {
|
|
662
|
-
const { blockLen: t, suffix: n, outputLen:
|
|
663
|
-
return e || (e = new L(t, n,
|
|
656
|
+
const { blockLen: t, suffix: n, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
657
|
+
return e || (e = new L(t, n, s, a, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = n, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
664
658
|
}
|
|
665
659
|
}
|
|
666
660
|
const It = (r, e, t) => ct(() => new L(e, r, t)), vt = /* @__PURE__ */ It(1, 136, 256 / 8);
|
|
667
|
-
let
|
|
668
|
-
const
|
|
661
|
+
let de = !1;
|
|
662
|
+
const he = function(r) {
|
|
669
663
|
return vt(r);
|
|
670
664
|
};
|
|
671
|
-
let ue =
|
|
665
|
+
let ue = he;
|
|
672
666
|
function M(r) {
|
|
673
667
|
const e = O(r, "data");
|
|
674
668
|
return tt(ue(e));
|
|
675
669
|
}
|
|
676
|
-
M._ =
|
|
670
|
+
M._ = he;
|
|
677
671
|
M.lock = function() {
|
|
678
|
-
|
|
672
|
+
de = !0;
|
|
679
673
|
};
|
|
680
674
|
M.register = function(r) {
|
|
681
|
-
if (
|
|
675
|
+
if (de)
|
|
682
676
|
throw new TypeError("keccak256 is locked");
|
|
683
677
|
ue = r;
|
|
684
678
|
};
|
|
@@ -687,11 +681,11 @@ const Et = BigInt(0), xt = BigInt(36);
|
|
|
687
681
|
function ee(r) {
|
|
688
682
|
r = r.toLowerCase();
|
|
689
683
|
const e = r.substring(2).split(""), t = new Uint8Array(40);
|
|
690
|
-
for (let
|
|
691
|
-
t[
|
|
684
|
+
for (let s = 0; s < 40; s++)
|
|
685
|
+
t[s] = e[s].charCodeAt(0);
|
|
692
686
|
const n = O(M(t));
|
|
693
|
-
for (let
|
|
694
|
-
n[
|
|
687
|
+
for (let s = 0; s < 40; s += 2)
|
|
688
|
+
n[s >> 1] >> 4 >= 8 && (e[s] = e[s].toUpperCase()), (n[s >> 1] & 15) >= 8 && (e[s + 1] = e[s + 1].toUpperCase());
|
|
695
689
|
return "0x" + e.join("");
|
|
696
690
|
}
|
|
697
691
|
const Y = {};
|
|
@@ -712,7 +706,7 @@ function Ct(r) {
|
|
|
712
706
|
t = "0" + t;
|
|
713
707
|
return t;
|
|
714
708
|
}
|
|
715
|
-
const
|
|
709
|
+
const Rt = function() {
|
|
716
710
|
const r = {};
|
|
717
711
|
for (let e = 0; e < 36; e++) {
|
|
718
712
|
const t = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
|
|
@@ -720,29 +714,29 @@ const Pt = function() {
|
|
|
720
714
|
}
|
|
721
715
|
return r;
|
|
722
716
|
}();
|
|
723
|
-
function
|
|
717
|
+
function St(r) {
|
|
724
718
|
r = r.toLowerCase();
|
|
725
719
|
let e = Et;
|
|
726
720
|
for (let t = 0; t < r.length; t++)
|
|
727
|
-
e = e * xt +
|
|
721
|
+
e = e * xt + Rt[r[t]];
|
|
728
722
|
return e;
|
|
729
723
|
}
|
|
730
|
-
function
|
|
731
|
-
if (
|
|
724
|
+
function g(r) {
|
|
725
|
+
if (D(typeof r == "string", "invalid address", "address", r), r.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
732
726
|
r.startsWith("0x") || (r = "0x" + r);
|
|
733
727
|
const e = ee(r);
|
|
734
|
-
return
|
|
728
|
+
return D(!r.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || e === r, "bad address checksum", "address", r), e;
|
|
735
729
|
}
|
|
736
730
|
if (r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
737
|
-
|
|
738
|
-
let e =
|
|
731
|
+
D(r.substring(2, 4) === Ct(r), "bad icap checksum", "address", r);
|
|
732
|
+
let e = St(r.substring(4)).toString(16);
|
|
739
733
|
for (; e.length < 40; )
|
|
740
734
|
e = "0" + e;
|
|
741
735
|
return ee("0x" + e);
|
|
742
736
|
}
|
|
743
|
-
|
|
737
|
+
D(!1, "invalid address", "address", r);
|
|
744
738
|
}
|
|
745
|
-
class
|
|
739
|
+
class Pt {
|
|
746
740
|
type = "argent";
|
|
747
741
|
platform = "starknet";
|
|
748
742
|
wallet = void 0;
|
|
@@ -768,8 +762,8 @@ class St {
|
|
|
768
762
|
try {
|
|
769
763
|
if (!this.isAvailable())
|
|
770
764
|
throw new Error("Argent is not available");
|
|
771
|
-
const { wallet: e, connectorData: t } = await
|
|
772
|
-
connectors: [new
|
|
765
|
+
const { wallet: e, connectorData: t } = await ve({
|
|
766
|
+
connectors: [new Ee({ options: { id: "argentX" } })]
|
|
773
767
|
});
|
|
774
768
|
if (!e)
|
|
775
769
|
throw new Error("No wallet found");
|
|
@@ -832,17 +826,17 @@ class St {
|
|
|
832
826
|
}
|
|
833
827
|
}
|
|
834
828
|
}
|
|
835
|
-
function
|
|
829
|
+
function Dt(r) {
|
|
836
830
|
if (typeof window > "u")
|
|
837
831
|
return;
|
|
838
832
|
const e = (t) => r(t.detail);
|
|
839
833
|
return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new CustomEvent("eip6963:requestProvider")), () => window.removeEventListener("eip6963:announceProvider", e);
|
|
840
834
|
}
|
|
841
|
-
function
|
|
835
|
+
function fe() {
|
|
842
836
|
const r = /* @__PURE__ */ new Set();
|
|
843
837
|
let e = [];
|
|
844
|
-
const t = () =>
|
|
845
|
-
e.some(({ info:
|
|
838
|
+
const t = () => Dt((s) => {
|
|
839
|
+
e.some(({ info: o }) => o.uuid === s.info.uuid) || (e = [...e, s], r.forEach((o) => o(e, { added: [s] })));
|
|
846
840
|
});
|
|
847
841
|
let n = t();
|
|
848
842
|
return {
|
|
@@ -850,13 +844,13 @@ function pe() {
|
|
|
850
844
|
return r;
|
|
851
845
|
},
|
|
852
846
|
clear() {
|
|
853
|
-
r.forEach((
|
|
847
|
+
r.forEach((s) => s([], { removed: [...e] })), e = [];
|
|
854
848
|
},
|
|
855
849
|
destroy() {
|
|
856
850
|
this.clear(), r.clear(), n?.();
|
|
857
851
|
},
|
|
858
|
-
findProvider({ rdns:
|
|
859
|
-
return e.find((
|
|
852
|
+
findProvider({ rdns: s }) {
|
|
853
|
+
return e.find((o) => o.info.rdns === s);
|
|
860
854
|
},
|
|
861
855
|
getProviders() {
|
|
862
856
|
return e;
|
|
@@ -864,20 +858,20 @@ function pe() {
|
|
|
864
858
|
reset() {
|
|
865
859
|
this.clear(), n?.(), n = t();
|
|
866
860
|
},
|
|
867
|
-
subscribe(
|
|
868
|
-
return r.add(
|
|
861
|
+
subscribe(s, { emitImmediately: o } = {}) {
|
|
862
|
+
return r.add(s), o && s(e, { added: e }), () => r.delete(s);
|
|
869
863
|
}
|
|
870
864
|
};
|
|
871
865
|
}
|
|
872
|
-
class
|
|
866
|
+
class Nt {
|
|
873
867
|
type = "metamask";
|
|
874
868
|
platform = "ethereum";
|
|
875
869
|
MMSDK;
|
|
876
|
-
store =
|
|
870
|
+
store = fe();
|
|
877
871
|
account = void 0;
|
|
878
872
|
connectedAccounts = [];
|
|
879
873
|
constructor() {
|
|
880
|
-
this.MMSDK = new
|
|
874
|
+
this.MMSDK = new xe({
|
|
881
875
|
dappMetadata: {
|
|
882
876
|
name: "Cartridge Controller",
|
|
883
877
|
url: window.location.href
|
|
@@ -886,13 +880,9 @@ class Dt {
|
|
|
886
880
|
this.MMSDK.getProvider()?.request({
|
|
887
881
|
method: "eth_accounts"
|
|
888
882
|
}).then((e) => {
|
|
889
|
-
e && e.length > 0 && (this.account =
|
|
890
|
-
(t) => m(t)
|
|
891
|
-
));
|
|
883
|
+
e && e.length > 0 && (this.account = g(e[0]), this.connectedAccounts = e.map(g));
|
|
892
884
|
}), this.MMSDK.getProvider()?.on("accountsChanged", (e) => {
|
|
893
|
-
Array.isArray(e) &&
|
|
894
|
-
(t) => m(t)
|
|
895
|
-
));
|
|
885
|
+
Array.isArray(e) && e.length > 0 && (this.account = g(e?.[0]), this.connectedAccounts = e.map(g));
|
|
896
886
|
});
|
|
897
887
|
});
|
|
898
888
|
}
|
|
@@ -911,23 +901,23 @@ class Dt {
|
|
|
911
901
|
connectedAccounts: this.connectedAccounts
|
|
912
902
|
};
|
|
913
903
|
}
|
|
914
|
-
async connect(
|
|
915
|
-
if (
|
|
904
|
+
async connect() {
|
|
905
|
+
if (this.account)
|
|
916
906
|
return { success: !0, wallet: this.type, account: this.account };
|
|
917
907
|
try {
|
|
918
908
|
if (!this.isAvailable())
|
|
919
909
|
throw new Error("MetaMask is not available");
|
|
920
|
-
const
|
|
921
|
-
if (
|
|
922
|
-
return this.account =
|
|
923
|
-
(
|
|
910
|
+
const e = await this.MMSDK.connect();
|
|
911
|
+
if (e && e.length > 0)
|
|
912
|
+
return this.account = g(e[0]), this.connectedAccounts = e.map(
|
|
913
|
+
(t) => g(t)
|
|
924
914
|
), { success: !0, wallet: this.type, account: this.account };
|
|
925
915
|
throw new Error("No accounts found");
|
|
926
|
-
} catch (
|
|
927
|
-
return console.error("Error connecting to MetaMask:",
|
|
916
|
+
} catch (e) {
|
|
917
|
+
return console.error("Error connecting to MetaMask:", e), {
|
|
928
918
|
success: !1,
|
|
929
919
|
wallet: this.type,
|
|
930
|
-
error:
|
|
920
|
+
error: e.message || "Unknown error"
|
|
931
921
|
};
|
|
932
922
|
}
|
|
933
923
|
}
|
|
@@ -954,20 +944,20 @@ class Dt {
|
|
|
954
944
|
};
|
|
955
945
|
}
|
|
956
946
|
}
|
|
957
|
-
async signMessage(e) {
|
|
947
|
+
async signMessage(e, t) {
|
|
958
948
|
try {
|
|
959
949
|
if (!this.isAvailable() || !this.account)
|
|
960
950
|
throw new Error("MetaMask is not connected");
|
|
961
|
-
const
|
|
951
|
+
const n = await this.MMSDK.getProvider()?.request({
|
|
962
952
|
method: "personal_sign",
|
|
963
|
-
params: [this.account, e]
|
|
953
|
+
params: [t || this.account, e]
|
|
964
954
|
});
|
|
965
|
-
return { success: !0, wallet: this.type, result:
|
|
966
|
-
} catch (
|
|
967
|
-
return console.error("Error signing message with MetaMask:",
|
|
955
|
+
return { success: !0, wallet: this.type, result: n };
|
|
956
|
+
} catch (n) {
|
|
957
|
+
return console.error("Error signing message with MetaMask:", n), {
|
|
968
958
|
success: !1,
|
|
969
959
|
wallet: this.type,
|
|
970
|
-
error:
|
|
960
|
+
error: n.message || "Unknown error"
|
|
971
961
|
};
|
|
972
962
|
}
|
|
973
963
|
}
|
|
@@ -1114,11 +1104,11 @@ class Mt {
|
|
|
1114
1104
|
if (!this.isAvailable() || !this.account)
|
|
1115
1105
|
throw new Error("Phantom is not connected");
|
|
1116
1106
|
try {
|
|
1117
|
-
const t =
|
|
1107
|
+
const t = Ce.from(e), s = await this.getProvider().signAndSendTransaction(t);
|
|
1118
1108
|
return {
|
|
1119
1109
|
success: !0,
|
|
1120
1110
|
wallet: this.type,
|
|
1121
|
-
result:
|
|
1111
|
+
result: s
|
|
1122
1112
|
};
|
|
1123
1113
|
} catch (t) {
|
|
1124
1114
|
return console.error("Error sending transaction with Phantom:", t), {
|
|
@@ -1150,20 +1140,20 @@ class Mt {
|
|
|
1150
1140
|
}
|
|
1151
1141
|
}
|
|
1152
1142
|
const Bt = "io.rabby";
|
|
1153
|
-
class
|
|
1143
|
+
class Qt {
|
|
1154
1144
|
type = "rabby";
|
|
1155
1145
|
platform = "ethereum";
|
|
1156
1146
|
account = void 0;
|
|
1157
|
-
store =
|
|
1147
|
+
store = fe();
|
|
1158
1148
|
provider;
|
|
1159
1149
|
connectedAccounts = [];
|
|
1160
1150
|
constructor() {
|
|
1161
1151
|
this.provider = this.store.getProviders().find((e) => e.info.rdns === Bt), this.provider?.provider.request({
|
|
1162
1152
|
method: "eth_accounts"
|
|
1163
1153
|
}).then((e) => {
|
|
1164
|
-
this.connectedAccounts = e;
|
|
1154
|
+
this.connectedAccounts = e.map(g), e.length > 0 && (this.account = g(e?.[0]));
|
|
1165
1155
|
}), this.provider?.provider?.on("accountsChanged", (e) => {
|
|
1166
|
-
e && (this.connectedAccounts = e.map((t) =>
|
|
1156
|
+
e && (this.connectedAccounts = e.map((t) => g(t)), this.account = g(e?.[0]));
|
|
1167
1157
|
});
|
|
1168
1158
|
}
|
|
1169
1159
|
isAvailable() {
|
|
@@ -1182,7 +1172,7 @@ class Ut {
|
|
|
1182
1172
|
};
|
|
1183
1173
|
}
|
|
1184
1174
|
async connect(e) {
|
|
1185
|
-
if (e && this.connectedAccounts.includes(
|
|
1175
|
+
if (e && this.connectedAccounts.includes(g(e)) && (this.account = g(e)), this.account)
|
|
1186
1176
|
return { success: !0, wallet: this.type, account: this.account };
|
|
1187
1177
|
try {
|
|
1188
1178
|
if (!this.isAvailable())
|
|
@@ -1191,7 +1181,7 @@ class Ut {
|
|
|
1191
1181
|
method: "eth_requestAccounts"
|
|
1192
1182
|
});
|
|
1193
1183
|
if (t && t.length > 0)
|
|
1194
|
-
return this.account = t[0], this.connectedAccounts = t, { success: !0, wallet: this.type, account: this.account };
|
|
1184
|
+
return this.account = g(t[0]), this.connectedAccounts = t.map(g), { success: !0, wallet: this.type, account: this.account };
|
|
1195
1185
|
throw new Error("No accounts found");
|
|
1196
1186
|
} catch (t) {
|
|
1197
1187
|
return console.error("Error connecting to Rabby:", t), {
|
|
@@ -1224,20 +1214,20 @@ class Ut {
|
|
|
1224
1214
|
};
|
|
1225
1215
|
}
|
|
1226
1216
|
}
|
|
1227
|
-
async signMessage(e) {
|
|
1217
|
+
async signMessage(e, t) {
|
|
1228
1218
|
try {
|
|
1229
1219
|
if (!this.isAvailable() || !this.account)
|
|
1230
1220
|
throw new Error("Rabby is not connected");
|
|
1231
|
-
const
|
|
1221
|
+
const n = await this.provider?.provider.request({
|
|
1232
1222
|
method: "personal_sign",
|
|
1233
|
-
params: [this.account, e]
|
|
1223
|
+
params: [t || this.account, e]
|
|
1234
1224
|
});
|
|
1235
|
-
return { success: !0, wallet: this.type, result:
|
|
1236
|
-
} catch (
|
|
1237
|
-
return console.error("Error signing message with Rabby:",
|
|
1225
|
+
return { success: !0, wallet: this.type, result: n };
|
|
1226
|
+
} catch (n) {
|
|
1227
|
+
return console.error("Error signing message with Rabby:", n), {
|
|
1238
1228
|
success: !1,
|
|
1239
1229
|
wallet: this.type,
|
|
1240
|
-
error:
|
|
1230
|
+
error: n.message || "Unknown error"
|
|
1241
1231
|
};
|
|
1242
1232
|
}
|
|
1243
1233
|
}
|
|
@@ -1316,24 +1306,24 @@ class Ut {
|
|
|
1316
1306
|
}
|
|
1317
1307
|
}
|
|
1318
1308
|
}
|
|
1319
|
-
class
|
|
1309
|
+
class Ut {
|
|
1320
1310
|
walletAdapters;
|
|
1321
1311
|
constructor() {
|
|
1322
1312
|
if (this.walletAdapters = /* @__PURE__ */ new Map(), typeof window > "u")
|
|
1323
1313
|
return;
|
|
1324
|
-
const e = new
|
|
1314
|
+
const e = new Nt();
|
|
1325
1315
|
e.isAvailable() && this.walletAdapters.set("metamask", e);
|
|
1326
1316
|
const t = new Mt();
|
|
1327
1317
|
t.isAvailable() && this.walletAdapters.set("phantom", t);
|
|
1328
|
-
const n = new
|
|
1318
|
+
const n = new Pt();
|
|
1329
1319
|
n.isAvailable() && this.walletAdapters.set("argent", n);
|
|
1330
|
-
const
|
|
1331
|
-
|
|
1320
|
+
const s = new Qt();
|
|
1321
|
+
s.isAvailable() && this.walletAdapters.set("rabby", s), window.wallet_bridge = this;
|
|
1332
1322
|
}
|
|
1333
1323
|
getIFrameMethods() {
|
|
1334
1324
|
return {
|
|
1335
1325
|
externalDetectWallets: (e) => () => this.detectWallets(),
|
|
1336
|
-
externalConnectWallet: (e) => (t
|
|
1326
|
+
externalConnectWallet: (e) => (t) => this.connectWallet(t),
|
|
1337
1327
|
externalSignMessage: (e) => (t, n) => this.signMessage(t, n),
|
|
1338
1328
|
externalSignTypedData: (e) => (t, n) => this.signTypedData(t, n),
|
|
1339
1329
|
externalSendTransaction: (e) => (t, n) => this.sendTransaction(t, n),
|
|
@@ -1351,50 +1341,48 @@ class Qt {
|
|
|
1351
1341
|
throw new Error(`Unsupported wallet type: ${e}`);
|
|
1352
1342
|
return t;
|
|
1353
1343
|
}
|
|
1354
|
-
handleError(e, t, n,
|
|
1355
|
-
const
|
|
1344
|
+
handleError(e, t, n, s) {
|
|
1345
|
+
const o = t instanceof Error ? t.message : "Unknown error";
|
|
1356
1346
|
let a = "unknown";
|
|
1357
1347
|
if (typeof e == "string") {
|
|
1358
1348
|
const i = this.getConnectedWalletAdapter(e);
|
|
1359
|
-
a =
|
|
1349
|
+
a = s ?? i?.type ?? e;
|
|
1360
1350
|
} else
|
|
1361
1351
|
a = e;
|
|
1362
1352
|
return console.error(`Error ${n} with ${e} wallet:`, t), {
|
|
1363
1353
|
success: !1,
|
|
1364
1354
|
wallet: a,
|
|
1365
|
-
error:
|
|
1355
|
+
error: o
|
|
1366
1356
|
};
|
|
1367
1357
|
}
|
|
1368
|
-
async connectWallet(e
|
|
1358
|
+
async connectWallet(e) {
|
|
1369
1359
|
try {
|
|
1370
|
-
const
|
|
1371
|
-
if (
|
|
1360
|
+
const n = await this.getWalletAdapterByType(e).connect();
|
|
1361
|
+
if (n.success && n.account)
|
|
1372
1362
|
console.log(
|
|
1373
|
-
`Wallet ${e} connected with address ${
|
|
1363
|
+
`Wallet ${e} connected with address ${n.account}`
|
|
1374
1364
|
);
|
|
1375
|
-
else if (
|
|
1365
|
+
else if (n.success && !n.account)
|
|
1376
1366
|
return console.error(
|
|
1377
1367
|
`Wallet ${e} connected successfully but did not provide an address.`
|
|
1378
1368
|
), {
|
|
1379
|
-
...
|
|
1369
|
+
...n,
|
|
1380
1370
|
success: !1,
|
|
1381
1371
|
error: "Wallet connected but address not found."
|
|
1382
1372
|
};
|
|
1383
|
-
return
|
|
1384
|
-
} catch (
|
|
1385
|
-
return this.handleError(e,
|
|
1373
|
+
return n;
|
|
1374
|
+
} catch (t) {
|
|
1375
|
+
return this.handleError(e, t, "connecting to");
|
|
1386
1376
|
}
|
|
1387
1377
|
}
|
|
1388
1378
|
getConnectedWalletAdapter(e) {
|
|
1389
1379
|
let t;
|
|
1390
1380
|
if (typeof e == "string") {
|
|
1391
|
-
const n =
|
|
1392
|
-
t = this.walletAdapters.values().find((
|
|
1381
|
+
const n = g(e);
|
|
1382
|
+
t = this.walletAdapters.values().find((s) => s.getConnectedAccounts().includes(n));
|
|
1393
1383
|
} else
|
|
1394
1384
|
t = this.walletAdapters.get(e);
|
|
1395
|
-
if (!t
|
|
1396
|
-
(n) => n.getConnectedAccounts().includes(m(e))
|
|
1397
|
-
)), !t)
|
|
1385
|
+
if (!t)
|
|
1398
1386
|
throw new Error(
|
|
1399
1387
|
`Wallet with identifier ${e} is not connected or supported`
|
|
1400
1388
|
);
|
|
@@ -1407,11 +1395,11 @@ class Qt {
|
|
|
1407
1395
|
throw new Error(
|
|
1408
1396
|
`Wallet type ${n.type} (identifier: ${e}) does not support signing messages`
|
|
1409
1397
|
);
|
|
1410
|
-
return await n.signMessage(t);
|
|
1411
|
-
} catch (
|
|
1398
|
+
return await n.signMessage(t, e);
|
|
1399
|
+
} catch (s) {
|
|
1412
1400
|
return this.handleError(
|
|
1413
1401
|
e,
|
|
1414
|
-
|
|
1402
|
+
s,
|
|
1415
1403
|
"signing message with",
|
|
1416
1404
|
n?.type
|
|
1417
1405
|
);
|
|
@@ -1425,10 +1413,10 @@ class Qt {
|
|
|
1425
1413
|
`Wallet type ${n.type} (identifier: ${e}) does not support signing typed data`
|
|
1426
1414
|
);
|
|
1427
1415
|
return await n.signTypedData(t);
|
|
1428
|
-
} catch (
|
|
1416
|
+
} catch (s) {
|
|
1429
1417
|
return this.handleError(
|
|
1430
1418
|
e,
|
|
1431
|
-
|
|
1419
|
+
s,
|
|
1432
1420
|
"signing typed data with",
|
|
1433
1421
|
n?.type
|
|
1434
1422
|
);
|
|
@@ -1438,10 +1426,10 @@ class Qt {
|
|
|
1438
1426
|
let n;
|
|
1439
1427
|
try {
|
|
1440
1428
|
return n = this.getConnectedWalletAdapter(e), await n.sendTransaction(t);
|
|
1441
|
-
} catch (
|
|
1429
|
+
} catch (s) {
|
|
1442
1430
|
return this.handleError(
|
|
1443
1431
|
e,
|
|
1444
|
-
|
|
1432
|
+
s,
|
|
1445
1433
|
"sending transaction with",
|
|
1446
1434
|
n?.type
|
|
1447
1435
|
);
|
|
@@ -1451,62 +1439,47 @@ class Qt {
|
|
|
1451
1439
|
let n;
|
|
1452
1440
|
try {
|
|
1453
1441
|
return n = this.getConnectedWalletAdapter(e), await n.getBalance(t);
|
|
1454
|
-
} catch (
|
|
1442
|
+
} catch (s) {
|
|
1455
1443
|
return this.handleError(
|
|
1456
1444
|
e,
|
|
1457
|
-
|
|
1445
|
+
s,
|
|
1458
1446
|
"getting balance from",
|
|
1459
1447
|
n?.type
|
|
1460
1448
|
);
|
|
1461
1449
|
}
|
|
1462
1450
|
}
|
|
1463
1451
|
}
|
|
1464
|
-
class Tt extends
|
|
1452
|
+
class Tt extends Ge {
|
|
1465
1453
|
walletBridge;
|
|
1466
|
-
constructor({
|
|
1467
|
-
|
|
1468
|
-
t
|
|
1454
|
+
constructor({
|
|
1455
|
+
url: e,
|
|
1456
|
+
policies: t,
|
|
1457
|
+
version: n,
|
|
1458
|
+
slot: s,
|
|
1459
|
+
namespace: o,
|
|
1460
|
+
tokens: a,
|
|
1461
|
+
...i
|
|
1462
|
+
}) {
|
|
1463
|
+
const c = new URL(e ?? we), l = new Ut();
|
|
1464
|
+
t && c.searchParams.set(
|
|
1469
1465
|
"policies",
|
|
1470
1466
|
encodeURIComponent(JSON.stringify(t))
|
|
1467
|
+
), n && c.searchParams.set("v", encodeURIComponent(n)), s && c.searchParams.set("ps", encodeURIComponent(s)), o && c.searchParams.set("ns", encodeURIComponent(o)), a?.erc20 && c.searchParams.set(
|
|
1468
|
+
"erc20",
|
|
1469
|
+
encodeURIComponent(a.erc20.toString())
|
|
1471
1470
|
), super({
|
|
1472
|
-
...
|
|
1471
|
+
...i,
|
|
1473
1472
|
id: "controller-keychain",
|
|
1474
|
-
url:
|
|
1475
|
-
methods:
|
|
1476
|
-
}), this.walletBridge =
|
|
1473
|
+
url: c,
|
|
1474
|
+
methods: l.getIFrameMethods()
|
|
1475
|
+
}), this.walletBridge = l, typeof window < "u" && (window.external_wallets = this.walletBridge);
|
|
1477
1476
|
}
|
|
1478
1477
|
getWalletBridge() {
|
|
1479
1478
|
return this.walletBridge;
|
|
1480
1479
|
}
|
|
1481
1480
|
}
|
|
1482
|
-
class
|
|
1483
|
-
constructor({
|
|
1484
|
-
profileUrl: e,
|
|
1485
|
-
rpcUrl: t,
|
|
1486
|
-
version: n,
|
|
1487
|
-
username: o,
|
|
1488
|
-
slot: s,
|
|
1489
|
-
namespace: a,
|
|
1490
|
-
tokens: i,
|
|
1491
|
-
...c
|
|
1492
|
-
}) {
|
|
1493
|
-
const d = (e || _e).replace(/\/$/, "");
|
|
1494
|
-
let l = new URL(
|
|
1495
|
-
s ? `${d}/account/${o}/slot/${s}` : `${d}/account/${o}`
|
|
1496
|
-
);
|
|
1497
|
-
s && l.searchParams.set("ps", encodeURIComponent(s)), a && l.searchParams.set("ns", encodeURIComponent(a)), n && l.searchParams.set("v", encodeURIComponent(n)), l.searchParams.set("rpcUrl", encodeURIComponent(t)), i?.erc20 && l.searchParams.set(
|
|
1498
|
-
"erc20",
|
|
1499
|
-
encodeURIComponent(i.erc20.toString())
|
|
1500
|
-
), super({
|
|
1501
|
-
...c,
|
|
1502
|
-
id: "controller-profile",
|
|
1503
|
-
url: l
|
|
1504
|
-
});
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
class jt extends ke {
|
|
1481
|
+
class Ht extends _e {
|
|
1508
1482
|
keychain;
|
|
1509
|
-
profile;
|
|
1510
1483
|
options;
|
|
1511
1484
|
iframes;
|
|
1512
1485
|
selectedChain;
|
|
@@ -1514,25 +1487,26 @@ class jt extends ke {
|
|
|
1514
1487
|
isReady() {
|
|
1515
1488
|
return !!this.keychain;
|
|
1516
1489
|
}
|
|
1517
|
-
constructor(e) {
|
|
1490
|
+
constructor(e = {}) {
|
|
1518
1491
|
super();
|
|
1519
1492
|
const n = [...[
|
|
1520
1493
|
{ rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia" },
|
|
1521
1494
|
{ rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet" }
|
|
1522
|
-
], ...e.chains || []],
|
|
1523
|
-
this.selectedChain =
|
|
1495
|
+
], ...e.chains || []], s = e.defaultChainId || $.StarknetChainId.SN_MAIN;
|
|
1496
|
+
this.selectedChain = s, this.chains = /* @__PURE__ */ new Map(), this.iframes = {
|
|
1524
1497
|
keychain: new Tt({
|
|
1525
1498
|
...e,
|
|
1526
1499
|
onClose: this.keychain?.reset,
|
|
1527
|
-
onConnect: (
|
|
1528
|
-
this.keychain =
|
|
1529
|
-
}
|
|
1500
|
+
onConnect: (o) => {
|
|
1501
|
+
this.keychain = o;
|
|
1502
|
+
},
|
|
1503
|
+
version: ke
|
|
1530
1504
|
})
|
|
1531
|
-
}, this.options = { ...e, chains: n, defaultChainId:
|
|
1505
|
+
}, this.options = { ...e, chains: n, defaultChainId: s }, this.initializeChains(n), typeof window < "u" && (window.starknet_controller = this);
|
|
1532
1506
|
}
|
|
1533
1507
|
async logout() {
|
|
1534
1508
|
if (!this.keychain) {
|
|
1535
|
-
console.error(new
|
|
1509
|
+
console.error(new p().message);
|
|
1536
1510
|
return;
|
|
1537
1511
|
}
|
|
1538
1512
|
try {
|
|
@@ -1547,7 +1521,7 @@ class jt extends ke {
|
|
|
1547
1521
|
async probe() {
|
|
1548
1522
|
try {
|
|
1549
1523
|
if (await this.waitForKeychain(), !this.keychain) {
|
|
1550
|
-
console.error(new
|
|
1524
|
+
console.error(new p().message);
|
|
1551
1525
|
return;
|
|
1552
1526
|
}
|
|
1553
1527
|
const e = await this.keychain.probe(this.rpcUrl());
|
|
@@ -1564,31 +1538,13 @@ class jt extends ke {
|
|
|
1564
1538
|
console.error(e);
|
|
1565
1539
|
return;
|
|
1566
1540
|
}
|
|
1567
|
-
if (!this.iframes.profile) {
|
|
1568
|
-
const e = await this.keychain.username();
|
|
1569
|
-
this.iframes.profile = new $t({
|
|
1570
|
-
...this.options,
|
|
1571
|
-
onConnect: (t) => {
|
|
1572
|
-
this.profile = t;
|
|
1573
|
-
},
|
|
1574
|
-
methods: {
|
|
1575
|
-
openSettings: () => this.openSettings.bind(this),
|
|
1576
|
-
openPurchaseCredits: () => this.openPurchaseCredits.bind(this),
|
|
1577
|
-
openExecute: () => this.openExecute.bind(this),
|
|
1578
|
-
logout: () => this.logout.bind(this)
|
|
1579
|
-
},
|
|
1580
|
-
rpcUrl: this.rpcUrl(),
|
|
1581
|
-
username: e,
|
|
1582
|
-
version: this.version
|
|
1583
|
-
});
|
|
1584
|
-
}
|
|
1585
1541
|
return this.account;
|
|
1586
1542
|
}
|
|
1587
1543
|
async connect() {
|
|
1588
1544
|
if (this.account)
|
|
1589
1545
|
return this.account;
|
|
1590
1546
|
if (!this.keychain || !this.iframes.keychain) {
|
|
1591
|
-
console.error(new
|
|
1547
|
+
console.error(new p().message);
|
|
1592
1548
|
return;
|
|
1593
1549
|
}
|
|
1594
1550
|
typeof document < "u" && document.hasStorageAccess && (await document.hasStorageAccess() || await document.requestStorageAccess()), this.iframes.keychain.open();
|
|
@@ -1600,10 +1556,9 @@ class jt extends ke {
|
|
|
1600
1556
|
// 3. Otherwise, use provided policies or empty object
|
|
1601
1557
|
this.options.shouldOverridePresetPolicies && this.options.policies ? this.options.policies : this.options.preset ? {} : this.options.policies || {},
|
|
1602
1558
|
this.rpcUrl(),
|
|
1603
|
-
this.options.signupOptions
|
|
1604
|
-
Ae
|
|
1559
|
+
this.options.signupOptions
|
|
1605
1560
|
);
|
|
1606
|
-
if (e.code !==
|
|
1561
|
+
if (e.code !== R.SUCCESS)
|
|
1607
1562
|
throw new Error(e.message);
|
|
1608
1563
|
return e = e, this.account = new H(
|
|
1609
1564
|
this,
|
|
@@ -1621,11 +1576,11 @@ class jt extends ke {
|
|
|
1621
1576
|
}
|
|
1622
1577
|
async switchStarknetChain(e) {
|
|
1623
1578
|
if (!this.keychain || !this.iframes.keychain)
|
|
1624
|
-
return console.error(new
|
|
1579
|
+
return console.error(new p().message), !1;
|
|
1625
1580
|
try {
|
|
1626
1581
|
if (this.selectedChain = e, (await this.keychain.probe(this.rpcUrl())).rpcUrl === this.rpcUrl())
|
|
1627
1582
|
return !0;
|
|
1628
|
-
await this.keychain.switchChain(this.rpcUrl())
|
|
1583
|
+
await this.keychain.switchChain(this.rpcUrl());
|
|
1629
1584
|
} catch (t) {
|
|
1630
1585
|
return console.error(t), !1;
|
|
1631
1586
|
}
|
|
@@ -1636,53 +1591,55 @@ class jt extends ke {
|
|
|
1636
1591
|
}
|
|
1637
1592
|
async disconnect() {
|
|
1638
1593
|
if (!this.keychain) {
|
|
1639
|
-
console.error(new
|
|
1594
|
+
console.error(new p().message);
|
|
1640
1595
|
return;
|
|
1641
1596
|
}
|
|
1642
1597
|
return typeof document < "u" && document.hasStorageAccess && (await document.hasStorageAccess() || await document.requestStorageAccess()), this.account = void 0, this.keychain.disconnect();
|
|
1643
1598
|
}
|
|
1644
1599
|
async openProfile(e = "inventory") {
|
|
1645
|
-
if (!this.
|
|
1646
|
-
console.error(
|
|
1600
|
+
if (!this.keychain || !this.iframes.keychain) {
|
|
1601
|
+
console.error(new p().message);
|
|
1647
1602
|
return;
|
|
1648
1603
|
}
|
|
1649
1604
|
if (!this.account) {
|
|
1650
1605
|
console.error("Account is not ready");
|
|
1651
1606
|
return;
|
|
1652
1607
|
}
|
|
1653
|
-
|
|
1608
|
+
const t = await this.keychain.username();
|
|
1609
|
+
await this.keychain.navigate(`/account/${t}/${e}`), this.iframes.keychain.open();
|
|
1654
1610
|
}
|
|
1655
1611
|
async openProfileTo(e) {
|
|
1656
|
-
if (!this.
|
|
1657
|
-
console.error(
|
|
1612
|
+
if (!this.keychain || !this.iframes.keychain) {
|
|
1613
|
+
console.error(new p().message);
|
|
1658
1614
|
return;
|
|
1659
1615
|
}
|
|
1660
1616
|
if (!this.account) {
|
|
1661
1617
|
console.error("Account is not ready");
|
|
1662
1618
|
return;
|
|
1663
1619
|
}
|
|
1664
|
-
|
|
1620
|
+
const t = await this.keychain.username();
|
|
1621
|
+
await this.keychain.navigate(`/account/${t}/${e}`), this.iframes.keychain.open();
|
|
1665
1622
|
}
|
|
1666
1623
|
async openProfileAt(e) {
|
|
1667
|
-
if (!this.
|
|
1668
|
-
console.error(
|
|
1624
|
+
if (!this.keychain || !this.iframes.keychain) {
|
|
1625
|
+
console.error(new p().message);
|
|
1669
1626
|
return;
|
|
1670
1627
|
}
|
|
1671
1628
|
if (!this.account) {
|
|
1672
1629
|
console.error("Account is not ready");
|
|
1673
1630
|
return;
|
|
1674
1631
|
}
|
|
1675
|
-
this.
|
|
1632
|
+
await this.keychain.navigate(e), this.iframes.keychain.open();
|
|
1676
1633
|
}
|
|
1677
|
-
|
|
1678
|
-
if (!this.keychain || !this.iframes.keychain)
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1634
|
+
openSettings() {
|
|
1635
|
+
if (!this.keychain || !this.iframes.keychain) {
|
|
1636
|
+
console.error(new p().message);
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
this.iframes.keychain.open(), this.keychain.openSettings();
|
|
1683
1640
|
}
|
|
1684
1641
|
revoke(e, t) {
|
|
1685
|
-
return this.keychain ? this.keychain.revoke(e) : (console.error(new
|
|
1642
|
+
return this.keychain ? this.keychain.revoke(e) : (console.error(new p().message), null);
|
|
1686
1643
|
}
|
|
1687
1644
|
rpcUrl() {
|
|
1688
1645
|
const e = this.chains.get(this.selectedChain);
|
|
@@ -1698,62 +1655,52 @@ class jt extends ke {
|
|
|
1698
1655
|
}
|
|
1699
1656
|
username() {
|
|
1700
1657
|
if (!this.keychain) {
|
|
1701
|
-
console.error(new
|
|
1658
|
+
console.error(new p().message);
|
|
1702
1659
|
return;
|
|
1703
1660
|
}
|
|
1704
1661
|
return this.keychain.username();
|
|
1705
1662
|
}
|
|
1706
1663
|
openPurchaseCredits() {
|
|
1707
1664
|
if (!this.keychain || !this.iframes.keychain) {
|
|
1708
|
-
console.error(new
|
|
1709
|
-
return;
|
|
1710
|
-
}
|
|
1711
|
-
if (!this.iframes.profile) {
|
|
1712
|
-
console.error("Profile is not ready");
|
|
1665
|
+
console.error(new p().message);
|
|
1713
1666
|
return;
|
|
1714
1667
|
}
|
|
1715
|
-
this.iframes.
|
|
1668
|
+
this.iframes.keychain.open(), this.keychain.openPurchaseCredits();
|
|
1716
1669
|
}
|
|
1717
1670
|
openStarterPack(e) {
|
|
1718
1671
|
if (!this.keychain || !this.iframes.keychain) {
|
|
1719
|
-
console.error(new
|
|
1672
|
+
console.error(new p().message);
|
|
1720
1673
|
return;
|
|
1721
1674
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
}
|
|
1726
|
-
this.iframes.profile.close(), this.iframes.keychain.open(), this.keychain.openStarterPack(e);
|
|
1675
|
+
this.keychain.navigate(`/starter-pack/${e}`).then(() => {
|
|
1676
|
+
this.iframes.keychain.open();
|
|
1677
|
+
});
|
|
1727
1678
|
}
|
|
1728
1679
|
async openExecute(e, t) {
|
|
1729
1680
|
if (!this.keychain || !this.iframes.keychain) {
|
|
1730
|
-
console.error(new
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
if (!this.iframes.profile) {
|
|
1734
|
-
console.error("Profile is not ready");
|
|
1681
|
+
console.error(new p().message);
|
|
1735
1682
|
return;
|
|
1736
1683
|
}
|
|
1737
1684
|
let n = this.selectedChain;
|
|
1738
|
-
t && this.switchStarknetChain(t), this.iframes.
|
|
1739
|
-
const
|
|
1740
|
-
return this.iframes.
|
|
1741
|
-
status: !(
|
|
1742
|
-
transactionHash:
|
|
1685
|
+
t && this.switchStarknetChain(t), this.iframes.keychain.open();
|
|
1686
|
+
const s = await this.keychain.execute(e, void 0, void 0, !0);
|
|
1687
|
+
return this.iframes.keychain.close(), t && this.switchStarknetChain(n), {
|
|
1688
|
+
status: !(s && (s.code === R.NOT_CONNECTED || s.code === R.CANCELED)),
|
|
1689
|
+
transactionHash: s?.transaction_hash
|
|
1743
1690
|
};
|
|
1744
1691
|
}
|
|
1745
1692
|
async delegateAccount() {
|
|
1746
|
-
return this.keychain ? await this.keychain.delegateAccount() : (console.error(new
|
|
1693
|
+
return this.keychain ? await this.keychain.delegateAccount() : (console.error(new p().message), null);
|
|
1747
1694
|
}
|
|
1748
1695
|
initializeChains(e) {
|
|
1749
1696
|
for (const t of e)
|
|
1750
1697
|
try {
|
|
1751
|
-
const n = new URL(t.rpcUrl),
|
|
1752
|
-
if ((
|
|
1698
|
+
const n = new URL(t.rpcUrl), s = Ae(n), o = s === $.StarknetChainId.SN_MAIN, a = s === $.StarknetChainId.SN_SEPOLIA, i = n.hostname === "api.cartridge.gg", c = n.hostname === "localhost" || n.hostname === "127.0.0.1";
|
|
1699
|
+
if ((o || a) && !(i || c))
|
|
1753
1700
|
throw new Error(
|
|
1754
|
-
`Only Cartridge RPC providers are allowed for ${
|
|
1701
|
+
`Only Cartridge RPC providers are allowed for ${o ? "mainnet" : "sepolia"}. Please use: https://api.cartridge.gg/x/starknet/${o ? "mainnet" : "sepolia"}`
|
|
1755
1702
|
);
|
|
1756
|
-
this.chains.set(
|
|
1703
|
+
this.chains.set(s, t);
|
|
1757
1704
|
} catch (n) {
|
|
1758
1705
|
throw console.error(`Failed to parse chainId for ${t.rpcUrl}:`, n), n;
|
|
1759
1706
|
}
|
|
@@ -1765,10 +1712,10 @@ class jt extends ke {
|
|
|
1765
1712
|
timeout: e = 5e4,
|
|
1766
1713
|
interval: t = 100
|
|
1767
1714
|
} = {}) {
|
|
1768
|
-
return new Promise((n,
|
|
1769
|
-
const
|
|
1770
|
-
if (Date.now() -
|
|
1771
|
-
clearInterval(a),
|
|
1715
|
+
return new Promise((n, s) => {
|
|
1716
|
+
const o = Date.now(), a = setInterval(() => {
|
|
1717
|
+
if (Date.now() - o > e) {
|
|
1718
|
+
clearInterval(a), s(new Error("Timeout waiting for keychain"));
|
|
1772
1719
|
return;
|
|
1773
1720
|
}
|
|
1774
1721
|
this.keychain && (clearInterval(a), n());
|
|
@@ -1776,11 +1723,11 @@ class jt extends ke {
|
|
|
1776
1723
|
});
|
|
1777
1724
|
}
|
|
1778
1725
|
}
|
|
1779
|
-
const
|
|
1780
|
-
async function
|
|
1726
|
+
const S = /* @__PURE__ */ new Map();
|
|
1727
|
+
async function pe(r) {
|
|
1781
1728
|
if (!r.addresses?.length && !r.usernames?.length)
|
|
1782
1729
|
return { results: [] };
|
|
1783
|
-
const e = await fetch(`${
|
|
1730
|
+
const e = await fetch(`${Ie}/lookup`, {
|
|
1784
1731
|
method: "POST",
|
|
1785
1732
|
headers: {
|
|
1786
1733
|
"Content-Type": "application/json"
|
|
@@ -1791,26 +1738,26 @@ async function me(r) {
|
|
|
1791
1738
|
throw new Error(`HTTP error! status: ${e.status}`);
|
|
1792
1739
|
return e.json();
|
|
1793
1740
|
}
|
|
1794
|
-
async function
|
|
1795
|
-
const e = r.filter((t) => !
|
|
1796
|
-
return e.length > 0 && (await
|
|
1797
|
-
|
|
1741
|
+
async function Kt(r) {
|
|
1742
|
+
const e = r.filter((t) => !S.has(t));
|
|
1743
|
+
return e.length > 0 && (await pe({ usernames: e })).results.forEach((n) => {
|
|
1744
|
+
S.set(n.username, n.addresses[0]);
|
|
1798
1745
|
}), new Map(
|
|
1799
|
-
r.map((t) => [t,
|
|
1746
|
+
r.map((t) => [t, S.get(t)]).filter((t) => t[1] !== void 0)
|
|
1800
1747
|
);
|
|
1801
1748
|
}
|
|
1802
|
-
async function
|
|
1749
|
+
async function jt(r) {
|
|
1803
1750
|
r = r.map(ye.toHex);
|
|
1804
|
-
const e = r.filter((t) => !
|
|
1805
|
-
return e.length > 0 && (await
|
|
1751
|
+
const e = r.filter((t) => !S.has(t));
|
|
1752
|
+
return e.length > 0 && (await pe({
|
|
1806
1753
|
addresses: e
|
|
1807
1754
|
})).results.forEach((n) => {
|
|
1808
|
-
|
|
1755
|
+
S.set(n.addresses[0], n.username);
|
|
1809
1756
|
}), new Map(
|
|
1810
|
-
r.map((t) => [t,
|
|
1757
|
+
r.map((t) => [t, S.get(t)]).filter((t) => t[1] !== void 0)
|
|
1811
1758
|
);
|
|
1812
1759
|
}
|
|
1813
|
-
var
|
|
1760
|
+
var $t = [
|
|
1814
1761
|
{
|
|
1815
1762
|
name: "Wrapped BTC",
|
|
1816
1763
|
symbol: "WBTC",
|
|
@@ -2374,97 +2321,98 @@ var zt = [
|
|
|
2374
2321
|
total_supply: null,
|
|
2375
2322
|
logo_url: "https://assets.underware.gg/pistols/fame.svg"
|
|
2376
2323
|
}
|
|
2377
|
-
],
|
|
2324
|
+
], ge = {
|
|
2378
2325
|
theme: {
|
|
2379
2326
|
name: "Cartridge",
|
|
2380
2327
|
icon: "icon.svg"
|
|
2381
2328
|
}
|
|
2382
|
-
},
|
|
2329
|
+
}, Q = "https://static.cartridge.gg/presets";
|
|
2383
2330
|
async function F() {
|
|
2384
2331
|
try {
|
|
2385
|
-
const r = await fetch(`${
|
|
2332
|
+
const r = await fetch(`${Q}/index.json`);
|
|
2386
2333
|
if (!r.ok)
|
|
2387
2334
|
throw new Error(`Failed to load configs index: ${r.statusText}`);
|
|
2388
2335
|
return await r.json();
|
|
2389
2336
|
} catch (r) {
|
|
2390
|
-
return console.error("Error loading configs index:", r), { configs: [], baseUrl:
|
|
2337
|
+
return console.error("Error loading configs index:", r), { configs: [], baseUrl: Q };
|
|
2391
2338
|
}
|
|
2392
2339
|
}
|
|
2393
|
-
async function
|
|
2340
|
+
async function qt() {
|
|
2394
2341
|
return (await F()).configs;
|
|
2395
2342
|
}
|
|
2396
|
-
async function
|
|
2343
|
+
async function Xt(r) {
|
|
2397
2344
|
try {
|
|
2398
|
-
const n = `${(await F()).baseUrl ||
|
|
2399
|
-
if (!
|
|
2345
|
+
const n = `${(await F()).baseUrl || Q}/${r}`, s = await fetch(`${n}/config.json`);
|
|
2346
|
+
if (!s.ok)
|
|
2400
2347
|
throw new Error(
|
|
2401
|
-
`Failed to load config ${r}: ${
|
|
2348
|
+
`Failed to load config ${r}: ${s.statusText}`
|
|
2402
2349
|
);
|
|
2403
|
-
const
|
|
2404
|
-
if (
|
|
2405
|
-
|
|
2350
|
+
const o = await s.json();
|
|
2351
|
+
if (o && o.theme) {
|
|
2352
|
+
o.theme.icon && !o.theme.icon.startsWith("http") && (o.theme.icon = `${n}/${o.theme.icon}`), o.theme.cover && (typeof o.theme.cover == "string" ? o.theme.cover.startsWith("http") || (o.theme.cover = `${n}/${o.theme.cover}`) : (o.theme.cover.light && !o.theme.cover.light.startsWith("http") && (o.theme.cover.light = `${n}/${o.theme.cover.light}`), o.theme.cover.dark && !o.theme.cover.dark.startsWith("http") && (o.theme.cover.dark = `${n}/${o.theme.cover.dark}`)));
|
|
2406
2353
|
const a = (i) => {
|
|
2407
2354
|
if (i) {
|
|
2408
2355
|
for (const c in i)
|
|
2409
2356
|
if (i[c])
|
|
2410
|
-
for (const
|
|
2411
|
-
i[c][
|
|
2357
|
+
for (const l in i[c])
|
|
2358
|
+
i[c][l] && !i[c][l].startsWith("http") && (i[c][l] = `${n}/${i[c][l]}`);
|
|
2412
2359
|
}
|
|
2413
2360
|
};
|
|
2414
|
-
if (
|
|
2415
|
-
if (typeof
|
|
2416
|
-
|
|
2417
|
-
else if (
|
|
2418
|
-
const i =
|
|
2361
|
+
if (o.theme.optimizedIcon && a(o.theme.optimizedIcon), o.theme.optimizedCover)
|
|
2362
|
+
if (typeof o.theme.optimizedCover == "string")
|
|
2363
|
+
o.theme.optimizedCover.startsWith("http") || (o.theme.optimizedCover = `${n}/${o.theme.optimizedCover}`);
|
|
2364
|
+
else if (o.theme.optimizedCover.light || o.theme.optimizedCover.dark) {
|
|
2365
|
+
const i = o.theme.optimizedCover;
|
|
2419
2366
|
i.light && a(i.light), i.dark && a(i.dark);
|
|
2420
2367
|
} else
|
|
2421
|
-
a(
|
|
2368
|
+
a(o.theme.optimizedCover);
|
|
2422
2369
|
}
|
|
2423
|
-
return
|
|
2370
|
+
return o;
|
|
2424
2371
|
} catch (e) {
|
|
2425
2372
|
return console.error(`Error loading config ${r}:`, e), null;
|
|
2426
2373
|
}
|
|
2427
2374
|
}
|
|
2428
|
-
async function
|
|
2429
|
-
const r = await F(), e = r.configs, t = r.baseUrl ||
|
|
2375
|
+
async function Gt() {
|
|
2376
|
+
const r = await F(), e = r.configs, t = r.baseUrl || Q, n = {};
|
|
2430
2377
|
return await Promise.all(
|
|
2431
|
-
e.map(async (
|
|
2378
|
+
e.map(async (s) => {
|
|
2432
2379
|
try {
|
|
2433
|
-
const
|
|
2434
|
-
if (
|
|
2435
|
-
const a = await
|
|
2436
|
-
n[
|
|
2380
|
+
const o = await fetch(`${t}/${s}/config.json`);
|
|
2381
|
+
if (o.ok) {
|
|
2382
|
+
const a = await o.json();
|
|
2383
|
+
n[s] = a;
|
|
2437
2384
|
}
|
|
2438
|
-
} catch (
|
|
2439
|
-
console.error(`Error loading config ${
|
|
2385
|
+
} catch (o) {
|
|
2386
|
+
console.error(`Error loading config ${s}:`, o);
|
|
2440
2387
|
}
|
|
2441
2388
|
})
|
|
2442
2389
|
), n;
|
|
2443
2390
|
}
|
|
2444
|
-
|
|
2391
|
+
ge.theme.icon = "https://static.cartridge.gg/presets/cartridge/icon.svg";
|
|
2392
|
+
var Vt = $t, Jt = ge.theme;
|
|
2445
2393
|
export {
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2394
|
+
Pt as ArgentWallet,
|
|
2395
|
+
tr as FeeSource,
|
|
2396
|
+
Nt as MetaMaskWallet,
|
|
2397
|
+
p as NotReadyToConnect,
|
|
2450
2398
|
Mt as PhantomWallet,
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2399
|
+
Qt as RabbyWallet,
|
|
2400
|
+
R as ResponseCodes,
|
|
2401
|
+
Ut as WalletBridge,
|
|
2402
|
+
Ht as default,
|
|
2403
|
+
Jt as defaultTheme,
|
|
2404
|
+
Vt as erc20Metadata,
|
|
2405
|
+
qt as getAvailableConfigs,
|
|
2458
2406
|
F as getConfigsIndex,
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2407
|
+
rr as humanizeString,
|
|
2408
|
+
Gt as loadAllConfigs,
|
|
2409
|
+
Xt as loadConfig,
|
|
2410
|
+
jt as lookupAddresses,
|
|
2411
|
+
Kt as lookupUsernames,
|
|
2412
|
+
nr as normalizeCalls,
|
|
2413
|
+
Ae as parseChainId,
|
|
2466
2414
|
be as toArray,
|
|
2467
|
-
|
|
2468
|
-
|
|
2415
|
+
sr as toSessionPolicies,
|
|
2416
|
+
or as toWasmPolicies
|
|
2469
2417
|
};
|
|
2470
2418
|
//# sourceMappingURL=index.js.map
|