@cartridge/controller 0.7.13-alpha.3 → 0.7.13
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 +15 -15
- package/.turbo/turbo-build.log +15 -15
- package/dist/index.js +238 -211
- 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.d.cts +2 -4
- package/dist/node/index.d.ts +2 -4
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/{provider-M8-BWFF8.js → provider-C4iZV8Y5.js} +2 -2
- package/dist/provider-C4iZV8Y5.js.map +1 -0
- package/dist/session.js +2 -2
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/wallets/argent/index.d.ts +3 -1
- package/dist/wallets/bridge.d.ts +2 -4
- package/dist/wallets/metamask/index.d.ts +3 -1
- package/dist/wallets/phantom/index.d.ts +3 -1
- package/dist/wallets/rabby/index.d.ts +2 -1
- package/dist/wallets/turnkey/index.d.ts +1 -0
- package/dist/wallets/types.d.ts +2 -1
- package/dist/wallets/wallet-connect/index.d.ts +2 -1
- package/package.json +4 -4
- package/src/types.ts +1 -0
- package/src/wallets/argent/index.ts +10 -5
- package/src/wallets/bridge.ts +22 -17
- package/src/wallets/metamask/index.ts +34 -12
- package/src/wallets/phantom/index.ts +7 -2
- package/src/wallets/rabby/index.ts +18 -2
- package/src/wallets/turnkey/index.ts +4 -0
- package/src/wallets/types.ts +2 -1
- package/src/wallets/wallet-connect/index.ts +8 -3
- package/dist/provider-M8-BWFF8.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { WalletAccount as
|
|
2
|
-
import { R as E, t as
|
|
3
|
-
import { F as fn, h as bn, n as yn, a as wn, b as vn } from "./provider-
|
|
4
|
-
import { connect as
|
|
5
|
-
import { InjectedConnector as
|
|
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-C4iZV8Y5.js";
|
|
3
|
+
import { F as fn, h as bn, n as yn, a as wn, b as vn } from "./provider-C4iZV8Y5.js";
|
|
4
|
+
import { connect as Ue } from "starknetkit";
|
|
5
|
+
import { InjectedConnector as Le } from "starknetkit/injected";
|
|
6
6
|
import { MetaMaskSDK as Oe } from "@metamask/sdk";
|
|
7
|
-
import { Transaction as
|
|
8
|
-
class J extends
|
|
7
|
+
import { Transaction as Fe } from "@solana/web3.js";
|
|
8
|
+
class J extends Pe {
|
|
9
9
|
address;
|
|
10
10
|
keychain;
|
|
11
11
|
modal;
|
|
@@ -26,7 +26,7 @@ class J extends Se {
|
|
|
26
26
|
* @returns response from addTransaction
|
|
27
27
|
*/
|
|
28
28
|
async execute(e) {
|
|
29
|
-
return e =
|
|
29
|
+
return e = Ne(e), new Promise(async (t, r) => {
|
|
30
30
|
const o = await this.keychain.execute(
|
|
31
31
|
e,
|
|
32
32
|
void 0,
|
|
@@ -78,10 +78,10 @@ class J extends Se {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var
|
|
81
|
+
var A;
|
|
82
82
|
(function(n) {
|
|
83
83
|
n.Call = "call", n.Reply = "reply", n.Syn = "syn", n.SynAck = "synAck", n.Ack = "ack";
|
|
84
|
-
})(
|
|
84
|
+
})(A || (A = {}));
|
|
85
85
|
var R;
|
|
86
86
|
(function(n) {
|
|
87
87
|
n.Fulfilled = "fulfilled", n.Rejected = "rejected";
|
|
@@ -94,11 +94,11 @@ var H;
|
|
|
94
94
|
(function(n) {
|
|
95
95
|
n.DataCloneError = "DataCloneError";
|
|
96
96
|
})(H || (H = {}));
|
|
97
|
-
var
|
|
97
|
+
var I;
|
|
98
98
|
(function(n) {
|
|
99
99
|
n.Message = "message";
|
|
100
|
-
})(
|
|
101
|
-
const
|
|
100
|
+
})(I || (I = {}));
|
|
101
|
+
const Qe = (n, e) => {
|
|
102
102
|
const t = [];
|
|
103
103
|
let r = !1;
|
|
104
104
|
return {
|
|
@@ -111,31 +111,31 @@ const Fe = (n, e) => {
|
|
|
111
111
|
r ? o() : t.push(o);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
},
|
|
114
|
+
}, We = (n) => (...e) => {
|
|
115
115
|
n && console.log("[Penpal]", ...e);
|
|
116
|
-
},
|
|
116
|
+
}, $e = {
|
|
117
117
|
"http:": "80",
|
|
118
118
|
"https:": "443"
|
|
119
|
-
},
|
|
120
|
-
if (n &&
|
|
119
|
+
}, He = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, Ye = ["file:", "data:"], qe = (n) => {
|
|
120
|
+
if (n && Ye.find((s) => n.startsWith(s)))
|
|
121
121
|
return "null";
|
|
122
|
-
const e = document.location, t =
|
|
122
|
+
const e = document.location, t = He.exec(n);
|
|
123
123
|
let r, o, a;
|
|
124
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 !==
|
|
125
|
+
const i = a && a !== $e[r] ? `:${a}` : "";
|
|
126
126
|
return `${r}//${o}${i}`;
|
|
127
127
|
}, X = ({ name: n, message: e, stack: t }) => ({
|
|
128
128
|
name: n,
|
|
129
129
|
message: e,
|
|
130
130
|
stack: t
|
|
131
|
-
}),
|
|
131
|
+
}), Ke = (n) => {
|
|
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
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 !== a || c.data.penpal !==
|
|
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}`);
|
|
@@ -143,24 +143,24 @@ const Fe = (n, e) => {
|
|
|
143
143
|
}
|
|
144
144
|
const l = c.data, { methodName: g, args: m, id: f } = l;
|
|
145
145
|
t(`${r}: Received ${g}() call`);
|
|
146
|
-
const
|
|
146
|
+
const C = (b) => (x) => {
|
|
147
147
|
if (t(`${r}: Sending ${g}() reply`), d) {
|
|
148
148
|
t(`${r}: Unable to send ${g}() reply due to destroyed connection`);
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
const
|
|
152
|
-
penpal:
|
|
151
|
+
const k = {
|
|
152
|
+
penpal: A.Reply,
|
|
153
153
|
id: f,
|
|
154
154
|
resolution: b,
|
|
155
|
-
returnValue:
|
|
155
|
+
returnValue: x
|
|
156
156
|
};
|
|
157
|
-
b === R.Rejected &&
|
|
157
|
+
b === R.Rejected && x instanceof Error && (k.returnValue = X(x), k.returnValueIsError = !0);
|
|
158
158
|
try {
|
|
159
|
-
a.postMessage(
|
|
159
|
+
a.postMessage(k, i);
|
|
160
160
|
} catch (u) {
|
|
161
161
|
if (u.name === H.DataCloneError) {
|
|
162
162
|
const S = {
|
|
163
|
-
penpal:
|
|
163
|
+
penpal: A.Reply,
|
|
164
164
|
id: f,
|
|
165
165
|
resolution: R.Rejected,
|
|
166
166
|
returnValue: X(u),
|
|
@@ -171,73 +171,73 @@ const Fe = (n, e) => {
|
|
|
171
171
|
throw u;
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
|
-
new Promise((b) => b(e[g].call(e, c.origin).apply(e, m))).then(
|
|
174
|
+
new Promise((b) => b(e[g].call(e, c.origin).apply(e, m))).then(C(R.Fulfilled), C(R.Rejected));
|
|
175
175
|
};
|
|
176
|
-
return o.addEventListener(
|
|
177
|
-
d = !0, o.removeEventListener(
|
|
176
|
+
return o.addEventListener(I.Message, p), () => {
|
|
177
|
+
d = !0, o.removeEventListener(I.Message, p);
|
|
178
178
|
};
|
|
179
179
|
};
|
|
180
|
-
let
|
|
181
|
-
const
|
|
180
|
+
let Ge = 0;
|
|
181
|
+
const Je = () => ++Ge, he = ".", ue = (n) => n ? n.split(he) : [], Xe = (n) => n.join(he), Ze = (n, e) => {
|
|
182
182
|
const t = ue(e || "");
|
|
183
|
-
return t.push(n),
|
|
184
|
-
},
|
|
183
|
+
return t.push(n), Xe(t);
|
|
184
|
+
}, et = (n, e, t) => {
|
|
185
185
|
const r = ue(e);
|
|
186
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], a =
|
|
190
|
+
const o = n[r], a = Ze(r, e);
|
|
191
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 = {};
|
|
195
195
|
for (const t in n)
|
|
196
|
-
|
|
196
|
+
et(e, t, n[t]);
|
|
197
197
|
return e;
|
|
198
|
-
},
|
|
198
|
+
}, nt = (n, e, t, r, o) => {
|
|
199
199
|
const { localName: a, local: i, remote: s, originForSending: d, originForReceiving: p } = e;
|
|
200
200
|
let c = !1;
|
|
201
201
|
o(`${a}: Connecting call sender`);
|
|
202
202
|
const l = (m) => (...f) => {
|
|
203
203
|
o(`${a}: Sending ${m}() call`);
|
|
204
|
-
let
|
|
204
|
+
let C;
|
|
205
205
|
try {
|
|
206
|
-
s.closed && (
|
|
206
|
+
s.closed && (C = !0);
|
|
207
207
|
} catch {
|
|
208
|
-
|
|
208
|
+
C = !0;
|
|
209
209
|
}
|
|
210
|
-
if (
|
|
210
|
+
if (C && r(), c) {
|
|
211
211
|
const b = new Error(`Unable to send ${m}() call due to destroyed connection`);
|
|
212
212
|
throw b.code = T.ConnectionDestroyed, b;
|
|
213
213
|
}
|
|
214
|
-
return new Promise((b,
|
|
215
|
-
const
|
|
216
|
-
if (P.source !== s || P.data.penpal !==
|
|
214
|
+
return new Promise((b, x) => {
|
|
215
|
+
const k = Je(), u = (P) => {
|
|
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
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(`${a}: Received ${m}() reply`), i.removeEventListener(
|
|
223
|
+
o(`${a}: Received ${m}() reply`), i.removeEventListener(I.Message, u);
|
|
224
224
|
let W = Q.returnValue;
|
|
225
|
-
Q.returnValueIsError && (W =
|
|
225
|
+
Q.returnValueIsError && (W = Ke(W)), (Q.resolution === R.Fulfilled ? b : x)(W);
|
|
226
226
|
};
|
|
227
|
-
i.addEventListener(
|
|
227
|
+
i.addEventListener(I.Message, u);
|
|
228
228
|
const S = {
|
|
229
|
-
penpal:
|
|
230
|
-
id:
|
|
229
|
+
penpal: A.Call,
|
|
230
|
+
id: k,
|
|
231
231
|
methodName: m,
|
|
232
232
|
args: f
|
|
233
233
|
};
|
|
234
234
|
s.postMessage(S, d);
|
|
235
235
|
});
|
|
236
236
|
}, g = t.reduce((m, f) => (m[f] = l(f), m), {});
|
|
237
|
-
return Object.assign(n,
|
|
237
|
+
return Object.assign(n, tt(g)), () => {
|
|
238
238
|
c = !0;
|
|
239
239
|
};
|
|
240
|
-
},
|
|
240
|
+
}, rt = (n, e, t, r, o) => {
|
|
241
241
|
const { destroy: a, onDestroy: i } = r;
|
|
242
242
|
let s, d;
|
|
243
243
|
const p = {};
|
|
@@ -254,13 +254,13 @@ const Ge = () => ++Ve, he = ".", ue = (n) => n ? n.split(he) : [], Je = (n) => n
|
|
|
254
254
|
originForSending: t,
|
|
255
255
|
originForReceiving: e
|
|
256
256
|
};
|
|
257
|
-
s && s(), s =
|
|
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 =
|
|
260
|
+
const g = nt(p, l, d, a, o);
|
|
261
261
|
return i(g), p;
|
|
262
262
|
};
|
|
263
|
-
},
|
|
263
|
+
}, ot = (n, e, t, r) => (o) => {
|
|
264
264
|
if (!o.source)
|
|
265
265
|
return;
|
|
266
266
|
if (t !== "*" && o.origin !== t) {
|
|
@@ -269,18 +269,18 @@ const Ge = () => ++Ve, he = ".", ue = (n) => n ? n.split(he) : [], Je = (n) => n
|
|
|
269
269
|
}
|
|
270
270
|
n("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
271
271
|
const a = {
|
|
272
|
-
penpal:
|
|
272
|
+
penpal: A.SynAck,
|
|
273
273
|
methodNames: Object.keys(e)
|
|
274
274
|
};
|
|
275
275
|
o.source.postMessage(a, r);
|
|
276
|
-
},
|
|
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
|
});
|
|
283
|
-
},
|
|
283
|
+
}, st = (n, e) => {
|
|
284
284
|
let t;
|
|
285
285
|
return n !== void 0 && (t = window.setTimeout(() => {
|
|
286
286
|
const r = new Error(`Connection timed out after ${n}ms`);
|
|
@@ -288,33 +288,33 @@ const Ge = () => ++Ve, he = ".", ue = (n) => n ? n.split(he) : [], Je = (n) => n
|
|
|
288
288
|
}, n)), () => {
|
|
289
289
|
clearTimeout(t);
|
|
290
290
|
};
|
|
291
|
-
},
|
|
291
|
+
}, ct = (n) => {
|
|
292
292
|
if (!n.src && !n.srcdoc) {
|
|
293
293
|
const e = new Error("Iframe must have src or srcdoc property defined.");
|
|
294
294
|
throw e.code = T.NoIframeSrc, e;
|
|
295
295
|
}
|
|
296
|
-
},
|
|
296
|
+
}, dt = (n) => {
|
|
297
297
|
let { iframe: e, methods: t = {}, childOrigin: r, timeout: o, debug: a = !1 } = n;
|
|
298
|
-
const i =
|
|
299
|
-
r || (
|
|
300
|
-
const c = r === "null" ? "*" : r, l = fe(t), g =
|
|
298
|
+
const i = We(a), s = Qe("Parent", i), { onDestroy: d, destroy: p } = s;
|
|
299
|
+
r || (ct(e), r = qe(e.src));
|
|
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
|
-
promise: new Promise((
|
|
303
|
-
const
|
|
302
|
+
promise: new Promise((C, b) => {
|
|
303
|
+
const x = st(o, p), k = (u) => {
|
|
304
304
|
if (!(u.source !== e.contentWindow || !u.data)) {
|
|
305
|
-
if (u.data.penpal ===
|
|
305
|
+
if (u.data.penpal === A.Syn) {
|
|
306
306
|
g(u);
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
|
-
if (u.data.penpal ===
|
|
309
|
+
if (u.data.penpal === A.Ack) {
|
|
310
310
|
const S = m(u);
|
|
311
|
-
S && (
|
|
311
|
+
S && (x(), C(S));
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
|
-
window.addEventListener(
|
|
317
|
-
window.removeEventListener(
|
|
316
|
+
window.addEventListener(I.Message, k), i("Parent: Awaiting handshake"), it(e, s), d((u) => {
|
|
317
|
+
window.removeEventListener(I.Message, k), u && b(u);
|
|
318
318
|
});
|
|
319
319
|
}),
|
|
320
320
|
destroy() {
|
|
@@ -341,7 +341,7 @@ class be {
|
|
|
341
341
|
const s = document.createElement("iframe");
|
|
342
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-popups-to-escape-sandbox"), 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
343
|
const d = document.createElement("div");
|
|
344
|
-
d.id = "controller", d.style.position = "fixed", d.style.height = "100%", d.style.width = "100%", d.style.top = "0", d.style.left = "0", d.style.zIndex = "10000", d.style.backgroundColor = "rgba(0,0,0,0.6)", d.style.display = "flex", d.style.alignItems = "center", d.style.justifyContent = "center", d.style.visibility = "hidden", d.style.opacity = "0", d.style.transition = "opacity 0.2s ease", d.style.pointerEvents = "auto", d.appendChild(s), this.iframe = s, this.container = d,
|
|
344
|
+
d.id = "controller", d.style.position = "fixed", d.style.height = "100%", d.style.width = "100%", d.style.top = "0", d.style.left = "0", d.style.zIndex = "10000", d.style.backgroundColor = "rgba(0,0,0,0.6)", d.style.display = "flex", d.style.alignItems = "center", d.style.justifyContent = "center", d.style.visibility = "hidden", d.style.opacity = "0", d.style.transition = "opacity 0.2s ease", d.style.pointerEvents = "auto", d.appendChild(s), this.iframe = s, this.container = d, dt({
|
|
345
345
|
iframe: this.iframe,
|
|
346
346
|
methods: {
|
|
347
347
|
close: (l) => () => this.close(),
|
|
@@ -390,11 +390,12 @@ class be {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
class
|
|
393
|
+
class pt {
|
|
394
394
|
type = "argent";
|
|
395
395
|
platform = "starknet";
|
|
396
396
|
wallet = void 0;
|
|
397
397
|
account = void 0;
|
|
398
|
+
connectedAccounts = [];
|
|
398
399
|
isAvailable() {
|
|
399
400
|
return typeof window < "u" && !!window.starknet_argentX;
|
|
400
401
|
}
|
|
@@ -415,8 +416,8 @@ class dt {
|
|
|
415
416
|
try {
|
|
416
417
|
if (!this.isAvailable())
|
|
417
418
|
throw new Error("Argent is not available");
|
|
418
|
-
const { wallet: e, connectorData: t } = await
|
|
419
|
-
connectors: [new
|
|
419
|
+
const { wallet: e, connectorData: t } = await Ue({
|
|
420
|
+
connectors: [new Le({ options: { id: "argentX" } })]
|
|
420
421
|
});
|
|
421
422
|
if (!e)
|
|
422
423
|
throw new Error("No wallet found");
|
|
@@ -429,6 +430,9 @@ class dt {
|
|
|
429
430
|
};
|
|
430
431
|
}
|
|
431
432
|
}
|
|
433
|
+
getConnectedAccounts() {
|
|
434
|
+
return this.connectedAccounts;
|
|
435
|
+
}
|
|
432
436
|
async signTypedData(e) {
|
|
433
437
|
try {
|
|
434
438
|
if (!this.isAvailable() || !this.wallet)
|
|
@@ -476,10 +480,48 @@ class dt {
|
|
|
476
480
|
}
|
|
477
481
|
}
|
|
478
482
|
}
|
|
479
|
-
|
|
483
|
+
function lt(n) {
|
|
484
|
+
if (typeof window > "u")
|
|
485
|
+
return;
|
|
486
|
+
const e = (t) => n(t.detail);
|
|
487
|
+
return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new CustomEvent("eip6963:requestProvider")), () => window.removeEventListener("eip6963:announceProvider", e);
|
|
488
|
+
}
|
|
489
|
+
function ye() {
|
|
490
|
+
const n = /* @__PURE__ */ new Set();
|
|
491
|
+
let e = [];
|
|
492
|
+
const t = () => lt((o) => {
|
|
493
|
+
e.some(({ info: a }) => a.uuid === o.info.uuid) || (e = [...e, o], n.forEach((a) => a(e, { added: [o] })));
|
|
494
|
+
});
|
|
495
|
+
let r = t();
|
|
496
|
+
return {
|
|
497
|
+
_listeners() {
|
|
498
|
+
return n;
|
|
499
|
+
},
|
|
500
|
+
clear() {
|
|
501
|
+
n.forEach((o) => o([], { removed: [...e] })), e = [];
|
|
502
|
+
},
|
|
503
|
+
destroy() {
|
|
504
|
+
this.clear(), n.clear(), r?.();
|
|
505
|
+
},
|
|
506
|
+
findProvider({ rdns: o }) {
|
|
507
|
+
return e.find((a) => a.info.rdns === o);
|
|
508
|
+
},
|
|
509
|
+
getProviders() {
|
|
510
|
+
return e;
|
|
511
|
+
},
|
|
512
|
+
reset() {
|
|
513
|
+
this.clear(), r?.(), r = t();
|
|
514
|
+
},
|
|
515
|
+
subscribe(o, { emitImmediately: a } = {}) {
|
|
516
|
+
return n.add(o), a && o(e, { added: e }), () => n.delete(o);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
class gt {
|
|
480
521
|
type = "metamask";
|
|
481
522
|
platform = "ethereum";
|
|
482
523
|
MMSDK;
|
|
524
|
+
store = ye();
|
|
483
525
|
account = void 0;
|
|
484
526
|
connectedAccounts = [];
|
|
485
527
|
constructor() {
|
|
@@ -488,16 +530,18 @@ class pt {
|
|
|
488
530
|
name: "Cartridge Controller",
|
|
489
531
|
url: window.location.href
|
|
490
532
|
}
|
|
491
|
-
}), this.MMSDK.sdkInitPromise?.then(() => {
|
|
533
|
+
}), this.isAvailable() && this.MMSDK.sdkInitPromise?.then(() => {
|
|
492
534
|
this.MMSDK.getProvider()?.request({
|
|
493
535
|
method: "eth_accounts"
|
|
494
536
|
}).then((e) => {
|
|
495
|
-
e && e.length > 0 && (
|
|
537
|
+
e && e.length > 0 && (this.account = e[0], this.connectedAccounts = e);
|
|
538
|
+
}), this.MMSDK.getProvider()?.on("accountsChanged", (e) => {
|
|
539
|
+
Array.isArray(e) && (this.account = e?.[0], this.connectedAccounts = e);
|
|
496
540
|
});
|
|
497
541
|
});
|
|
498
542
|
}
|
|
499
543
|
isAvailable() {
|
|
500
|
-
return typeof window < "u" &&
|
|
544
|
+
return typeof window < "u" && this.store.getProviders().some((e) => e.info.rdns === "io.metamask");
|
|
501
545
|
}
|
|
502
546
|
getInfo() {
|
|
503
547
|
const e = this.isAvailable();
|
|
@@ -511,24 +555,27 @@ class pt {
|
|
|
511
555
|
connectedAccounts: this.connectedAccounts
|
|
512
556
|
};
|
|
513
557
|
}
|
|
514
|
-
async connect() {
|
|
515
|
-
if (this.account)
|
|
558
|
+
async connect(e) {
|
|
559
|
+
if (e && this.connectedAccounts.includes(e) && (this.account = e), this.account)
|
|
516
560
|
return { success: !0, wallet: this.type, account: this.account };
|
|
517
561
|
try {
|
|
518
562
|
if (!this.isAvailable())
|
|
519
563
|
throw new Error("MetaMask is not available");
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
return this.account =
|
|
564
|
+
const t = await this.MMSDK.connect();
|
|
565
|
+
if (t && t.length > 0)
|
|
566
|
+
return this.account = t[0], this.connectedAccounts = t, { success: !0, wallet: this.type, account: this.account };
|
|
523
567
|
throw new Error("No accounts found");
|
|
524
|
-
} catch (
|
|
525
|
-
return console.error("Error connecting to MetaMask:",
|
|
568
|
+
} catch (t) {
|
|
569
|
+
return console.error("Error connecting to MetaMask:", t), {
|
|
526
570
|
success: !1,
|
|
527
571
|
wallet: this.type,
|
|
528
|
-
error:
|
|
572
|
+
error: t.message || "Unknown error"
|
|
529
573
|
};
|
|
530
574
|
}
|
|
531
575
|
}
|
|
576
|
+
getConnectedAccounts() {
|
|
577
|
+
return this.connectedAccounts;
|
|
578
|
+
}
|
|
532
579
|
async signTransaction(e) {
|
|
533
580
|
try {
|
|
534
581
|
if (!this.isAvailable() || !this.account)
|
|
@@ -641,10 +688,11 @@ class pt {
|
|
|
641
688
|
}
|
|
642
689
|
}
|
|
643
690
|
}
|
|
644
|
-
class
|
|
691
|
+
class mt {
|
|
645
692
|
type = "phantom";
|
|
646
693
|
platform = "solana";
|
|
647
694
|
account = void 0;
|
|
695
|
+
connectedAccounts = [];
|
|
648
696
|
getProvider() {
|
|
649
697
|
if (typeof window > "u")
|
|
650
698
|
throw new Error("Not ready");
|
|
@@ -684,6 +732,9 @@ class lt {
|
|
|
684
732
|
};
|
|
685
733
|
}
|
|
686
734
|
}
|
|
735
|
+
getConnectedAccounts() {
|
|
736
|
+
return this.connectedAccounts;
|
|
737
|
+
}
|
|
687
738
|
async signMessage(e) {
|
|
688
739
|
try {
|
|
689
740
|
if (!this.isAvailable() || !this.account)
|
|
@@ -705,7 +756,7 @@ class lt {
|
|
|
705
756
|
if (!this.isAvailable() || !this.account)
|
|
706
757
|
throw new Error("Phantom is not connected");
|
|
707
758
|
try {
|
|
708
|
-
const t =
|
|
759
|
+
const t = Fe.from(e), o = await this.getProvider().signAndSendTransaction(t);
|
|
709
760
|
return {
|
|
710
761
|
success: !0,
|
|
711
762
|
wallet: this.type,
|
|
@@ -740,49 +791,12 @@ class lt {
|
|
|
740
791
|
}
|
|
741
792
|
}
|
|
742
793
|
}
|
|
743
|
-
function gt(n) {
|
|
744
|
-
if (typeof window > "u")
|
|
745
|
-
return;
|
|
746
|
-
const e = (t) => n(t.detail);
|
|
747
|
-
return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new CustomEvent("eip6963:requestProvider")), () => window.removeEventListener("eip6963:announceProvider", e);
|
|
748
|
-
}
|
|
749
|
-
function mt() {
|
|
750
|
-
const n = /* @__PURE__ */ new Set();
|
|
751
|
-
let e = [];
|
|
752
|
-
const t = () => gt((o) => {
|
|
753
|
-
e.some(({ info: a }) => a.uuid === o.info.uuid) || (e = [...e, o], n.forEach((a) => a(e, { added: [o] })));
|
|
754
|
-
});
|
|
755
|
-
let r = t();
|
|
756
|
-
return {
|
|
757
|
-
_listeners() {
|
|
758
|
-
return n;
|
|
759
|
-
},
|
|
760
|
-
clear() {
|
|
761
|
-
n.forEach((o) => o([], { removed: [...e] })), e = [];
|
|
762
|
-
},
|
|
763
|
-
destroy() {
|
|
764
|
-
this.clear(), n.clear(), r?.();
|
|
765
|
-
},
|
|
766
|
-
findProvider({ rdns: o }) {
|
|
767
|
-
return e.find((a) => a.info.rdns === o);
|
|
768
|
-
},
|
|
769
|
-
getProviders() {
|
|
770
|
-
return e;
|
|
771
|
-
},
|
|
772
|
-
reset() {
|
|
773
|
-
this.clear(), r?.(), r = t();
|
|
774
|
-
},
|
|
775
|
-
subscribe(o, { emitImmediately: a } = {}) {
|
|
776
|
-
return n.add(o), a && o(e, { added: e }), () => n.delete(o);
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
794
|
const ht = "io.rabby";
|
|
781
795
|
class ut {
|
|
782
796
|
type = "rabby";
|
|
783
797
|
platform = "ethereum";
|
|
784
798
|
account = void 0;
|
|
785
|
-
store =
|
|
799
|
+
store = ye();
|
|
786
800
|
provider;
|
|
787
801
|
connectedAccounts = [];
|
|
788
802
|
constructor() {
|
|
@@ -790,6 +804,10 @@ class ut {
|
|
|
790
804
|
method: "eth_accounts"
|
|
791
805
|
}).then((e) => {
|
|
792
806
|
this.connectedAccounts = e;
|
|
807
|
+
}), this.provider?.provider?.on("accountsChanged", (e) => {
|
|
808
|
+
e && (this.connectedAccounts = e.map(
|
|
809
|
+
(t) => t.toLowerCase()
|
|
810
|
+
), this.account = e?.[0]?.toLowerCase());
|
|
793
811
|
});
|
|
794
812
|
}
|
|
795
813
|
isAvailable() {
|
|
@@ -807,26 +825,29 @@ class ut {
|
|
|
807
825
|
connectedAccounts: this.connectedAccounts
|
|
808
826
|
};
|
|
809
827
|
}
|
|
810
|
-
async connect() {
|
|
811
|
-
if (this.account)
|
|
828
|
+
async connect(e) {
|
|
829
|
+
if (e && this.connectedAccounts.includes(e.toLowerCase()) && (this.account = e.toLowerCase()), this.account)
|
|
812
830
|
return { success: !0, wallet: this.type, account: this.account };
|
|
813
831
|
try {
|
|
814
832
|
if (!this.isAvailable())
|
|
815
833
|
throw new Error("Rabby is not available");
|
|
816
|
-
const
|
|
834
|
+
const t = await this.provider?.provider.request({
|
|
817
835
|
method: "eth_requestAccounts"
|
|
818
836
|
});
|
|
819
|
-
if (
|
|
820
|
-
return this.account =
|
|
837
|
+
if (t && t.length > 0)
|
|
838
|
+
return this.account = t[0], this.connectedAccounts = t, { success: !0, wallet: this.type, account: this.account };
|
|
821
839
|
throw new Error("No accounts found");
|
|
822
|
-
} catch (
|
|
823
|
-
return console.error("Error connecting to Rabby:",
|
|
840
|
+
} catch (t) {
|
|
841
|
+
return console.error("Error connecting to Rabby:", t), {
|
|
824
842
|
success: !1,
|
|
825
843
|
wallet: this.type,
|
|
826
|
-
error:
|
|
844
|
+
error: t.message || "Unknown error"
|
|
827
845
|
};
|
|
828
846
|
}
|
|
829
847
|
}
|
|
848
|
+
getConnectedAccounts() {
|
|
849
|
+
return this.connectedAccounts;
|
|
850
|
+
}
|
|
830
851
|
async signTransaction(e) {
|
|
831
852
|
try {
|
|
832
853
|
if (!this.isAvailable() || !this.account)
|
|
@@ -941,15 +962,13 @@ class ut {
|
|
|
941
962
|
}
|
|
942
963
|
class ft {
|
|
943
964
|
walletAdapters;
|
|
944
|
-
connectedWalletsByType = /* @__PURE__ */ new Map();
|
|
945
|
-
connectedWalletsByAddress = /* @__PURE__ */ new Map();
|
|
946
965
|
constructor() {
|
|
947
966
|
this.walletAdapters = /* @__PURE__ */ new Map();
|
|
948
|
-
const e = new
|
|
967
|
+
const e = new gt();
|
|
949
968
|
e.isAvailable() && this.walletAdapters.set("metamask", e);
|
|
950
|
-
const t = new
|
|
969
|
+
const t = new mt();
|
|
951
970
|
t.isAvailable() && this.walletAdapters.set("phantom", t);
|
|
952
|
-
const r = new
|
|
971
|
+
const r = new pt();
|
|
953
972
|
r.isAvailable() && this.walletAdapters.set("argent", r);
|
|
954
973
|
const o = new ut();
|
|
955
974
|
o.isAvailable() && this.walletAdapters.set("rabby", o), typeof window < "u" && (window.wallet_bridge = this);
|
|
@@ -957,7 +976,7 @@ class ft {
|
|
|
957
976
|
getIFrameMethods() {
|
|
958
977
|
return {
|
|
959
978
|
externalDetectWallets: (e) => () => this.detectWallets(),
|
|
960
|
-
externalConnectWallet: (e) => (t) => this.connectWallet(t),
|
|
979
|
+
externalConnectWallet: (e) => (t, r) => this.connectWallet(t, r),
|
|
961
980
|
externalSignMessage: (e) => (t, r) => this.signMessage(t, r),
|
|
962
981
|
externalSignTypedData: (e) => (t, r) => this.signTypedData(t, r),
|
|
963
982
|
externalSendTransaction: (e) => (t, r) => this.sendTransaction(t, r),
|
|
@@ -979,7 +998,7 @@ class ft {
|
|
|
979
998
|
const a = t instanceof Error ? t.message : "Unknown error";
|
|
980
999
|
let i = "unknown";
|
|
981
1000
|
if (typeof e == "string") {
|
|
982
|
-
const s = this.
|
|
1001
|
+
const s = this.getConnectedWalletAdapter(e);
|
|
983
1002
|
i = o ?? s?.type ?? e;
|
|
984
1003
|
} else
|
|
985
1004
|
i = e;
|
|
@@ -989,30 +1008,32 @@ class ft {
|
|
|
989
1008
|
error: a
|
|
990
1009
|
};
|
|
991
1010
|
}
|
|
992
|
-
async connectWallet(e) {
|
|
1011
|
+
async connectWallet(e, t) {
|
|
993
1012
|
try {
|
|
994
|
-
const
|
|
995
|
-
if (
|
|
996
|
-
|
|
997
|
-
`Wallet ${e} connected with address ${
|
|
1013
|
+
const o = await this.getWalletAdapterByType(e).connect(t);
|
|
1014
|
+
if (o.success && o.account)
|
|
1015
|
+
console.log(
|
|
1016
|
+
`Wallet ${e} connected with address ${o.account}`
|
|
998
1017
|
);
|
|
999
|
-
else if (
|
|
1018
|
+
else if (o.success && !o.account)
|
|
1000
1019
|
return console.error(
|
|
1001
1020
|
`Wallet ${e} connected successfully but did not provide an address.`
|
|
1002
1021
|
), {
|
|
1003
|
-
...
|
|
1022
|
+
...o,
|
|
1004
1023
|
success: !1,
|
|
1005
1024
|
error: "Wallet connected but address not found."
|
|
1006
1025
|
};
|
|
1007
|
-
return
|
|
1008
|
-
} catch (
|
|
1009
|
-
return this.handleError(e,
|
|
1026
|
+
return o;
|
|
1027
|
+
} catch (r) {
|
|
1028
|
+
return this.handleError(e, r, "connecting to");
|
|
1010
1029
|
}
|
|
1011
1030
|
}
|
|
1012
1031
|
getConnectedWalletAdapter(e) {
|
|
1013
1032
|
let t;
|
|
1014
|
-
if (typeof e == "string" ? t = this.
|
|
1015
|
-
e
|
|
1033
|
+
if (typeof e == "string" ? t = this.walletAdapters.values().find(
|
|
1034
|
+
(r) => r.getConnectedAccounts().includes(e.toLowerCase())
|
|
1035
|
+
) : t = this.walletAdapters.get(e), !t && typeof e == "string" && (t = this.walletAdapters.values().find(
|
|
1036
|
+
(r) => r.getConnectedAccounts().includes(e.toLowerCase())
|
|
1016
1037
|
)), !t)
|
|
1017
1038
|
throw new Error(
|
|
1018
1039
|
`Wallet with identifier ${e} is not connected or supported`
|
|
@@ -1083,7 +1104,7 @@ class ft {
|
|
|
1083
1104
|
class bt extends be {
|
|
1084
1105
|
walletBridge;
|
|
1085
1106
|
constructor({ url: e, policies: t, ...r }) {
|
|
1086
|
-
const o = new URL(e ??
|
|
1107
|
+
const o = new URL(e ?? De), a = new ft();
|
|
1087
1108
|
t && o.searchParams.set(
|
|
1088
1109
|
"policies",
|
|
1089
1110
|
encodeURIComponent(JSON.stringify(t))
|
|
@@ -1110,7 +1131,7 @@ class yt extends be {
|
|
|
1110
1131
|
policies: d,
|
|
1111
1132
|
...p
|
|
1112
1133
|
}) {
|
|
1113
|
-
const c = (e ||
|
|
1134
|
+
const c = (e || Be).replace(/\/$/, "");
|
|
1114
1135
|
let l = new URL(
|
|
1115
1136
|
a ? `${c}/account/${o}/slot/${a}` : `${c}/account/${o}`
|
|
1116
1137
|
);
|
|
@@ -1133,7 +1154,7 @@ class yt extends be {
|
|
|
1133
1154
|
});
|
|
1134
1155
|
}
|
|
1135
1156
|
}
|
|
1136
|
-
class an extends
|
|
1157
|
+
class an extends ze {
|
|
1137
1158
|
keychain;
|
|
1138
1159
|
profile;
|
|
1139
1160
|
options;
|
|
@@ -1348,7 +1369,7 @@ class an extends Be {
|
|
|
1348
1369
|
async validateChains(e) {
|
|
1349
1370
|
for (const t of e)
|
|
1350
1371
|
try {
|
|
1351
|
-
const r = new URL(t.rpcUrl), o = await
|
|
1372
|
+
const r = new URL(t.rpcUrl), o = await Te(r);
|
|
1352
1373
|
this.chains.set(o, t);
|
|
1353
1374
|
} catch (r) {
|
|
1354
1375
|
console.error(`Failed to parse chainId for ${t.rpcUrl}:`, r);
|
|
@@ -1373,10 +1394,10 @@ class an extends Be {
|
|
|
1373
1394
|
}
|
|
1374
1395
|
}
|
|
1375
1396
|
const D = /* @__PURE__ */ new Map();
|
|
1376
|
-
async function
|
|
1397
|
+
async function we(n) {
|
|
1377
1398
|
if (!n.addresses?.length && !n.usernames?.length)
|
|
1378
1399
|
return { results: [] };
|
|
1379
|
-
const e = await fetch(`${
|
|
1400
|
+
const e = await fetch(`${je}/lookup`, {
|
|
1380
1401
|
method: "POST",
|
|
1381
1402
|
headers: {
|
|
1382
1403
|
"Content-Type": "application/json"
|
|
@@ -1389,16 +1410,16 @@ async function ye(n) {
|
|
|
1389
1410
|
}
|
|
1390
1411
|
async function sn(n) {
|
|
1391
1412
|
const e = n.filter((t) => !D.has(t));
|
|
1392
|
-
return e.length > 0 && (await
|
|
1413
|
+
return e.length > 0 && (await we({ usernames: e })).results.forEach((r) => {
|
|
1393
1414
|
D.set(r.username, r.addresses[0]);
|
|
1394
1415
|
}), new Map(
|
|
1395
1416
|
n.map((t) => [t, D.get(t)]).filter((t) => t[1] !== void 0)
|
|
1396
1417
|
);
|
|
1397
1418
|
}
|
|
1398
1419
|
async function cn(n) {
|
|
1399
|
-
n = n.map(
|
|
1420
|
+
n = n.map(Me.toHex);
|
|
1400
1421
|
const e = n.filter((t) => !D.has(t));
|
|
1401
|
-
return e.length > 0 && (await
|
|
1422
|
+
return e.length > 0 && (await we({
|
|
1402
1423
|
addresses: e
|
|
1403
1424
|
})).results.forEach((r) => {
|
|
1404
1425
|
D.set(r.addresses[0], r.username);
|
|
@@ -1500,7 +1521,7 @@ function _t(n, e, t) {
|
|
|
1500
1521
|
});
|
|
1501
1522
|
}
|
|
1502
1523
|
}
|
|
1503
|
-
function
|
|
1524
|
+
function At(n, e, t) {
|
|
1504
1525
|
if (n instanceof Uint8Array)
|
|
1505
1526
|
return n;
|
|
1506
1527
|
if (typeof n == "string" && n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
|
|
@@ -1513,7 +1534,7 @@ function kt(n, e, t) {
|
|
|
1513
1534
|
h(!1, "invalid BytesLike value", e || "value", n);
|
|
1514
1535
|
}
|
|
1515
1536
|
function _(n, e) {
|
|
1516
|
-
return
|
|
1537
|
+
return At(n, e);
|
|
1517
1538
|
}
|
|
1518
1539
|
function Y(n, e) {
|
|
1519
1540
|
return !(typeof n != "string" || !n.match(/^0x[0-9A-Fa-f]*$/) || typeof e == "number" && n.length !== 2 + 2 * e || e === !0 && n.length % 2 !== 0);
|
|
@@ -1534,7 +1555,7 @@ function q(n) {
|
|
|
1534
1555
|
function te(n) {
|
|
1535
1556
|
return Y(n, !0) ? (n.length - 2) / 2 : _(n).length;
|
|
1536
1557
|
}
|
|
1537
|
-
function
|
|
1558
|
+
function kt(n, e, t) {
|
|
1538
1559
|
const r = _(n);
|
|
1539
1560
|
F(e >= r.length, "padding exceeds data length", "BUFFER_OVERRUN", {
|
|
1540
1561
|
buffer: new Uint8Array(r),
|
|
@@ -1544,10 +1565,10 @@ function At(n, e, t) {
|
|
|
1544
1565
|
const o = new Uint8Array(e);
|
|
1545
1566
|
return o.fill(0), o.set(r, e - r.length), v(o);
|
|
1546
1567
|
}
|
|
1547
|
-
function
|
|
1548
|
-
return
|
|
1568
|
+
function Ct(n, e) {
|
|
1569
|
+
return kt(n, e);
|
|
1549
1570
|
}
|
|
1550
|
-
const
|
|
1571
|
+
const ve = BigInt(0);
|
|
1551
1572
|
BigInt(1);
|
|
1552
1573
|
const K = 9007199254740991;
|
|
1553
1574
|
function z(n, e) {
|
|
@@ -1567,15 +1588,15 @@ function z(n, e) {
|
|
|
1567
1588
|
}
|
|
1568
1589
|
h(!1, "invalid BigNumberish value", e || "value", n);
|
|
1569
1590
|
}
|
|
1570
|
-
function
|
|
1591
|
+
function It(n, e) {
|
|
1571
1592
|
const t = z(n, e);
|
|
1572
|
-
return F(t >=
|
|
1593
|
+
return F(t >= ve, "unsigned value cannot be negative", "NUMERIC_FAULT", {
|
|
1573
1594
|
fault: "overflow",
|
|
1574
1595
|
operation: "getUint",
|
|
1575
1596
|
value: n
|
|
1576
1597
|
}), t;
|
|
1577
1598
|
}
|
|
1578
|
-
function
|
|
1599
|
+
function O(n, e) {
|
|
1579
1600
|
switch (typeof n) {
|
|
1580
1601
|
case "bigint":
|
|
1581
1602
|
return h(n >= -9007199254740991 && n <= K, "overflow", e || "value", n), Number(n);
|
|
@@ -1585,16 +1606,16 @@ function L(n, e) {
|
|
|
1585
1606
|
try {
|
|
1586
1607
|
if (n === "")
|
|
1587
1608
|
throw new Error("empty string");
|
|
1588
|
-
return
|
|
1609
|
+
return O(BigInt(n), e);
|
|
1589
1610
|
} catch (t) {
|
|
1590
1611
|
h(!1, `invalid numeric string: ${t.message}`, e || "value", n);
|
|
1591
1612
|
}
|
|
1592
1613
|
}
|
|
1593
1614
|
h(!1, "invalid numeric value", e || "value", n);
|
|
1594
1615
|
}
|
|
1595
|
-
function
|
|
1596
|
-
const e =
|
|
1597
|
-
if (e ===
|
|
1616
|
+
function xt(n) {
|
|
1617
|
+
const e = It(n, "value");
|
|
1618
|
+
if (e === ve)
|
|
1598
1619
|
return new Uint8Array([]);
|
|
1599
1620
|
let t = e.toString(16);
|
|
1600
1621
|
t.length % 2 && (t = "0" + t);
|
|
@@ -1629,7 +1650,7 @@ function ne(n) {
|
|
|
1629
1650
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
1630
1651
|
throw new Error(`Wrong positive integer: ${n}`);
|
|
1631
1652
|
}
|
|
1632
|
-
function
|
|
1653
|
+
function _e(n, ...e) {
|
|
1633
1654
|
if (!(n instanceof Uint8Array))
|
|
1634
1655
|
throw new Error("Expected Uint8Array");
|
|
1635
1656
|
if (e.length > 0 && !e.includes(n.length))
|
|
@@ -1642,7 +1663,7 @@ function re(n, e = !0) {
|
|
|
1642
1663
|
throw new Error("Hash#digest() has already been called");
|
|
1643
1664
|
}
|
|
1644
1665
|
function Et(n, e) {
|
|
1645
|
-
|
|
1666
|
+
_e(n);
|
|
1646
1667
|
const t = e.outputLen;
|
|
1647
1668
|
if (n.length < t)
|
|
1648
1669
|
throw new Error(`digestInto() expects output buffer of length at least ${t}`);
|
|
@@ -1656,7 +1677,7 @@ function Mt(n) {
|
|
|
1656
1677
|
throw new Error(`utf8ToBytes expected string, got ${typeof n}`);
|
|
1657
1678
|
return new Uint8Array(new TextEncoder().encode(n));
|
|
1658
1679
|
}
|
|
1659
|
-
function
|
|
1680
|
+
function Ae(n) {
|
|
1660
1681
|
if (typeof n == "string" && (n = Mt(n)), !Rt(n))
|
|
1661
1682
|
throw new Error(`expected Uint8Array, got ${typeof n}`);
|
|
1662
1683
|
return n;
|
|
@@ -1668,7 +1689,7 @@ class Nt {
|
|
|
1668
1689
|
}
|
|
1669
1690
|
}
|
|
1670
1691
|
function Dt(n) {
|
|
1671
|
-
const e = (r) => n().update(
|
|
1692
|
+
const e = (r) => n().update(Ae(r)).digest(), t = n();
|
|
1672
1693
|
return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => n(), e;
|
|
1673
1694
|
}
|
|
1674
1695
|
const U = /* @__PURE__ */ BigInt(2 ** 32 - 1), oe = /* @__PURE__ */ BigInt(32);
|
|
@@ -1683,15 +1704,15 @@ function zt(n, e = !1) {
|
|
|
1683
1704
|
}
|
|
1684
1705
|
return [t, r];
|
|
1685
1706
|
}
|
|
1686
|
-
const Tt = (n, e, t) => n << t | e >>> 32 - t, jt = (n, e, t) => e << t | n >>> 32 - t, Ut = (n, e, t) => e << t - 32 | n >>> 64 - t,
|
|
1707
|
+
const Tt = (n, e, t) => n << t | e >>> 32 - t, jt = (n, e, t) => e << t | n >>> 32 - t, Ut = (n, e, t) => e << t - 32 | n >>> 64 - t, Lt = (n, e, t) => n << t - 32 | e >>> 64 - t, [ke, Ce, Ie] = [[], [], []], Ot = /* @__PURE__ */ BigInt(0), B = /* @__PURE__ */ BigInt(1), Ft = /* @__PURE__ */ BigInt(2), Qt = /* @__PURE__ */ BigInt(7), Wt = /* @__PURE__ */ BigInt(256), $t = /* @__PURE__ */ BigInt(113);
|
|
1687
1708
|
for (let n = 0, e = B, t = 1, r = 0; n < 24; n++) {
|
|
1688
|
-
[t, r] = [r, (2 * t + 3 * r) % 5], ke.push(2 * (5 * r + t)),
|
|
1689
|
-
let o =
|
|
1709
|
+
[t, r] = [r, (2 * t + 3 * r) % 5], ke.push(2 * (5 * r + t)), Ce.push((n + 1) * (n + 2) / 2 % 64);
|
|
1710
|
+
let o = Ot;
|
|
1690
1711
|
for (let a = 0; a < 7; a++)
|
|
1691
1712
|
e = (e << B ^ (e >> Qt) * $t) % Wt, e & Ft && (o ^= B << (B << /* @__PURE__ */ BigInt(a)) - B);
|
|
1692
1713
|
Ie.push(o);
|
|
1693
1714
|
}
|
|
1694
|
-
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 ?
|
|
1715
|
+
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);
|
|
1695
1716
|
function qt(n, e = 24) {
|
|
1696
1717
|
const t = new Uint32Array(10);
|
|
1697
1718
|
for (let r = 24 - e; r < 24; r++) {
|
|
@@ -1704,7 +1725,7 @@ function qt(n, e = 24) {
|
|
|
1704
1725
|
}
|
|
1705
1726
|
let o = n[2], a = n[3];
|
|
1706
1727
|
for (let i = 0; i < 24; i++) {
|
|
1707
|
-
const s =
|
|
1728
|
+
const s = Ce[i], d = ae(o, a, s), p = ie(o, a, s), c = ke[i];
|
|
1708
1729
|
o = n[c], a = n[c + 1], n[c] = d, n[c + 1] = p;
|
|
1709
1730
|
}
|
|
1710
1731
|
for (let i = 0; i < 50; i += 10) {
|
|
@@ -1730,7 +1751,7 @@ class V extends Nt {
|
|
|
1730
1751
|
update(e) {
|
|
1731
1752
|
re(this);
|
|
1732
1753
|
const { blockLen: t, state: r } = this;
|
|
1733
|
-
e =
|
|
1754
|
+
e = Ae(e);
|
|
1734
1755
|
const o = e.length;
|
|
1735
1756
|
for (let a = 0; a < o; ) {
|
|
1736
1757
|
const i = Math.min(t - this.pos, o - a);
|
|
@@ -1748,7 +1769,7 @@ class V extends Nt {
|
|
|
1748
1769
|
e[r] ^= t, (t & 128) !== 0 && r === o - 1 && this.keccak(), e[o - 1] ^= 128, this.keccak();
|
|
1749
1770
|
}
|
|
1750
1771
|
writeInto(e) {
|
|
1751
|
-
re(this, !1),
|
|
1772
|
+
re(this, !1), _e(e), this.finish();
|
|
1752
1773
|
const t = this.state, { blockLen: r } = this;
|
|
1753
1774
|
for (let o = 0, a = e.length; o < a; ) {
|
|
1754
1775
|
this.posOut >= r && this.keccak();
|
|
@@ -1783,28 +1804,28 @@ class V extends Nt {
|
|
|
1783
1804
|
}
|
|
1784
1805
|
const Kt = (n, e, t) => Dt(() => new V(e, n, t)), Vt = /* @__PURE__ */ Kt(1, 136, 256 / 8);
|
|
1785
1806
|
let xe = !1;
|
|
1786
|
-
const
|
|
1807
|
+
const Ee = function(n) {
|
|
1787
1808
|
return Vt(n);
|
|
1788
1809
|
};
|
|
1789
|
-
let
|
|
1810
|
+
let Re = Ee;
|
|
1790
1811
|
function j(n) {
|
|
1791
1812
|
const e = _(n, "data");
|
|
1792
|
-
return v(
|
|
1813
|
+
return v(Re(e));
|
|
1793
1814
|
}
|
|
1794
|
-
j._ =
|
|
1815
|
+
j._ = Ee;
|
|
1795
1816
|
j.lock = function() {
|
|
1796
1817
|
xe = !0;
|
|
1797
1818
|
};
|
|
1798
1819
|
j.register = function(n) {
|
|
1799
1820
|
if (xe)
|
|
1800
1821
|
throw new TypeError("keccak256 is locked");
|
|
1801
|
-
|
|
1822
|
+
Re = n;
|
|
1802
1823
|
};
|
|
1803
1824
|
Object.freeze(j);
|
|
1804
1825
|
const se = "0x0000000000000000000000000000000000000000000000000000000000000000", Gt = `Ethereum Signed Message:
|
|
1805
|
-
`, ce = BigInt(0), de = BigInt(1), pe = BigInt(2), le = BigInt(27), ge = BigInt(28),
|
|
1826
|
+
`, ce = BigInt(0), de = BigInt(1), pe = BigInt(2), le = BigInt(27), ge = BigInt(28), L = BigInt(35), M = {};
|
|
1806
1827
|
function me(n) {
|
|
1807
|
-
return
|
|
1828
|
+
return Ct(xt(n), 32);
|
|
1808
1829
|
}
|
|
1809
1830
|
class w {
|
|
1810
1831
|
#t;
|
|
@@ -1848,7 +1869,7 @@ class w {
|
|
|
1848
1869
|
return this.#r;
|
|
1849
1870
|
}
|
|
1850
1871
|
set v(e) {
|
|
1851
|
-
const t =
|
|
1872
|
+
const t = O(e, "value");
|
|
1852
1873
|
h(t === 27 || t === 28, "invalid v", "v", e), this.#r = t;
|
|
1853
1874
|
}
|
|
1854
1875
|
/**
|
|
@@ -1935,7 +1956,7 @@ class w {
|
|
|
1935
1956
|
*/
|
|
1936
1957
|
static getChainId(e) {
|
|
1937
1958
|
const t = z(e, "v");
|
|
1938
|
-
return t == le || t == ge ? ce : (h(t >=
|
|
1959
|
+
return t == le || t == ge ? ce : (h(t >= L, "invalid EIP-155 v", "v", e), (t - L) / pe);
|
|
1939
1960
|
}
|
|
1940
1961
|
/**
|
|
1941
1962
|
* Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
|
|
@@ -1977,7 +1998,7 @@ class w {
|
|
|
1977
1998
|
*/
|
|
1978
1999
|
static getNormalizedV(e) {
|
|
1979
2000
|
const t = z(e);
|
|
1980
|
-
return t === ce || t === le ? 27 : t === de || t === ge ? 28 : (h(t >=
|
|
2001
|
+
return t === ce || t === le ? 27 : t === de || t === ge ? 28 : (h(t >= L, "invalid v", "v", e), t & de ? 27 : 28);
|
|
1981
2002
|
}
|
|
1982
2003
|
/**
|
|
1983
2004
|
* Creates a new [[Signature]].
|
|
@@ -2026,14 +2047,14 @@ class w {
|
|
|
2026
2047
|
if (p != null) {
|
|
2027
2048
|
const g = z(p);
|
|
2028
2049
|
return {
|
|
2029
|
-
networkV: g >=
|
|
2050
|
+
networkV: g >= L ? g : void 0,
|
|
2030
2051
|
v: w.getNormalizedV(g)
|
|
2031
2052
|
};
|
|
2032
2053
|
}
|
|
2033
2054
|
if (c != null)
|
|
2034
2055
|
return t(Y(c, 32), "invalid yParityAndS"), { v: _(c)[0] & 128 ? 28 : 27 };
|
|
2035
2056
|
if (l != null) {
|
|
2036
|
-
switch (
|
|
2057
|
+
switch (O(l, "sig.yParity")) {
|
|
2037
2058
|
case 0:
|
|
2038
2059
|
return { v: 27 };
|
|
2039
2060
|
case 1:
|
|
@@ -2043,7 +2064,7 @@ class w {
|
|
|
2043
2064
|
}
|
|
2044
2065
|
t(!1, "missing v");
|
|
2045
2066
|
}(e.v, e.yParityAndS, e.yParity), d = new w(M, o, a, s);
|
|
2046
|
-
return i && (d.#e = i), t(e.yParity == null ||
|
|
2067
|
+
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;
|
|
2047
2068
|
}
|
|
2048
2069
|
}
|
|
2049
2070
|
function Jt(n) {
|
|
@@ -2095,6 +2116,9 @@ class dn {
|
|
|
2095
2116
|
};
|
|
2096
2117
|
}
|
|
2097
2118
|
}
|
|
2119
|
+
getConnectedAccounts() {
|
|
2120
|
+
return this.account ? [this.account] : [];
|
|
2121
|
+
}
|
|
2098
2122
|
async signTransaction(e) {
|
|
2099
2123
|
try {
|
|
2100
2124
|
if (!this.isAvailable() || !this.account)
|
|
@@ -2179,11 +2203,14 @@ class dn {
|
|
|
2179
2203
|
}
|
|
2180
2204
|
class pn {
|
|
2181
2205
|
constructor(e, t) {
|
|
2182
|
-
this.provider = e, this.account = t;
|
|
2206
|
+
this.provider = e, this.account = t?.toLowerCase();
|
|
2183
2207
|
}
|
|
2184
2208
|
type = "walletconnect";
|
|
2185
2209
|
platform = "ethereum";
|
|
2186
2210
|
account = void 0;
|
|
2211
|
+
getConnectedAccounts() {
|
|
2212
|
+
return this.account ? [this.account] : [];
|
|
2213
|
+
}
|
|
2187
2214
|
isAvailable() {
|
|
2188
2215
|
return !!this.provider;
|
|
2189
2216
|
}
|
|
@@ -2241,7 +2268,7 @@ class pn {
|
|
|
2241
2268
|
throw new Error("WalletConnect is not connected");
|
|
2242
2269
|
const t = await this.provider.request({
|
|
2243
2270
|
method: "personal_sign",
|
|
2244
|
-
params: [this.account
|
|
2271
|
+
params: [e, this.account]
|
|
2245
2272
|
});
|
|
2246
2273
|
return { success: !0, wallet: this.type, result: t };
|
|
2247
2274
|
} catch (t) {
|
|
@@ -2318,7 +2345,7 @@ class pn {
|
|
|
2318
2345
|
}
|
|
2319
2346
|
}
|
|
2320
2347
|
}
|
|
2321
|
-
var
|
|
2348
|
+
var Se = {
|
|
2322
2349
|
"blob-arena": {
|
|
2323
2350
|
origin: ["*.blobarena.xyz", "blobarena.xyz", "development.blobarena.xyz"],
|
|
2324
2351
|
theme: {
|
|
@@ -6472,13 +6499,13 @@ var Re = {
|
|
|
6472
6499
|
total_supply: null,
|
|
6473
6500
|
logo_url: "https://assets.underware.gg/pistols/fame.svg"
|
|
6474
6501
|
}
|
|
6475
|
-
], ln =
|
|
6502
|
+
], ln = Se, gn = Xt, mn = Se.cartridge.theme;
|
|
6476
6503
|
export {
|
|
6477
|
-
|
|
6504
|
+
pt as ArgentWallet,
|
|
6478
6505
|
fn as FeeSource,
|
|
6479
|
-
|
|
6506
|
+
gt as MetaMaskWallet,
|
|
6480
6507
|
y as NotReadyToConnect,
|
|
6481
|
-
|
|
6508
|
+
mt as PhantomWallet,
|
|
6482
6509
|
ut as RabbyWallet,
|
|
6483
6510
|
E as ResponseCodes,
|
|
6484
6511
|
dn as TurnkeyWallet,
|
|
@@ -6492,8 +6519,8 @@ export {
|
|
|
6492
6519
|
cn as lookupAddresses,
|
|
6493
6520
|
sn as lookupUsernames,
|
|
6494
6521
|
yn as normalizeCalls,
|
|
6495
|
-
|
|
6496
|
-
|
|
6522
|
+
Te as parseChainId,
|
|
6523
|
+
Ne as toArray,
|
|
6497
6524
|
wn as toSessionPolicies,
|
|
6498
6525
|
vn as toWasmPolicies
|
|
6499
6526
|
};
|