@cartridge/controller 0.7.14-alpha.2 → 0.7.14-alpha.3
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 +49 -51
- package/.turbo/turbo-build.log +45 -47
- package/.turbo/turbo-format$colon$check.log +7 -0
- package/.turbo/turbo-format.log +42 -0
- package/dist/index.js +128 -119
- 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-vgdJbfDg.js → provider-sFJ4sl5V.js} +2 -2
- package/dist/{provider-vgdJbfDg.js.map → provider-sFJ4sl5V.js.map} +1 -1
- package/dist/session.js +2 -2
- package/dist/session.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +4 -4
- package/src/wallets/bridge.ts +6 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletAccount as Pe, shortString as G, num as Me } from "starknet";
|
|
2
|
-
import { R as E, t as Ne, K as De, P as Be, B as ze, N as y, p as Te, A as je } from "./provider-
|
|
3
|
-
import { F as fn, h as bn, n as yn, a as wn, b as vn } from "./provider-
|
|
2
|
+
import { R as E, t as Ne, K as De, P as Be, B as ze, N as y, p as Te, A as je } from "./provider-sFJ4sl5V.js";
|
|
3
|
+
import { F as fn, h as bn, n as yn, a as wn, b as vn } from "./provider-sFJ4sl5V.js";
|
|
4
4
|
import { connect as Ue } from "starknetkit";
|
|
5
5
|
import { InjectedConnector as Le } from "starknetkit/injected";
|
|
6
6
|
import { MetaMaskSDK as Oe } from "@metamask/sdk";
|
|
@@ -10,8 +10,8 @@ class J extends Pe {
|
|
|
10
10
|
keychain;
|
|
11
11
|
modal;
|
|
12
12
|
options;
|
|
13
|
-
constructor(e, t, r, o,
|
|
14
|
-
super({ nodeUrl: t }, e), this.address = r, this.keychain = o, this.options =
|
|
13
|
+
constructor(e, t, r, o, a, i) {
|
|
14
|
+
super({ nodeUrl: t }, e), this.address = r, this.keychain = o, this.options = a, this.modal = i;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Invoke execute function in account contract
|
|
@@ -43,18 +43,18 @@ class J extends Pe {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
this.modal.open();
|
|
46
|
-
const
|
|
46
|
+
const a = await this.keychain.execute(
|
|
47
47
|
e,
|
|
48
48
|
void 0,
|
|
49
49
|
void 0,
|
|
50
50
|
!0,
|
|
51
51
|
o.error
|
|
52
52
|
);
|
|
53
|
-
if (
|
|
54
|
-
t(
|
|
53
|
+
if (a.code === E.SUCCESS) {
|
|
54
|
+
t(a), this.modal.close();
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
r(
|
|
57
|
+
r(a.error);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
@@ -73,8 +73,8 @@ class J extends Pe {
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
this.modal.open();
|
|
76
|
-
const
|
|
77
|
-
"code" in
|
|
76
|
+
const a = await this.keychain.signMessage(e, "", !1);
|
|
77
|
+
"code" in a ? r(a.error) : t(a), this.modal.close();
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -103,8 +103,8 @@ const Qe = (n, e) => {
|
|
|
103
103
|
let r = !1;
|
|
104
104
|
return {
|
|
105
105
|
destroy(o) {
|
|
106
|
-
r || (r = !0, e(`${n}: Destroying connection`), t.forEach((
|
|
107
|
-
|
|
106
|
+
r || (r = !0, e(`${n}: Destroying connection`), t.forEach((a) => {
|
|
107
|
+
a(o);
|
|
108
108
|
}));
|
|
109
109
|
},
|
|
110
110
|
onDestroy(o) {
|
|
@@ -120,10 +120,10 @@ const Qe = (n, e) => {
|
|
|
120
120
|
if (n && Ye.find((s) => n.startsWith(s)))
|
|
121
121
|
return "null";
|
|
122
122
|
const e = document.location, t = He.exec(n);
|
|
123
|
-
let r, o,
|
|
124
|
-
t ? (r = t[1] ? t[1] : e.protocol, o = t[2],
|
|
125
|
-
const
|
|
126
|
-
return `${r}//${o}${
|
|
123
|
+
let r, o, a;
|
|
124
|
+
t ? (r = t[1] ? t[1] : e.protocol, o = t[2], a = t[4]) : (r = e.protocol, o = e.hostname, a = e.port);
|
|
125
|
+
const i = a && a !== $e[r] ? `:${a}` : "";
|
|
126
|
+
return `${r}//${o}${i}`;
|
|
127
127
|
}, X = ({ name: n, message: e, stack: t }) => ({
|
|
128
128
|
name: n,
|
|
129
129
|
message: e,
|
|
@@ -132,10 +132,10 @@ const Qe = (n, e) => {
|
|
|
132
132
|
const e = new Error();
|
|
133
133
|
return Object.keys(n).forEach((t) => e[t] = n[t]), e;
|
|
134
134
|
}, Ve = (n, e, t) => {
|
|
135
|
-
const { localName: r, local: o, remote:
|
|
135
|
+
const { localName: r, local: o, remote: a, originForSending: i, originForReceiving: s } = n;
|
|
136
136
|
let d = !1;
|
|
137
137
|
const p = (c) => {
|
|
138
|
-
if (c.source !==
|
|
138
|
+
if (c.source !== a || c.data.penpal !== A.Call)
|
|
139
139
|
return;
|
|
140
140
|
if (s !== "*" && c.origin !== s) {
|
|
141
141
|
t(`${r} received message from origin ${c.origin} which did not match expected origin ${s}`);
|
|
@@ -156,7 +156,7 @@ const Qe = (n, e) => {
|
|
|
156
156
|
};
|
|
157
157
|
b === R.Rejected && x instanceof Error && (k.returnValue = X(x), k.returnValueIsError = !0);
|
|
158
158
|
try {
|
|
159
|
-
|
|
159
|
+
a.postMessage(k, i);
|
|
160
160
|
} catch (u) {
|
|
161
161
|
if (u.name === H.DataCloneError) {
|
|
162
162
|
const S = {
|
|
@@ -166,7 +166,7 @@ const Qe = (n, e) => {
|
|
|
166
166
|
returnValue: X(u),
|
|
167
167
|
returnValueIsError: !0
|
|
168
168
|
};
|
|
169
|
-
|
|
169
|
+
a.postMessage(S, i);
|
|
170
170
|
}
|
|
171
171
|
throw u;
|
|
172
172
|
}
|
|
@@ -183,12 +183,12 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
183
183
|
return t.push(n), Xe(t);
|
|
184
184
|
}, et = (n, e, t) => {
|
|
185
185
|
const r = ue(e);
|
|
186
|
-
return r.reduce((o,
|
|
186
|
+
return r.reduce((o, a, i) => (typeof o[a] > "u" && (o[a] = {}), i === r.length - 1 && (o[a] = t), o[a]), n), n;
|
|
187
187
|
}, fe = (n, e) => {
|
|
188
188
|
const t = {};
|
|
189
189
|
return Object.keys(n).forEach((r) => {
|
|
190
|
-
const o = n[r],
|
|
191
|
-
typeof o == "object" && Object.assign(t, fe(o,
|
|
190
|
+
const o = n[r], a = Ze(r, e);
|
|
191
|
+
typeof o == "object" && Object.assign(t, fe(o, a)), typeof o == "function" && (t[a] = o);
|
|
192
192
|
}), t;
|
|
193
193
|
}, tt = (n) => {
|
|
194
194
|
const e = {};
|
|
@@ -196,11 +196,11 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
196
196
|
et(e, t, n[t]);
|
|
197
197
|
return e;
|
|
198
198
|
}, nt = (n, e, t, r, o) => {
|
|
199
|
-
const { localName:
|
|
199
|
+
const { localName: a, local: i, remote: s, originForSending: d, originForReceiving: p } = e;
|
|
200
200
|
let c = !1;
|
|
201
|
-
o(`${
|
|
201
|
+
o(`${a}: Connecting call sender`);
|
|
202
202
|
const l = (m) => (...f) => {
|
|
203
|
-
o(`${
|
|
203
|
+
o(`${a}: Sending ${m}() call`);
|
|
204
204
|
let C;
|
|
205
205
|
try {
|
|
206
206
|
s.closed && (C = !0);
|
|
@@ -216,15 +216,15 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
216
216
|
if (P.source !== s || P.data.penpal !== A.Reply || P.data.id !== k)
|
|
217
217
|
return;
|
|
218
218
|
if (p !== "*" && P.origin !== p) {
|
|
219
|
-
o(`${
|
|
219
|
+
o(`${a} received message from origin ${P.origin} which did not match expected origin ${p}`);
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
const Q = P.data;
|
|
223
|
-
o(`${
|
|
223
|
+
o(`${a}: Received ${m}() reply`), i.removeEventListener(I.Message, u);
|
|
224
224
|
let W = Q.returnValue;
|
|
225
225
|
Q.returnValueIsError && (W = Ke(W)), (Q.resolution === R.Fulfilled ? b : x)(W);
|
|
226
226
|
};
|
|
227
|
-
|
|
227
|
+
i.addEventListener(I.Message, u);
|
|
228
228
|
const S = {
|
|
229
229
|
penpal: A.Call,
|
|
230
230
|
id: k,
|
|
@@ -238,7 +238,7 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
238
238
|
c = !0;
|
|
239
239
|
};
|
|
240
240
|
}, rt = (n, e, t, r, o) => {
|
|
241
|
-
const { destroy:
|
|
241
|
+
const { destroy: a, onDestroy: i } = r;
|
|
242
242
|
let s, d;
|
|
243
243
|
const p = {};
|
|
244
244
|
return (c) => {
|
|
@@ -254,11 +254,11 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
254
254
|
originForSending: t,
|
|
255
255
|
originForReceiving: e
|
|
256
256
|
};
|
|
257
|
-
s && s(), s = Ve(l, n, o),
|
|
257
|
+
s && s(), s = Ve(l, n, o), i(s), d && d.forEach((m) => {
|
|
258
258
|
delete p[m];
|
|
259
259
|
}), d = c.data.methodNames;
|
|
260
|
-
const g = nt(p, l, d,
|
|
261
|
-
return
|
|
260
|
+
const g = nt(p, l, d, a, o);
|
|
261
|
+
return i(g), p;
|
|
262
262
|
};
|
|
263
263
|
}, ot = (n, e, t, r) => (o) => {
|
|
264
264
|
if (!o.source)
|
|
@@ -268,15 +268,15 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
270
|
n("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
271
|
-
const
|
|
271
|
+
const a = {
|
|
272
272
|
penpal: A.SynAck,
|
|
273
273
|
methodNames: Object.keys(e)
|
|
274
274
|
};
|
|
275
|
-
o.source.postMessage(
|
|
276
|
-
},
|
|
275
|
+
o.source.postMessage(a, r);
|
|
276
|
+
}, at = 6e4, it = (n, e) => {
|
|
277
277
|
const { destroy: t, onDestroy: r } = e, o = setInterval(() => {
|
|
278
278
|
n.isConnected || (clearInterval(o), t());
|
|
279
|
-
},
|
|
279
|
+
}, at);
|
|
280
280
|
r(() => {
|
|
281
281
|
clearInterval(o);
|
|
282
282
|
});
|
|
@@ -294,10 +294,10 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
294
294
|
throw e.code = T.NoIframeSrc, e;
|
|
295
295
|
}
|
|
296
296
|
}, dt = (n) => {
|
|
297
|
-
let { iframe: e, methods: t = {}, childOrigin: r, timeout: o, debug:
|
|
298
|
-
const
|
|
297
|
+
let { iframe: e, methods: t = {}, childOrigin: r, timeout: o, debug: a = !1 } = n;
|
|
298
|
+
const i = We(a), s = Qe("Parent", i), { onDestroy: d, destroy: p } = s;
|
|
299
299
|
r || (ct(e), r = qe(e.src));
|
|
300
|
-
const c = r === "null" ? "*" : r, l = fe(t), g = ot(
|
|
300
|
+
const c = r === "null" ? "*" : r, l = fe(t), g = ot(i, l, r, c), m = rt(l, r, c, s, i);
|
|
301
301
|
return {
|
|
302
302
|
promise: new Promise((C, b) => {
|
|
303
303
|
const x = st(o, p), k = (u) => {
|
|
@@ -313,7 +313,7 @@ const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
|
-
window.addEventListener(I.Message, k),
|
|
316
|
+
window.addEventListener(I.Message, k), i("Parent: Awaiting handshake"), it(e, s), d((u) => {
|
|
317
317
|
window.removeEventListener(I.Message, k), u && b(u);
|
|
318
318
|
});
|
|
319
319
|
}),
|
|
@@ -332,8 +332,8 @@ class be {
|
|
|
332
332
|
url: t,
|
|
333
333
|
preset: r,
|
|
334
334
|
onClose: o,
|
|
335
|
-
onConnect:
|
|
336
|
-
methods:
|
|
335
|
+
onConnect: a,
|
|
336
|
+
methods: i = {}
|
|
337
337
|
}) {
|
|
338
338
|
if (typeof document > "u" || typeof window > "u")
|
|
339
339
|
return;
|
|
@@ -354,9 +354,9 @@ class be {
|
|
|
354
354
|
}), document.body && (document.body.style.overflow = "auto");
|
|
355
355
|
},
|
|
356
356
|
reload: (l) => () => window.location.reload(),
|
|
357
|
-
...
|
|
357
|
+
...i
|
|
358
358
|
}
|
|
359
|
-
}).promise.then(
|
|
359
|
+
}).promise.then(a), this.resize(), window.addEventListener("resize", () => this.resize());
|
|
360
360
|
const p = new MutationObserver(() => {
|
|
361
361
|
if (typeof document > "u") return;
|
|
362
362
|
const l = document.getElementById("controller");
|
|
@@ -491,7 +491,7 @@ function ye() {
|
|
|
491
491
|
const n = /* @__PURE__ */ new Set();
|
|
492
492
|
let e = [];
|
|
493
493
|
const t = () => lt((o) => {
|
|
494
|
-
e.some(({ info:
|
|
494
|
+
e.some(({ info: a }) => a.uuid === o.info.uuid) || (e = [...e, o], n.forEach((a) => a(e, { added: [o] })));
|
|
495
495
|
});
|
|
496
496
|
let r = t();
|
|
497
497
|
return {
|
|
@@ -505,7 +505,7 @@ function ye() {
|
|
|
505
505
|
this.clear(), n.clear(), r?.();
|
|
506
506
|
},
|
|
507
507
|
findProvider({ rdns: o }) {
|
|
508
|
-
return e.find((
|
|
508
|
+
return e.find((a) => a.info.rdns === o);
|
|
509
509
|
},
|
|
510
510
|
getProviders() {
|
|
511
511
|
return e;
|
|
@@ -513,8 +513,8 @@ function ye() {
|
|
|
513
513
|
reset() {
|
|
514
514
|
this.clear(), r?.(), r = t();
|
|
515
515
|
},
|
|
516
|
-
subscribe(o, { emitImmediately:
|
|
517
|
-
return n.add(o),
|
|
516
|
+
subscribe(o, { emitImmediately: a } = {}) {
|
|
517
|
+
return n.add(o), a && o(e, { added: e }), () => n.delete(o);
|
|
518
518
|
}
|
|
519
519
|
};
|
|
520
520
|
}
|
|
@@ -997,17 +997,17 @@ class ft {
|
|
|
997
997
|
return t;
|
|
998
998
|
}
|
|
999
999
|
handleError(e, t, r, o) {
|
|
1000
|
-
const
|
|
1001
|
-
let
|
|
1000
|
+
const a = t instanceof Error ? t.message : "Unknown error";
|
|
1001
|
+
let i = "unknown";
|
|
1002
1002
|
if (typeof e == "string") {
|
|
1003
1003
|
const s = this.getConnectedWalletAdapter(e);
|
|
1004
|
-
|
|
1004
|
+
i = o ?? s?.type ?? e;
|
|
1005
1005
|
} else
|
|
1006
|
-
|
|
1006
|
+
i = e;
|
|
1007
1007
|
return console.error(`Error ${r} with ${e} wallet:`, t), {
|
|
1008
1008
|
success: !1,
|
|
1009
|
-
wallet:
|
|
1010
|
-
error:
|
|
1009
|
+
wallet: i,
|
|
1010
|
+
error: a
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
1013
|
async connectWallet(e, t) {
|
|
@@ -1032,9 +1032,10 @@ class ft {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
getConnectedWalletAdapter(e) {
|
|
1034
1034
|
let t;
|
|
1035
|
-
if (typeof e == "string" ? t = this.walletAdapters.values().find(
|
|
1036
|
-
|
|
1037
|
-
|
|
1035
|
+
if (typeof e == "string" ? t = this.walletAdapters.values().find((r) => {
|
|
1036
|
+
const o = e.toLowerCase();
|
|
1037
|
+
return r.getConnectedAccounts().includes(o) || r.type === o;
|
|
1038
|
+
}) : t = this.walletAdapters.get(e), !t && typeof e == "string" && (t = this.walletAdapters.values().find(
|
|
1038
1039
|
(r) => r.getConnectedAccounts().includes(e.toLowerCase())
|
|
1039
1040
|
)), !t)
|
|
1040
1041
|
throw new Error(
|
|
@@ -1106,7 +1107,7 @@ class ft {
|
|
|
1106
1107
|
class bt extends be {
|
|
1107
1108
|
walletBridge;
|
|
1108
1109
|
constructor({ url: e, policies: t, ...r }) {
|
|
1109
|
-
const o = new URL(e ?? De),
|
|
1110
|
+
const o = new URL(e ?? De), a = new ft();
|
|
1110
1111
|
t && o.searchParams.set(
|
|
1111
1112
|
"policies",
|
|
1112
1113
|
encodeURIComponent(JSON.stringify(t))
|
|
@@ -1114,8 +1115,8 @@ class bt extends be {
|
|
|
1114
1115
|
...r,
|
|
1115
1116
|
id: "controller-keychain",
|
|
1116
1117
|
url: o,
|
|
1117
|
-
methods:
|
|
1118
|
-
}), this.walletBridge =
|
|
1118
|
+
methods: a.getIFrameMethods()
|
|
1119
|
+
}), this.walletBridge = a, typeof window < "u" && (window.external_wallets = this.walletBridge);
|
|
1119
1120
|
}
|
|
1120
1121
|
getWalletBridge() {
|
|
1121
1122
|
return this.walletBridge;
|
|
@@ -1127,17 +1128,17 @@ class yt extends be {
|
|
|
1127
1128
|
rpcUrl: t,
|
|
1128
1129
|
version: r,
|
|
1129
1130
|
username: o,
|
|
1130
|
-
slot:
|
|
1131
|
-
namespace:
|
|
1131
|
+
slot: a,
|
|
1132
|
+
namespace: i,
|
|
1132
1133
|
tokens: s,
|
|
1133
1134
|
policies: d,
|
|
1134
1135
|
...p
|
|
1135
1136
|
}) {
|
|
1136
1137
|
const c = (e || Be).replace(/\/$/, "");
|
|
1137
1138
|
let l = new URL(
|
|
1138
|
-
|
|
1139
|
+
a ? `${c}/account/${o}/slot/${a}` : `${c}/account/${o}`
|
|
1139
1140
|
);
|
|
1140
|
-
if (
|
|
1141
|
+
if (a && l.searchParams.set("ps", encodeURIComponent(a)), i && l.searchParams.set("ns", encodeURIComponent(i)), r && l.searchParams.set("v", encodeURIComponent(r)), l.searchParams.set("rpcUrl", encodeURIComponent(t)), s?.erc20 && l.searchParams.set(
|
|
1141
1142
|
"erc20",
|
|
1142
1143
|
encodeURIComponent(s.erc20.toString())
|
|
1143
1144
|
), d?.contracts) {
|
|
@@ -1386,12 +1387,12 @@ class an extends ze {
|
|
|
1386
1387
|
interval: t = 100
|
|
1387
1388
|
} = {}) {
|
|
1388
1389
|
return new Promise((r, o) => {
|
|
1389
|
-
const
|
|
1390
|
-
if (Date.now() -
|
|
1391
|
-
clearInterval(
|
|
1390
|
+
const a = Date.now(), i = setInterval(() => {
|
|
1391
|
+
if (Date.now() - a > e) {
|
|
1392
|
+
clearInterval(i), o(new Error("Timeout waiting for keychain"));
|
|
1392
1393
|
return;
|
|
1393
1394
|
}
|
|
1394
|
-
this.keychain && (clearInterval(
|
|
1395
|
+
this.keychain && (clearInterval(i), r());
|
|
1395
1396
|
}, t);
|
|
1396
1397
|
});
|
|
1397
1398
|
}
|
|
@@ -1471,18 +1472,18 @@ function N(n) {
|
|
|
1471
1472
|
function vt(n, e, t) {
|
|
1472
1473
|
let r = n;
|
|
1473
1474
|
{
|
|
1474
|
-
const
|
|
1475
|
+
const a = [];
|
|
1475
1476
|
if (t) {
|
|
1476
1477
|
if ("message" in t || "code" in t || "name" in t)
|
|
1477
1478
|
throw new Error(`value will overwrite populated values: ${N(t)}`);
|
|
1478
|
-
for (const
|
|
1479
|
-
if (
|
|
1479
|
+
for (const i in t) {
|
|
1480
|
+
if (i === "shortMessage")
|
|
1480
1481
|
continue;
|
|
1481
|
-
const s = t[
|
|
1482
|
-
|
|
1482
|
+
const s = t[i];
|
|
1483
|
+
a.push(i + "=" + N(s));
|
|
1483
1484
|
}
|
|
1484
1485
|
}
|
|
1485
|
-
|
|
1486
|
+
a.push(`code=${e}`), a.push(`version=${wt}`), a.length && (n += " (" + a.join(", ") + ")");
|
|
1486
1487
|
}
|
|
1487
1488
|
let o;
|
|
1488
1489
|
switch (e) {
|
|
@@ -1530,8 +1531,8 @@ function At(n, e, t) {
|
|
|
1530
1531
|
if (typeof n == "string" && n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
|
|
1531
1532
|
const r = new Uint8Array((n.length - 2) / 2);
|
|
1532
1533
|
let o = 2;
|
|
1533
|
-
for (let
|
|
1534
|
-
r[
|
|
1534
|
+
for (let a = 0; a < r.length; a++)
|
|
1535
|
+
r[a] = parseInt(n.substring(o, o + 2), 16), o += 2;
|
|
1535
1536
|
return r;
|
|
1536
1537
|
}
|
|
1537
1538
|
h(!1, "invalid BytesLike value", e || "value", n);
|
|
@@ -1624,8 +1625,8 @@ function xt(n) {
|
|
|
1624
1625
|
t.length % 2 && (t = "0" + t);
|
|
1625
1626
|
const r = new Uint8Array(t.length / 2);
|
|
1626
1627
|
for (let o = 0; o < r.length; o++) {
|
|
1627
|
-
const
|
|
1628
|
-
r[o] = parseInt(t.substring(
|
|
1628
|
+
const a = o * 2;
|
|
1629
|
+
r[o] = parseInt(t.substring(a, a + 2), 16);
|
|
1629
1630
|
}
|
|
1630
1631
|
return r;
|
|
1631
1632
|
}
|
|
@@ -1640,10 +1641,10 @@ function $(n, e) {
|
|
|
1640
1641
|
t.push(o >> 6 | 192), t.push(o & 63 | 128);
|
|
1641
1642
|
else if ((o & 64512) == 55296) {
|
|
1642
1643
|
r++;
|
|
1643
|
-
const
|
|
1644
|
-
h(r < n.length && (
|
|
1645
|
-
const
|
|
1646
|
-
t.push(
|
|
1644
|
+
const a = n.charCodeAt(r);
|
|
1645
|
+
h(r < n.length && (a & 64512) === 56320, "invalid surrogate pair", "str", n);
|
|
1646
|
+
const i = 65536 + ((o & 1023) << 10) + (a & 1023);
|
|
1647
|
+
t.push(i >> 18 | 240), t.push(i >> 12 & 63 | 128), t.push(i >> 6 & 63 | 128), t.push(i & 63 | 128);
|
|
1647
1648
|
} else
|
|
1648
1649
|
t.push(o >> 12 | 224), t.push(o >> 6 & 63 | 128), t.push(o & 63 | 128);
|
|
1649
1650
|
}
|
|
@@ -1702,8 +1703,8 @@ function Bt(n, e = !1) {
|
|
|
1702
1703
|
function zt(n, e = !1) {
|
|
1703
1704
|
let t = new Uint32Array(n.length), r = new Uint32Array(n.length);
|
|
1704
1705
|
for (let o = 0; o < n.length; o++) {
|
|
1705
|
-
const { h:
|
|
1706
|
-
[t[o], r[o]] = [
|
|
1706
|
+
const { h: a, l: i } = Bt(n[o], e);
|
|
1707
|
+
[t[o], r[o]] = [a, i];
|
|
1707
1708
|
}
|
|
1708
1709
|
return [t, r];
|
|
1709
1710
|
}
|
|
@@ -1711,31 +1712,31 @@ const Tt = (n, e, t) => n << t | e >>> 32 - t, jt = (n, e, t) => e << t | n >>>
|
|
|
1711
1712
|
for (let n = 0, e = B, t = 1, r = 0; n < 24; n++) {
|
|
1712
1713
|
[t, r] = [r, (2 * t + 3 * r) % 5], ke.push(2 * (5 * r + t)), Ce.push((n + 1) * (n + 2) / 2 % 64);
|
|
1713
1714
|
let o = Ot;
|
|
1714
|
-
for (let
|
|
1715
|
-
e = (e << B ^ (e >> Qt) * $t) % Wt, e & Ft && (o ^= B << (B << /* @__PURE__ */ BigInt(
|
|
1715
|
+
for (let a = 0; a < 7; a++)
|
|
1716
|
+
e = (e << B ^ (e >> Qt) * $t) % Wt, e & Ft && (o ^= B << (B << /* @__PURE__ */ BigInt(a)) - B);
|
|
1716
1717
|
Ie.push(o);
|
|
1717
1718
|
}
|
|
1718
|
-
const [Ht, Yt] = /* @__PURE__ */ zt(Ie, !0),
|
|
1719
|
+
const [Ht, Yt] = /* @__PURE__ */ zt(Ie, !0), ae = (n, e, t) => t > 32 ? Ut(n, e, t) : Tt(n, e, t), ie = (n, e, t) => t > 32 ? Lt(n, e, t) : jt(n, e, t);
|
|
1719
1720
|
function qt(n, e = 24) {
|
|
1720
1721
|
const t = new Uint32Array(10);
|
|
1721
1722
|
for (let r = 24 - e; r < 24; r++) {
|
|
1722
|
-
for (let
|
|
1723
|
-
t[
|
|
1724
|
-
for (let
|
|
1725
|
-
const s = (
|
|
1723
|
+
for (let i = 0; i < 10; i++)
|
|
1724
|
+
t[i] = n[i] ^ n[i + 10] ^ n[i + 20] ^ n[i + 30] ^ n[i + 40];
|
|
1725
|
+
for (let i = 0; i < 10; i += 2) {
|
|
1726
|
+
const s = (i + 8) % 10, d = (i + 2) % 10, p = t[d], c = t[d + 1], l = ae(p, c, 1) ^ t[s], g = ie(p, c, 1) ^ t[s + 1];
|
|
1726
1727
|
for (let m = 0; m < 50; m += 10)
|
|
1727
|
-
n[
|
|
1728
|
+
n[i + m] ^= l, n[i + m + 1] ^= g;
|
|
1728
1729
|
}
|
|
1729
|
-
let o = n[2],
|
|
1730
|
-
for (let
|
|
1731
|
-
const s = Ce[
|
|
1732
|
-
o = n[c],
|
|
1730
|
+
let o = n[2], a = n[3];
|
|
1731
|
+
for (let i = 0; i < 24; i++) {
|
|
1732
|
+
const s = Ce[i], d = ae(o, a, s), p = ie(o, a, s), c = ke[i];
|
|
1733
|
+
o = n[c], a = n[c + 1], n[c] = d, n[c + 1] = p;
|
|
1733
1734
|
}
|
|
1734
|
-
for (let
|
|
1735
|
+
for (let i = 0; i < 50; i += 10) {
|
|
1735
1736
|
for (let s = 0; s < 10; s++)
|
|
1736
|
-
t[s] = n[
|
|
1737
|
+
t[s] = n[i + s];
|
|
1737
1738
|
for (let s = 0; s < 10; s++)
|
|
1738
|
-
n[
|
|
1739
|
+
n[i + s] ^= ~t[(s + 2) % 10] & t[(s + 4) % 10];
|
|
1739
1740
|
}
|
|
1740
1741
|
n[0] ^= Ht[r], n[1] ^= Yt[r];
|
|
1741
1742
|
}
|
|
@@ -1743,8 +1744,8 @@ function qt(n, e = 24) {
|
|
|
1743
1744
|
}
|
|
1744
1745
|
class V extends Nt {
|
|
1745
1746
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1746
|
-
constructor(e, t, r, o = !1,
|
|
1747
|
-
if (super(), this.blockLen = e, this.suffix = t, this.outputLen = r, this.enableXOF = o, this.rounds =
|
|
1747
|
+
constructor(e, t, r, o = !1, a = 24) {
|
|
1748
|
+
if (super(), this.blockLen = e, this.suffix = t, this.outputLen = r, this.enableXOF = o, this.rounds = a, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, ne(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1748
1749
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1749
1750
|
this.state = new Uint8Array(200), this.state32 = St(this.state);
|
|
1750
1751
|
}
|
|
@@ -1756,10 +1757,10 @@ class V extends Nt {
|
|
|
1756
1757
|
const { blockLen: t, state: r } = this;
|
|
1757
1758
|
e = Ae(e);
|
|
1758
1759
|
const o = e.length;
|
|
1759
|
-
for (let
|
|
1760
|
-
const
|
|
1761
|
-
for (let s = 0; s <
|
|
1762
|
-
r[this.pos++] ^= e[
|
|
1760
|
+
for (let a = 0; a < o; ) {
|
|
1761
|
+
const i = Math.min(t - this.pos, o - a);
|
|
1762
|
+
for (let s = 0; s < i; s++)
|
|
1763
|
+
r[this.pos++] ^= e[a++];
|
|
1763
1764
|
this.pos === t && this.keccak();
|
|
1764
1765
|
}
|
|
1765
1766
|
return this;
|
|
@@ -1774,10 +1775,10 @@ class V extends Nt {
|
|
|
1774
1775
|
writeInto(e) {
|
|
1775
1776
|
re(this, !1), _e(e), this.finish();
|
|
1776
1777
|
const t = this.state, { blockLen: r } = this;
|
|
1777
|
-
for (let o = 0,
|
|
1778
|
+
for (let o = 0, a = e.length; o < a; ) {
|
|
1778
1779
|
this.posOut >= r && this.keccak();
|
|
1779
|
-
const
|
|
1780
|
-
e.set(t.subarray(this.posOut, this.posOut +
|
|
1780
|
+
const i = Math.min(r - this.posOut, a - o);
|
|
1781
|
+
e.set(t.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
|
|
1781
1782
|
}
|
|
1782
1783
|
return e;
|
|
1783
1784
|
}
|
|
@@ -1801,8 +1802,8 @@ class V extends Nt {
|
|
|
1801
1802
|
this.destroyed = !0, this.state.fill(0);
|
|
1802
1803
|
}
|
|
1803
1804
|
_cloneInto(e) {
|
|
1804
|
-
const { blockLen: t, suffix: r, outputLen: o, rounds:
|
|
1805
|
-
return e || (e = new V(t, r, o,
|
|
1805
|
+
const { blockLen: t, suffix: r, outputLen: o, rounds: a, enableXOF: i } = this;
|
|
1806
|
+
return e || (e = new V(t, r, o, i, a)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = a, e.suffix = r, e.outputLen = o, e.enableXOF = i, e.destroyed = this.destroyed, e;
|
|
1806
1807
|
}
|
|
1807
1808
|
}
|
|
1808
1809
|
const Kt = (n, e, t) => Dt(() => new V(e, n, t)), Vt = /* @__PURE__ */ Kt(1, 136, 256 / 8);
|
|
@@ -2035,7 +2036,7 @@ class w {
|
|
|
2035
2036
|
return e.clone();
|
|
2036
2037
|
const r = e.r;
|
|
2037
2038
|
t(r != null, "missing r");
|
|
2038
|
-
const o = me(r),
|
|
2039
|
+
const o = me(r), a = function(p, c) {
|
|
2039
2040
|
if (p != null)
|
|
2040
2041
|
return me(p);
|
|
2041
2042
|
if (c != null) {
|
|
@@ -2045,8 +2046,8 @@ class w {
|
|
|
2045
2046
|
}
|
|
2046
2047
|
t(!1, "missing s");
|
|
2047
2048
|
}(e.s, e.yParityAndS);
|
|
2048
|
-
t((_(
|
|
2049
|
-
const { networkV:
|
|
2049
|
+
t((_(a)[0] & 128) == 0, "non-canonical s");
|
|
2050
|
+
const { networkV: i, v: s } = function(p, c, l) {
|
|
2050
2051
|
if (p != null) {
|
|
2051
2052
|
const g = z(p);
|
|
2052
2053
|
return {
|
|
@@ -2066,8 +2067,8 @@ class w {
|
|
|
2066
2067
|
t(!1, "invalid yParity");
|
|
2067
2068
|
}
|
|
2068
2069
|
t(!1, "missing v");
|
|
2069
|
-
}(e.v, e.yParityAndS, e.yParity), d = new w(M, o,
|
|
2070
|
-
return
|
|
2070
|
+
}(e.v, e.yParityAndS, e.yParity), d = new w(M, o, a, s);
|
|
2071
|
+
return i && (d.#e = i), t(e.yParity == null || O(e.yParity, "sig.yParity") === d.yParity, "yParity mismatch"), t(e.yParityAndS == null || e.yParityAndS === d.yParityAndS, "yParityAndS mismatch"), d;
|
|
2071
2072
|
}
|
|
2072
2073
|
}
|
|
2073
2074
|
function Jt(n) {
|
|
@@ -2145,13 +2146,13 @@ class dn {
|
|
|
2145
2146
|
try {
|
|
2146
2147
|
if (!this.isAvailable() || !this.account)
|
|
2147
2148
|
throw new Error("Turnkey is not connected");
|
|
2148
|
-
const t = `0x${e.replace("0x", "").padStart(64, "0")}`, r = _(t), o = Jt(r), { r:
|
|
2149
|
+
const t = `0x${e.replace("0x", "").padStart(64, "0")}`, r = _(t), o = Jt(r), { r: a, s: i, v: s } = await this.turnkeyIframeClient.signRawPayload({
|
|
2149
2150
|
organizationId: this.organizationId,
|
|
2150
2151
|
signWith: this.account,
|
|
2151
2152
|
payload: o,
|
|
2152
2153
|
encoding: "PAYLOAD_ENCODING_HEXADECIMAL",
|
|
2153
2154
|
hashFunction: "HASH_FUNCTION_NO_OP"
|
|
2154
|
-
}), d =
|
|
2155
|
+
}), d = a.startsWith("0x") ? a : "0x" + a, p = i.startsWith("0x") ? i : "0x" + i, c = parseInt(s, 16);
|
|
2155
2156
|
if (isNaN(c))
|
|
2156
2157
|
throw console.error(`Invalid recovery ID (v) received from Turnkey: ${s}`), new Error(`Invalid recovery ID (v) received: ${s}`);
|
|
2157
2158
|
const l = w.from({
|
|
@@ -3025,7 +3026,7 @@ var Se = {
|
|
|
3025
3026
|
}
|
|
3026
3027
|
},
|
|
3027
3028
|
coloniz: {
|
|
3028
|
-
origin: ["coloniz.xyz"],
|
|
3029
|
+
origin: ["*.coloniz.xyz"],
|
|
3029
3030
|
chains: {
|
|
3030
3031
|
SN_MAIN: {
|
|
3031
3032
|
policies: {
|
|
@@ -3733,6 +3734,14 @@ var Se = {
|
|
|
3733
3734
|
}
|
|
3734
3735
|
]
|
|
3735
3736
|
},
|
|
3737
|
+
"0x31973536315f0915760065cdbe90accf397a7163e77fcf57a570ae9e0210560": {
|
|
3738
|
+
methods: [
|
|
3739
|
+
{
|
|
3740
|
+
name: "set_approval_for_all",
|
|
3741
|
+
entrypoint: "set_approval_for_all"
|
|
3742
|
+
}
|
|
3743
|
+
]
|
|
3744
|
+
},
|
|
3736
3745
|
"0x2620f65aa2fd72d705306ada1ee7410023a3df03da9291f1ccb744fabfebc0": {
|
|
3737
3746
|
name: "Battle contract",
|
|
3738
3747
|
description: "Required to engage in battles",
|