@cartridge/controller 0.9.1 → 0.9.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 +14 -14
- package/.turbo/turbo-build.log +11 -11
- package/dist/iframe/base.d.ts +1 -0
- package/dist/index.js +67 -60
- 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-iltRv2Q1.js → provider-C1UeMjUr.js} +2 -2
- package/dist/{provider-iltRv2Q1.js.map → provider-C1UeMjUr.js.map} +1 -1
- package/dist/session.js +2 -2
- package/dist/stats.html +1 -1
- package/package.json +2 -2
- package/src/controller.ts +5 -1
- package/src/iframe/base.ts +27 -7
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.9.
|
|
2
|
+
> @cartridge/controller@0.9.2 build:deps /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> pnpm build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @cartridge/controller@0.9.
|
|
6
|
+
> @cartridge/controller@0.9.2 build /home/runner/work/controller/controller/packages/controller
|
|
7
7
|
> pnpm build:browser && pnpm build:node
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @cartridge/controller@0.9.
|
|
10
|
+
> @cartridge/controller@0.9.2 build:browser /home/runner/work/controller/controller/packages/controller
|
|
11
11
|
> vite build
|
|
12
12
|
|
|
13
13
|
[36mvite v6.3.4 [32mbuilding for production...[36m[39m
|
|
@@ -19,13 +19,13 @@ rendering chunks...
|
|
|
19
19
|
[vite:dts] Start generate declaration files...
|
|
20
20
|
computing gzip size...
|
|
21
21
|
[2mdist/[22m[36msession.js [39m[1m[2m11.17 kB[22m[1m[22m[2m │ gzip: 3.47 kB[22m[2m │ map: 60.40 kB[22m
|
|
22
|
-
[2mdist/[22m[36mprovider-
|
|
23
|
-
[2mdist/[22m[36mindex.js [39m[1m[2m77.
|
|
24
|
-
[vite:dts] Declaration files built in
|
|
22
|
+
[2mdist/[22m[36mprovider-C1UeMjUr.js [39m[1m[2m13.48 kB[22m[1m[22m[2m │ gzip: 5.51 kB[22m[2m │ map: 32.57 kB[22m
|
|
23
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m77.34 kB[22m[1m[22m[2m │ gzip: 20.27 kB[22m[2m │ map: 218.96 kB[22m
|
|
24
|
+
[vite:dts] Declaration files built in 4818ms.
|
|
25
25
|
|
|
26
|
-
[32m✓ built in 6.
|
|
26
|
+
[32m✓ built in 6.21s[39m
|
|
27
27
|
|
|
28
|
-
> @cartridge/controller@0.9.
|
|
28
|
+
> @cartridge/controller@0.9.2 build:node /home/runner/work/controller/controller/packages/controller
|
|
29
29
|
> tsup --config tsup.node.config.ts
|
|
30
30
|
|
|
31
31
|
[34mCLI[39m Building entry: src/node/index.ts
|
|
@@ -36,16 +36,16 @@ computing gzip size...
|
|
|
36
36
|
[34mCLI[39m Cleaning output folder
|
|
37
37
|
[34mESM[39m Build start
|
|
38
38
|
[34mCJS[39m Build start
|
|
39
|
-
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
40
39
|
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.cjs".
|
|
41
40
|
Entry module "dist/node/index.cjs" is using named and default exports together. Consumers of your bundle will have to use `chunk.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
|
|
42
|
-
|
|
43
|
-
[32mESM[39m [1mdist/node/index.js.map [22m[32m50.30 KB[39m
|
|
44
|
-
[32mESM[39m ⚡️ Build success in 361ms
|
|
41
|
+
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
45
42
|
[32mCJS[39m [1mdist/node/index.cjs [22m[32m21.89 KB[39m
|
|
46
43
|
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m50.50 KB[39m
|
|
47
|
-
[32mCJS[39m ⚡️ Build success in
|
|
44
|
+
[32mCJS[39m ⚡️ Build success in 364ms
|
|
45
|
+
[32mESM[39m [1mdist/node/index.js [22m[32m21.13 KB[39m
|
|
46
|
+
[32mESM[39m [1mdist/node/index.js.map [22m[32m50.30 KB[39m
|
|
47
|
+
[32mESM[39m ⚡️ Build success in 364ms
|
|
48
48
|
[34mDTS[39m Build start
|
|
49
|
-
[32mDTS[39m ⚡️ Build success in
|
|
49
|
+
[32mDTS[39m ⚡️ Build success in 4463ms
|
|
50
50
|
[32mDTS[39m [1mdist/node/index.d.ts [22m[32m5.26 KB[39m
|
|
51
51
|
[32mDTS[39m [1mdist/node/index.d.cts [22m[32m5.26 KB[39m
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.9.
|
|
2
|
+
> @cartridge/controller@0.9.2 build /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> pnpm build:browser && pnpm build:node
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @cartridge/controller@0.9.
|
|
6
|
+
> @cartridge/controller@0.9.2 build:browser /home/runner/work/controller/controller/packages/controller
|
|
7
7
|
> vite build
|
|
8
8
|
|
|
9
9
|
[36mvite v6.3.4 [32mbuilding for production...[36m[39m
|
|
@@ -15,13 +15,13 @@ rendering chunks...
|
|
|
15
15
|
[vite:dts] Start generate declaration files...
|
|
16
16
|
computing gzip size...
|
|
17
17
|
[2mdist/[22m[36msession.js [39m[1m[2m11.17 kB[22m[1m[22m[2m │ gzip: 3.47 kB[22m[2m │ map: 60.40 kB[22m
|
|
18
|
-
[2mdist/[22m[36mprovider-
|
|
19
|
-
[2mdist/[22m[36mindex.js [39m[1m[2m77.
|
|
20
|
-
[vite:dts] Declaration files built in
|
|
18
|
+
[2mdist/[22m[36mprovider-C1UeMjUr.js [39m[1m[2m13.48 kB[22m[1m[22m[2m │ gzip: 5.51 kB[22m[2m │ map: 32.57 kB[22m
|
|
19
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m77.34 kB[22m[1m[22m[2m │ gzip: 20.27 kB[22m[2m │ map: 218.96 kB[22m
|
|
20
|
+
[vite:dts] Declaration files built in 5212ms.
|
|
21
21
|
|
|
22
|
-
[32m✓ built in 6.
|
|
22
|
+
[32m✓ built in 6.70s[39m
|
|
23
23
|
|
|
24
|
-
> @cartridge/controller@0.9.
|
|
24
|
+
> @cartridge/controller@0.9.2 build:node /home/runner/work/controller/controller/packages/controller
|
|
25
25
|
> tsup --config tsup.node.config.ts
|
|
26
26
|
|
|
27
27
|
[34mCLI[39m Building entry: src/node/index.ts
|
|
@@ -32,16 +32,16 @@ computing gzip size...
|
|
|
32
32
|
[34mCLI[39m Cleaning output folder
|
|
33
33
|
[34mESM[39m Build start
|
|
34
34
|
[34mCJS[39m Build start
|
|
35
|
+
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
35
36
|
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.cjs".
|
|
36
37
|
Entry module "dist/node/index.cjs" is using named and default exports together. Consumers of your bundle will have to use `chunk.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
|
|
37
|
-
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
38
38
|
[32mCJS[39m [1mdist/node/index.cjs [22m[32m21.89 KB[39m
|
|
39
39
|
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m50.50 KB[39m
|
|
40
|
-
[32mCJS[39m ⚡️ Build success in
|
|
40
|
+
[32mCJS[39m ⚡️ Build success in 419ms
|
|
41
41
|
[32mESM[39m [1mdist/node/index.js [22m[32m21.13 KB[39m
|
|
42
42
|
[32mESM[39m [1mdist/node/index.js.map [22m[32m50.30 KB[39m
|
|
43
|
-
[32mESM[39m ⚡️ Build success in
|
|
43
|
+
[32mESM[39m ⚡️ Build success in 421ms
|
|
44
44
|
[34mDTS[39m Build start
|
|
45
|
-
[32mDTS[39m ⚡️ Build success in
|
|
45
|
+
[32mDTS[39m ⚡️ Build success in 4482ms
|
|
46
46
|
[32mDTS[39m [1mdist/node/index.d.ts [22m[32m5.26 KB[39m
|
|
47
47
|
[32mDTS[39m [1mdist/node/index.d.cts [22m[32m5.26 KB[39m
|
package/dist/iframe/base.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class IFrame<CallSender extends {}> implements Modal {
|
|
|
10
10
|
private container?;
|
|
11
11
|
private onClose?;
|
|
12
12
|
private child?;
|
|
13
|
+
private closeTimeout?;
|
|
13
14
|
constructor({ id, url, preset, onClose, onConnect, methods, }: Pick<ControllerOptions, "preset"> & {
|
|
14
15
|
id: string;
|
|
15
16
|
url: URL;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { WalletAccount as
|
|
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-
|
|
3
|
-
import { F as tr, h as rr, n as nr, a as sr, b as or } from "./provider-
|
|
1
|
+
import { WalletAccount as ge, 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-C1UeMjUr.js";
|
|
3
|
+
import { F as tr, h as rr, n as nr, a as sr, b as or } from "./provider-C1UeMjUr.js";
|
|
4
4
|
import { connect as ve } from "starknetkit";
|
|
5
5
|
import { InjectedConnector as Ee } from "starknetkit/injected";
|
|
6
6
|
import { MetaMaskSDK as xe } from "@metamask/sdk";
|
|
7
7
|
import { Transaction as Ce } from "@solana/web3.js";
|
|
8
|
-
class H extends
|
|
8
|
+
class H extends ge {
|
|
9
9
|
keychain;
|
|
10
10
|
modal;
|
|
11
11
|
options;
|
|
@@ -130,7 +130,7 @@ const Re = (r, e) => {
|
|
|
130
130
|
}), Be = (r) => {
|
|
131
131
|
const e = new Error();
|
|
132
132
|
return Object.keys(r).forEach((t) => e[t] = r[t]), e;
|
|
133
|
-
},
|
|
133
|
+
}, Te = (r, e, t) => {
|
|
134
134
|
const { localName: n, local: s, remote: o, originForSending: a, originForReceiving: i } = r;
|
|
135
135
|
let c = !1;
|
|
136
136
|
const l = (d) => {
|
|
@@ -140,11 +140,11 @@ const Re = (r, e) => {
|
|
|
140
140
|
t(`${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:
|
|
144
|
-
t(`${n}: Received ${
|
|
143
|
+
const h = d.data, { methodName: g, args: u, id: _ } = h;
|
|
144
|
+
t(`${n}: Received ${g}() call`);
|
|
145
145
|
const k = (y) => (I) => {
|
|
146
|
-
if (t(`${n}: Sending ${
|
|
147
|
-
t(`${n}: Unable to send ${
|
|
146
|
+
if (t(`${n}: Sending ${g}() reply`), c) {
|
|
147
|
+
t(`${n}: Unable to send ${g}() reply due to destroyed connection`);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
const w = {
|
|
@@ -170,14 +170,14 @@ const Re = (r, e) => {
|
|
|
170
170
|
throw f;
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
new Promise((y) => y(e[
|
|
173
|
+
new Promise((y) => y(e[g].call(e, d.origin).apply(e, u))).then(k(v.Fulfilled), k(v.Rejected));
|
|
174
174
|
};
|
|
175
175
|
return s.addEventListener(A.Message, l), () => {
|
|
176
176
|
c = !0, s.removeEventListener(A.Message, l);
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
let
|
|
180
|
-
const
|
|
179
|
+
let Qe = 0;
|
|
180
|
+
const Ue = () => ++Qe, re = ".", ne = (r) => r ? r.split(re) : [], $e = (r) => r.join(re), ze = (r, e) => {
|
|
181
181
|
const t = ne(e || "");
|
|
182
182
|
return t.push(r), $e(t);
|
|
183
183
|
}, Oe = (r, e, t) => {
|
|
@@ -211,17 +211,17 @@ const Te = () => ++Ue, re = ".", ne = (r) => r ? r.split(re) : [], $e = (r) => r
|
|
|
211
211
|
throw y.code = N.ConnectionDestroyed, y;
|
|
212
212
|
}
|
|
213
213
|
return new Promise((y, I) => {
|
|
214
|
-
const w =
|
|
214
|
+
const w = Ue(), f = (x) => {
|
|
215
215
|
if (x.source !== i || x.data.penpal !== b.Reply || x.data.id !== w)
|
|
216
216
|
return;
|
|
217
217
|
if (l !== "*" && x.origin !== l) {
|
|
218
218
|
s(`${o} received message from origin ${x.origin} which did not match expected origin ${l}`);
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
|
-
const
|
|
221
|
+
const Q = x.data;
|
|
222
222
|
s(`${o}: Received ${u}() reply`), a.removeEventListener(A.Message, f);
|
|
223
|
-
let
|
|
224
|
-
|
|
223
|
+
let U = Q.returnValue;
|
|
224
|
+
Q.returnValueIsError && (U = Be(U)), (Q.resolution === v.Fulfilled ? y : I)(U);
|
|
225
225
|
};
|
|
226
226
|
a.addEventListener(A.Message, f);
|
|
227
227
|
const E = {
|
|
@@ -232,8 +232,8 @@ const Te = () => ++Ue, re = ".", ne = (r) => r ? r.split(re) : [], $e = (r) => r
|
|
|
232
232
|
};
|
|
233
233
|
i.postMessage(E, c);
|
|
234
234
|
});
|
|
235
|
-
},
|
|
236
|
-
return Object.assign(r, Le(
|
|
235
|
+
}, g = t.reduce((u, _) => (u[_] = h(_), u), {});
|
|
236
|
+
return Object.assign(r, Le(g)), () => {
|
|
237
237
|
d = !0;
|
|
238
238
|
};
|
|
239
239
|
}, Fe = (r, e, t, n, s) => {
|
|
@@ -253,11 +253,11 @@ const Te = () => ++Ue, re = ".", ne = (r) => r ? r.split(re) : [], $e = (r) => r
|
|
|
253
253
|
originForSending: t,
|
|
254
254
|
originForReceiving: e
|
|
255
255
|
};
|
|
256
|
-
i && i(), i =
|
|
256
|
+
i && i(), i = Te(h, r, s), a(i), c && c.forEach((u) => {
|
|
257
257
|
delete l[u];
|
|
258
258
|
}), c = d.data.methodNames;
|
|
259
|
-
const
|
|
260
|
-
return a(
|
|
259
|
+
const g = Ye(l, h, c, o, s);
|
|
260
|
+
return a(g), l;
|
|
261
261
|
};
|
|
262
262
|
}, We = (r, e, t, n) => (s) => {
|
|
263
263
|
if (!s.source)
|
|
@@ -296,13 +296,13 @@ const Te = () => ++Ue, re = ".", ne = (r) => r ? r.split(re) : [], $e = (r) => r
|
|
|
296
296
|
let { iframe: e, methods: t = {}, childOrigin: n, timeout: s, debug: o = !1 } = r;
|
|
297
297
|
const a = Se(o), i = Re("Parent", a), { onDestroy: c, destroy: l } = i;
|
|
298
298
|
n || (qe(e), n = Me(e.src));
|
|
299
|
-
const d = n === "null" ? "*" : n, h = se(t),
|
|
299
|
+
const d = n === "null" ? "*" : n, h = se(t), g = We(a, h, n, d), u = Fe(h, n, d, i, a);
|
|
300
300
|
return {
|
|
301
301
|
promise: new Promise((k, y) => {
|
|
302
302
|
const I = je(s, l), w = (f) => {
|
|
303
303
|
if (!(f.source !== e.contentWindow || !f.data)) {
|
|
304
304
|
if (f.data.penpal === b.Syn) {
|
|
305
|
-
|
|
305
|
+
g(f);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
308
|
if (f.data.penpal === b.Ack) {
|
|
@@ -327,6 +327,7 @@ class Ge {
|
|
|
327
327
|
container;
|
|
328
328
|
onClose;
|
|
329
329
|
child;
|
|
330
|
+
closeTimeout;
|
|
330
331
|
constructor({
|
|
331
332
|
id: e,
|
|
332
333
|
url: t,
|
|
@@ -341,8 +342,8 @@ class Ge {
|
|
|
341
342
|
const i = document.createElement("iframe");
|
|
342
343
|
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");
|
|
343
344
|
const c = document.createElement("div");
|
|
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 = "
|
|
345
|
-
h.target === c && (e === "controller-keychain" && this.child && this.child.reset?.().catch((
|
|
345
|
+
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 = "none", c.style.alignItems = "center", c.style.justifyContent = "center", c.style.transition = "opacity 0.2s ease", c.style.opacity = "0", c.style.pointerEvents = "auto", c.appendChild(i), c.addEventListener("click", (h) => {
|
|
346
|
+
h.target === c && (e === "controller-keychain" && this.child && this.child.reset?.().catch((g) => console.error("Error resetting context:", g)), this.close());
|
|
346
347
|
}), this.iframe = i, this.container = c, Xe({
|
|
347
348
|
iframe: this.iframe,
|
|
348
349
|
methods: {
|
|
@@ -366,10 +367,14 @@ class Ge {
|
|
|
366
367
|
document.body && e === "controller-keychain" && !d && document.body.appendChild(c), this.onClose = s;
|
|
367
368
|
}
|
|
368
369
|
open() {
|
|
369
|
-
!this.container || typeof document > "u" || !document.body || (
|
|
370
|
+
!this.container || typeof document > "u" || !document.body || (this.closeTimeout && (clearTimeout(this.closeTimeout), this.closeTimeout = void 0), document.body.style.overflow = "hidden", this.container.style.display = "flex", requestAnimationFrame(() => {
|
|
371
|
+
this.container && (this.container.style.opacity = "1");
|
|
372
|
+
}));
|
|
370
373
|
}
|
|
371
374
|
close() {
|
|
372
|
-
!this.container || typeof document > "u" || !document.body || (this.onClose?.(), document.body.style.overflow = "auto", this.container.style.
|
|
375
|
+
!this.container || typeof document > "u" || !document.body || (this.onClose?.(), document.body.style.overflow = "auto", this.container.style.opacity = "0", this.closeTimeout = setTimeout(() => {
|
|
376
|
+
this.container && (this.container.style.display = "none"), this.closeTimeout = void 0;
|
|
377
|
+
}, 200));
|
|
373
378
|
}
|
|
374
379
|
sendBackward() {
|
|
375
380
|
this.container && (this.container.style.zIndex = "9999");
|
|
@@ -387,7 +392,7 @@ class Ge {
|
|
|
387
392
|
}
|
|
388
393
|
}
|
|
389
394
|
isOpen() {
|
|
390
|
-
return this.
|
|
395
|
+
return this.container?.style.display !== "none";
|
|
391
396
|
}
|
|
392
397
|
}
|
|
393
398
|
const Ve = "6.13.7";
|
|
@@ -559,12 +564,12 @@ function dt(r, e = !1) {
|
|
|
559
564
|
}
|
|
560
565
|
return [t, n];
|
|
561
566
|
}
|
|
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] = [[], [], []],
|
|
567
|
+
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] = [[], [], []], mt = /* @__PURE__ */ BigInt(0), P = /* @__PURE__ */ BigInt(1), gt = /* @__PURE__ */ BigInt(2), yt = /* @__PURE__ */ BigInt(7), bt = /* @__PURE__ */ BigInt(256), wt = /* @__PURE__ */ BigInt(113);
|
|
563
568
|
for (let r = 0, e = P, t = 1, n = 0; r < 24; r++) {
|
|
564
569
|
[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 =
|
|
570
|
+
let s = mt;
|
|
566
571
|
for (let o = 0; o < 7; o++)
|
|
567
|
-
e = (e << P ^ (e >> yt) * wt) % bt, e &
|
|
572
|
+
e = (e << P ^ (e >> yt) * wt) % bt, e & gt && (s ^= P << (P << /* @__PURE__ */ BigInt(o)) - P);
|
|
568
573
|
le.push(s);
|
|
569
574
|
}
|
|
570
575
|
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);
|
|
@@ -574,9 +579,9 @@ function At(r, e = 24) {
|
|
|
574
579
|
for (let a = 0; a < 10; a++)
|
|
575
580
|
t[a] = r[a] ^ r[a + 10] ^ r[a + 20] ^ r[a + 30] ^ r[a + 40];
|
|
576
581
|
for (let a = 0; a < 10; a += 2) {
|
|
577
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = t[c], d = t[c + 1], h = J(l, d, 1) ^ t[i],
|
|
582
|
+
const i = (a + 8) % 10, c = (a + 2) % 10, l = t[c], d = t[c + 1], h = J(l, d, 1) ^ t[i], g = Z(l, d, 1) ^ t[i + 1];
|
|
578
583
|
for (let u = 0; u < 50; u += 10)
|
|
579
|
-
r[a + u] ^= h, r[a + u + 1] ^=
|
|
584
|
+
r[a + u] ^= h, r[a + u + 1] ^= g;
|
|
580
585
|
}
|
|
581
586
|
let s = r[2], o = r[3];
|
|
582
587
|
for (let a = 0; a < 24; a++) {
|
|
@@ -721,7 +726,7 @@ function St(r) {
|
|
|
721
726
|
e = e * xt + Rt[r[t]];
|
|
722
727
|
return e;
|
|
723
728
|
}
|
|
724
|
-
function
|
|
729
|
+
function m(r) {
|
|
725
730
|
if (D(typeof r == "string", "invalid address", "address", r), r.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
726
731
|
r.startsWith("0x") || (r = "0x" + r);
|
|
727
732
|
const e = ee(r);
|
|
@@ -880,9 +885,9 @@ class Nt {
|
|
|
880
885
|
this.MMSDK.getProvider()?.request({
|
|
881
886
|
method: "eth_accounts"
|
|
882
887
|
}).then((e) => {
|
|
883
|
-
e && e.length > 0 && (this.account =
|
|
888
|
+
e && e.length > 0 && (this.account = m(e[0]), this.connectedAccounts = e.map(m));
|
|
884
889
|
}), this.MMSDK.getProvider()?.on("accountsChanged", (e) => {
|
|
885
|
-
Array.isArray(e) && e.length > 0 && (this.account =
|
|
890
|
+
Array.isArray(e) && e.length > 0 && (this.account = m(e?.[0]), this.connectedAccounts = e.map(m));
|
|
886
891
|
});
|
|
887
892
|
});
|
|
888
893
|
}
|
|
@@ -909,8 +914,8 @@ class Nt {
|
|
|
909
914
|
throw new Error("MetaMask is not available");
|
|
910
915
|
const e = await this.MMSDK.connect();
|
|
911
916
|
if (e && e.length > 0)
|
|
912
|
-
return this.account =
|
|
913
|
-
(t) =>
|
|
917
|
+
return this.account = m(e[0]), this.connectedAccounts = e.map(
|
|
918
|
+
(t) => m(t)
|
|
914
919
|
), { success: !0, wallet: this.type, account: this.account };
|
|
915
920
|
throw new Error("No accounts found");
|
|
916
921
|
} catch (e) {
|
|
@@ -1140,7 +1145,7 @@ class Mt {
|
|
|
1140
1145
|
}
|
|
1141
1146
|
}
|
|
1142
1147
|
const Bt = "io.rabby";
|
|
1143
|
-
class
|
|
1148
|
+
class Tt {
|
|
1144
1149
|
type = "rabby";
|
|
1145
1150
|
platform = "ethereum";
|
|
1146
1151
|
account = void 0;
|
|
@@ -1151,9 +1156,9 @@ class Qt {
|
|
|
1151
1156
|
this.provider = this.store.getProviders().find((e) => e.info.rdns === Bt), this.provider?.provider.request({
|
|
1152
1157
|
method: "eth_accounts"
|
|
1153
1158
|
}).then((e) => {
|
|
1154
|
-
this.connectedAccounts = e.map(
|
|
1159
|
+
this.connectedAccounts = e.map(m), e.length > 0 && (this.account = m(e?.[0]));
|
|
1155
1160
|
}), this.provider?.provider?.on("accountsChanged", (e) => {
|
|
1156
|
-
e && (this.connectedAccounts = e.map((t) =>
|
|
1161
|
+
e && (this.connectedAccounts = e.map((t) => m(t)), this.account = m(e?.[0]));
|
|
1157
1162
|
});
|
|
1158
1163
|
}
|
|
1159
1164
|
isAvailable() {
|
|
@@ -1172,7 +1177,7 @@ class Qt {
|
|
|
1172
1177
|
};
|
|
1173
1178
|
}
|
|
1174
1179
|
async connect(e) {
|
|
1175
|
-
if (e && this.connectedAccounts.includes(
|
|
1180
|
+
if (e && this.connectedAccounts.includes(m(e)) && (this.account = m(e)), this.account)
|
|
1176
1181
|
return { success: !0, wallet: this.type, account: this.account };
|
|
1177
1182
|
try {
|
|
1178
1183
|
if (!this.isAvailable())
|
|
@@ -1181,7 +1186,7 @@ class Qt {
|
|
|
1181
1186
|
method: "eth_requestAccounts"
|
|
1182
1187
|
});
|
|
1183
1188
|
if (t && t.length > 0)
|
|
1184
|
-
return this.account =
|
|
1189
|
+
return this.account = m(t[0]), this.connectedAccounts = t.map(m), { success: !0, wallet: this.type, account: this.account };
|
|
1185
1190
|
throw new Error("No accounts found");
|
|
1186
1191
|
} catch (t) {
|
|
1187
1192
|
return console.error("Error connecting to Rabby:", t), {
|
|
@@ -1306,7 +1311,7 @@ class Qt {
|
|
|
1306
1311
|
}
|
|
1307
1312
|
}
|
|
1308
1313
|
}
|
|
1309
|
-
class
|
|
1314
|
+
class Qt {
|
|
1310
1315
|
walletAdapters;
|
|
1311
1316
|
constructor() {
|
|
1312
1317
|
if (this.walletAdapters = /* @__PURE__ */ new Map(), typeof window > "u")
|
|
@@ -1317,7 +1322,7 @@ class Ut {
|
|
|
1317
1322
|
t.isAvailable() && this.walletAdapters.set("phantom", t);
|
|
1318
1323
|
const n = new Pt();
|
|
1319
1324
|
n.isAvailable() && this.walletAdapters.set("argent", n);
|
|
1320
|
-
const s = new
|
|
1325
|
+
const s = new Tt();
|
|
1321
1326
|
s.isAvailable() && this.walletAdapters.set("rabby", s), window.wallet_bridge = this;
|
|
1322
1327
|
}
|
|
1323
1328
|
getIFrameMethods() {
|
|
@@ -1378,7 +1383,7 @@ class Ut {
|
|
|
1378
1383
|
getConnectedWalletAdapter(e) {
|
|
1379
1384
|
let t;
|
|
1380
1385
|
if (typeof e == "string") {
|
|
1381
|
-
const n =
|
|
1386
|
+
const n = m(e);
|
|
1382
1387
|
t = this.walletAdapters.values().find((s) => s.getConnectedAccounts().includes(n));
|
|
1383
1388
|
} else
|
|
1384
1389
|
t = this.walletAdapters.get(e);
|
|
@@ -1449,7 +1454,7 @@ class Ut {
|
|
|
1449
1454
|
}
|
|
1450
1455
|
}
|
|
1451
1456
|
}
|
|
1452
|
-
class
|
|
1457
|
+
class Ut extends Ge {
|
|
1453
1458
|
walletBridge;
|
|
1454
1459
|
constructor({
|
|
1455
1460
|
url: e,
|
|
@@ -1460,7 +1465,7 @@ class Tt extends Ge {
|
|
|
1460
1465
|
tokens: a,
|
|
1461
1466
|
...i
|
|
1462
1467
|
}) {
|
|
1463
|
-
const c = new URL(e ?? we), l = new
|
|
1468
|
+
const c = new URL(e ?? we), l = new Qt();
|
|
1464
1469
|
t && c.searchParams.set(
|
|
1465
1470
|
"policies",
|
|
1466
1471
|
encodeURIComponent(JSON.stringify(t))
|
|
@@ -1494,7 +1499,7 @@ class Ht extends _e {
|
|
|
1494
1499
|
{ rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet" }
|
|
1495
1500
|
], ...e.chains || []], s = e.defaultChainId || $.StarknetChainId.SN_MAIN;
|
|
1496
1501
|
this.selectedChain = s, this.chains = /* @__PURE__ */ new Map(), this.iframes = {
|
|
1497
|
-
keychain: new
|
|
1502
|
+
keychain: new Ut({
|
|
1498
1503
|
...e,
|
|
1499
1504
|
onClose: this.keychain?.reset,
|
|
1500
1505
|
onConnect: (o) => {
|
|
@@ -1512,7 +1517,9 @@ class Ht extends _e {
|
|
|
1512
1517
|
try {
|
|
1513
1518
|
await this.disconnect(), document.querySelectorAll('iframe[id^="controller-"]').forEach((t) => {
|
|
1514
1519
|
const n = t.parentElement;
|
|
1515
|
-
n && (n.style.
|
|
1520
|
+
n && (n.style.opacity = "0", setTimeout(() => {
|
|
1521
|
+
n.style.display = "none";
|
|
1522
|
+
}, 200));
|
|
1516
1523
|
}), document.body && (document.body.style.overflow = "auto"), window.location.reload();
|
|
1517
1524
|
} catch (e) {
|
|
1518
1525
|
throw console.error("Logout failed:", e), e;
|
|
@@ -2321,20 +2328,20 @@ var $t = [
|
|
|
2321
2328
|
total_supply: null,
|
|
2322
2329
|
logo_url: "https://assets.underware.gg/pistols/fame.svg"
|
|
2323
2330
|
}
|
|
2324
|
-
],
|
|
2331
|
+
], me = {
|
|
2325
2332
|
theme: {
|
|
2326
2333
|
name: "Cartridge",
|
|
2327
2334
|
icon: "icon.svg"
|
|
2328
2335
|
}
|
|
2329
|
-
},
|
|
2336
|
+
}, T = "https://static.cartridge.gg/presets";
|
|
2330
2337
|
async function F() {
|
|
2331
2338
|
try {
|
|
2332
|
-
const r = await fetch(`${
|
|
2339
|
+
const r = await fetch(`${T}/index.json`);
|
|
2333
2340
|
if (!r.ok)
|
|
2334
2341
|
throw new Error(`Failed to load configs index: ${r.statusText}`);
|
|
2335
2342
|
return await r.json();
|
|
2336
2343
|
} catch (r) {
|
|
2337
|
-
return console.error("Error loading configs index:", r), { configs: [], baseUrl:
|
|
2344
|
+
return console.error("Error loading configs index:", r), { configs: [], baseUrl: T };
|
|
2338
2345
|
}
|
|
2339
2346
|
}
|
|
2340
2347
|
async function qt() {
|
|
@@ -2342,7 +2349,7 @@ async function qt() {
|
|
|
2342
2349
|
}
|
|
2343
2350
|
async function Xt(r) {
|
|
2344
2351
|
try {
|
|
2345
|
-
const n = `${(await F()).baseUrl ||
|
|
2352
|
+
const n = `${(await F()).baseUrl || T}/${r}`, s = await fetch(`${n}/config.json`);
|
|
2346
2353
|
if (!s.ok)
|
|
2347
2354
|
throw new Error(
|
|
2348
2355
|
`Failed to load config ${r}: ${s.statusText}`
|
|
@@ -2373,7 +2380,7 @@ async function Xt(r) {
|
|
|
2373
2380
|
}
|
|
2374
2381
|
}
|
|
2375
2382
|
async function Gt() {
|
|
2376
|
-
const r = await F(), e = r.configs, t = r.baseUrl ||
|
|
2383
|
+
const r = await F(), e = r.configs, t = r.baseUrl || T, n = {};
|
|
2377
2384
|
return await Promise.all(
|
|
2378
2385
|
e.map(async (s) => {
|
|
2379
2386
|
try {
|
|
@@ -2388,17 +2395,17 @@ async function Gt() {
|
|
|
2388
2395
|
})
|
|
2389
2396
|
), n;
|
|
2390
2397
|
}
|
|
2391
|
-
|
|
2392
|
-
var Vt = $t, Jt =
|
|
2398
|
+
me.theme.icon = "https://static.cartridge.gg/presets/cartridge/icon.svg";
|
|
2399
|
+
var Vt = $t, Jt = me.theme;
|
|
2393
2400
|
export {
|
|
2394
2401
|
Pt as ArgentWallet,
|
|
2395
2402
|
tr as FeeSource,
|
|
2396
2403
|
Nt as MetaMaskWallet,
|
|
2397
2404
|
p as NotReadyToConnect,
|
|
2398
2405
|
Mt as PhantomWallet,
|
|
2399
|
-
|
|
2406
|
+
Tt as RabbyWallet,
|
|
2400
2407
|
R as ResponseCodes,
|
|
2401
|
-
|
|
2408
|
+
Qt as WalletBridge,
|
|
2402
2409
|
Ht as default,
|
|
2403
2410
|
Jt as defaultTheme,
|
|
2404
2411
|
Vt as erc20Metadata,
|