@cartridge/controller 0.7.9 → 0.7.11
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 +12 -12
- package/.turbo/turbo-build.log +10 -10
- package/dist/index.js +122 -108
- 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-CH2PlazB.js → provider-CyO7_h7r.js} +39 -38
- package/dist/provider-CyO7_h7r.js.map +1 -0
- package/dist/session.js +29 -28
- package/dist/session.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +7 -1
- package/package.json +3 -3
- package/src/account.ts +1 -0
- package/src/iframe/base.ts +20 -1
- package/src/types.ts +8 -1
- package/dist/provider-CH2PlazB.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.7.
|
|
2
|
+
> @cartridge/controller@0.7.11 build:deps /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> pnpm build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @cartridge/controller@0.7.
|
|
6
|
+
> @cartridge/controller@0.7.11 build /home/runner/work/controller/controller/packages/controller
|
|
7
7
|
> pnpm build:browser && pnpm build:node
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @cartridge/controller@0.7.
|
|
10
|
+
> @cartridge/controller@0.7.11 build:browser /home/runner/work/controller/controller/packages/controller
|
|
11
11
|
> vite build
|
|
12
12
|
|
|
13
13
|
[36mvite v6.1.0 [32mbuilding for production...[36m[39m
|
|
@@ -18,14 +18,14 @@ rendering chunks...
|
|
|
18
18
|
|
|
19
19
|
[vite:dts] Start generate declaration files...
|
|
20
20
|
computing gzip size...
|
|
21
|
-
[2mdist/[22m[36msession.js [39m[1m[2m 10.
|
|
22
|
-
[2mdist/[22m[36mprovider-
|
|
23
|
-
[2mdist/[22m[36mindex.js [39m[1m[2m135.
|
|
24
|
-
[vite:dts] Declaration files built in
|
|
21
|
+
[2mdist/[22m[36msession.js [39m[1m[2m 10.84 kB[22m[1m[22m[2m │ gzip: 3.38 kB[22m[2m │ map: 56.54 kB[22m
|
|
22
|
+
[2mdist/[22m[36mprovider-CyO7_h7r.js [39m[1m[2m 23.30 kB[22m[1m[22m[2m │ gzip: 13.58 kB[22m[2m │ map: 40.95 kB[22m
|
|
23
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m135.90 kB[22m[1m[22m[2m │ gzip: 24.37 kB[22m[2m │ map: 258.64 kB[22m
|
|
24
|
+
[vite:dts] Declaration files built in 3359ms.
|
|
25
25
|
|
|
26
|
-
[32m✓ built in 4.
|
|
26
|
+
[32m✓ built in 4.17s[39m
|
|
27
27
|
|
|
28
|
-
> @cartridge/controller@0.7.
|
|
28
|
+
> @cartridge/controller@0.7.11 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
|
|
@@ -41,11 +41,11 @@ Entry module "dist/node/index.cjs" is using named and default exports together.
|
|
|
41
41
|
"constants", "getChecksumAddress", "Provider" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
42
42
|
[32mCJS[39m [1mdist/node/index.cjs [22m[32m31.90 KB[39m
|
|
43
43
|
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m58.78 KB[39m
|
|
44
|
-
[32mCJS[39m ⚡️ Build success in
|
|
44
|
+
[32mCJS[39m ⚡️ Build success in 389ms
|
|
45
45
|
[32mESM[39m [1mdist/node/index.js [22m[32m31.14 KB[39m
|
|
46
46
|
[32mESM[39m [1mdist/node/index.js.map [22m[32m58.58 KB[39m
|
|
47
|
-
[32mESM[39m ⚡️ Build success in
|
|
47
|
+
[32mESM[39m ⚡️ Build success in 389ms
|
|
48
48
|
[34mDTS[39m Build start
|
|
49
|
-
[32mDTS[39m ⚡️ Build success in
|
|
49
|
+
[32mDTS[39m ⚡️ Build success in 3222ms
|
|
50
50
|
[32mDTS[39m [1mdist/node/index.d.ts [22m[32m5.09 KB[39m
|
|
51
51
|
[32mDTS[39m [1mdist/node/index.d.cts [22m[32m5.09 KB[39m
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.7.
|
|
2
|
+
> @cartridge/controller@0.7.11 build /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> pnpm build:browser && pnpm build:node
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @cartridge/controller@0.7.
|
|
6
|
+
> @cartridge/controller@0.7.11 build:browser /home/runner/work/controller/controller/packages/controller
|
|
7
7
|
> vite build
|
|
8
8
|
|
|
9
9
|
[36mvite v6.1.0 [32mbuilding for production...[36m[39m
|
|
@@ -14,14 +14,14 @@ rendering chunks...
|
|
|
14
14
|
|
|
15
15
|
[vite:dts] Start generate declaration files...
|
|
16
16
|
computing gzip size...
|
|
17
|
-
[2mdist/[22m[36msession.js [39m[1m[2m 10.
|
|
18
|
-
[2mdist/[22m[36mprovider-
|
|
19
|
-
[2mdist/[22m[36mindex.js [39m[1m[2m135.
|
|
20
|
-
[vite:dts] Declaration files built in
|
|
17
|
+
[2mdist/[22m[36msession.js [39m[1m[2m 10.84 kB[22m[1m[22m[2m │ gzip: 3.38 kB[22m[2m │ map: 56.54 kB[22m
|
|
18
|
+
[2mdist/[22m[36mprovider-CyO7_h7r.js [39m[1m[2m 23.30 kB[22m[1m[22m[2m │ gzip: 13.58 kB[22m[2m │ map: 40.95 kB[22m
|
|
19
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m135.90 kB[22m[1m[22m[2m │ gzip: 24.37 kB[22m[2m │ map: 258.64 kB[22m
|
|
20
|
+
[vite:dts] Declaration files built in 3354ms.
|
|
21
21
|
|
|
22
|
-
[32m✓ built in 4.
|
|
22
|
+
[32m✓ built in 4.32s[39m
|
|
23
23
|
|
|
24
|
-
> @cartridge/controller@0.7.
|
|
24
|
+
> @cartridge/controller@0.7.11 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
|
|
@@ -40,8 +40,8 @@ Entry module "dist/node/index.cjs" is using named and default exports together.
|
|
|
40
40
|
[32mESM[39m ⚡️ Build success in 325ms
|
|
41
41
|
[32mCJS[39m [1mdist/node/index.cjs [22m[32m31.90 KB[39m
|
|
42
42
|
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m58.78 KB[39m
|
|
43
|
-
[32mCJS[39m ⚡️ Build success in
|
|
43
|
+
[32mCJS[39m ⚡️ Build success in 325ms
|
|
44
44
|
[34mDTS[39m Build start
|
|
45
|
-
[32mDTS[39m ⚡️ Build success in
|
|
45
|
+
[32mDTS[39m ⚡️ Build success in 3307ms
|
|
46
46
|
[32mDTS[39m [1mdist/node/index.d.ts [22m[32m5.09 KB[39m
|
|
47
47
|
[32mDTS[39m [1mdist/node/index.d.cts [22m[32m5.09 KB[39m
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletAccount as L, shortString as M, num as O } from "starknet";
|
|
2
|
-
import { R as A, t as Y, K as $, P as W, B as H, N as
|
|
3
|
-
import {
|
|
2
|
+
import { R as A, t as Y, K as $, P as W, B as H, N as u, p as K, A as q } from "./provider-CyO7_h7r.js";
|
|
3
|
+
import { F as Oe, h as Ye, n as $e, a as We, b as He } from "./provider-CyO7_h7r.js";
|
|
4
4
|
import { MetaMaskSDK as G } from "@metamask/sdk";
|
|
5
5
|
import { Transaction as V } from "@solana/web3.js";
|
|
6
6
|
import { connect as J } from "starknetkit";
|
|
@@ -31,7 +31,8 @@ class z extends L {
|
|
|
31
31
|
e,
|
|
32
32
|
void 0,
|
|
33
33
|
void 0,
|
|
34
|
-
!1
|
|
34
|
+
!1,
|
|
35
|
+
this.options?.feeSource
|
|
35
36
|
);
|
|
36
37
|
if (r.code === A.SUCCESS) {
|
|
37
38
|
t(r);
|
|
@@ -77,18 +78,18 @@ class z extends L {
|
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
var
|
|
81
|
+
var y;
|
|
81
82
|
(function(o) {
|
|
82
83
|
o.Call = "call", o.Reply = "reply", o.Syn = "syn", o.SynAck = "synAck", o.Ack = "ack";
|
|
83
|
-
})(
|
|
84
|
+
})(y || (y = {}));
|
|
84
85
|
var C;
|
|
85
86
|
(function(o) {
|
|
86
87
|
o.Fulfilled = "fulfilled", o.Rejected = "rejected";
|
|
87
88
|
})(C || (C = {}));
|
|
88
|
-
var
|
|
89
|
+
var E;
|
|
89
90
|
(function(o) {
|
|
90
91
|
o.ConnectionDestroyed = "ConnectionDestroyed", o.ConnectionTimeout = "ConnectionTimeout", o.NoIframeSrc = "NoIframeSrc";
|
|
91
|
-
})(
|
|
92
|
+
})(E || (E = {}));
|
|
92
93
|
var D;
|
|
93
94
|
(function(o) {
|
|
94
95
|
o.DataCloneError = "DataCloneError";
|
|
@@ -116,7 +117,7 @@ const Z = (o, e) => {
|
|
|
116
117
|
"http:": "80",
|
|
117
118
|
"https:": "443"
|
|
118
119
|
}, ne = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, oe = ["file:", "data:"], re = (o) => {
|
|
119
|
-
if (o && oe.find((
|
|
120
|
+
if (o && oe.find((s) => o.startsWith(s)))
|
|
120
121
|
return "null";
|
|
121
122
|
const e = document.location, t = ne.exec(o);
|
|
122
123
|
let n, r, a;
|
|
@@ -131,49 +132,49 @@ const Z = (o, e) => {
|
|
|
131
132
|
const e = new Error();
|
|
132
133
|
return Object.keys(o).forEach((t) => e[t] = o[t]), e;
|
|
133
134
|
}, ie = (o, e, t) => {
|
|
134
|
-
const { localName: n, local: r, remote: a, originForSending: c, originForReceiving:
|
|
135
|
-
let
|
|
135
|
+
const { localName: n, local: r, remote: a, originForSending: c, originForReceiving: s } = o;
|
|
136
|
+
let i = !1;
|
|
136
137
|
const l = (d) => {
|
|
137
|
-
if (d.source !== a || d.data.penpal !==
|
|
138
|
+
if (d.source !== a || d.data.penpal !== y.Call)
|
|
138
139
|
return;
|
|
139
|
-
if (
|
|
140
|
-
t(`${n} received message from origin ${d.origin} which did not match expected origin ${
|
|
140
|
+
if (s !== "*" && d.origin !== s) {
|
|
141
|
+
t(`${n} received message from origin ${d.origin} which did not match expected origin ${s}`);
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
|
-
const p = d.data, { methodName: h, args:
|
|
144
|
+
const p = d.data, { methodName: h, args: g, id: f } = p;
|
|
144
145
|
t(`${n}: Received ${h}() call`);
|
|
145
|
-
const w = (
|
|
146
|
-
if (t(`${n}: Sending ${h}() reply`),
|
|
146
|
+
const w = (b) => (k) => {
|
|
147
|
+
if (t(`${n}: Sending ${h}() reply`), i) {
|
|
147
148
|
t(`${n}: Unable to send ${h}() reply due to destroyed connection`);
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
|
-
const
|
|
151
|
-
penpal:
|
|
152
|
-
id:
|
|
153
|
-
resolution:
|
|
151
|
+
const v = {
|
|
152
|
+
penpal: y.Reply,
|
|
153
|
+
id: f,
|
|
154
|
+
resolution: b,
|
|
154
155
|
returnValue: k
|
|
155
156
|
};
|
|
156
|
-
|
|
157
|
+
b === C.Rejected && k instanceof Error && (v.returnValue = N(k), v.returnValueIsError = !0);
|
|
157
158
|
try {
|
|
158
|
-
a.postMessage(
|
|
159
|
-
} catch (
|
|
160
|
-
if (
|
|
159
|
+
a.postMessage(v, c);
|
|
160
|
+
} catch (m) {
|
|
161
|
+
if (m.name === D.DataCloneError) {
|
|
161
162
|
const I = {
|
|
162
|
-
penpal:
|
|
163
|
-
id:
|
|
163
|
+
penpal: y.Reply,
|
|
164
|
+
id: f,
|
|
164
165
|
resolution: C.Rejected,
|
|
165
|
-
returnValue: N(
|
|
166
|
+
returnValue: N(m),
|
|
166
167
|
returnValueIsError: !0
|
|
167
168
|
};
|
|
168
169
|
a.postMessage(I, c);
|
|
169
170
|
}
|
|
170
|
-
throw
|
|
171
|
+
throw m;
|
|
171
172
|
}
|
|
172
173
|
};
|
|
173
|
-
new Promise((
|
|
174
|
+
new Promise((b) => b(e[h].call(e, d.origin).apply(e, g))).then(w(C.Fulfilled), w(C.Rejected));
|
|
174
175
|
};
|
|
175
176
|
return r.addEventListener(_.Message, l), () => {
|
|
176
|
-
|
|
177
|
+
i = !0, r.removeEventListener(_.Message, l);
|
|
177
178
|
};
|
|
178
179
|
};
|
|
179
180
|
let se = 0;
|
|
@@ -195,50 +196,50 @@ const ce = () => ++se, j = ".", B = (o) => o ? o.split(j) : [], de = (o) => o.jo
|
|
|
195
196
|
le(e, t, o[t]);
|
|
196
197
|
return e;
|
|
197
198
|
}, me = (o, e, t, n, r) => {
|
|
198
|
-
const { localName: a, local: c, remote:
|
|
199
|
+
const { localName: a, local: c, remote: s, originForSending: i, originForReceiving: l } = e;
|
|
199
200
|
let d = !1;
|
|
200
201
|
r(`${a}: Connecting call sender`);
|
|
201
|
-
const p = (
|
|
202
|
-
r(`${a}: Sending ${
|
|
202
|
+
const p = (g) => (...f) => {
|
|
203
|
+
r(`${a}: Sending ${g}() call`);
|
|
203
204
|
let w;
|
|
204
205
|
try {
|
|
205
|
-
|
|
206
|
+
s.closed && (w = !0);
|
|
206
207
|
} catch {
|
|
207
208
|
w = !0;
|
|
208
209
|
}
|
|
209
210
|
if (w && n(), d) {
|
|
210
|
-
const
|
|
211
|
-
throw
|
|
211
|
+
const b = new Error(`Unable to send ${g}() call due to destroyed connection`);
|
|
212
|
+
throw b.code = E.ConnectionDestroyed, b;
|
|
212
213
|
}
|
|
213
|
-
return new Promise((
|
|
214
|
-
const
|
|
215
|
-
if (x.source !==
|
|
214
|
+
return new Promise((b, k) => {
|
|
215
|
+
const v = ce(), m = (x) => {
|
|
216
|
+
if (x.source !== s || x.data.penpal !== y.Reply || x.data.id !== v)
|
|
216
217
|
return;
|
|
217
218
|
if (l !== "*" && x.origin !== l) {
|
|
218
219
|
r(`${a} received message from origin ${x.origin} which did not match expected origin ${l}`);
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
|
-
const
|
|
222
|
-
r(`${a}: Received ${
|
|
223
|
-
let P =
|
|
224
|
-
|
|
222
|
+
const R = x.data;
|
|
223
|
+
r(`${a}: Received ${g}() reply`), c.removeEventListener(_.Message, m);
|
|
224
|
+
let P = R.returnValue;
|
|
225
|
+
R.returnValueIsError && (P = ae(P)), (R.resolution === C.Fulfilled ? b : k)(P);
|
|
225
226
|
};
|
|
226
|
-
c.addEventListener(_.Message,
|
|
227
|
+
c.addEventListener(_.Message, m);
|
|
227
228
|
const I = {
|
|
228
|
-
penpal:
|
|
229
|
-
id:
|
|
230
|
-
methodName:
|
|
231
|
-
args:
|
|
229
|
+
penpal: y.Call,
|
|
230
|
+
id: v,
|
|
231
|
+
methodName: g,
|
|
232
|
+
args: f
|
|
232
233
|
};
|
|
233
|
-
|
|
234
|
+
s.postMessage(I, i);
|
|
234
235
|
});
|
|
235
|
-
}, h = t.reduce((
|
|
236
|
+
}, h = t.reduce((g, f) => (g[f] = p(f), g), {});
|
|
236
237
|
return Object.assign(o, ge(h)), () => {
|
|
237
238
|
d = !0;
|
|
238
239
|
};
|
|
239
240
|
}, he = (o, e, t, n, r) => {
|
|
240
241
|
const { destroy: a, onDestroy: c } = n;
|
|
241
|
-
let
|
|
242
|
+
let s, i;
|
|
242
243
|
const l = {};
|
|
243
244
|
return (d) => {
|
|
244
245
|
if (e !== "*" && d.origin !== e) {
|
|
@@ -253,10 +254,10 @@ const ce = () => ++se, j = ".", B = (o) => o ? o.split(j) : [], de = (o) => o.jo
|
|
|
253
254
|
originForSending: t,
|
|
254
255
|
originForReceiving: e
|
|
255
256
|
};
|
|
256
|
-
|
|
257
|
-
delete l[
|
|
258
|
-
}),
|
|
259
|
-
const h = me(l, p,
|
|
257
|
+
s && s(), s = ie(p, o, r), c(s), i && i.forEach((g) => {
|
|
258
|
+
delete l[g];
|
|
259
|
+
}), i = d.data.methodNames;
|
|
260
|
+
const h = me(l, p, i, a, r);
|
|
260
261
|
return c(h), l;
|
|
261
262
|
};
|
|
262
263
|
}, fe = (o, e, t, n) => (r) => {
|
|
@@ -268,7 +269,7 @@ const ce = () => ++se, j = ".", B = (o) => o ? o.split(j) : [], de = (o) => o.jo
|
|
|
268
269
|
}
|
|
269
270
|
o("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
270
271
|
const a = {
|
|
271
|
-
penpal:
|
|
272
|
+
penpal: y.SynAck,
|
|
272
273
|
methodNames: Object.keys(e)
|
|
273
274
|
};
|
|
274
275
|
r.source.postMessage(a, n);
|
|
@@ -283,37 +284,37 @@ const ce = () => ++se, j = ".", B = (o) => o ? o.split(j) : [], de = (o) => o.jo
|
|
|
283
284
|
let t;
|
|
284
285
|
return o !== void 0 && (t = window.setTimeout(() => {
|
|
285
286
|
const n = new Error(`Connection timed out after ${o}ms`);
|
|
286
|
-
n.code =
|
|
287
|
+
n.code = E.ConnectionTimeout, e(n);
|
|
287
288
|
}, o)), () => {
|
|
288
289
|
clearTimeout(t);
|
|
289
290
|
};
|
|
290
291
|
}, ve = (o) => {
|
|
291
292
|
if (!o.src && !o.srcdoc) {
|
|
292
293
|
const e = new Error("Iframe must have src or srcdoc property defined.");
|
|
293
|
-
throw e.code =
|
|
294
|
+
throw e.code = E.NoIframeSrc, e;
|
|
294
295
|
}
|
|
295
296
|
}, we = (o) => {
|
|
296
297
|
let { iframe: e, methods: t = {}, childOrigin: n, timeout: r, debug: a = !1 } = o;
|
|
297
|
-
const c = ee(a),
|
|
298
|
+
const c = ee(a), s = Z("Parent", c), { onDestroy: i, destroy: l } = s;
|
|
298
299
|
n || (ve(e), n = re(e.src));
|
|
299
|
-
const d = n === "null" ? "*" : n, p = T(t), h = fe(c, p, n, d),
|
|
300
|
+
const d = n === "null" ? "*" : n, p = T(t), h = fe(c, p, n, d), g = he(p, n, d, s, c);
|
|
300
301
|
return {
|
|
301
|
-
promise: new Promise((w,
|
|
302
|
-
const k = ye(r, l),
|
|
303
|
-
if (!(
|
|
304
|
-
if (
|
|
305
|
-
h(
|
|
302
|
+
promise: new Promise((w, b) => {
|
|
303
|
+
const k = ye(r, l), v = (m) => {
|
|
304
|
+
if (!(m.source !== e.contentWindow || !m.data)) {
|
|
305
|
+
if (m.data.penpal === y.Syn) {
|
|
306
|
+
h(m);
|
|
306
307
|
return;
|
|
307
308
|
}
|
|
308
|
-
if (
|
|
309
|
-
const I = m
|
|
309
|
+
if (m.data.penpal === y.Ack) {
|
|
310
|
+
const I = g(m);
|
|
310
311
|
I && (k(), w(I));
|
|
311
312
|
return;
|
|
312
313
|
}
|
|
313
314
|
}
|
|
314
315
|
};
|
|
315
|
-
window.addEventListener(_.Message,
|
|
316
|
-
window.removeEventListener(_.Message,
|
|
316
|
+
window.addEventListener(_.Message, v), c("Parent: Awaiting handshake"), ue(e, s), i((m) => {
|
|
317
|
+
window.removeEventListener(_.Message, v), m && b(m);
|
|
317
318
|
});
|
|
318
319
|
}),
|
|
319
320
|
destroy() {
|
|
@@ -337,23 +338,35 @@ class Q {
|
|
|
337
338
|
if (typeof document > "u")
|
|
338
339
|
return;
|
|
339
340
|
n && t.searchParams.set("preset", n), this.url = t;
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
|
|
341
|
+
const s = document.createElement("iframe");
|
|
342
|
+
s.src = t.toString(), s.id = e, s.style.border = "none", s.sandbox.add("allow-forms"), s.sandbox.add("allow-popups"), s.sandbox.add("allow-scripts"), s.sandbox.add("allow-same-origin"), s.allow = "publickey-credentials-create *; publickey-credentials-get *; clipboard-write", document.hasStorageAccess && s.sandbox.add("allow-storage-access-by-user-activation");
|
|
343
|
+
const i = document.createElement("div");
|
|
344
|
+
i.id = "controller", i.style.position = "fixed", i.style.height = "100%", i.style.width = "100%", i.style.top = "0", i.style.left = "0", i.style.zIndex = "10000", i.style.backgroundColor = "rgba(0,0,0,0.6)", i.style.display = "flex", i.style.alignItems = "center", i.style.justifyContent = "center", i.style.visibility = "hidden", i.style.opacity = "0", i.style.transition = "opacity 0.2s ease", i.style.pointerEvents = "auto", i.appendChild(s), this.iframe = s, this.container = i, we({
|
|
344
345
|
iframe: this.iframe,
|
|
345
|
-
methods: {
|
|
346
|
+
methods: {
|
|
347
|
+
close: (p) => () => this.close(),
|
|
348
|
+
closeAll: (p) => () => {
|
|
349
|
+
document.querySelectorAll(
|
|
350
|
+
'iframe[id^="controller-"]'
|
|
351
|
+
).forEach((g) => {
|
|
352
|
+
const f = g.parentElement;
|
|
353
|
+
f && (f.style.visibility = "hidden", f.style.opacity = "0");
|
|
354
|
+
}), document.body.style.overflow = "auto";
|
|
355
|
+
},
|
|
356
|
+
reload: (p) => () => window.location.reload(),
|
|
357
|
+
...c
|
|
358
|
+
}
|
|
346
359
|
}).promise.then(a), this.resize(), window.addEventListener("resize", () => this.resize());
|
|
347
360
|
const l = new MutationObserver(() => {
|
|
348
361
|
const p = document.getElementById("controller");
|
|
349
|
-
document.body && (e === "controller-keychain" && !p || e === "controller-profile") && (document.body.appendChild(
|
|
362
|
+
document.body && (e === "controller-keychain" && !p || e === "controller-profile") && (document.body.appendChild(i), l.disconnect());
|
|
350
363
|
});
|
|
351
364
|
l.observe(document.documentElement, {
|
|
352
365
|
childList: !0,
|
|
353
366
|
subtree: !0
|
|
354
367
|
});
|
|
355
368
|
const d = document.getElementById("controller");
|
|
356
|
-
document.body && (e === "controller-keychain" && !d || e === "controller-profile") && document.body.appendChild(
|
|
369
|
+
document.body && (e === "controller-keychain" && !d || e === "controller-profile") && document.body.appendChild(i), this.onClose = r;
|
|
357
370
|
}
|
|
358
371
|
open() {
|
|
359
372
|
this.container && (document.body.style.overflow = "hidden", this.container.style.visibility = "visible", this.container.style.opacity = "1");
|
|
@@ -826,20 +839,20 @@ class xe extends Q {
|
|
|
826
839
|
username: r,
|
|
827
840
|
slot: a,
|
|
828
841
|
namespace: c,
|
|
829
|
-
tokens:
|
|
830
|
-
policies:
|
|
842
|
+
tokens: s,
|
|
843
|
+
policies: i,
|
|
831
844
|
...l
|
|
832
845
|
}) {
|
|
833
846
|
const d = (e || W).replace(/\/$/, "");
|
|
834
847
|
let p = new URL(
|
|
835
848
|
a ? `${d}/account/${r}/slot/${a}` : `${d}/account/${r}`
|
|
836
849
|
);
|
|
837
|
-
if (a && p.searchParams.set("ps", encodeURIComponent(a)), c && p.searchParams.set("ns", encodeURIComponent(c)), n && p.searchParams.set("v", encodeURIComponent(n)), p.searchParams.set("rpcUrl", encodeURIComponent(t)),
|
|
850
|
+
if (a && p.searchParams.set("ps", encodeURIComponent(a)), c && p.searchParams.set("ns", encodeURIComponent(c)), n && p.searchParams.set("v", encodeURIComponent(n)), p.searchParams.set("rpcUrl", encodeURIComponent(t)), s?.erc20 && p.searchParams.set(
|
|
838
851
|
"erc20",
|
|
839
|
-
encodeURIComponent(
|
|
840
|
-
),
|
|
841
|
-
const h = Object.values(
|
|
842
|
-
(
|
|
852
|
+
encodeURIComponent(s.erc20.toString())
|
|
853
|
+
), i?.contracts) {
|
|
854
|
+
const h = Object.values(i.contracts).flatMap(
|
|
855
|
+
(g) => g.methods
|
|
843
856
|
);
|
|
844
857
|
p.searchParams.set(
|
|
845
858
|
"methods",
|
|
@@ -874,7 +887,7 @@ class Ne extends H {
|
|
|
874
887
|
async probe() {
|
|
875
888
|
try {
|
|
876
889
|
if (await this.waitForKeychain(), !this.keychain) {
|
|
877
|
-
console.error(new
|
|
890
|
+
console.error(new u().message);
|
|
878
891
|
return;
|
|
879
892
|
}
|
|
880
893
|
const e = await this.keychain.probe(this.rpcUrl());
|
|
@@ -914,7 +927,7 @@ class Ne extends H {
|
|
|
914
927
|
if (this.account)
|
|
915
928
|
return this.account;
|
|
916
929
|
if (!this.keychain || !this.iframes.keychain) {
|
|
917
|
-
console.error(new
|
|
930
|
+
console.error(new u().message);
|
|
918
931
|
return;
|
|
919
932
|
}
|
|
920
933
|
document.hasStorageAccess && (await document.hasStorageAccess() || await document.requestStorageAccess()), this.iframes.keychain.open();
|
|
@@ -941,7 +954,7 @@ class Ne extends H {
|
|
|
941
954
|
}
|
|
942
955
|
async switchStarknetChain(e) {
|
|
943
956
|
if (!this.keychain || !this.iframes.keychain)
|
|
944
|
-
return console.error(new
|
|
957
|
+
return console.error(new u().message), !1;
|
|
945
958
|
try {
|
|
946
959
|
if (this.selectedChain = e, (await this.keychain.probe(this.rpcUrl())).rpcUrl === this.rpcUrl())
|
|
947
960
|
return !0;
|
|
@@ -956,7 +969,7 @@ class Ne extends H {
|
|
|
956
969
|
}
|
|
957
970
|
async disconnect() {
|
|
958
971
|
if (!this.keychain) {
|
|
959
|
-
console.error(new
|
|
972
|
+
console.error(new u().message);
|
|
960
973
|
return;
|
|
961
974
|
}
|
|
962
975
|
return document.hasStorageAccess && (await document.hasStorageAccess() || await document.requestStorageAccess()), this.account = void 0, this.keychain.disconnect();
|
|
@@ -996,13 +1009,13 @@ class Ne extends H {
|
|
|
996
1009
|
}
|
|
997
1010
|
async openSettings() {
|
|
998
1011
|
if (!this.keychain || !this.iframes.keychain)
|
|
999
|
-
return console.error(new
|
|
1012
|
+
return console.error(new u().message), null;
|
|
1000
1013
|
this.iframes.profile?.sendBackward ? this.iframes.profile?.sendBackward() : this.iframes.profile?.close(), this.iframes.keychain.open();
|
|
1001
1014
|
const e = await this.keychain.openSettings();
|
|
1002
1015
|
return this.iframes.keychain.close(), this.iframes.profile?.sendForward?.(), !(e && e.code === A.NOT_CONNECTED);
|
|
1003
1016
|
}
|
|
1004
1017
|
revoke(e, t) {
|
|
1005
|
-
return this.keychain ? this.keychain.revoke(e) : (console.error(new
|
|
1018
|
+
return this.keychain ? this.keychain.revoke(e) : (console.error(new u().message), null);
|
|
1006
1019
|
}
|
|
1007
1020
|
rpcUrl() {
|
|
1008
1021
|
const e = this.chains.get(this.selectedChain);
|
|
@@ -1018,14 +1031,14 @@ class Ne extends H {
|
|
|
1018
1031
|
}
|
|
1019
1032
|
username() {
|
|
1020
1033
|
if (!this.keychain) {
|
|
1021
|
-
console.error(new
|
|
1034
|
+
console.error(new u().message);
|
|
1022
1035
|
return;
|
|
1023
1036
|
}
|
|
1024
1037
|
return this.keychain.username();
|
|
1025
1038
|
}
|
|
1026
1039
|
openPurchaseCredits() {
|
|
1027
1040
|
if (!this.keychain || !this.iframes.keychain) {
|
|
1028
|
-
console.error(new
|
|
1041
|
+
console.error(new u().message);
|
|
1029
1042
|
return;
|
|
1030
1043
|
}
|
|
1031
1044
|
if (!this.iframes.profile) {
|
|
@@ -1036,7 +1049,7 @@ class Ne extends H {
|
|
|
1036
1049
|
}
|
|
1037
1050
|
openStarterPack() {
|
|
1038
1051
|
if (!this.keychain || !this.iframes.keychain) {
|
|
1039
|
-
console.error(new
|
|
1052
|
+
console.error(new u().message);
|
|
1040
1053
|
return;
|
|
1041
1054
|
}
|
|
1042
1055
|
if (!this.iframes.profile) {
|
|
@@ -1047,7 +1060,7 @@ class Ne extends H {
|
|
|
1047
1060
|
}
|
|
1048
1061
|
async openExecute(e, t) {
|
|
1049
1062
|
if (!this.keychain || !this.iframes.keychain) {
|
|
1050
|
-
console.error(new
|
|
1063
|
+
console.error(new u().message);
|
|
1051
1064
|
return;
|
|
1052
1065
|
}
|
|
1053
1066
|
if (!this.iframes.profile) {
|
|
@@ -1060,7 +1073,7 @@ class Ne extends H {
|
|
|
1060
1073
|
return this.iframes.profile?.open(), this.iframes.keychain.close(), this.iframes.profile?.sendForward(), t && this.switchStarknetChain(n), !(r && (r.code === A.NOT_CONNECTED || r.code === A.CANCELED));
|
|
1061
1074
|
}
|
|
1062
1075
|
async delegateAccount() {
|
|
1063
|
-
return this.keychain ? await this.keychain.delegateAccount() : (console.error(new
|
|
1076
|
+
return this.keychain ? await this.keychain.delegateAccount() : (console.error(new u().message), null);
|
|
1064
1077
|
}
|
|
1065
1078
|
async validateChains(e) {
|
|
1066
1079
|
for (const t of e)
|
|
@@ -1089,7 +1102,7 @@ class Ne extends H {
|
|
|
1089
1102
|
});
|
|
1090
1103
|
}
|
|
1091
1104
|
}
|
|
1092
|
-
const
|
|
1105
|
+
const S = /* @__PURE__ */ new Map();
|
|
1093
1106
|
async function F(o) {
|
|
1094
1107
|
if (!o.addresses?.length && !o.usernames?.length)
|
|
1095
1108
|
return { results: [] };
|
|
@@ -1105,22 +1118,22 @@ async function F(o) {
|
|
|
1105
1118
|
return e.json();
|
|
1106
1119
|
}
|
|
1107
1120
|
async function je(o) {
|
|
1108
|
-
const e = o.filter((t) => !
|
|
1121
|
+
const e = o.filter((t) => !S.has(t));
|
|
1109
1122
|
return e.length > 0 && (await F({ usernames: e })).results.forEach((n) => {
|
|
1110
|
-
|
|
1123
|
+
S.set(n.username, n.addresses[0]);
|
|
1111
1124
|
}), new Map(
|
|
1112
|
-
o.map((t) => [t,
|
|
1125
|
+
o.map((t) => [t, S.get(t)]).filter((t) => t[1] !== void 0)
|
|
1113
1126
|
);
|
|
1114
1127
|
}
|
|
1115
1128
|
async function Be(o) {
|
|
1116
1129
|
o = o.map(O.toHex);
|
|
1117
|
-
const e = o.filter((t) => !
|
|
1130
|
+
const e = o.filter((t) => !S.has(t));
|
|
1118
1131
|
return e.length > 0 && (await F({
|
|
1119
1132
|
addresses: e
|
|
1120
1133
|
})).results.forEach((n) => {
|
|
1121
|
-
|
|
1134
|
+
S.set(n.addresses[0], n.username);
|
|
1122
1135
|
}), new Map(
|
|
1123
|
-
o.map((t) => [t,
|
|
1136
|
+
o.map((t) => [t, S.get(t)]).filter((t) => t[1] !== void 0)
|
|
1124
1137
|
);
|
|
1125
1138
|
}
|
|
1126
1139
|
var U = {
|
|
@@ -3802,7 +3815,7 @@ var U = {
|
|
|
3802
3815
|
}
|
|
3803
3816
|
}
|
|
3804
3817
|
}
|
|
3805
|
-
},
|
|
3818
|
+
}, Se = [
|
|
3806
3819
|
{
|
|
3807
3820
|
name: "Wrapped BTC",
|
|
3808
3821
|
symbol: "WBTC",
|
|
@@ -4348,11 +4361,12 @@ var U = {
|
|
|
4348
4361
|
hidden: !0,
|
|
4349
4362
|
logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/6deef27f-df40-4248-4e1b-ed1d79a3f000/logo"
|
|
4350
4363
|
}
|
|
4351
|
-
], Te = U, Qe =
|
|
4364
|
+
], Te = U, Qe = Se, Fe = U.cartridge.theme;
|
|
4352
4365
|
export {
|
|
4353
4366
|
Ae as ArgentWallet,
|
|
4367
|
+
Oe as FeeSource,
|
|
4354
4368
|
_e as MetaMaskWallet,
|
|
4355
|
-
|
|
4369
|
+
u as NotReadyToConnect,
|
|
4356
4370
|
ke as PhantomWallet,
|
|
4357
4371
|
A as ResponseCodes,
|
|
4358
4372
|
Ce as WalletBridge,
|
|
@@ -4360,13 +4374,13 @@ export {
|
|
|
4360
4374
|
Ne as default,
|
|
4361
4375
|
Fe as defaultTheme,
|
|
4362
4376
|
Qe as erc20Metadata,
|
|
4363
|
-
|
|
4377
|
+
Ye as humanizeString,
|
|
4364
4378
|
Be as lookupAddresses,
|
|
4365
4379
|
je as lookupUsernames,
|
|
4366
|
-
|
|
4380
|
+
$e as normalizeCalls,
|
|
4367
4381
|
K as parseChainId,
|
|
4368
4382
|
Y as toArray,
|
|
4369
|
-
|
|
4370
|
-
|
|
4383
|
+
We as toSessionPolicies,
|
|
4384
|
+
He as toWasmPolicies
|
|
4371
4385
|
};
|
|
4372
4386
|
//# sourceMappingURL=index.js.map
|