@springmicro/auth 0.7.19 → 0.7.20
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/dist/{Index-1e31d199-uzuBdtPJ.js → Index-1e31d199-BXGGyb0l.js} +48 -48
- package/dist/{Index-6078f122-DLKGZ31_.js → Index-6078f122-DGZJdnAZ.js} +67 -67
- package/dist/{Web3Auth-Zi4vzALJ.js → Web3Auth-DG8Yz_cD.js} +5884 -5161
- package/dist/{ccip-c78d2f16-DUJGUJJo.js → ccip-c78d2f16-BfTJLflq.js} +2 -2
- package/dist/{hmac-CGR-aDxj.js → hmac-CW2mnXa8.js} +1 -1
- package/dist/{index-021f6a62-DBObZnNM.js → index-021f6a62-CxfpndDE.js} +32 -32
- package/dist/{index-40a497ea-BEwImqwN.js → index-40a497ea-BRLn4BDo.js} +3 -3
- package/dist/index-B51q7F_W.js +9742 -0
- package/dist/{index-BrtZvnd0.js → index-BXvsDp0W.js} +582 -584
- package/dist/{index-B4ilnhZS.js → index-BYJic99M.js} +33 -33
- package/dist/{index-Bu--mwXK.js → index-Bfb6JoQf.js} +9082 -8717
- package/dist/{index-XgTFhms9.js → index-C8R4klyg.js} +27 -27
- package/dist/{index-C8ynRf9-.js → index-CBbDq4vF.js} +3310 -3294
- package/dist/{index-1_Q3geSC.js → index-DbQi7wFl.js} +26 -26
- package/dist/index-hDobpv7u.js +32 -0
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +293 -286
- package/dist/native-FDN9oNjc.js +15 -0
- package/dist/{number-BfxMSPkm.js → number-DvQcSzeP.js} +556 -335
- package/dist/parseEther-C7cmMVOE.js +24 -0
- package/dist/{sha256-JJGtJ2gn.js → sha256-C90UGNQg.js} +8 -7
- package/dist/{transactionRequest-be6a8ea9-_q5BIZxq.js → transactionRequest-be6a8ea9-CCwC71wa.js} +9 -9
- package/package.json +2 -2
- package/dist/index-Cn-_BAwo.js +0 -6151
- package/dist/index-Cw8vH8KI.js +0 -29
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { bJ as En, bK as Lt } from "./Web3Auth-DG8Yz_cD.js";
|
|
2
|
+
const Cn = (t, e) => {
|
|
3
3
|
let n;
|
|
4
4
|
switch (t) {
|
|
5
5
|
case "standard":
|
|
@@ -18,7 +18,7 @@ const In = (t, e) => {
|
|
|
18
18
|
return n = e, `data:image/svg+xml,%3Csvg width='${e}' height='${n}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
class
|
|
21
|
+
class D {
|
|
22
22
|
constructor(e, n) {
|
|
23
23
|
this.scope = e, this.module = n;
|
|
24
24
|
}
|
|
@@ -50,7 +50,7 @@ class O {
|
|
|
50
50
|
return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`;
|
|
51
51
|
}
|
|
52
52
|
static clearAll() {
|
|
53
|
-
new
|
|
53
|
+
new D("CBWSDK").clear(), new D("walletlink").clear();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
const E = {
|
|
@@ -75,7 +75,7 @@ const E = {
|
|
|
75
75
|
chainDisconnected: 4901,
|
|
76
76
|
unsupportedChain: 4902
|
|
77
77
|
}
|
|
78
|
-
},
|
|
78
|
+
}, Pe = {
|
|
79
79
|
"-32700": {
|
|
80
80
|
standard: "JSON RPC 2.0",
|
|
81
81
|
message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
|
|
@@ -144,42 +144,42 @@ const E = {
|
|
|
144
144
|
standard: "EIP-3085",
|
|
145
145
|
message: "Unrecognized chain ID."
|
|
146
146
|
}
|
|
147
|
-
},
|
|
148
|
-
function
|
|
147
|
+
}, Pt = "Unspecified error message.", xn = "Unspecified server error.";
|
|
148
|
+
function qe(t, e = Pt) {
|
|
149
149
|
if (t && Number.isInteger(t)) {
|
|
150
150
|
const n = t.toString();
|
|
151
|
-
if (
|
|
152
|
-
return
|
|
153
|
-
if (
|
|
154
|
-
return
|
|
151
|
+
if (Re(Pe, n))
|
|
152
|
+
return Pe[n].message;
|
|
153
|
+
if (Rt(t))
|
|
154
|
+
return xn;
|
|
155
155
|
}
|
|
156
156
|
return e;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function In(t) {
|
|
159
159
|
if (!Number.isInteger(t))
|
|
160
160
|
return !1;
|
|
161
161
|
const e = t.toString();
|
|
162
|
-
return !!(
|
|
162
|
+
return !!(Pe[e] || Rt(t));
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Sn(t, { shouldIncludeStack: e = !1 } = {}) {
|
|
165
165
|
const n = {};
|
|
166
|
-
if (t && typeof t == "object" && !Array.isArray(t) &&
|
|
166
|
+
if (t && typeof t == "object" && !Array.isArray(t) && Re(t, "code") && In(t.code)) {
|
|
167
167
|
const s = t;
|
|
168
|
-
n.code = s.code, s.message && typeof s.message == "string" ? (n.message = s.message,
|
|
168
|
+
n.code = s.code, s.message && typeof s.message == "string" ? (n.message = s.message, Re(s, "data") && (n.data = s.data)) : (n.message = qe(n.code), n.data = { originalError: Xe(t) });
|
|
169
169
|
} else
|
|
170
|
-
n.code = E.rpc.internal, n.message =
|
|
171
|
-
return e && (n.stack =
|
|
170
|
+
n.code = E.rpc.internal, n.message = et(t, "message") ? t.message : Pt, n.data = { originalError: Xe(t) };
|
|
171
|
+
return e && (n.stack = et(t, "stack") ? t.stack : void 0), n;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function Rt(t) {
|
|
174
174
|
return t >= -32099 && t <= -32e3;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Xe(t) {
|
|
177
177
|
return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t;
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function Re(t, e) {
|
|
180
180
|
return Object.prototype.hasOwnProperty.call(t, e);
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function et(t, e) {
|
|
183
183
|
return typeof t == "object" && t !== null && e in t && typeof t[e] == "string";
|
|
184
184
|
}
|
|
185
185
|
const b = {
|
|
@@ -217,19 +217,19 @@ const b = {
|
|
|
217
217
|
const { code: e, message: n, data: s } = t;
|
|
218
218
|
if (!n || typeof n != "string")
|
|
219
219
|
throw new Error('"message" must be a nonempty string');
|
|
220
|
-
return new
|
|
220
|
+
return new Dt(e, n, s);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
function A(t, e) {
|
|
225
|
-
const [n, s] =
|
|
226
|
-
return new
|
|
225
|
+
const [n, s] = Tt(e);
|
|
226
|
+
return new Nt(t, n || qe(t), s);
|
|
227
227
|
}
|
|
228
228
|
function G(t, e) {
|
|
229
|
-
const [n, s] =
|
|
230
|
-
return new
|
|
229
|
+
const [n, s] = Tt(e);
|
|
230
|
+
return new Dt(t, n || qe(t), s);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function Tt(t) {
|
|
233
233
|
if (t) {
|
|
234
234
|
if (typeof t == "string")
|
|
235
235
|
return [t];
|
|
@@ -242,7 +242,7 @@ function Nt(t) {
|
|
|
242
242
|
}
|
|
243
243
|
return [];
|
|
244
244
|
}
|
|
245
|
-
class
|
|
245
|
+
class Nt extends Error {
|
|
246
246
|
constructor(e, n, s) {
|
|
247
247
|
if (!Number.isInteger(e))
|
|
248
248
|
throw new Error('"code" must be an integer.');
|
|
@@ -251,145 +251,145 @@ class Dt extends Error {
|
|
|
251
251
|
super(n), this.code = e, s !== void 0 && (this.data = s);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
class
|
|
254
|
+
class Dt extends Nt {
|
|
255
255
|
/**
|
|
256
256
|
* Create an Ethereum Provider JSON-RPC error.
|
|
257
257
|
* `code` must be an integer in the 1000 <= 4999 range.
|
|
258
258
|
*/
|
|
259
259
|
constructor(e, n, s) {
|
|
260
|
-
if (!
|
|
260
|
+
if (!An(e))
|
|
261
261
|
throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');
|
|
262
262
|
super(e, n, s);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function An(t) {
|
|
266
266
|
return Number.isInteger(t) && t >= 1e3 && t <= 4999;
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function Ve() {
|
|
269
269
|
return (t) => t;
|
|
270
270
|
}
|
|
271
|
-
const
|
|
271
|
+
const ie = Ve(), Mn = Ve(), Ln = Ve();
|
|
272
272
|
function U(t) {
|
|
273
273
|
return Math.floor(t);
|
|
274
274
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
277
|
-
return
|
|
275
|
+
const Ot = /^[0-9]*$/, Ut = /^[a-f0-9]*$/;
|
|
276
|
+
function z(t) {
|
|
277
|
+
return Ke(crypto.getRandomValues(new Uint8Array(t)));
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Ke(t) {
|
|
280
280
|
return [...t].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function le(t) {
|
|
283
283
|
return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16)));
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function ee(t, e = !1) {
|
|
286
286
|
const n = t.toString("hex");
|
|
287
|
-
return
|
|
287
|
+
return ie(e ? `0x${n}` : n);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
289
|
+
function Ce(t) {
|
|
290
|
+
return ee(Te(t), !0);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
292
|
+
function R(t) {
|
|
293
|
+
return Ln(t.toString(10));
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
return
|
|
295
|
+
function F(t) {
|
|
296
|
+
return ie(`0x${BigInt(t).toString(16)}`);
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function jt(t) {
|
|
299
299
|
return t.startsWith("0x") || t.startsWith("0X");
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
return
|
|
301
|
+
function Fe(t) {
|
|
302
|
+
return jt(t) ? t.slice(2) : t;
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
return
|
|
304
|
+
function Ht(t) {
|
|
305
|
+
return jt(t) ? `0x${t.slice(2)}` : `0x${t}`;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function me(t) {
|
|
308
308
|
if (typeof t != "string")
|
|
309
309
|
return !1;
|
|
310
|
-
const e =
|
|
311
|
-
return
|
|
310
|
+
const e = Fe(t).toLowerCase();
|
|
311
|
+
return Ut.test(e);
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Pn(t, e = !1) {
|
|
314
314
|
if (typeof t == "string") {
|
|
315
|
-
const n =
|
|
316
|
-
if (
|
|
317
|
-
return
|
|
315
|
+
const n = Fe(t).toLowerCase();
|
|
316
|
+
if (Ut.test(n))
|
|
317
|
+
return ie(e ? `0x${n}` : n);
|
|
318
318
|
}
|
|
319
319
|
throw b.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
let n =
|
|
323
|
-
return n.length % 2 === 1 && (n =
|
|
321
|
+
function ze(t, e = !1) {
|
|
322
|
+
let n = Pn(t, !1);
|
|
323
|
+
return n.length % 2 === 1 && (n = ie(`0${n}`)), e ? ie(`0x${n}`) : n;
|
|
324
324
|
}
|
|
325
325
|
function B(t) {
|
|
326
326
|
if (typeof t == "string") {
|
|
327
|
-
const e =
|
|
328
|
-
if (
|
|
329
|
-
return
|
|
327
|
+
const e = Fe(t).toLowerCase();
|
|
328
|
+
if (me(e) && e.length === 40)
|
|
329
|
+
return Mn(Ht(e));
|
|
330
330
|
}
|
|
331
331
|
throw b.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`);
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Te(t) {
|
|
334
334
|
if (Buffer.isBuffer(t))
|
|
335
335
|
return t;
|
|
336
336
|
if (typeof t == "string") {
|
|
337
|
-
if (
|
|
338
|
-
const e =
|
|
337
|
+
if (me(t)) {
|
|
338
|
+
const e = ze(t, !1);
|
|
339
339
|
return Buffer.from(e, "hex");
|
|
340
340
|
}
|
|
341
341
|
return Buffer.from(t, "utf8");
|
|
342
342
|
}
|
|
343
343
|
throw b.rpc.invalidParams(`Not binary data: ${String(t)}`);
|
|
344
344
|
}
|
|
345
|
-
function
|
|
345
|
+
function te(t) {
|
|
346
346
|
if (typeof t == "number" && Number.isInteger(t))
|
|
347
347
|
return U(t);
|
|
348
348
|
if (typeof t == "string") {
|
|
349
|
-
if (
|
|
349
|
+
if (Ot.test(t))
|
|
350
350
|
return U(Number(t));
|
|
351
|
-
if (
|
|
352
|
-
return U(Number(BigInt(
|
|
351
|
+
if (me(t))
|
|
352
|
+
return U(Number(BigInt(ze(t, !0))));
|
|
353
353
|
}
|
|
354
354
|
throw b.rpc.invalidParams(`Not an integer: ${String(t)}`);
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
if (t !== null && (typeof t == "bigint" ||
|
|
356
|
+
function X(t) {
|
|
357
|
+
if (t !== null && (typeof t == "bigint" || Tn(t)))
|
|
358
358
|
return BigInt(t.toString(10));
|
|
359
359
|
if (typeof t == "number")
|
|
360
|
-
return BigInt(
|
|
360
|
+
return BigInt(te(t));
|
|
361
361
|
if (typeof t == "string") {
|
|
362
|
-
if (
|
|
362
|
+
if (Ot.test(t))
|
|
363
363
|
return BigInt(t);
|
|
364
|
-
if (
|
|
365
|
-
return BigInt(
|
|
364
|
+
if (me(t))
|
|
365
|
+
return BigInt(ze(t, !0));
|
|
366
366
|
}
|
|
367
367
|
throw b.rpc.invalidParams(`Not an integer: ${String(t)}`);
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Rn(t) {
|
|
370
370
|
if (typeof t == "string")
|
|
371
371
|
return JSON.parse(t);
|
|
372
372
|
if (typeof t == "object")
|
|
373
373
|
return t;
|
|
374
374
|
throw b.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Tn(t) {
|
|
377
377
|
if (t == null || typeof t.constructor != "function")
|
|
378
378
|
return !1;
|
|
379
379
|
const { constructor: e } = t;
|
|
380
380
|
return typeof e.config == "function" && typeof e.EUCLID == "number";
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Nn() {
|
|
383
383
|
const t = document.querySelector('link[sizes="192x192"]') || document.querySelector('link[sizes="180x180"]') || document.querySelector('link[rel="icon"]') || document.querySelector('link[rel="shortcut icon"]'), { protocol: e, host: n } = document.location, s = t ? t.getAttribute("href") : null;
|
|
384
384
|
return !s || s.startsWith("javascript:") || s.startsWith("vbscript:") ? `${e}//${n}/favicon.ico` : s.startsWith("http://") || s.startsWith("https://") || s.startsWith("data:") ? s : s.startsWith("//") ? e + s : `${e}//${n}${s}`;
|
|
385
385
|
}
|
|
386
|
-
async function
|
|
386
|
+
async function Dn() {
|
|
387
387
|
return crypto.subtle.generateKey({
|
|
388
388
|
name: "ECDH",
|
|
389
389
|
namedCurve: "P-256"
|
|
390
390
|
}, !0, ["deriveKey"]);
|
|
391
391
|
}
|
|
392
|
-
async function
|
|
392
|
+
async function On(t, e) {
|
|
393
393
|
return crypto.subtle.deriveKey({
|
|
394
394
|
name: "ECDH",
|
|
395
395
|
public: e
|
|
@@ -398,21 +398,21 @@ async function jn(t, e) {
|
|
|
398
398
|
length: 256
|
|
399
399
|
}, !1, ["encrypt", "decrypt"]);
|
|
400
400
|
}
|
|
401
|
-
async function
|
|
401
|
+
async function Un(t, e) {
|
|
402
402
|
const n = crypto.getRandomValues(new Uint8Array(12)), s = await crypto.subtle.encrypt({
|
|
403
403
|
name: "AES-GCM",
|
|
404
404
|
iv: n
|
|
405
405
|
}, t, new TextEncoder().encode(e));
|
|
406
406
|
return { iv: n, cipherText: s };
|
|
407
407
|
}
|
|
408
|
-
async function
|
|
408
|
+
async function jn(t, { iv: e, cipherText: n }) {
|
|
409
409
|
const s = await crypto.subtle.decrypt({
|
|
410
410
|
name: "AES-GCM",
|
|
411
411
|
iv: e
|
|
412
412
|
}, t, n);
|
|
413
413
|
return new TextDecoder().decode(s);
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Wt(t) {
|
|
416
416
|
switch (t) {
|
|
417
417
|
case "public":
|
|
418
418
|
return "spki";
|
|
@@ -420,42 +420,42 @@ function Bt(t) {
|
|
|
420
420
|
return "pkcs8";
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
async function
|
|
424
|
-
const n =
|
|
425
|
-
return
|
|
423
|
+
async function Bt(t, e) {
|
|
424
|
+
const n = Wt(t), s = await crypto.subtle.exportKey(n, e);
|
|
425
|
+
return Ke(new Uint8Array(s));
|
|
426
426
|
}
|
|
427
|
-
async function
|
|
428
|
-
const n =
|
|
427
|
+
async function qt(t, e) {
|
|
428
|
+
const n = Wt(t), s = le(e).buffer;
|
|
429
429
|
return await crypto.subtle.importKey(n, new Uint8Array(s), {
|
|
430
430
|
name: "ECDH",
|
|
431
431
|
namedCurve: "P-256"
|
|
432
432
|
}, !0, t === "private" ? ["deriveKey"] : []);
|
|
433
433
|
}
|
|
434
|
-
async function
|
|
434
|
+
async function Hn(t, e) {
|
|
435
435
|
const n = JSON.stringify(t, (s, i) => {
|
|
436
436
|
if (!(i instanceof Error))
|
|
437
437
|
return i;
|
|
438
438
|
const r = i;
|
|
439
439
|
return Object.assign(Object.assign({}, r.code ? { code: r.code } : {}), { message: r.message });
|
|
440
440
|
});
|
|
441
|
-
return
|
|
441
|
+
return Un(e, n);
|
|
442
442
|
}
|
|
443
|
-
async function
|
|
444
|
-
return JSON.parse(await
|
|
443
|
+
async function Wn(t, e) {
|
|
444
|
+
return JSON.parse(await jn(e, t));
|
|
445
445
|
}
|
|
446
|
-
const
|
|
446
|
+
const xe = {
|
|
447
447
|
storageKey: "ownPrivateKey",
|
|
448
448
|
keyType: "private"
|
|
449
|
-
},
|
|
449
|
+
}, Ie = {
|
|
450
450
|
storageKey: "ownPublicKey",
|
|
451
451
|
keyType: "public"
|
|
452
|
-
},
|
|
452
|
+
}, Se = {
|
|
453
453
|
storageKey: "peerPublicKey",
|
|
454
454
|
keyType: "public"
|
|
455
455
|
};
|
|
456
|
-
class
|
|
456
|
+
class Bn {
|
|
457
457
|
constructor() {
|
|
458
|
-
this.storage = new
|
|
458
|
+
this.storage = new D("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null;
|
|
459
459
|
}
|
|
460
460
|
async getOwnPublicKey() {
|
|
461
461
|
return await this.loadKeysIfNeeded(), this.ownPublicKey;
|
|
@@ -465,52 +465,52 @@ class Vn {
|
|
|
465
465
|
return await this.loadKeysIfNeeded(), this.sharedSecret;
|
|
466
466
|
}
|
|
467
467
|
async setPeerPublicKey(e) {
|
|
468
|
-
this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(
|
|
468
|
+
this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(Se, e), await this.loadKeysIfNeeded();
|
|
469
469
|
}
|
|
470
470
|
async clear() {
|
|
471
|
-
this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(
|
|
471
|
+
this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Ie.storageKey), this.storage.removeItem(xe.storageKey), this.storage.removeItem(Se.storageKey);
|
|
472
472
|
}
|
|
473
473
|
async generateKeyPair() {
|
|
474
|
-
const e = await
|
|
475
|
-
this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(
|
|
474
|
+
const e = await Dn();
|
|
475
|
+
this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(xe, e.privateKey), await this.storeKey(Ie, e.publicKey);
|
|
476
476
|
}
|
|
477
477
|
async loadKeysIfNeeded() {
|
|
478
|
-
if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(
|
|
478
|
+
if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(xe)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Ie)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Se)), this.sharedSecret === null) {
|
|
479
479
|
if (this.ownPrivateKey === null || this.peerPublicKey === null)
|
|
480
480
|
return;
|
|
481
|
-
this.sharedSecret = await
|
|
481
|
+
this.sharedSecret = await On(this.ownPrivateKey, this.peerPublicKey);
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
// storage methods
|
|
485
485
|
async loadKey(e) {
|
|
486
486
|
const n = this.storage.getItem(e.storageKey);
|
|
487
|
-
return n ?
|
|
487
|
+
return n ? qt(e.keyType, n) : null;
|
|
488
488
|
}
|
|
489
489
|
async storeKey(e, n) {
|
|
490
|
-
const s = await
|
|
490
|
+
const s = await Bt(e.keyType, n);
|
|
491
491
|
this.storage.setItem(e.storageKey, s);
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
const
|
|
495
|
-
async function
|
|
494
|
+
const re = "4.3.0", Vt = "@coinbase/wallet-sdk";
|
|
495
|
+
async function $e(t, e) {
|
|
496
496
|
const n = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), s = await window.fetch(e, {
|
|
497
497
|
method: "POST",
|
|
498
498
|
body: JSON.stringify(n),
|
|
499
499
|
mode: "cors",
|
|
500
500
|
headers: {
|
|
501
501
|
"Content-Type": "application/json",
|
|
502
|
-
"X-Cbw-Sdk-Version":
|
|
503
|
-
"X-Cbw-Sdk-Platform":
|
|
502
|
+
"X-Cbw-Sdk-Version": re,
|
|
503
|
+
"X-Cbw-Sdk-Platform": Vt
|
|
504
504
|
}
|
|
505
505
|
}), { result: i, error: r } = await s.json();
|
|
506
506
|
if (r)
|
|
507
507
|
throw r;
|
|
508
508
|
return i;
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function qn() {
|
|
511
511
|
return globalThis.coinbaseWalletExtension;
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function Vn() {
|
|
514
514
|
var t, e;
|
|
515
515
|
try {
|
|
516
516
|
const n = globalThis;
|
|
@@ -519,19 +519,19 @@ function Fn() {
|
|
|
519
519
|
return;
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function Kn({ metadata: t, preference: e }) {
|
|
523
523
|
var n, s;
|
|
524
524
|
const { appName: i, appLogoUrl: r, appChainIds: o } = t;
|
|
525
525
|
if (e.options !== "smartWalletOnly") {
|
|
526
|
-
const d =
|
|
526
|
+
const d = qn();
|
|
527
527
|
if (d)
|
|
528
528
|
return (n = d.setAppInfo) === null || n === void 0 || n.call(d, i, r, o, e), d;
|
|
529
529
|
}
|
|
530
|
-
const a =
|
|
530
|
+
const a = Vn();
|
|
531
531
|
if (a != null && a.isCoinbaseBrowser)
|
|
532
532
|
return (s = a.setAppInfo) === null || s === void 0 || s.call(a, i, r, o, e), a;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function Fn(t) {
|
|
535
535
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
536
536
|
throw b.rpc.invalidParams({
|
|
537
537
|
message: "Expected a single, non-array, object argument.",
|
|
@@ -556,11 +556,11 @@ function $n(t) {
|
|
|
556
556
|
throw b.provider.unsupportedMethod();
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
const
|
|
560
|
-
class
|
|
559
|
+
const tt = "accounts", nt = "activeChain", st = "availableChains", it = "walletCapabilities";
|
|
560
|
+
class zn {
|
|
561
561
|
constructor(e) {
|
|
562
562
|
var n, s, i;
|
|
563
|
-
this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new
|
|
563
|
+
this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new Bn(), this.storage = new D("CBWSDK", "SCWStateManager"), this.accounts = (n = this.storage.loadObject(tt)) !== null && n !== void 0 ? n : [], this.chain = this.storage.loadObject(nt) || {
|
|
564
564
|
id: (i = (s = e.metadata.appChainIds) === null || s === void 0 ? void 0 : s[0]) !== null && i !== void 0 ? i : 1
|
|
565
565
|
}, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this);
|
|
566
566
|
}
|
|
@@ -575,7 +575,7 @@ class Zn {
|
|
|
575
575
|
}), a = await this.communicator.postRequestAndWaitForResponse(o);
|
|
576
576
|
if ("failure" in a.content)
|
|
577
577
|
throw a.content.failure;
|
|
578
|
-
const d = await
|
|
578
|
+
const d = await qt("public", a.sender);
|
|
579
579
|
await this.keyManager.setPeerPublicKey(d);
|
|
580
580
|
const h = (await this.decryptResponseMessage(a)).result;
|
|
581
581
|
if ("error" in h)
|
|
@@ -583,7 +583,7 @@ class Zn {
|
|
|
583
583
|
switch (e.method) {
|
|
584
584
|
case "eth_requestAccounts": {
|
|
585
585
|
const c = h.value;
|
|
586
|
-
this.accounts = c, this.storage.storeObject(
|
|
586
|
+
this.accounts = c, this.storage.storeObject(tt, c), (r = this.callback) === null || r === void 0 || r.call(this, "accountsChanged", c);
|
|
587
587
|
break;
|
|
588
588
|
}
|
|
589
589
|
}
|
|
@@ -599,7 +599,7 @@ class Zn {
|
|
|
599
599
|
}
|
|
600
600
|
switch (e.method) {
|
|
601
601
|
case "eth_requestAccounts":
|
|
602
|
-
return (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId:
|
|
602
|
+
return (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId: F(this.chain.id) }), this.accounts;
|
|
603
603
|
case "eth_accounts":
|
|
604
604
|
return this.accounts;
|
|
605
605
|
case "eth_coinbase":
|
|
@@ -607,9 +607,9 @@ class Zn {
|
|
|
607
607
|
case "net_version":
|
|
608
608
|
return this.chain.id;
|
|
609
609
|
case "eth_chainId":
|
|
610
|
-
return
|
|
610
|
+
return F(this.chain.id);
|
|
611
611
|
case "wallet_getCapabilities":
|
|
612
|
-
return this.storage.loadObject(
|
|
612
|
+
return this.storage.loadObject(it);
|
|
613
613
|
case "wallet_switchEthereumChain":
|
|
614
614
|
return this.handleSwitchChainRequest(e);
|
|
615
615
|
case "eth_ecRecover":
|
|
@@ -631,7 +631,7 @@ class Zn {
|
|
|
631
631
|
default:
|
|
632
632
|
if (!this.chain.rpcUrl)
|
|
633
633
|
throw b.rpc.internal("No RPC URL set for chain");
|
|
634
|
-
return
|
|
634
|
+
return $e(e, this.chain.rpcUrl);
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
async sendRequestToPopup(e) {
|
|
@@ -657,7 +657,7 @@ class Zn {
|
|
|
657
657
|
const s = e.params;
|
|
658
658
|
if (!s || !(!((n = s[0]) === null || n === void 0) && n.chainId))
|
|
659
659
|
throw b.rpc.invalidParams();
|
|
660
|
-
const i =
|
|
660
|
+
const i = te(s[0].chainId);
|
|
661
661
|
if (this.updateChain(i))
|
|
662
662
|
return null;
|
|
663
663
|
const o = await this.sendRequestToPopup(e);
|
|
@@ -667,14 +667,14 @@ class Zn {
|
|
|
667
667
|
const n = await this.keyManager.getSharedSecret();
|
|
668
668
|
if (!n)
|
|
669
669
|
throw b.provider.unauthorized("No valid session found, try requestAccounts before other methods");
|
|
670
|
-
const s = await
|
|
670
|
+
const s = await Hn({
|
|
671
671
|
action: e,
|
|
672
672
|
chainId: this.chain.id
|
|
673
673
|
}, n), i = await this.createRequestMessage({ encrypted: s });
|
|
674
674
|
return this.communicator.postRequestAndWaitForResponse(i);
|
|
675
675
|
}
|
|
676
676
|
async createRequestMessage(e) {
|
|
677
|
-
const n = await
|
|
677
|
+
const n = await Bt("public", await this.keyManager.getOwnPublicKey());
|
|
678
678
|
return {
|
|
679
679
|
id: crypto.randomUUID(),
|
|
680
680
|
sender: n,
|
|
@@ -690,31 +690,31 @@ class Zn {
|
|
|
690
690
|
const r = await this.keyManager.getSharedSecret();
|
|
691
691
|
if (!r)
|
|
692
692
|
throw b.provider.unauthorized("Invalid session");
|
|
693
|
-
const o = await
|
|
693
|
+
const o = await Wn(i.encrypted, r), a = (n = o.data) === null || n === void 0 ? void 0 : n.chains;
|
|
694
694
|
if (a) {
|
|
695
695
|
const l = Object.entries(a).map(([h, c]) => ({
|
|
696
696
|
id: Number(h),
|
|
697
697
|
rpcUrl: c
|
|
698
698
|
}));
|
|
699
|
-
this.storage.storeObject(
|
|
699
|
+
this.storage.storeObject(st, l), this.updateChain(this.chain.id, l);
|
|
700
700
|
}
|
|
701
701
|
const d = (s = o.data) === null || s === void 0 ? void 0 : s.capabilities;
|
|
702
|
-
return d && this.storage.storeObject(
|
|
702
|
+
return d && this.storage.storeObject(it, d), o;
|
|
703
703
|
}
|
|
704
704
|
updateChain(e, n) {
|
|
705
705
|
var s;
|
|
706
|
-
const i = n ?? this.storage.loadObject(
|
|
707
|
-
return r ? (r !== this.chain && (this.chain = r, this.storage.storeObject(
|
|
706
|
+
const i = n ?? this.storage.loadObject(st), r = i == null ? void 0 : i.find((o) => o.id === e);
|
|
707
|
+
return r ? (r !== this.chain && (this.chain = r, this.storage.storeObject(nt, r), (s = this.callback) === null || s === void 0 || s.call(this, "chainChanged", F(r.id))), !0) : !1;
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
|
-
const { keccak_256:
|
|
711
|
-
function
|
|
710
|
+
const { keccak_256: $n } = En;
|
|
711
|
+
function Kt(t) {
|
|
712
712
|
return Buffer.allocUnsafe(t).fill(0);
|
|
713
713
|
}
|
|
714
|
-
function
|
|
714
|
+
function Zn(t) {
|
|
715
715
|
return t.toString(2).length;
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function Ft(t, e) {
|
|
718
718
|
let n = t.toString(16);
|
|
719
719
|
n.length % 2 !== 0 && (n = "0" + n);
|
|
720
720
|
const s = n.match(/.{1,2}/g).map((i) => parseInt(i, 16));
|
|
@@ -722,7 +722,7 @@ function zt(t, e) {
|
|
|
722
722
|
s.unshift(0);
|
|
723
723
|
return Buffer.from(s);
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Gn(t, e) {
|
|
726
726
|
const n = t < 0n;
|
|
727
727
|
let s;
|
|
728
728
|
if (n) {
|
|
@@ -732,77 +732,77 @@ function Jn(t, e) {
|
|
|
732
732
|
s = t;
|
|
733
733
|
return s &= (1n << BigInt(e)) - 1n, s;
|
|
734
734
|
}
|
|
735
|
-
function
|
|
736
|
-
const s =
|
|
737
|
-
return t =
|
|
735
|
+
function zt(t, e, n) {
|
|
736
|
+
const s = Kt(e);
|
|
737
|
+
return t = be(t), n ? t.length < e ? (t.copy(s), s) : t.slice(0, e) : t.length < e ? (t.copy(s, e - t.length), s) : t.slice(-e);
|
|
738
738
|
}
|
|
739
|
-
function
|
|
740
|
-
return
|
|
739
|
+
function Yn(t, e) {
|
|
740
|
+
return zt(t, e, !0);
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function be(t) {
|
|
743
743
|
if (!Buffer.isBuffer(t))
|
|
744
744
|
if (Array.isArray(t))
|
|
745
745
|
t = Buffer.from(t);
|
|
746
746
|
else if (typeof t == "string")
|
|
747
|
-
|
|
747
|
+
$t(t) ? t = Buffer.from(Xn(Zt(t)), "hex") : t = Buffer.from(t);
|
|
748
748
|
else if (typeof t == "number")
|
|
749
749
|
t = intToBuffer(t);
|
|
750
750
|
else if (t == null)
|
|
751
751
|
t = Buffer.allocUnsafe(0);
|
|
752
752
|
else if (typeof t == "bigint")
|
|
753
|
-
t =
|
|
753
|
+
t = Ft(t);
|
|
754
754
|
else if (t.toArray)
|
|
755
755
|
t = Buffer.from(t.toArray());
|
|
756
756
|
else
|
|
757
757
|
throw new Error("invalid type");
|
|
758
758
|
return t;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
761
|
-
return t =
|
|
760
|
+
function Jn(t) {
|
|
761
|
+
return t = be(t), "0x" + t.toString("hex");
|
|
762
762
|
}
|
|
763
|
-
function
|
|
764
|
-
if (t =
|
|
763
|
+
function Qn(t, e) {
|
|
764
|
+
if (t = be(t), e || (e = 256), e !== 256)
|
|
765
765
|
throw new Error("unsupported");
|
|
766
|
-
return Buffer.from(
|
|
766
|
+
return Buffer.from($n(new Uint8Array(t)));
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function Xn(t) {
|
|
769
769
|
return t.length % 2 ? "0" + t : t;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function $t(t) {
|
|
772
772
|
return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/);
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function Zt(t) {
|
|
775
775
|
return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t;
|
|
776
776
|
}
|
|
777
|
-
var
|
|
778
|
-
zeros:
|
|
779
|
-
setLength:
|
|
780
|
-
setLengthRight:
|
|
781
|
-
isHexString:
|
|
782
|
-
stripHexPrefix:
|
|
783
|
-
toBuffer:
|
|
784
|
-
bufferToHex:
|
|
785
|
-
keccak:
|
|
786
|
-
bitLengthFromBigInt:
|
|
787
|
-
bufferBEFromBigInt:
|
|
788
|
-
twosFromBigInt:
|
|
777
|
+
var Gt = {
|
|
778
|
+
zeros: Kt,
|
|
779
|
+
setLength: zt,
|
|
780
|
+
setLengthRight: Yn,
|
|
781
|
+
isHexString: $t,
|
|
782
|
+
stripHexPrefix: Zt,
|
|
783
|
+
toBuffer: be,
|
|
784
|
+
bufferToHex: Jn,
|
|
785
|
+
keccak: Qn,
|
|
786
|
+
bitLengthFromBigInt: Zn,
|
|
787
|
+
bufferBEFromBigInt: Ft,
|
|
788
|
+
twosFromBigInt: Gn
|
|
789
789
|
};
|
|
790
|
-
const S =
|
|
791
|
-
function
|
|
790
|
+
const S = Gt;
|
|
791
|
+
function Yt(t) {
|
|
792
792
|
return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t;
|
|
793
793
|
}
|
|
794
794
|
function Y(t) {
|
|
795
795
|
return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10);
|
|
796
796
|
}
|
|
797
|
-
function
|
|
797
|
+
function rt(t) {
|
|
798
798
|
var e = /^\D+(\d+)x(\d+)$/.exec(t);
|
|
799
799
|
return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)];
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Jt(t) {
|
|
802
802
|
var e = t.match(/(.*)\[(.*?)\]$/);
|
|
803
803
|
return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null;
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function $(t) {
|
|
806
806
|
var e = typeof t;
|
|
807
807
|
if (e === "string" || e === "number")
|
|
808
808
|
return BigInt(t);
|
|
@@ -810,30 +810,30 @@ function z(t) {
|
|
|
810
810
|
return t;
|
|
811
811
|
throw new Error("Argument is not a number");
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function N(t, e) {
|
|
814
814
|
var n, s, i, r;
|
|
815
815
|
if (t === "address")
|
|
816
|
-
return
|
|
816
|
+
return N("uint160", $(e));
|
|
817
817
|
if (t === "bool")
|
|
818
|
-
return
|
|
818
|
+
return N("uint8", e ? 1 : 0);
|
|
819
819
|
if (t === "string")
|
|
820
|
-
return
|
|
821
|
-
if (
|
|
820
|
+
return N("bytes", new Buffer(e, "utf8"));
|
|
821
|
+
if (ts(t)) {
|
|
822
822
|
if (typeof e.length > "u")
|
|
823
823
|
throw new Error("Not an array?");
|
|
824
|
-
if (n =
|
|
824
|
+
if (n = Jt(t), n !== "dynamic" && n !== 0 && e.length > n)
|
|
825
825
|
throw new Error("Elements exceed array size: " + n);
|
|
826
826
|
i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e));
|
|
827
827
|
for (r in e)
|
|
828
|
-
i.push(
|
|
828
|
+
i.push(N(t, e[r]));
|
|
829
829
|
if (n === "dynamic") {
|
|
830
|
-
var o =
|
|
830
|
+
var o = N("uint256", e.length);
|
|
831
831
|
i.unshift(o);
|
|
832
832
|
}
|
|
833
833
|
return Buffer.concat(i);
|
|
834
834
|
} else {
|
|
835
835
|
if (t === "bytes")
|
|
836
|
-
return e = new Buffer(e), i = Buffer.concat([
|
|
836
|
+
return e = new Buffer(e), i = Buffer.concat([N("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, S.zeros(32 - e.length % 32)])), i;
|
|
837
837
|
if (t.startsWith("bytes")) {
|
|
838
838
|
if (n = Y(t), n < 1 || n > 32)
|
|
839
839
|
throw new Error("Invalid bytes<N> width: " + n);
|
|
@@ -841,7 +841,7 @@ function D(t, e) {
|
|
|
841
841
|
} else if (t.startsWith("uint")) {
|
|
842
842
|
if (n = Y(t), n % 8 || n < 8 || n > 256)
|
|
843
843
|
throw new Error("Invalid uint<N> width: " + n);
|
|
844
|
-
s =
|
|
844
|
+
s = $(e);
|
|
845
845
|
const a = S.bitLengthFromBigInt(s);
|
|
846
846
|
if (a > n)
|
|
847
847
|
throw new Error("Supplied uint exceeds width: " + n + " vs " + a);
|
|
@@ -851,40 +851,40 @@ function D(t, e) {
|
|
|
851
851
|
} else if (t.startsWith("int")) {
|
|
852
852
|
if (n = Y(t), n % 8 || n < 8 || n > 256)
|
|
853
853
|
throw new Error("Invalid int<N> width: " + n);
|
|
854
|
-
s =
|
|
854
|
+
s = $(e);
|
|
855
855
|
const a = S.bitLengthFromBigInt(s);
|
|
856
856
|
if (a > n)
|
|
857
857
|
throw new Error("Supplied int exceeds width: " + n + " vs " + a);
|
|
858
858
|
const d = S.twosFromBigInt(s, 256);
|
|
859
859
|
return S.bufferBEFromBigInt(d, 32);
|
|
860
860
|
} else if (t.startsWith("ufixed")) {
|
|
861
|
-
if (n =
|
|
861
|
+
if (n = rt(t), s = $(e), s < 0)
|
|
862
862
|
throw new Error("Supplied ufixed is negative");
|
|
863
|
-
return
|
|
863
|
+
return N("uint256", s * BigInt(2) ** BigInt(n[1]));
|
|
864
864
|
} else if (t.startsWith("fixed"))
|
|
865
|
-
return n =
|
|
865
|
+
return n = rt(t), N("int256", $(e) * BigInt(2) ** BigInt(n[1]));
|
|
866
866
|
}
|
|
867
867
|
throw new Error("Unsupported or invalid type: " + t);
|
|
868
868
|
}
|
|
869
|
-
function
|
|
870
|
-
return t === "string" || t === "bytes" ||
|
|
869
|
+
function es(t) {
|
|
870
|
+
return t === "string" || t === "bytes" || Jt(t) === "dynamic";
|
|
871
871
|
}
|
|
872
|
-
function
|
|
872
|
+
function ts(t) {
|
|
873
873
|
return t.lastIndexOf("]") === t.length - 1;
|
|
874
874
|
}
|
|
875
|
-
function
|
|
875
|
+
function ns(t, e) {
|
|
876
876
|
var n = [], s = [], i = 32 * t.length;
|
|
877
877
|
for (var r in t) {
|
|
878
|
-
var o =
|
|
879
|
-
|
|
878
|
+
var o = Yt(t[r]), a = e[r], d = N(o, a);
|
|
879
|
+
es(o) ? (n.push(N("uint256", i)), s.push(d), i += d.length) : n.push(d);
|
|
880
880
|
}
|
|
881
881
|
return Buffer.concat(n.concat(s));
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function Qt(t, e) {
|
|
884
884
|
if (t.length !== e.length)
|
|
885
885
|
throw new Error("Number of types are not matching the values");
|
|
886
886
|
for (var n, s, i = [], r = 0; r < t.length; r++) {
|
|
887
|
-
var o =
|
|
887
|
+
var o = Yt(t[r]), a = e[r];
|
|
888
888
|
if (o === "bytes")
|
|
889
889
|
i.push(a);
|
|
890
890
|
else if (o === "string")
|
|
@@ -900,7 +900,7 @@ function Xt(t, e) {
|
|
|
900
900
|
} else if (o.startsWith("uint")) {
|
|
901
901
|
if (n = Y(o), n % 8 || n < 8 || n > 256)
|
|
902
902
|
throw new Error("Invalid uint<N> width: " + n);
|
|
903
|
-
s =
|
|
903
|
+
s = $(a);
|
|
904
904
|
const d = S.bitLengthFromBigInt(s);
|
|
905
905
|
if (d > n)
|
|
906
906
|
throw new Error("Supplied uint exceeds width: " + n + " vs " + d);
|
|
@@ -908,7 +908,7 @@ function Xt(t, e) {
|
|
|
908
908
|
} else if (o.startsWith("int")) {
|
|
909
909
|
if (n = Y(o), n % 8 || n < 8 || n > 256)
|
|
910
910
|
throw new Error("Invalid int<N> width: " + n);
|
|
911
|
-
s =
|
|
911
|
+
s = $(a);
|
|
912
912
|
const d = S.bitLengthFromBigInt(s);
|
|
913
913
|
if (d > n)
|
|
914
914
|
throw new Error("Supplied int exceeds width: " + n + " vs " + d);
|
|
@@ -919,15 +919,15 @@ function Xt(t, e) {
|
|
|
919
919
|
}
|
|
920
920
|
return Buffer.concat(i);
|
|
921
921
|
}
|
|
922
|
-
function
|
|
923
|
-
return S.keccak(
|
|
922
|
+
function ss(t, e) {
|
|
923
|
+
return S.keccak(Qt(t, e));
|
|
924
924
|
}
|
|
925
|
-
var
|
|
926
|
-
rawEncode:
|
|
927
|
-
solidityPack:
|
|
928
|
-
soliditySHA3:
|
|
925
|
+
var is = {
|
|
926
|
+
rawEncode: ns,
|
|
927
|
+
solidityPack: Qt,
|
|
928
|
+
soliditySHA3: ss
|
|
929
929
|
};
|
|
930
|
-
const
|
|
930
|
+
const L = Gt, ne = is, Xt = {
|
|
931
931
|
type: "object",
|
|
932
932
|
properties: {
|
|
933
933
|
types: {
|
|
@@ -949,7 +949,7 @@ const M = Yt, ie = os, en = {
|
|
|
949
949
|
message: { type: "object" }
|
|
950
950
|
},
|
|
951
951
|
required: ["types", "primaryType", "domain", "message"]
|
|
952
|
-
},
|
|
952
|
+
}, Ae = {
|
|
953
953
|
/**
|
|
954
954
|
* Encodes an object by encoding and concatenating each of its members
|
|
955
955
|
*
|
|
@@ -963,16 +963,16 @@ const M = Yt, ie = os, en = {
|
|
|
963
963
|
if (s) {
|
|
964
964
|
const o = (a, d, l) => {
|
|
965
965
|
if (n[d] !== void 0)
|
|
966
|
-
return ["bytes32", l == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" :
|
|
966
|
+
return ["bytes32", l == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : L.keccak(this.encodeData(d, l, n, s))];
|
|
967
967
|
if (l === void 0)
|
|
968
968
|
throw new Error(`missing value for field ${a} of type ${d}`);
|
|
969
969
|
if (d === "bytes")
|
|
970
|
-
return ["bytes32",
|
|
970
|
+
return ["bytes32", L.keccak(l)];
|
|
971
971
|
if (d === "string")
|
|
972
|
-
return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32",
|
|
972
|
+
return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32", L.keccak(l)];
|
|
973
973
|
if (d.lastIndexOf("]") === d.length - 1) {
|
|
974
974
|
const h = d.slice(0, d.lastIndexOf("[")), c = l.map((f) => o(a, h, f));
|
|
975
|
-
return ["bytes32",
|
|
975
|
+
return ["bytes32", L.keccak(ne.rawEncode(
|
|
976
976
|
c.map(([f]) => f),
|
|
977
977
|
c.map(([, f]) => f)
|
|
978
978
|
))];
|
|
@@ -988,18 +988,18 @@ const M = Yt, ie = os, en = {
|
|
|
988
988
|
let a = e[o.name];
|
|
989
989
|
if (a !== void 0)
|
|
990
990
|
if (o.type === "bytes")
|
|
991
|
-
i.push("bytes32"), a =
|
|
991
|
+
i.push("bytes32"), a = L.keccak(a), r.push(a);
|
|
992
992
|
else if (o.type === "string")
|
|
993
|
-
i.push("bytes32"), typeof a == "string" && (a = Buffer.from(a, "utf8")), a =
|
|
993
|
+
i.push("bytes32"), typeof a == "string" && (a = Buffer.from(a, "utf8")), a = L.keccak(a), r.push(a);
|
|
994
994
|
else if (n[o.type] !== void 0)
|
|
995
|
-
i.push("bytes32"), a =
|
|
995
|
+
i.push("bytes32"), a = L.keccak(this.encodeData(o.type, a, n, s)), r.push(a);
|
|
996
996
|
else {
|
|
997
997
|
if (o.type.lastIndexOf("]") === o.type.length - 1)
|
|
998
998
|
throw new Error("Arrays currently unimplemented in encodeData");
|
|
999
999
|
i.push(o.type), r.push(a);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
return
|
|
1002
|
+
return ne.rawEncode(i, r);
|
|
1003
1003
|
},
|
|
1004
1004
|
/**
|
|
1005
1005
|
* Encodes the type of an object by encoding a comma delimited list of its members
|
|
@@ -1044,7 +1044,7 @@ const M = Yt, ie = os, en = {
|
|
|
1044
1044
|
* @returns {Buffer} - Hash of an object
|
|
1045
1045
|
*/
|
|
1046
1046
|
hashStruct(t, e, n, s = !0) {
|
|
1047
|
-
return
|
|
1047
|
+
return L.keccak(this.encodeData(t, e, n, s));
|
|
1048
1048
|
},
|
|
1049
1049
|
/**
|
|
1050
1050
|
* Hashes the type of an object
|
|
@@ -1054,7 +1054,7 @@ const M = Yt, ie = os, en = {
|
|
|
1054
1054
|
* @returns {string} - Hash of an object
|
|
1055
1055
|
*/
|
|
1056
1056
|
hashType(t, e) {
|
|
1057
|
-
return
|
|
1057
|
+
return L.keccak(this.encodeType(t, e));
|
|
1058
1058
|
},
|
|
1059
1059
|
/**
|
|
1060
1060
|
* Removes properties from a message object that are not defined per EIP-712
|
|
@@ -1064,7 +1064,7 @@ const M = Yt, ie = os, en = {
|
|
|
1064
1064
|
*/
|
|
1065
1065
|
sanitizeData(t) {
|
|
1066
1066
|
const e = {};
|
|
1067
|
-
for (const n in
|
|
1067
|
+
for (const n in Xt.properties)
|
|
1068
1068
|
t[n] && (e[n] = t[n]);
|
|
1069
1069
|
return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e;
|
|
1070
1070
|
},
|
|
@@ -1076,46 +1076,46 @@ const M = Yt, ie = os, en = {
|
|
|
1076
1076
|
*/
|
|
1077
1077
|
hash(t, e = !0) {
|
|
1078
1078
|
const n = this.sanitizeData(t), s = [Buffer.from("1901", "hex")];
|
|
1079
|
-
return s.push(this.hashStruct("EIP712Domain", n.domain, n.types, e)), n.primaryType !== "EIP712Domain" && s.push(this.hashStruct(n.primaryType, n.message, n.types, e)),
|
|
1079
|
+
return s.push(this.hashStruct("EIP712Domain", n.domain, n.types, e)), n.primaryType !== "EIP712Domain" && s.push(this.hashStruct(n.primaryType, n.message, n.types, e)), L.keccak(Buffer.concat(s));
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
1082
|
-
var
|
|
1083
|
-
TYPED_MESSAGE_SCHEMA:
|
|
1084
|
-
TypedDataUtils:
|
|
1082
|
+
var rs = {
|
|
1083
|
+
TYPED_MESSAGE_SCHEMA: Xt,
|
|
1084
|
+
TypedDataUtils: Ae,
|
|
1085
1085
|
hashForSignTypedDataLegacy: function(t) {
|
|
1086
|
-
return
|
|
1086
|
+
return os(t.data);
|
|
1087
1087
|
},
|
|
1088
1088
|
hashForSignTypedData_v3: function(t) {
|
|
1089
|
-
return
|
|
1089
|
+
return Ae.hash(t.data, !1);
|
|
1090
1090
|
},
|
|
1091
1091
|
hashForSignTypedData_v4: function(t) {
|
|
1092
|
-
return
|
|
1092
|
+
return Ae.hash(t.data);
|
|
1093
1093
|
}
|
|
1094
1094
|
};
|
|
1095
|
-
function
|
|
1095
|
+
function os(t) {
|
|
1096
1096
|
const e = new Error("Expect argument to be non-empty array");
|
|
1097
1097
|
if (typeof t != "object" || !t.length) throw e;
|
|
1098
1098
|
const n = t.map(function(r) {
|
|
1099
|
-
return r.type === "bytes" ?
|
|
1099
|
+
return r.type === "bytes" ? L.toBuffer(r.value) : r.value;
|
|
1100
1100
|
}), s = t.map(function(r) {
|
|
1101
1101
|
return r.type;
|
|
1102
1102
|
}), i = t.map(function(r) {
|
|
1103
1103
|
if (!r.name) throw e;
|
|
1104
1104
|
return r.type + " " + r.name;
|
|
1105
1105
|
});
|
|
1106
|
-
return
|
|
1106
|
+
return ne.soliditySHA3(
|
|
1107
1107
|
["bytes32", "bytes32"],
|
|
1108
1108
|
[
|
|
1109
|
-
|
|
1110
|
-
|
|
1109
|
+
ne.soliditySHA3(new Array(t.length).fill("string"), i),
|
|
1110
|
+
ne.soliditySHA3(s, n)
|
|
1111
1111
|
]
|
|
1112
1112
|
);
|
|
1113
1113
|
}
|
|
1114
|
-
const
|
|
1114
|
+
const ae = /* @__PURE__ */ Lt(rs), as = "walletUsername", Ne = "Addresses", cs = "AppVersion";
|
|
1115
1115
|
function I(t) {
|
|
1116
1116
|
return t.errorMessage !== void 0;
|
|
1117
1117
|
}
|
|
1118
|
-
class
|
|
1118
|
+
class ls {
|
|
1119
1119
|
// @param secret hex representation of 32-byte secret
|
|
1120
1120
|
constructor(e) {
|
|
1121
1121
|
this.secret = e;
|
|
@@ -1131,11 +1131,11 @@ class hs {
|
|
|
1131
1131
|
const n = this.secret;
|
|
1132
1132
|
if (n.length !== 64)
|
|
1133
1133
|
throw Error("secret must be 256 bits");
|
|
1134
|
-
const s = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw",
|
|
1134
|
+
const s = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", le(n), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), r = new TextEncoder(), o = await window.crypto.subtle.encrypt({
|
|
1135
1135
|
name: "AES-GCM",
|
|
1136
1136
|
iv: s
|
|
1137
1137
|
}, i, r.encode(e)), a = 16, d = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), h = new Uint8Array(d), c = new Uint8Array(l), f = new Uint8Array([...s, ...h, ...c]);
|
|
1138
|
-
return
|
|
1138
|
+
return Ke(f);
|
|
1139
1139
|
}
|
|
1140
1140
|
/**
|
|
1141
1141
|
*
|
|
@@ -1148,7 +1148,7 @@ class hs {
|
|
|
1148
1148
|
throw Error("secret must be 256 bits");
|
|
1149
1149
|
return new Promise((s, i) => {
|
|
1150
1150
|
(async function() {
|
|
1151
|
-
const r = await crypto.subtle.importKey("raw",
|
|
1151
|
+
const r = await crypto.subtle.importKey("raw", le(n), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), o = le(e), a = o.slice(0, 12), d = o.slice(12, 28), l = o.slice(28), h = new Uint8Array([...l, ...d]), c = {
|
|
1152
1152
|
name: "AES-GCM",
|
|
1153
1153
|
iv: new Uint8Array(a)
|
|
1154
1154
|
};
|
|
@@ -1162,7 +1162,7 @@ class hs {
|
|
|
1162
1162
|
});
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
class
|
|
1165
|
+
class ds {
|
|
1166
1166
|
constructor(e, n, s) {
|
|
1167
1167
|
this.linkAPIUrl = e, this.sessionId = n;
|
|
1168
1168
|
const i = `${n}:${s}`;
|
|
@@ -1204,7 +1204,7 @@ var H;
|
|
|
1204
1204
|
(function(t) {
|
|
1205
1205
|
t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED";
|
|
1206
1206
|
})(H || (H = {}));
|
|
1207
|
-
class
|
|
1207
|
+
class hs {
|
|
1208
1208
|
setConnectionStateListener(e) {
|
|
1209
1209
|
this.connectionStateListener = e;
|
|
1210
1210
|
}
|
|
@@ -1287,8 +1287,8 @@ class fs {
|
|
|
1287
1287
|
e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null);
|
|
1288
1288
|
}
|
|
1289
1289
|
}
|
|
1290
|
-
const
|
|
1291
|
-
class
|
|
1290
|
+
const ot = 1e4, us = 6e4;
|
|
1291
|
+
class fs {
|
|
1292
1292
|
/**
|
|
1293
1293
|
* Constructor
|
|
1294
1294
|
* @param session Session
|
|
@@ -1326,15 +1326,15 @@ class gs {
|
|
|
1326
1326
|
const d = await this.cipher.decrypt(o);
|
|
1327
1327
|
(a = this.listener) === null || a === void 0 || a.metadataUpdated(r, d);
|
|
1328
1328
|
}, this.handleWalletUsernameUpdated = async (r) => {
|
|
1329
|
-
this.handleMetadataUpdated(
|
|
1329
|
+
this.handleMetadataUpdated(as, r);
|
|
1330
1330
|
}, this.handleAppVersionUpdated = async (r) => {
|
|
1331
|
-
this.handleMetadataUpdated(
|
|
1331
|
+
this.handleMetadataUpdated(cs, r);
|
|
1332
1332
|
}, this.handleChainUpdated = async (r, o) => {
|
|
1333
1333
|
var a;
|
|
1334
1334
|
const d = await this.cipher.decrypt(r), l = await this.cipher.decrypt(o);
|
|
1335
1335
|
(a = this.listener) === null || a === void 0 || a.chainUpdated(d, l);
|
|
1336
|
-
}, this.session = e, this.cipher = new
|
|
1337
|
-
const i = new
|
|
1336
|
+
}, this.session = e, this.cipher = new ls(e.secret), this.listener = s;
|
|
1337
|
+
const i = new hs(`${n}/rpc`, WebSocket);
|
|
1338
1338
|
i.setConnectionStateListener(async (r) => {
|
|
1339
1339
|
let o = !1;
|
|
1340
1340
|
switch (r) {
|
|
@@ -1351,7 +1351,7 @@ class gs {
|
|
|
1351
1351
|
case H.CONNECTED:
|
|
1352
1352
|
o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => {
|
|
1353
1353
|
this.heartbeat();
|
|
1354
|
-
},
|
|
1354
|
+
}, ot), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI();
|
|
1355
1355
|
break;
|
|
1356
1356
|
case H.CONNECTING:
|
|
1357
1357
|
break;
|
|
@@ -1380,7 +1380,7 @@ class gs {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
1382
1382
|
r.id !== void 0 && ((o = this.requestResolutions.get(r.id)) === null || o === void 0 || o(r));
|
|
1383
|
-
}), this.ws = i, this.http = new
|
|
1383
|
+
}), this.ws = i, this.http = new ds(n, e.id, e.key);
|
|
1384
1384
|
}
|
|
1385
1385
|
/**
|
|
1386
1386
|
* Make a connection to the server
|
|
@@ -1477,7 +1477,7 @@ class gs {
|
|
|
1477
1477
|
this.lastHeartbeatResponse = Date.now();
|
|
1478
1478
|
}
|
|
1479
1479
|
heartbeat() {
|
|
1480
|
-
if (Date.now() - this.lastHeartbeatResponse >
|
|
1480
|
+
if (Date.now() - this.lastHeartbeatResponse > ot * 2) {
|
|
1481
1481
|
this.ws.disconnect();
|
|
1482
1482
|
return;
|
|
1483
1483
|
}
|
|
@@ -1486,7 +1486,7 @@ class gs {
|
|
|
1486
1486
|
} catch {
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
-
async makeRequest(e, n = { timeout:
|
|
1489
|
+
async makeRequest(e, n = { timeout: us }) {
|
|
1490
1490
|
const s = e.id;
|
|
1491
1491
|
this.sendData(e);
|
|
1492
1492
|
let i;
|
|
@@ -1520,94 +1520,94 @@ class gs {
|
|
|
1520
1520
|
}), !0);
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
|
-
class
|
|
1523
|
+
class ps {
|
|
1524
1524
|
constructor() {
|
|
1525
1525
|
this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map();
|
|
1526
1526
|
}
|
|
1527
1527
|
makeRequestId() {
|
|
1528
1528
|
this._nextRequestId = (this._nextRequestId + 1) % 2147483647;
|
|
1529
|
-
const e = this._nextRequestId, n =
|
|
1529
|
+
const e = this._nextRequestId, n = Ht(e.toString(16));
|
|
1530
1530
|
return this.callbacks.get(n) && this.callbacks.delete(n), e;
|
|
1531
1531
|
}
|
|
1532
1532
|
}
|
|
1533
1533
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1534
|
-
function
|
|
1534
|
+
function gs(t) {
|
|
1535
1535
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1536
1536
|
}
|
|
1537
|
-
function
|
|
1538
|
-
if (!
|
|
1537
|
+
function we(t, ...e) {
|
|
1538
|
+
if (!gs(t))
|
|
1539
1539
|
throw new Error("Uint8Array expected");
|
|
1540
1540
|
if (e.length > 0 && !e.includes(t.length))
|
|
1541
1541
|
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
1542
1542
|
}
|
|
1543
|
-
function
|
|
1543
|
+
function at(t, e = !0) {
|
|
1544
1544
|
if (t.destroyed)
|
|
1545
1545
|
throw new Error("Hash instance has been destroyed");
|
|
1546
1546
|
if (e && t.finished)
|
|
1547
1547
|
throw new Error("Hash#digest() has already been called");
|
|
1548
1548
|
}
|
|
1549
|
-
function
|
|
1550
|
-
|
|
1549
|
+
function _s(t, e) {
|
|
1550
|
+
we(t);
|
|
1551
1551
|
const n = e.outputLen;
|
|
1552
1552
|
if (t.length < n)
|
|
1553
1553
|
throw new Error("digestInto() expects output buffer of length at least " + n);
|
|
1554
1554
|
}
|
|
1555
|
-
function
|
|
1555
|
+
function De(...t) {
|
|
1556
1556
|
for (let e = 0; e < t.length; e++)
|
|
1557
1557
|
t[e].fill(0);
|
|
1558
1558
|
}
|
|
1559
|
-
function
|
|
1559
|
+
function Me(t) {
|
|
1560
1560
|
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function T(t, e) {
|
|
1563
1563
|
return t << 32 - e | t >>> e;
|
|
1564
1564
|
}
|
|
1565
|
-
const
|
|
1566
|
-
function
|
|
1567
|
-
if (
|
|
1565
|
+
const ms = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", bs = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1566
|
+
function ws(t) {
|
|
1567
|
+
if (we(t), ms)
|
|
1568
1568
|
return t.toHex();
|
|
1569
1569
|
let e = "";
|
|
1570
1570
|
for (let n = 0; n < t.length; n++)
|
|
1571
|
-
e +=
|
|
1571
|
+
e += bs[t[n]];
|
|
1572
1572
|
return e;
|
|
1573
1573
|
}
|
|
1574
|
-
function
|
|
1574
|
+
function ys(t) {
|
|
1575
1575
|
if (typeof t != "string")
|
|
1576
1576
|
throw new Error("string expected");
|
|
1577
1577
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
1578
1578
|
}
|
|
1579
|
-
function
|
|
1580
|
-
return typeof t == "string" && (t =
|
|
1579
|
+
function en(t) {
|
|
1580
|
+
return typeof t == "string" && (t = ys(t)), we(t), t;
|
|
1581
1581
|
}
|
|
1582
|
-
class
|
|
1582
|
+
class vs {
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1585
|
-
const e = (s) => t().update(
|
|
1584
|
+
function ks(t) {
|
|
1585
|
+
const e = (s) => t().update(en(s)).digest(), n = t();
|
|
1586
1586
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function Es(t, e, n, s) {
|
|
1589
1589
|
if (typeof t.setBigUint64 == "function")
|
|
1590
1590
|
return t.setBigUint64(e, n, s);
|
|
1591
1591
|
const i = BigInt(32), r = BigInt(4294967295), o = Number(n >> i & r), a = Number(n & r), d = s ? 4 : 0, l = s ? 0 : 4;
|
|
1592
1592
|
t.setUint32(e + d, o, s), t.setUint32(e + l, a, s);
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function Cs(t, e, n) {
|
|
1595
1595
|
return t & e ^ ~t & n;
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1597
|
+
function xs(t, e, n) {
|
|
1598
1598
|
return t & e ^ t & n ^ e & n;
|
|
1599
1599
|
}
|
|
1600
|
-
class
|
|
1600
|
+
class Is extends vs {
|
|
1601
1601
|
constructor(e, n, s, i) {
|
|
1602
|
-
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = n, this.padOffset = s, this.isLE = i, this.buffer = new Uint8Array(e), this.view =
|
|
1602
|
+
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = n, this.padOffset = s, this.isLE = i, this.buffer = new Uint8Array(e), this.view = Me(this.buffer);
|
|
1603
1603
|
}
|
|
1604
1604
|
update(e) {
|
|
1605
|
-
|
|
1605
|
+
at(this), e = en(e), we(e);
|
|
1606
1606
|
const { view: n, buffer: s, blockLen: i } = this, r = e.length;
|
|
1607
1607
|
for (let o = 0; o < r; ) {
|
|
1608
1608
|
const a = Math.min(i - this.pos, r - o);
|
|
1609
1609
|
if (a === i) {
|
|
1610
|
-
const d =
|
|
1610
|
+
const d = Me(e);
|
|
1611
1611
|
for (; i <= r - o; o += i)
|
|
1612
1612
|
this.process(d, o);
|
|
1613
1613
|
continue;
|
|
@@ -1617,14 +1617,14 @@ class As extends Es {
|
|
|
1617
1617
|
return this.length += e.length, this.roundClean(), this;
|
|
1618
1618
|
}
|
|
1619
1619
|
digestInto(e) {
|
|
1620
|
-
|
|
1620
|
+
at(this), _s(e, this), this.finished = !0;
|
|
1621
1621
|
const { buffer: n, view: s, blockLen: i, isLE: r } = this;
|
|
1622
1622
|
let { pos: o } = this;
|
|
1623
|
-
n[o++] = 128,
|
|
1623
|
+
n[o++] = 128, De(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(s, 0), o = 0);
|
|
1624
1624
|
for (let c = o; c < i; c++)
|
|
1625
1625
|
n[c] = 0;
|
|
1626
|
-
|
|
1627
|
-
const a =
|
|
1626
|
+
Es(s, i - 8, BigInt(this.length * 8), r), this.process(s, 0);
|
|
1627
|
+
const a = Me(e), d = this.outputLen;
|
|
1628
1628
|
if (d % 4)
|
|
1629
1629
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
1630
1630
|
const l = d / 4, h = this.get();
|
|
@@ -1657,7 +1657,7 @@ const q = /* @__PURE__ */ Uint32Array.from([
|
|
|
1657
1657
|
2600822924,
|
|
1658
1658
|
528734635,
|
|
1659
1659
|
1541459225
|
|
1660
|
-
]),
|
|
1660
|
+
]), Ss = /* @__PURE__ */ Uint32Array.from([
|
|
1661
1661
|
1116352408,
|
|
1662
1662
|
1899447441,
|
|
1663
1663
|
3049323471,
|
|
@@ -1723,7 +1723,7 @@ const q = /* @__PURE__ */ Uint32Array.from([
|
|
|
1723
1723
|
3204031479,
|
|
1724
1724
|
3329325298
|
|
1725
1725
|
]), V = /* @__PURE__ */ new Uint32Array(64);
|
|
1726
|
-
class
|
|
1726
|
+
class As extends Is {
|
|
1727
1727
|
constructor(e = 32) {
|
|
1728
1728
|
super(64, e, 8, !1), this.A = q[0] | 0, this.B = q[1] | 0, this.C = q[2] | 0, this.D = q[3] | 0, this.E = q[4] | 0, this.F = q[5] | 0, this.G = q[6] | 0, this.H = q[7] | 0;
|
|
1729
1729
|
}
|
|
@@ -1739,34 +1739,34 @@ class Ls extends As {
|
|
|
1739
1739
|
for (let c = 0; c < 16; c++, n += 4)
|
|
1740
1740
|
V[c] = e.getUint32(n, !1);
|
|
1741
1741
|
for (let c = 16; c < 64; c++) {
|
|
1742
|
-
const f = V[c - 15], u = V[c - 2], g =
|
|
1742
|
+
const f = V[c - 15], u = V[c - 2], g = T(f, 7) ^ T(f, 18) ^ f >>> 3, v = T(u, 17) ^ T(u, 19) ^ u >>> 10;
|
|
1743
1743
|
V[c] = v + V[c - 7] + g + V[c - 16] | 0;
|
|
1744
1744
|
}
|
|
1745
1745
|
let { A: s, B: i, C: r, D: o, E: a, F: d, G: l, H: h } = this;
|
|
1746
1746
|
for (let c = 0; c < 64; c++) {
|
|
1747
|
-
const f =
|
|
1747
|
+
const f = T(a, 6) ^ T(a, 11) ^ T(a, 25), u = h + f + Cs(a, d, l) + Ss[c] + V[c] | 0, v = (T(s, 2) ^ T(s, 13) ^ T(s, 22)) + xs(s, i, r) | 0;
|
|
1748
1748
|
h = l, l = d, d = a, a = o + u | 0, o = r, r = i, i = s, s = u + v | 0;
|
|
1749
1749
|
}
|
|
1750
1750
|
s = s + this.A | 0, i = i + this.B | 0, r = r + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, d = d + this.F | 0, l = l + this.G | 0, h = h + this.H | 0, this.set(s, i, r, o, a, d, l, h);
|
|
1751
1751
|
}
|
|
1752
1752
|
roundClean() {
|
|
1753
|
-
|
|
1753
|
+
De(V);
|
|
1754
1754
|
}
|
|
1755
1755
|
destroy() {
|
|
1756
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0),
|
|
1756
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), De(this.buffer);
|
|
1757
1757
|
}
|
|
1758
1758
|
}
|
|
1759
|
-
const
|
|
1759
|
+
const Ms = /* @__PURE__ */ ks(() => new As()), Ls = Ms, ct = "session:id", lt = "session:secret", dt = "session:linked";
|
|
1760
1760
|
class J {
|
|
1761
1761
|
constructor(e, n, s, i = !1) {
|
|
1762
|
-
this.storage = e, this.id = n, this.secret = s, this.key =
|
|
1762
|
+
this.storage = e, this.id = n, this.secret = s, this.key = ws(Ls(`${n}, ${s} WalletLink`)), this._linked = !!i;
|
|
1763
1763
|
}
|
|
1764
1764
|
static create(e) {
|
|
1765
|
-
const n =
|
|
1765
|
+
const n = z(16), s = z(32);
|
|
1766
1766
|
return new J(e, n, s).save();
|
|
1767
1767
|
}
|
|
1768
1768
|
static load(e) {
|
|
1769
|
-
const n = e.getItem(
|
|
1769
|
+
const n = e.getItem(ct), s = e.getItem(dt), i = e.getItem(lt);
|
|
1770
1770
|
return n && i ? new J(e, n, i, s === "1") : null;
|
|
1771
1771
|
}
|
|
1772
1772
|
get linked() {
|
|
@@ -1776,72 +1776,72 @@ class J {
|
|
|
1776
1776
|
this._linked = e, this.persistLinked();
|
|
1777
1777
|
}
|
|
1778
1778
|
save() {
|
|
1779
|
-
return this.storage.setItem(
|
|
1779
|
+
return this.storage.setItem(ct, this.id), this.storage.setItem(lt, this.secret), this.persistLinked(), this;
|
|
1780
1780
|
}
|
|
1781
1781
|
persistLinked() {
|
|
1782
|
-
this.storage.setItem(
|
|
1782
|
+
this.storage.setItem(dt, this._linked ? "1" : "0");
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
1785
|
-
function
|
|
1785
|
+
function Ps() {
|
|
1786
1786
|
try {
|
|
1787
1787
|
return window.frameElement !== null;
|
|
1788
1788
|
} catch {
|
|
1789
1789
|
return !1;
|
|
1790
1790
|
}
|
|
1791
1791
|
}
|
|
1792
|
-
function
|
|
1792
|
+
function Rs() {
|
|
1793
1793
|
try {
|
|
1794
|
-
return
|
|
1794
|
+
return Ps() && window.top ? window.top.location : window.location;
|
|
1795
1795
|
} catch {
|
|
1796
1796
|
return window.location;
|
|
1797
1797
|
}
|
|
1798
1798
|
}
|
|
1799
|
-
function
|
|
1799
|
+
function Ts() {
|
|
1800
1800
|
var t;
|
|
1801
1801
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent);
|
|
1802
1802
|
}
|
|
1803
|
-
function
|
|
1803
|
+
function tn() {
|
|
1804
1804
|
var t, e;
|
|
1805
1805
|
return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1;
|
|
1806
1806
|
}
|
|
1807
|
-
const
|
|
1808
|
-
function
|
|
1807
|
+
const Ns = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';
|
|
1808
|
+
function nn() {
|
|
1809
1809
|
const t = document.createElement("style");
|
|
1810
|
-
t.type = "text/css", t.appendChild(document.createTextNode(
|
|
1810
|
+
t.type = "text/css", t.appendChild(document.createTextNode(Ns)), document.documentElement.appendChild(t);
|
|
1811
1811
|
}
|
|
1812
|
-
function
|
|
1812
|
+
function sn(t) {
|
|
1813
1813
|
var e, n, s = "";
|
|
1814
1814
|
if (typeof t == "string" || typeof t == "number") s += t;
|
|
1815
|
-
else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (n =
|
|
1815
|
+
else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (n = sn(t[e])) && (s && (s += " "), s += n);
|
|
1816
1816
|
else for (e in t) t[e] && (s && (s += " "), s += e);
|
|
1817
1817
|
return s;
|
|
1818
1818
|
}
|
|
1819
|
-
function
|
|
1820
|
-
for (var t, e, n = 0, s = ""; n < arguments.length; ) (t = arguments[n++]) && (e =
|
|
1819
|
+
function se() {
|
|
1820
|
+
for (var t, e, n = 0, s = ""; n < arguments.length; ) (t = arguments[n++]) && (e = sn(t)) && (s && (s += " "), s += e);
|
|
1821
1821
|
return s;
|
|
1822
1822
|
}
|
|
1823
|
-
var
|
|
1823
|
+
var ye, k, rn, K, ht, on, an, cn, Ze, Oe, Ue, fe = {}, pe = [], Ds = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ve = Array.isArray;
|
|
1824
1824
|
function W(t, e) {
|
|
1825
1825
|
for (var n in e) t[n] = e[n];
|
|
1826
1826
|
return t;
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1828
|
+
function Ge(t) {
|
|
1829
1829
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
1830
1830
|
}
|
|
1831
1831
|
function y(t, e, n) {
|
|
1832
1832
|
var s, i, r, o = {};
|
|
1833
1833
|
for (r in e) r == "key" ? s = e[r] : r == "ref" ? i = e[r] : o[r] = e[r];
|
|
1834
|
-
if (arguments.length > 2 && (o.children = arguments.length > 3 ?
|
|
1835
|
-
return
|
|
1834
|
+
if (arguments.length > 2 && (o.children = arguments.length > 3 ? ye.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (r in t.defaultProps) o[r] === void 0 && (o[r] = t.defaultProps[r]);
|
|
1835
|
+
return de(t, o, s, i, null);
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1838
|
-
var r = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++
|
|
1837
|
+
function de(t, e, n, s, i) {
|
|
1838
|
+
var r = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++rn, __i: -1, __u: 0 };
|
|
1839
1839
|
return i == null && k.vnode != null && k.vnode(r), r;
|
|
1840
1840
|
}
|
|
1841
|
-
function
|
|
1841
|
+
function ke(t) {
|
|
1842
1842
|
return t.children;
|
|
1843
1843
|
}
|
|
1844
|
-
function
|
|
1844
|
+
function he(t, e) {
|
|
1845
1845
|
this.props = t, this.context = e;
|
|
1846
1846
|
}
|
|
1847
1847
|
function Q(t, e) {
|
|
@@ -1849,38 +1849,42 @@ function Q(t, e) {
|
|
|
1849
1849
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
1850
1850
|
return typeof t.type == "function" ? Q(t) : null;
|
|
1851
1851
|
}
|
|
1852
|
-
function
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
t.__e = t.__c.base = n.__e;
|
|
1857
|
-
break;
|
|
1858
|
-
}
|
|
1859
|
-
return hn(t);
|
|
1852
|
+
function Os(t) {
|
|
1853
|
+
if (t.__P && t.__d) {
|
|
1854
|
+
var e = t.__v, n = e.__e, s = [], i = [], r = W({}, e);
|
|
1855
|
+
r.__v = e.__v + 1, k.vnode && k.vnode(r), Ye(t.__P, r, e, t.__n, t.__P.namespaceURI, 32 & e.__u ? [n] : null, s, n ?? Q(e), !!(32 & e.__u), i), r.__v = e.__v, r.__.__k[r.__i] = r, un(s, r, i), e.__e = e.__ = null, r.__e != n && ln(r);
|
|
1860
1856
|
}
|
|
1861
1857
|
}
|
|
1862
|
-
function
|
|
1863
|
-
(
|
|
1858
|
+
function ln(t) {
|
|
1859
|
+
if ((t = t.__) != null && t.__c != null) return t.__e = t.__c.base = null, t.__k.some(function(e) {
|
|
1860
|
+
if (e != null && e.__e != null) return t.__e = t.__c.base = e.__e;
|
|
1861
|
+
}), ln(t);
|
|
1862
|
+
}
|
|
1863
|
+
function ut(t) {
|
|
1864
|
+
(!t.__d && (t.__d = !0) && K.push(t) && !ge.__r++ || ht != k.debounceRendering) && ((ht = k.debounceRendering) || on)(ge);
|
|
1864
1865
|
}
|
|
1865
|
-
function
|
|
1866
|
-
|
|
1867
|
-
|
|
1866
|
+
function ge() {
|
|
1867
|
+
try {
|
|
1868
|
+
for (var t, e = 1; K.length; ) K.length > e && K.sort(an), t = K.shift(), e = K.length, Os(t);
|
|
1869
|
+
} finally {
|
|
1870
|
+
K.length = ge.__r = 0;
|
|
1871
|
+
}
|
|
1868
1872
|
}
|
|
1869
|
-
function
|
|
1870
|
-
var c, f, u, g, v, p, _, m = s && s.__k ||
|
|
1871
|
-
for (d =
|
|
1873
|
+
function dn(t, e, n, s, i, r, o, a, d, l, h) {
|
|
1874
|
+
var c, f, u, g, v, p, _, m = s && s.__k || pe, w = e.length;
|
|
1875
|
+
for (d = Us(n, e, m, d, w), c = 0; c < w; c++) (u = n.__k[c]) != null && (f = u.__i != -1 && m[u.__i] || fe, u.__i = c, p = Ye(t, u, f, i, r, o, a, d, l, h), g = u.__e, u.ref && f.ref != u.ref && (f.ref && Je(f.ref, null, u), h.push(u.ref, u.__c || g, u)), v == null && g != null && (v = g), (_ = !!(4 & u.__u)) || f.__k === u.__k ? d = hn(u, d, t, _) : typeof u.type == "function" && p !== void 0 ? d = p : g && (d = g.nextSibling), u.__u &= -7);
|
|
1872
1876
|
return n.__e = v, d;
|
|
1873
1877
|
}
|
|
1874
|
-
function
|
|
1878
|
+
function Us(t, e, n, s, i) {
|
|
1875
1879
|
var r, o, a, d, l, h = n.length, c = h, f = 0;
|
|
1876
|
-
for (t.__k = new Array(i), r = 0; r < i; r++) (o = e[r]) != null && typeof o != "boolean" && typeof o != "function" ? (
|
|
1877
|
-
if (c) for (r = 0; r < h; r++) (a = n[r]) != null && !(2 & a.__u) && (a.__e == s && (s = Q(a)),
|
|
1880
|
+
for (t.__k = new Array(i), r = 0; r < i; r++) (o = e[r]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = t.__k[r] = de(null, o, null, null, null) : ve(o) ? o = t.__k[r] = de(ke, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = t.__k[r] = de(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : t.__k[r] = o, d = r + f, o.__ = t, o.__b = t.__b + 1, a = null, (l = o.__i = js(o, n, d, c)) != -1 && (c--, (a = n[l]) && (a.__u |= 2)), a == null || a.__v == null ? (l == -1 && (i > h ? f-- : i < h && f++), typeof o.type != "function" && (o.__u |= 4)) : l != d && (l == d - 1 ? f-- : l == d + 1 ? f++ : (l > d ? f-- : f++, o.__u |= 4))) : t.__k[r] = null;
|
|
1881
|
+
if (c) for (r = 0; r < h; r++) (a = n[r]) != null && !(2 & a.__u) && (a.__e == s && (s = Q(a)), pn(a, a));
|
|
1878
1882
|
return s;
|
|
1879
1883
|
}
|
|
1880
|
-
function
|
|
1884
|
+
function hn(t, e, n, s) {
|
|
1881
1885
|
var i, r;
|
|
1882
1886
|
if (typeof t.type == "function") {
|
|
1883
|
-
for (i = t.__k, r = 0; i && r < i.length; r++) i[r] && (i[r].__ = t, e =
|
|
1887
|
+
for (i = t.__k, r = 0; i && r < i.length; r++) i[r] && (i[r].__ = t, e = hn(i[r], e, n, s));
|
|
1884
1888
|
return e;
|
|
1885
1889
|
}
|
|
1886
1890
|
t.__e != e && (s && (e && t.type && !e.parentNode && (e = Q(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
|
|
@@ -1889,25 +1893,25 @@ function fn(t, e, n, s) {
|
|
|
1889
1893
|
while (e != null && e.nodeType == 8);
|
|
1890
1894
|
return e;
|
|
1891
1895
|
}
|
|
1892
|
-
function
|
|
1896
|
+
function js(t, e, n, s) {
|
|
1893
1897
|
var i, r, o, a = t.key, d = t.type, l = e[n], h = l != null && (2 & l.__u) == 0;
|
|
1894
|
-
if (l === null &&
|
|
1898
|
+
if (l === null && a == null || h && a == l.key && d == l.type) return n;
|
|
1895
1899
|
if (s > (h ? 1 : 0)) {
|
|
1896
1900
|
for (i = n - 1, r = n + 1; i >= 0 || r < e.length; ) if ((l = e[o = i >= 0 ? i-- : r++]) != null && !(2 & l.__u) && a == l.key && d == l.type) return o;
|
|
1897
1901
|
}
|
|
1898
1902
|
return -1;
|
|
1899
1903
|
}
|
|
1900
|
-
function
|
|
1901
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" ||
|
|
1904
|
+
function ft(t, e, n) {
|
|
1905
|
+
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || Ds.test(e) ? n : n + "px";
|
|
1902
1906
|
}
|
|
1903
|
-
function
|
|
1907
|
+
function ce(t, e, n, s, i) {
|
|
1904
1908
|
var r, o;
|
|
1905
1909
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
1906
1910
|
else {
|
|
1907
|
-
if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n ||
|
|
1908
|
-
if (n) for (e in n) s && n[e] == s[e] ||
|
|
1911
|
+
if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n || ft(t.style, e, "");
|
|
1912
|
+
if (n) for (e in n) s && n[e] == s[e] || ft(t.style, e, n[e]);
|
|
1909
1913
|
}
|
|
1910
|
-
else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(
|
|
1914
|
+
else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(cn, "$1")), o = e.toLowerCase(), e = o in t || e == "onFocusOut" || e == "onFocusIn" ? o.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + r] = n, n ? s ? n.u = s.u : (n.u = Ze, t.addEventListener(e, r ? Ue : Oe, r)) : t.removeEventListener(e, r ? Ue : Oe, r);
|
|
1911
1915
|
else {
|
|
1912
1916
|
if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
1913
1917
|
else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
|
|
@@ -1918,60 +1922,57 @@ function he(t, e, n, s, i) {
|
|
|
1918
1922
|
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
1919
1923
|
}
|
|
1920
1924
|
}
|
|
1921
|
-
function
|
|
1925
|
+
function pt(t) {
|
|
1922
1926
|
return function(e) {
|
|
1923
1927
|
if (this.l) {
|
|
1924
1928
|
var n = this.l[e.type + t];
|
|
1925
|
-
if (e.t == null) e.t =
|
|
1929
|
+
if (e.t == null) e.t = Ze++;
|
|
1926
1930
|
else if (e.t < n.u) return;
|
|
1927
1931
|
return n(k.event ? k.event(e) : e);
|
|
1928
1932
|
}
|
|
1929
1933
|
};
|
|
1930
1934
|
}
|
|
1931
|
-
function
|
|
1932
|
-
var h, c, f, u, g, v, p, _, m, w,
|
|
1933
|
-
if (e.constructor
|
|
1935
|
+
function Ye(t, e, n, s, i, r, o, a, d, l) {
|
|
1936
|
+
var h, c, f, u, g, v, p, _, m, w, O, M, Qe, oe, Ee, P = e.type;
|
|
1937
|
+
if (e.constructor !== void 0) return null;
|
|
1934
1938
|
128 & n.__u && (d = !!(32 & n.__u), r = [a = e.__e = n.__e]), (h = k.__b) && h(e);
|
|
1935
|
-
e: if (typeof
|
|
1936
|
-
if (_ = e.props, m =
|
|
1939
|
+
e: if (typeof P == "function") try {
|
|
1940
|
+
if (_ = e.props, m = P.prototype && P.prototype.render, w = (h = P.contextType) && s[h.__c], O = h ? w ? w.props.value : h.__ : s, n.__c ? p = (c = e.__c = n.__c).__ = c.__E : (m ? e.__c = c = new P(_, O) : (e.__c = c = new he(_, O), c.constructor = P, c.render = Ws), w && w.sub(c), c.state || (c.state = {}), c.__n = s, f = c.__d = !0, c.__h = [], c._sb = []), m && c.__s == null && (c.__s = c.state), m && P.getDerivedStateFromProps != null && (c.__s == c.state && (c.__s = W({}, c.__s)), W(c.__s, P.getDerivedStateFromProps(_, c.__s))), u = c.props, g = c.state, c.__v = e, f) m && P.getDerivedStateFromProps == null && c.componentWillMount != null && c.componentWillMount(), m && c.componentDidMount != null && c.__h.push(c.componentDidMount);
|
|
1937
1941
|
else {
|
|
1938
|
-
if (m &&
|
|
1939
|
-
|
|
1942
|
+
if (m && P.getDerivedStateFromProps == null && _ !== u && c.componentWillReceiveProps != null && c.componentWillReceiveProps(_, O), e.__v == n.__v || !c.__e && c.shouldComponentUpdate != null && c.shouldComponentUpdate(_, c.__s, O) === !1) {
|
|
1943
|
+
e.__v != n.__v && (c.props = _, c.state = c.__s, c.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(Z) {
|
|
1940
1944
|
Z && (Z.__ = e);
|
|
1941
|
-
}),
|
|
1942
|
-
c._sb = [], c.__h.length && o.push(c);
|
|
1945
|
+
}), pe.push.apply(c.__h, c._sb), c._sb = [], c.__h.length && o.push(c);
|
|
1943
1946
|
break e;
|
|
1944
1947
|
}
|
|
1945
|
-
c.componentWillUpdate != null && c.componentWillUpdate(_, c.__s,
|
|
1948
|
+
c.componentWillUpdate != null && c.componentWillUpdate(_, c.__s, O), m && c.componentDidUpdate != null && c.__h.push(function() {
|
|
1946
1949
|
c.componentDidUpdate(u, g, v);
|
|
1947
1950
|
});
|
|
1948
1951
|
}
|
|
1949
|
-
if (c.context =
|
|
1950
|
-
|
|
1951
|
-
c.
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
while (c.__d && ++Xe < 25);
|
|
1955
|
-
c.state = c.__s, c.getChildContext != null && (s = W(W({}, s), c.getChildContext())), m && !f && c.getSnapshotBeforeUpdate != null && (v = c.getSnapshotBeforeUpdate(u, g)), ee = h, h != null && h.type === Ee && h.key == null && (ee = gn(h.props.children)), a = un(t, ke(ee) ? ee : [ee], e, n, s, i, r, o, a, d, l), c.base = e.__e, e.__u &= -161, c.__h.length && o.push(c), p && (c.__E = c.__ = null);
|
|
1952
|
+
if (c.context = O, c.props = _, c.__P = t, c.__e = !1, M = k.__r, Qe = 0, m) c.state = c.__s, c.__d = !1, M && M(e), h = c.render(c.props, c.state, c.context), pe.push.apply(c.__h, c._sb), c._sb = [];
|
|
1953
|
+
else do
|
|
1954
|
+
c.__d = !1, M && M(e), h = c.render(c.props, c.state, c.context), c.state = c.__s;
|
|
1955
|
+
while (c.__d && ++Qe < 25);
|
|
1956
|
+
c.state = c.__s, c.getChildContext != null && (s = W(W({}, s), c.getChildContext())), m && !f && c.getSnapshotBeforeUpdate != null && (v = c.getSnapshotBeforeUpdate(u, g)), oe = h != null && h.type === ke && h.key == null ? fn(h.props.children) : h, a = dn(t, ve(oe) ? oe : [oe], e, n, s, i, r, o, a, d, l), c.base = e.__e, e.__u &= -161, c.__h.length && o.push(c), p && (c.__E = c.__ = null);
|
|
1956
1957
|
} catch (Z) {
|
|
1957
1958
|
if (e.__v = null, d || r != null) if (Z.then) {
|
|
1958
1959
|
for (e.__u |= d ? 160 : 128; a && a.nodeType == 8 && a.nextSibling; ) a = a.nextSibling;
|
|
1959
1960
|
r[r.indexOf(a)] = null, e.__e = a;
|
|
1960
1961
|
} else {
|
|
1961
|
-
for (
|
|
1962
|
-
|
|
1962
|
+
for (Ee = r.length; Ee--; ) Ge(r[Ee]);
|
|
1963
|
+
je(e);
|
|
1963
1964
|
}
|
|
1964
|
-
else e.__e = n.__e, e.__k = n.__k, Z.then ||
|
|
1965
|
+
else e.__e = n.__e, e.__k = n.__k, Z.then || je(e);
|
|
1965
1966
|
k.__e(Z, e, n);
|
|
1966
1967
|
}
|
|
1967
|
-
else r == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : a = e.__e =
|
|
1968
|
+
else r == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : a = e.__e = Hs(n.__e, e, n, s, i, r, o, d, l);
|
|
1968
1969
|
return (h = k.diffed) && h(e), 128 & e.__u ? void 0 : a;
|
|
1969
1970
|
}
|
|
1970
|
-
function
|
|
1971
|
-
t && t.__c && (t.__c.__e = !0), t
|
|
1971
|
+
function je(t) {
|
|
1972
|
+
t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(je));
|
|
1972
1973
|
}
|
|
1973
|
-
function
|
|
1974
|
-
for (var s = 0; s < n.length; s++)
|
|
1974
|
+
function un(t, e, n) {
|
|
1975
|
+
for (var s = 0; s < n.length; s++) Je(n[s], n[++s], n[++s]);
|
|
1975
1976
|
k.__c && k.__c(e, t), t.some(function(i) {
|
|
1976
1977
|
try {
|
|
1977
1978
|
t = i.__h, i.__h = [], t.some(function(r) {
|
|
@@ -1982,11 +1983,11 @@ function pn(t, e, n) {
|
|
|
1982
1983
|
}
|
|
1983
1984
|
});
|
|
1984
1985
|
}
|
|
1985
|
-
function
|
|
1986
|
-
return typeof t != "object" || t == null || t.__b
|
|
1986
|
+
function fn(t) {
|
|
1987
|
+
return typeof t != "object" || t == null || t.__b > 0 ? t : ve(t) ? t.map(fn) : W({}, t);
|
|
1987
1988
|
}
|
|
1988
|
-
function
|
|
1989
|
-
var l, h, c, f, u, g, v, p = n.props, _ = e.props, m = e.type;
|
|
1989
|
+
function Hs(t, e, n, s, i, r, o, a, d) {
|
|
1990
|
+
var l, h, c, f, u, g, v, p = n.props || fe, _ = e.props, m = e.type;
|
|
1990
1991
|
if (m == "svg" ? i = "http://www.w3.org/2000/svg" : m == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), r != null) {
|
|
1991
1992
|
for (l = 0; l < r.length; l++) if ((u = r[l]) && "setAttribute" in u == !!m && (m ? u.localName == m : u.nodeType == 3)) {
|
|
1992
1993
|
t = u, r[l] = null;
|
|
@@ -1999,22 +2000,16 @@ function Ws(t, e, n, s, i, r, o, a, d) {
|
|
|
1999
2000
|
}
|
|
2000
2001
|
if (m == null) p === _ || a && t.data == _ || (t.data = _);
|
|
2001
2002
|
else {
|
|
2002
|
-
if (r = r &&
|
|
2003
|
-
for (l in p)
|
|
2004
|
-
|
|
2005
|
-
else if (!(l in _)) {
|
|
2006
|
-
if (l == "value" && "defaultValue" in _ || l == "checked" && "defaultChecked" in _) continue;
|
|
2007
|
-
he(t, l, null, u, i);
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
for (l in _) u = _[l], l == "children" ? f = u : l == "dangerouslySetInnerHTML" ? h = u : l == "value" ? g = u : l == "checked" ? v = u : a && typeof u != "function" || p[l] === u || he(t, l, u, p[l], i);
|
|
2003
|
+
if (r = r && ye.call(t.childNodes), !a && r != null) for (p = {}, l = 0; l < t.attributes.length; l++) p[(u = t.attributes[l]).name] = u.value;
|
|
2004
|
+
for (l in p) u = p[l], l == "dangerouslySetInnerHTML" ? c = u : l == "children" || l in _ || l == "value" && "defaultValue" in _ || l == "checked" && "defaultChecked" in _ || ce(t, l, null, u, i);
|
|
2005
|
+
for (l in _) u = _[l], l == "children" ? f = u : l == "dangerouslySetInnerHTML" ? h = u : l == "value" ? g = u : l == "checked" ? v = u : a && typeof u != "function" || p[l] === u || ce(t, l, u, p[l], i);
|
|
2011
2006
|
if (h) a || c && (h.__html == c.__html || h.__html == t.innerHTML) || (t.innerHTML = h.__html), e.__k = [];
|
|
2012
|
-
else if (c && (t.innerHTML = ""),
|
|
2013
|
-
a || (l = "value", m == "progress" && g == null ? t.removeAttribute("value") : g != null && (g !== t[l] || m == "progress" && !g || m == "option" && g != p[l]) &&
|
|
2007
|
+
else if (c && (t.innerHTML = ""), dn(e.type == "template" ? t.content : t, ve(f) ? f : [f], e, n, s, m == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, o, r ? r[0] : n.__k && Q(n, 0), a, d), r != null) for (l = r.length; l--; ) Ge(r[l]);
|
|
2008
|
+
a || (l = "value", m == "progress" && g == null ? t.removeAttribute("value") : g != null && (g !== t[l] || m == "progress" && !g || m == "option" && g != p[l]) && ce(t, l, g, p[l], i), l = "checked", v != null && v != t[l] && ce(t, l, v, p[l], i));
|
|
2014
2009
|
}
|
|
2015
2010
|
return t;
|
|
2016
2011
|
}
|
|
2017
|
-
function
|
|
2012
|
+
function Je(t, e, n) {
|
|
2018
2013
|
try {
|
|
2019
2014
|
if (typeof t == "function") {
|
|
2020
2015
|
var s = typeof t.__u == "function";
|
|
@@ -2024,9 +2019,9 @@ function Qe(t, e, n) {
|
|
|
2024
2019
|
k.__e(i, n);
|
|
2025
2020
|
}
|
|
2026
2021
|
}
|
|
2027
|
-
function
|
|
2022
|
+
function pn(t, e, n) {
|
|
2028
2023
|
var s, i;
|
|
2029
|
-
if (k.unmount && k.unmount(t), (s = t.ref) && (s.current && s.current != t.__e ||
|
|
2024
|
+
if (k.unmount && k.unmount(t), (s = t.ref) && (s.current && s.current != t.__e || Je(s, null, e)), (s = t.__c) != null) {
|
|
2030
2025
|
if (s.componentWillUnmount) try {
|
|
2031
2026
|
s.componentWillUnmount();
|
|
2032
2027
|
} catch (r) {
|
|
@@ -2034,56 +2029,56 @@ function _n(t, e, n) {
|
|
|
2034
2029
|
}
|
|
2035
2030
|
s.base = s.__P = null;
|
|
2036
2031
|
}
|
|
2037
|
-
if (s = t.__k) for (i = 0; i < s.length; i++) s[i] &&
|
|
2038
|
-
n ||
|
|
2032
|
+
if (s = t.__k) for (i = 0; i < s.length; i++) s[i] && pn(s[i], e, n || typeof t.type != "function");
|
|
2033
|
+
n || Ge(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
2039
2034
|
}
|
|
2040
|
-
function
|
|
2035
|
+
function Ws(t, e, n) {
|
|
2041
2036
|
return this.constructor(t, n);
|
|
2042
2037
|
}
|
|
2043
|
-
function
|
|
2038
|
+
function He(t, e, n) {
|
|
2044
2039
|
var s, i, r, o;
|
|
2045
|
-
e == document && (e = document.documentElement), k.__ && k.__(t, e), i = (s = !1) ? null : e.__k, r = [], o = [],
|
|
2040
|
+
e == document && (e = document.documentElement), k.__ && k.__(t, e), i = (s = !1) ? null : e.__k, r = [], o = [], Ye(e, t = e.__k = y(ke, null, [t]), i || fe, fe, e.namespaceURI, i ? null : e.firstChild ? ye.call(e.childNodes) : null, r, i ? i.__e : e.firstChild, s, o), un(r, t, o);
|
|
2046
2041
|
}
|
|
2047
|
-
|
|
2042
|
+
ye = pe.slice, k = { __e: function(t, e, n, s) {
|
|
2048
2043
|
for (var i, r, o; e = e.__; ) if ((i = e.__c) && !i.__) try {
|
|
2049
2044
|
if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, s || {}), o = i.__d), o) return i.__E = i;
|
|
2050
2045
|
} catch (a) {
|
|
2051
2046
|
t = a;
|
|
2052
2047
|
}
|
|
2053
2048
|
throw t;
|
|
2054
|
-
} },
|
|
2049
|
+
} }, rn = 0, he.prototype.setState = function(t, e) {
|
|
2055
2050
|
var n;
|
|
2056
|
-
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = W({}, this.state), typeof t == "function" && (t = t(W({}, n), this.props)), t && W(n, t), t != null && this.__v && (e && this._sb.push(e),
|
|
2057
|
-
},
|
|
2058
|
-
this.__v && (this.__e = !0, t && this.__h.push(t),
|
|
2059
|
-
},
|
|
2051
|
+
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = W({}, this.state), typeof t == "function" && (t = t(W({}, n), this.props)), t && W(n, t), t != null && this.__v && (e && this._sb.push(e), ut(this));
|
|
2052
|
+
}, he.prototype.forceUpdate = function(t) {
|
|
2053
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), ut(this));
|
|
2054
|
+
}, he.prototype.render = ke, K = [], on = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, an = function(t, e) {
|
|
2060
2055
|
return t.__v.__b - e.__v.__b;
|
|
2061
|
-
},
|
|
2062
|
-
var
|
|
2063
|
-
function
|
|
2064
|
-
x.__h && x.__h(C, t,
|
|
2056
|
+
}, ge.__r = 0, cn = /(PointerCapture)$|Capture$/i, Ze = 0, Oe = pt(!1), Ue = pt(!0);
|
|
2057
|
+
var _e, C, Le, gt, We = 0, gn = [], x = k, _t = x.__b, mt = x.__r, bt = x.diffed, wt = x.__c, yt = x.unmount, vt = x.__;
|
|
2058
|
+
function _n(t, e) {
|
|
2059
|
+
x.__h && x.__h(C, t, We || e), We = 0;
|
|
2065
2060
|
var n = C.__H || (C.__H = { __: [], __h: [] });
|
|
2066
2061
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
2067
2062
|
}
|
|
2068
|
-
function
|
|
2069
|
-
return
|
|
2063
|
+
function kt(t) {
|
|
2064
|
+
return We = 1, Bs(mn, t);
|
|
2070
2065
|
}
|
|
2071
|
-
function
|
|
2072
|
-
var s =
|
|
2073
|
-
if (s.t = t, !s.__c && (s.__ = [
|
|
2066
|
+
function Bs(t, e, n) {
|
|
2067
|
+
var s = _n(_e++, 2);
|
|
2068
|
+
if (s.t = t, !s.__c && (s.__ = [mn(void 0, e), function(a) {
|
|
2074
2069
|
var d = s.__N ? s.__N[0] : s.__[0], l = s.t(d, a);
|
|
2075
2070
|
d !== l && (s.__N = [l, s.__[1]], s.__c.setState({}));
|
|
2076
2071
|
}], s.__c = C, !C.__f)) {
|
|
2077
2072
|
var i = function(a, d, l) {
|
|
2078
2073
|
if (!s.__c.__H) return !0;
|
|
2079
2074
|
var h = s.__c.__H.__.filter(function(f) {
|
|
2080
|
-
return
|
|
2075
|
+
return f.__c;
|
|
2081
2076
|
});
|
|
2082
2077
|
if (h.every(function(f) {
|
|
2083
2078
|
return !f.__N;
|
|
2084
2079
|
})) return !r || r.call(this, a, d, l);
|
|
2085
2080
|
var c = s.__c.props !== a;
|
|
2086
|
-
return h.
|
|
2081
|
+
return h.some(function(f) {
|
|
2087
2082
|
if (f.__N) {
|
|
2088
2083
|
var u = f.__[0];
|
|
2089
2084
|
f.__ = f.__N, f.__N = void 0, u !== f.__[0] && (c = !0);
|
|
@@ -2102,83 +2097,86 @@ function qs(t, e, n) {
|
|
|
2102
2097
|
}
|
|
2103
2098
|
return s.__N || s.__;
|
|
2104
2099
|
}
|
|
2105
|
-
function
|
|
2106
|
-
var n =
|
|
2107
|
-
!x.__s &&
|
|
2100
|
+
function qs(t, e) {
|
|
2101
|
+
var n = _n(_e++, 3);
|
|
2102
|
+
!x.__s && Fs(n.__H, e) && (n.__ = t, n.u = e, C.__H.__h.push(n));
|
|
2108
2103
|
}
|
|
2109
|
-
function
|
|
2110
|
-
for (var t; t =
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2104
|
+
function Vs() {
|
|
2105
|
+
for (var t; t = gn.shift(); ) {
|
|
2106
|
+
var e = t.__H;
|
|
2107
|
+
if (t.__P && e) try {
|
|
2108
|
+
e.__h.some(ue), e.__h.some(Be), e.__h = [];
|
|
2109
|
+
} catch (n) {
|
|
2110
|
+
e.__h = [], x.__e(n, t.__v);
|
|
2111
|
+
}
|
|
2114
2112
|
}
|
|
2115
2113
|
}
|
|
2116
2114
|
x.__b = function(t) {
|
|
2117
|
-
C = null,
|
|
2115
|
+
C = null, _t && _t(t);
|
|
2118
2116
|
}, x.__ = function(t, e) {
|
|
2119
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
2117
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), vt && vt(t, e);
|
|
2120
2118
|
}, x.__r = function(t) {
|
|
2121
|
-
|
|
2119
|
+
mt && mt(t), _e = 0;
|
|
2122
2120
|
var e = (C = t.__c).__H;
|
|
2123
|
-
e && (
|
|
2121
|
+
e && (Le === C ? (e.__h = [], C.__h = [], e.__.some(function(n) {
|
|
2124
2122
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
2125
|
-
})) : (e.__h.
|
|
2123
|
+
})) : (e.__h.some(ue), e.__h.some(Be), e.__h = [], _e = 0)), Le = C;
|
|
2126
2124
|
}, x.diffed = function(t) {
|
|
2127
|
-
|
|
2125
|
+
bt && bt(t);
|
|
2128
2126
|
var e = t.__c;
|
|
2129
|
-
e && e.__H && (e.__H.__h.length && (
|
|
2127
|
+
e && e.__H && (e.__H.__h.length && (gn.push(e) !== 1 && gt === x.requestAnimationFrame || ((gt = x.requestAnimationFrame) || Ks)(Vs)), e.__H.__.some(function(n) {
|
|
2130
2128
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
2131
|
-
})),
|
|
2129
|
+
})), Le = C = null;
|
|
2132
2130
|
}, x.__c = function(t, e) {
|
|
2133
2131
|
e.some(function(n) {
|
|
2134
2132
|
try {
|
|
2135
|
-
n.__h.
|
|
2136
|
-
return !s.__ ||
|
|
2133
|
+
n.__h.some(ue), n.__h = n.__h.filter(function(s) {
|
|
2134
|
+
return !s.__ || Be(s);
|
|
2137
2135
|
});
|
|
2138
2136
|
} catch (s) {
|
|
2139
2137
|
e.some(function(i) {
|
|
2140
2138
|
i.__h && (i.__h = []);
|
|
2141
2139
|
}), e = [], x.__e(s, n.__v);
|
|
2142
2140
|
}
|
|
2143
|
-
}),
|
|
2141
|
+
}), wt && wt(t, e);
|
|
2144
2142
|
}, x.unmount = function(t) {
|
|
2145
|
-
|
|
2143
|
+
yt && yt(t);
|
|
2146
2144
|
var e, n = t.__c;
|
|
2147
|
-
n && n.__H && (n.__H.__.
|
|
2145
|
+
n && n.__H && (n.__H.__.some(function(s) {
|
|
2148
2146
|
try {
|
|
2149
|
-
|
|
2147
|
+
ue(s);
|
|
2150
2148
|
} catch (i) {
|
|
2151
2149
|
e = i;
|
|
2152
2150
|
}
|
|
2153
2151
|
}), n.__H = void 0, e && x.__e(e, n.__v));
|
|
2154
2152
|
};
|
|
2155
|
-
var
|
|
2156
|
-
function
|
|
2153
|
+
var Et = typeof requestAnimationFrame == "function";
|
|
2154
|
+
function Ks(t) {
|
|
2157
2155
|
var e, n = function() {
|
|
2158
|
-
clearTimeout(s),
|
|
2156
|
+
clearTimeout(s), Et && cancelAnimationFrame(e), setTimeout(t);
|
|
2159
2157
|
}, s = setTimeout(n, 35);
|
|
2160
|
-
|
|
2158
|
+
Et && (e = requestAnimationFrame(n));
|
|
2161
2159
|
}
|
|
2162
|
-
function
|
|
2160
|
+
function ue(t) {
|
|
2163
2161
|
var e = C, n = t.__c;
|
|
2164
2162
|
typeof n == "function" && (t.__c = void 0, n()), C = e;
|
|
2165
2163
|
}
|
|
2166
|
-
function
|
|
2164
|
+
function Be(t) {
|
|
2167
2165
|
var e = C;
|
|
2168
2166
|
t.__c = t.__(), C = e;
|
|
2169
2167
|
}
|
|
2170
|
-
function
|
|
2168
|
+
function Fs(t, e) {
|
|
2171
2169
|
return !t || t.length !== e.length || e.some(function(n, s) {
|
|
2172
2170
|
return n !== t[s];
|
|
2173
2171
|
});
|
|
2174
2172
|
}
|
|
2175
|
-
function
|
|
2173
|
+
function mn(t, e) {
|
|
2176
2174
|
return typeof e == "function" ? e(t) : e;
|
|
2177
2175
|
}
|
|
2178
|
-
const
|
|
2179
|
-
class
|
|
2176
|
+
const zs = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", $s = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", Zs = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";
|
|
2177
|
+
class Gs {
|
|
2180
2178
|
constructor() {
|
|
2181
|
-
this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode =
|
|
2179
|
+
this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = tn();
|
|
2182
2180
|
}
|
|
2183
2181
|
attach(e) {
|
|
2184
2182
|
this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render();
|
|
@@ -2193,21 +2191,21 @@ class Ys {
|
|
|
2193
2191
|
this.items.clear(), this.render();
|
|
2194
2192
|
}
|
|
2195
2193
|
render() {
|
|
2196
|
-
this.root &&
|
|
2194
|
+
this.root && He(y(
|
|
2197
2195
|
"div",
|
|
2198
2196
|
null,
|
|
2199
|
-
y(
|
|
2197
|
+
y(bn, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, n]) => y(Ys, Object.assign({}, n, { key: e }))))
|
|
2200
2198
|
), this.root);
|
|
2201
2199
|
}
|
|
2202
2200
|
}
|
|
2203
|
-
const
|
|
2201
|
+
const bn = (t) => y(
|
|
2204
2202
|
"div",
|
|
2205
|
-
{ class:
|
|
2206
|
-
y("style", null,
|
|
2203
|
+
{ class: se("-cbwsdk-snackbar-container") },
|
|
2204
|
+
y("style", null, zs),
|
|
2207
2205
|
y("div", { class: "-cbwsdk-snackbar" }, t.children)
|
|
2208
|
-
),
|
|
2209
|
-
const [s, i] =
|
|
2210
|
-
|
|
2206
|
+
), Ys = ({ autoExpand: t, message: e, menuItems: n }) => {
|
|
2207
|
+
const [s, i] = kt(!0), [r, o] = kt(t ?? !1);
|
|
2208
|
+
qs(() => {
|
|
2211
2209
|
const d = [
|
|
2212
2210
|
window.setTimeout(() => {
|
|
2213
2211
|
i(!1);
|
|
@@ -2225,11 +2223,11 @@ const yn = (t) => y(
|
|
|
2225
2223
|
};
|
|
2226
2224
|
return y(
|
|
2227
2225
|
"div",
|
|
2228
|
-
{ class:
|
|
2226
|
+
{ class: se("-cbwsdk-snackbar-instance", s && "-cbwsdk-snackbar-instance-hidden", r && "-cbwsdk-snackbar-instance-expanded") },
|
|
2229
2227
|
y(
|
|
2230
2228
|
"div",
|
|
2231
2229
|
{ class: "-cbwsdk-snackbar-instance-header", onClick: a },
|
|
2232
|
-
y("img", { src:
|
|
2230
|
+
y("img", { src: $s, class: "-cbwsdk-snackbar-instance-header-cblogo" }),
|
|
2233
2231
|
" ",
|
|
2234
2232
|
y("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e),
|
|
2235
2233
|
y(
|
|
@@ -2240,30 +2238,30 @@ const yn = (t) => y(
|
|
|
2240
2238
|
{ width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
2241
2239
|
y("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" })
|
|
2242
2240
|
),
|
|
2243
|
-
y("img", { src:
|
|
2241
|
+
y("img", { src: Zs, class: "-gear-icon", title: "Expand" })
|
|
2244
2242
|
)
|
|
2245
2243
|
),
|
|
2246
2244
|
n && n.length > 0 && y("div", { class: "-cbwsdk-snackbar-instance-menu" }, n.map((d, l) => y(
|
|
2247
2245
|
"div",
|
|
2248
|
-
{ class:
|
|
2246
|
+
{ class: se("-cbwsdk-snackbar-instance-menu-item", d.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: d.onClick, key: l },
|
|
2249
2247
|
y(
|
|
2250
2248
|
"svg",
|
|
2251
2249
|
{ width: d.svgWidth, height: d.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
2252
2250
|
y("path", { "fill-rule": d.defaultFillRule, "clip-rule": d.defaultClipRule, d: d.path, fill: "#AAAAAA" })
|
|
2253
2251
|
),
|
|
2254
|
-
y("span", { class:
|
|
2252
|
+
y("span", { class: se("-cbwsdk-snackbar-instance-menu-item-info", d.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, d.info)
|
|
2255
2253
|
)))
|
|
2256
2254
|
);
|
|
2257
2255
|
};
|
|
2258
|
-
class
|
|
2256
|
+
class Js {
|
|
2259
2257
|
constructor() {
|
|
2260
|
-
this.attached = !1, this.snackbar = new
|
|
2258
|
+
this.attached = !1, this.snackbar = new Gs();
|
|
2261
2259
|
}
|
|
2262
2260
|
attach() {
|
|
2263
2261
|
if (this.attached)
|
|
2264
2262
|
throw new Error("Coinbase Wallet SDK UI is already attached");
|
|
2265
2263
|
const e = document.documentElement, n = document.createElement("div");
|
|
2266
|
-
n.className = "-cbwsdk-css-reset", e.appendChild(n), this.snackbar.attach(n), this.attached = !0,
|
|
2264
|
+
n.className = "-cbwsdk-css-reset", e.appendChild(n), this.snackbar.attach(n), this.attached = !0, nn();
|
|
2267
2265
|
}
|
|
2268
2266
|
showConnecting(e) {
|
|
2269
2267
|
let n;
|
|
@@ -2309,14 +2307,14 @@ class Qs {
|
|
|
2309
2307
|
}, this.snackbar.presentItem(n);
|
|
2310
2308
|
}
|
|
2311
2309
|
}
|
|
2312
|
-
const
|
|
2313
|
-
class
|
|
2310
|
+
const Qs = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";
|
|
2311
|
+
class Xs {
|
|
2314
2312
|
constructor() {
|
|
2315
|
-
this.root = null, this.darkMode =
|
|
2313
|
+
this.root = null, this.darkMode = tn();
|
|
2316
2314
|
}
|
|
2317
2315
|
attach() {
|
|
2318
2316
|
const e = document.documentElement;
|
|
2319
|
-
this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root),
|
|
2317
|
+
this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), nn();
|
|
2320
2318
|
}
|
|
2321
2319
|
present(e) {
|
|
2322
2320
|
this.render(e);
|
|
@@ -2325,33 +2323,33 @@ class ei {
|
|
|
2325
2323
|
this.render(null);
|
|
2326
2324
|
}
|
|
2327
2325
|
render(e) {
|
|
2328
|
-
this.root && (
|
|
2326
|
+
this.root && (He(null, this.root), e && He(y(ei, Object.assign({}, e, { onDismiss: () => {
|
|
2329
2327
|
this.clear();
|
|
2330
2328
|
}, darkMode: this.darkMode })), this.root));
|
|
2331
2329
|
}
|
|
2332
2330
|
}
|
|
2333
|
-
const
|
|
2331
|
+
const ei = ({ title: t, buttonText: e, darkMode: n, onButtonClick: s, onDismiss: i }) => {
|
|
2334
2332
|
const r = n ? "dark" : "light";
|
|
2335
2333
|
return y(
|
|
2336
|
-
|
|
2334
|
+
bn,
|
|
2337
2335
|
{ darkMode: n },
|
|
2338
2336
|
y(
|
|
2339
2337
|
"div",
|
|
2340
2338
|
{ class: "-cbwsdk-redirect-dialog" },
|
|
2341
|
-
y("style", null,
|
|
2339
|
+
y("style", null, Qs),
|
|
2342
2340
|
y("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }),
|
|
2343
2341
|
y(
|
|
2344
2342
|
"div",
|
|
2345
|
-
{ class:
|
|
2343
|
+
{ class: se("-cbwsdk-redirect-dialog-box", r) },
|
|
2346
2344
|
y("p", null, t),
|
|
2347
2345
|
y("button", { onClick: s }, e)
|
|
2348
2346
|
)
|
|
2349
2347
|
)
|
|
2350
2348
|
);
|
|
2351
|
-
},
|
|
2352
|
-
class
|
|
2349
|
+
}, ti = "https://keys.coinbase.com/connect", ni = "http://rpc.wallet.coinbase.com", Ct = "https://www.walletlink.org", si = "https://go.cb-w.com/walletlink";
|
|
2350
|
+
class xt {
|
|
2353
2351
|
constructor() {
|
|
2354
|
-
this.attached = !1, this.redirectDialog = new
|
|
2352
|
+
this.attached = !1, this.redirectDialog = new Xs();
|
|
2355
2353
|
}
|
|
2356
2354
|
attach() {
|
|
2357
2355
|
if (this.attached)
|
|
@@ -2359,8 +2357,8 @@ class It {
|
|
|
2359
2357
|
this.redirectDialog.attach(), this.attached = !0;
|
|
2360
2358
|
}
|
|
2361
2359
|
redirectToCoinbaseWallet(e) {
|
|
2362
|
-
const n = new URL(
|
|
2363
|
-
n.searchParams.append("redirect_url",
|
|
2360
|
+
const n = new URL(si);
|
|
2361
|
+
n.searchParams.append("redirect_url", Rs().href), e && n.searchParams.append("wl_url", e);
|
|
2364
2362
|
const s = document.createElement("a");
|
|
2365
2363
|
s.target = "cbw-opener", s.href = n.href, s.rel = "noreferrer noopener", s.click();
|
|
2366
2364
|
}
|
|
@@ -2383,9 +2381,9 @@ class It {
|
|
|
2383
2381
|
}
|
|
2384
2382
|
class j {
|
|
2385
2383
|
constructor(e) {
|
|
2386
|
-
this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb =
|
|
2384
|
+
this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = Ts(), this.linkedUpdated = (r) => {
|
|
2387
2385
|
this.isLinked = r;
|
|
2388
|
-
const o = this.storage.getItem(
|
|
2386
|
+
const o = this.storage.getItem(Ne);
|
|
2389
2387
|
if (r && (this._session.linked = r), this.isUnlinkedErrorState = !1, o) {
|
|
2390
2388
|
const a = o.split(" "), d = this.storage.getItem("IsStandaloneSigning") === "true";
|
|
2391
2389
|
a[0] !== "" && !r && this._session.linked && !d && (this.isUnlinkedErrorState = !0);
|
|
@@ -2406,20 +2404,20 @@ class j {
|
|
|
2406
2404
|
}), j.accountRequestCallbackIds.clear());
|
|
2407
2405
|
}, this.resetAndReload = this.resetAndReload.bind(this), this.linkAPIUrl = e.linkAPIUrl, this.storage = e.storage, this.metadata = e.metadata, this.accountsCallback = e.accountsCallback, this.chainCallback = e.chainCallback;
|
|
2408
2406
|
const { session: n, ui: s, connection: i } = this.subscribe();
|
|
2409
|
-
this._session = n, this.connection = i, this.relayEventManager = new
|
|
2407
|
+
this._session = n, this.connection = i, this.relayEventManager = new ps(), this.ui = s, this.ui.attach();
|
|
2410
2408
|
}
|
|
2411
2409
|
subscribe() {
|
|
2412
|
-
const e = J.load(this.storage) || J.create(this.storage), { linkAPIUrl: n } = this, s = new
|
|
2410
|
+
const e = J.load(this.storage) || J.create(this.storage), { linkAPIUrl: n } = this, s = new fs({
|
|
2413
2411
|
session: e,
|
|
2414
2412
|
linkAPIUrl: n,
|
|
2415
2413
|
listener: this
|
|
2416
|
-
}), i = this.isMobileWeb ? new
|
|
2414
|
+
}), i = this.isMobileWeb ? new xt() : new Js();
|
|
2417
2415
|
return s.connect(), { session: e, ui: i, connection: s };
|
|
2418
2416
|
}
|
|
2419
2417
|
resetAndReload() {
|
|
2420
2418
|
this.connection.destroy().then(() => {
|
|
2421
2419
|
const e = J.load(this.storage);
|
|
2422
|
-
(e == null ? void 0 : e.id) === this._session.id &&
|
|
2420
|
+
(e == null ? void 0 : e.id) === this._session.id && D.clearAll(), document.location.reload();
|
|
2423
2421
|
}).catch((e) => {
|
|
2424
2422
|
});
|
|
2425
2423
|
}
|
|
@@ -2429,13 +2427,13 @@ class j {
|
|
|
2429
2427
|
params: {
|
|
2430
2428
|
fromAddress: e.fromAddress,
|
|
2431
2429
|
toAddress: e.toAddress,
|
|
2432
|
-
weiValue:
|
|
2433
|
-
data:
|
|
2430
|
+
weiValue: R(e.weiValue),
|
|
2431
|
+
data: ee(e.data, !0),
|
|
2434
2432
|
nonce: e.nonce,
|
|
2435
|
-
gasPriceInWei: e.gasPriceInWei ?
|
|
2436
|
-
maxFeePerGas: e.gasPriceInWei ?
|
|
2437
|
-
maxPriorityFeePerGas: e.gasPriceInWei ?
|
|
2438
|
-
gasLimit: e.gasLimit ?
|
|
2433
|
+
gasPriceInWei: e.gasPriceInWei ? R(e.gasPriceInWei) : null,
|
|
2434
|
+
maxFeePerGas: e.gasPriceInWei ? R(e.gasPriceInWei) : null,
|
|
2435
|
+
maxPriorityFeePerGas: e.gasPriceInWei ? R(e.gasPriceInWei) : null,
|
|
2436
|
+
gasLimit: e.gasLimit ? R(e.gasLimit) : null,
|
|
2439
2437
|
chainId: e.chainId,
|
|
2440
2438
|
shouldSubmit: !1
|
|
2441
2439
|
}
|
|
@@ -2447,13 +2445,13 @@ class j {
|
|
|
2447
2445
|
params: {
|
|
2448
2446
|
fromAddress: e.fromAddress,
|
|
2449
2447
|
toAddress: e.toAddress,
|
|
2450
|
-
weiValue:
|
|
2451
|
-
data:
|
|
2448
|
+
weiValue: R(e.weiValue),
|
|
2449
|
+
data: ee(e.data, !0),
|
|
2452
2450
|
nonce: e.nonce,
|
|
2453
|
-
gasPriceInWei: e.gasPriceInWei ?
|
|
2454
|
-
maxFeePerGas: e.maxFeePerGas ?
|
|
2455
|
-
maxPriorityFeePerGas: e.maxPriorityFeePerGas ?
|
|
2456
|
-
gasLimit: e.gasLimit ?
|
|
2451
|
+
gasPriceInWei: e.gasPriceInWei ? R(e.gasPriceInWei) : null,
|
|
2452
|
+
maxFeePerGas: e.maxFeePerGas ? R(e.maxFeePerGas) : null,
|
|
2453
|
+
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? R(e.maxPriorityFeePerGas) : null,
|
|
2454
|
+
gasLimit: e.gasLimit ? R(e.gasLimit) : null,
|
|
2457
2455
|
chainId: e.chainId,
|
|
2458
2456
|
shouldSubmit: !0
|
|
2459
2457
|
}
|
|
@@ -2463,7 +2461,7 @@ class j {
|
|
|
2463
2461
|
return this.sendRequest({
|
|
2464
2462
|
method: "submitEthereumTransaction",
|
|
2465
2463
|
params: {
|
|
2466
|
-
signedTransaction:
|
|
2464
|
+
signedTransaction: ee(e, !0),
|
|
2467
2465
|
chainId: n
|
|
2468
2466
|
}
|
|
2469
2467
|
});
|
|
@@ -2473,7 +2471,7 @@ class j {
|
|
|
2473
2471
|
}
|
|
2474
2472
|
sendRequest(e) {
|
|
2475
2473
|
let n = null;
|
|
2476
|
-
const s =
|
|
2474
|
+
const s = z(8), i = (r) => {
|
|
2477
2475
|
this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, e.method, r), n == null || n();
|
|
2478
2476
|
};
|
|
2479
2477
|
return new Promise((r, o) => {
|
|
@@ -2501,7 +2499,7 @@ class j {
|
|
|
2501
2499
|
}
|
|
2502
2500
|
// copied from MobileRelay
|
|
2503
2501
|
openCoinbaseWalletDeeplink(e) {
|
|
2504
|
-
if (this.ui instanceof
|
|
2502
|
+
if (this.ui instanceof xt)
|
|
2505
2503
|
switch (e) {
|
|
2506
2504
|
case "requestEthereumAccounts":
|
|
2507
2505
|
case "switchEthereumChain":
|
|
@@ -2551,7 +2549,7 @@ class j {
|
|
|
2551
2549
|
appName: e,
|
|
2552
2550
|
appLogoUrl: n
|
|
2553
2551
|
}
|
|
2554
|
-
}, i =
|
|
2552
|
+
}, i = z(8);
|
|
2555
2553
|
return new Promise((r, o) => {
|
|
2556
2554
|
this.relayEventManager.callbacks.set(i, (a) => {
|
|
2557
2555
|
if (I(a))
|
|
@@ -2575,7 +2573,7 @@ class j {
|
|
|
2575
2573
|
}
|
|
2576
2574
|
};
|
|
2577
2575
|
let d = null;
|
|
2578
|
-
const l =
|
|
2576
|
+
const l = z(8), h = (c) => {
|
|
2579
2577
|
this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, c), d == null || d();
|
|
2580
2578
|
};
|
|
2581
2579
|
return d = this.ui.showConnecting({
|
|
@@ -2604,7 +2602,7 @@ class j {
|
|
|
2604
2602
|
}
|
|
2605
2603
|
};
|
|
2606
2604
|
let d = null;
|
|
2607
|
-
const l =
|
|
2605
|
+
const l = z(8), h = (c) => {
|
|
2608
2606
|
this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, c), d == null || d();
|
|
2609
2607
|
};
|
|
2610
2608
|
return d = this.ui.showConnecting({
|
|
@@ -2626,7 +2624,7 @@ class j {
|
|
|
2626
2624
|
params: Object.assign({ chainId: e }, { address: n })
|
|
2627
2625
|
};
|
|
2628
2626
|
let i = null;
|
|
2629
|
-
const r =
|
|
2627
|
+
const r = z(8), o = (a) => {
|
|
2630
2628
|
this.publishWeb3RequestCanceledEvent(r), this.handleErrorResponse(r, s.method, a), i == null || i();
|
|
2631
2629
|
};
|
|
2632
2630
|
return i = this.ui.showConnecting({
|
|
@@ -2649,11 +2647,11 @@ class j {
|
|
|
2649
2647
|
}
|
|
2650
2648
|
}
|
|
2651
2649
|
j.accountRequestCallbackIds = /* @__PURE__ */ new Set();
|
|
2652
|
-
const
|
|
2653
|
-
class
|
|
2650
|
+
const It = "DefaultChainId", St = "DefaultJsonRpcUrl";
|
|
2651
|
+
class wn {
|
|
2654
2652
|
constructor(e) {
|
|
2655
|
-
this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new
|
|
2656
|
-
const n = this._storage.getItem(
|
|
2653
|
+
this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new D("walletlink", Ct), this.callback = e.callback || null;
|
|
2654
|
+
const n = this._storage.getItem(Ne);
|
|
2657
2655
|
if (n) {
|
|
2658
2656
|
const s = n.split(" ");
|
|
2659
2657
|
s[0] !== "" && (this._addresses = s.map((i) => B(i)));
|
|
@@ -2672,16 +2670,16 @@ class vn {
|
|
|
2672
2670
|
}
|
|
2673
2671
|
get jsonRpcUrl() {
|
|
2674
2672
|
var e;
|
|
2675
|
-
return (e = this._storage.getItem(
|
|
2673
|
+
return (e = this._storage.getItem(St)) !== null && e !== void 0 ? e : void 0;
|
|
2676
2674
|
}
|
|
2677
2675
|
set jsonRpcUrl(e) {
|
|
2678
|
-
this._storage.setItem(
|
|
2676
|
+
this._storage.setItem(St, e);
|
|
2679
2677
|
}
|
|
2680
2678
|
updateProviderInfo(e, n) {
|
|
2681
2679
|
var s;
|
|
2682
2680
|
this.jsonRpcUrl = e;
|
|
2683
2681
|
const i = this.getChainId();
|
|
2684
|
-
this._storage.setItem(
|
|
2682
|
+
this._storage.setItem(It, n.toString(10)), te(n) !== i && ((s = this.callback) === null || s === void 0 || s.call(this, "chainChanged", F(n)));
|
|
2685
2683
|
}
|
|
2686
2684
|
async watchAsset(e) {
|
|
2687
2685
|
const n = Array.isArray(e) ? e[0] : e;
|
|
@@ -2730,7 +2728,7 @@ class vn {
|
|
|
2730
2728
|
if (!Array.isArray(e))
|
|
2731
2729
|
throw new Error("addresses is not an array");
|
|
2732
2730
|
const i = e.map((r) => B(r));
|
|
2733
|
-
JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (s = this.callback) === null || s === void 0 || s.call(this, "accountsChanged", i), this._storage.setItem(
|
|
2731
|
+
JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (s = this.callback) === null || s === void 0 || s.call(this, "accountsChanged", i), this._storage.setItem(Ne, i.join(" ")));
|
|
2734
2732
|
}
|
|
2735
2733
|
async request(e) {
|
|
2736
2734
|
const n = e.params || [];
|
|
@@ -2742,7 +2740,7 @@ class vn {
|
|
|
2742
2740
|
case "net_version":
|
|
2743
2741
|
return this.getChainId().toString(10);
|
|
2744
2742
|
case "eth_chainId":
|
|
2745
|
-
return
|
|
2743
|
+
return F(this.getChainId());
|
|
2746
2744
|
case "eth_requestAccounts":
|
|
2747
2745
|
return this._eth_requestAccounts();
|
|
2748
2746
|
case "eth_ecRecover":
|
|
@@ -2770,7 +2768,7 @@ class vn {
|
|
|
2770
2768
|
default:
|
|
2771
2769
|
if (!this.jsonRpcUrl)
|
|
2772
2770
|
throw b.rpc.internal("No RPC URL set for chain");
|
|
2773
|
-
return
|
|
2771
|
+
return $e(e, this.jsonRpcUrl);
|
|
2774
2772
|
}
|
|
2775
2773
|
}
|
|
2776
2774
|
_ensureKnownAddress(e) {
|
|
@@ -2783,7 +2781,7 @@ class vn {
|
|
|
2783
2781
|
if (!n)
|
|
2784
2782
|
throw new Error("Ethereum address is unavailable");
|
|
2785
2783
|
this._ensureKnownAddress(n);
|
|
2786
|
-
const s = e.to ? B(e.to) : null, i = e.value != null ?
|
|
2784
|
+
const s = e.to ? B(e.to) : null, i = e.value != null ? X(e.value) : BigInt(0), r = e.data ? Te(e.data) : Buffer.alloc(0), o = e.nonce != null ? te(e.nonce) : null, a = e.gasPrice != null ? X(e.gasPrice) : null, d = e.maxFeePerGas != null ? X(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? X(e.maxPriorityFeePerGas) : null, h = e.gas != null ? X(e.gas) : null, c = e.chainId ? te(e.chainId) : this.getChainId();
|
|
2787
2785
|
return {
|
|
2788
2786
|
fromAddress: n,
|
|
2789
2787
|
toAddress: s,
|
|
@@ -2804,8 +2802,8 @@ class vn {
|
|
|
2804
2802
|
const r = await this.initializeRelay().sendRequest({
|
|
2805
2803
|
method: "ethereumAddressFromSignedMessage",
|
|
2806
2804
|
params: {
|
|
2807
|
-
message:
|
|
2808
|
-
signature:
|
|
2805
|
+
message: Ce(s[0]),
|
|
2806
|
+
signature: Ce(s[1]),
|
|
2809
2807
|
addPrefix: n === "personal_ecRecover"
|
|
2810
2808
|
}
|
|
2811
2809
|
});
|
|
@@ -2815,18 +2813,18 @@ class vn {
|
|
|
2815
2813
|
}
|
|
2816
2814
|
getChainId() {
|
|
2817
2815
|
var e;
|
|
2818
|
-
return Number.parseInt((e = this._storage.getItem(
|
|
2816
|
+
return Number.parseInt((e = this._storage.getItem(It)) !== null && e !== void 0 ? e : "1", 10);
|
|
2819
2817
|
}
|
|
2820
2818
|
async _eth_requestAccounts() {
|
|
2821
2819
|
var e, n;
|
|
2822
2820
|
if (this._addresses.length > 0)
|
|
2823
|
-
return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId:
|
|
2821
|
+
return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: F(this.getChainId()) }), this._addresses;
|
|
2824
2822
|
const i = await this.initializeRelay().requestEthereumAccounts();
|
|
2825
2823
|
if (I(i))
|
|
2826
2824
|
throw i;
|
|
2827
2825
|
if (!i.result)
|
|
2828
2826
|
throw new Error("accounts received is empty");
|
|
2829
|
-
return this._setAddresses(i.result), (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId:
|
|
2827
|
+
return this._setAddresses(i.result), (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId: F(this.getChainId()) }), this._addresses;
|
|
2830
2828
|
}
|
|
2831
2829
|
async personalSign({ params: e }) {
|
|
2832
2830
|
if (!Array.isArray(e))
|
|
@@ -2837,7 +2835,7 @@ class vn {
|
|
|
2837
2835
|
method: "signEthereumMessage",
|
|
2838
2836
|
params: {
|
|
2839
2837
|
address: B(n),
|
|
2840
|
-
message:
|
|
2838
|
+
message: Ce(s),
|
|
2841
2839
|
addPrefix: !0,
|
|
2842
2840
|
typedDataJson: null
|
|
2843
2841
|
}
|
|
@@ -2853,7 +2851,7 @@ class vn {
|
|
|
2853
2851
|
return i.result;
|
|
2854
2852
|
}
|
|
2855
2853
|
async _eth_sendRawTransaction(e) {
|
|
2856
|
-
const n =
|
|
2854
|
+
const n = Te(e[0]), i = await this.initializeRelay().submitEthereumTransaction(n, this.getChainId());
|
|
2857
2855
|
if (I(i))
|
|
2858
2856
|
throw i;
|
|
2859
2857
|
return i.result;
|
|
@@ -2870,13 +2868,13 @@ class vn {
|
|
|
2870
2868
|
throw b.rpc.invalidParams();
|
|
2871
2869
|
const i = (l) => {
|
|
2872
2870
|
const h = {
|
|
2873
|
-
eth_signTypedData_v1:
|
|
2874
|
-
eth_signTypedData_v3:
|
|
2875
|
-
eth_signTypedData_v4:
|
|
2876
|
-
eth_signTypedData:
|
|
2871
|
+
eth_signTypedData_v1: ae.hashForSignTypedDataLegacy,
|
|
2872
|
+
eth_signTypedData_v3: ae.hashForSignTypedData_v3,
|
|
2873
|
+
eth_signTypedData_v4: ae.hashForSignTypedData_v4,
|
|
2874
|
+
eth_signTypedData: ae.hashForSignTypedData_v4
|
|
2877
2875
|
};
|
|
2878
|
-
return
|
|
2879
|
-
data:
|
|
2876
|
+
return ee(h[n]({
|
|
2877
|
+
data: Rn(l)
|
|
2880
2878
|
}), !0);
|
|
2881
2879
|
}, r = s[n === "eth_signTypedData_v1" ? 1 : 0], o = s[n === "eth_signTypedData_v1" ? 0 : 1];
|
|
2882
2880
|
this._ensureKnownAddress(r);
|
|
@@ -2895,7 +2893,7 @@ class vn {
|
|
|
2895
2893
|
}
|
|
2896
2894
|
initializeRelay() {
|
|
2897
2895
|
return this._relay || (this._relay = new j({
|
|
2898
|
-
linkAPIUrl:
|
|
2896
|
+
linkAPIUrl: Ct,
|
|
2899
2897
|
storage: this._storage,
|
|
2900
2898
|
metadata: this.metadata,
|
|
2901
2899
|
accountsCallback: this._setAddresses.bind(this),
|
|
@@ -2903,16 +2901,16 @@ class vn {
|
|
|
2903
2901
|
})), this._relay;
|
|
2904
2902
|
}
|
|
2905
2903
|
}
|
|
2906
|
-
const
|
|
2907
|
-
function
|
|
2908
|
-
return
|
|
2904
|
+
const yn = "SignerType", vn = new D("CBWSDK", "SignerConfigurator");
|
|
2905
|
+
function ii() {
|
|
2906
|
+
return vn.getItem(yn);
|
|
2909
2907
|
}
|
|
2910
|
-
function
|
|
2911
|
-
|
|
2908
|
+
function ri(t) {
|
|
2909
|
+
vn.setItem(yn, t);
|
|
2912
2910
|
}
|
|
2913
|
-
async function
|
|
2911
|
+
async function oi(t) {
|
|
2914
2912
|
const { communicator: e, metadata: n, handshakeRequest: s, callback: i } = t;
|
|
2915
|
-
|
|
2913
|
+
ci(e, n, i).catch(() => {
|
|
2916
2914
|
});
|
|
2917
2915
|
const r = {
|
|
2918
2916
|
id: crypto.randomUUID(),
|
|
@@ -2921,25 +2919,25 @@ async function ai(t) {
|
|
|
2921
2919
|
}, { data: o } = await e.postRequestAndWaitForResponse(r);
|
|
2922
2920
|
return o;
|
|
2923
2921
|
}
|
|
2924
|
-
function
|
|
2922
|
+
function ai(t) {
|
|
2925
2923
|
const { signerType: e, metadata: n, communicator: s, callback: i } = t;
|
|
2926
2924
|
switch (e) {
|
|
2927
2925
|
case "scw":
|
|
2928
|
-
return new
|
|
2926
|
+
return new zn({
|
|
2929
2927
|
metadata: n,
|
|
2930
2928
|
callback: i,
|
|
2931
2929
|
communicator: s
|
|
2932
2930
|
});
|
|
2933
2931
|
case "walletlink":
|
|
2934
|
-
return new
|
|
2932
|
+
return new wn({
|
|
2935
2933
|
metadata: n,
|
|
2936
2934
|
callback: i
|
|
2937
2935
|
});
|
|
2938
2936
|
}
|
|
2939
2937
|
}
|
|
2940
|
-
async function
|
|
2938
|
+
async function ci(t, e, n) {
|
|
2941
2939
|
await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest");
|
|
2942
|
-
const s = new
|
|
2940
|
+
const s = new wn({
|
|
2943
2941
|
metadata: e,
|
|
2944
2942
|
callback: n
|
|
2945
2943
|
});
|
|
@@ -2951,9 +2949,9 @@ async function li(t, e, n) {
|
|
|
2951
2949
|
data: { connected: !0 }
|
|
2952
2950
|
});
|
|
2953
2951
|
}
|
|
2954
|
-
const
|
|
2952
|
+
const li = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app.
|
|
2955
2953
|
|
|
2956
|
-
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,
|
|
2954
|
+
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, di = () => {
|
|
2957
2955
|
let t;
|
|
2958
2956
|
return {
|
|
2959
2957
|
getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t,
|
|
@@ -2969,36 +2967,36 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene
|
|
|
2969
2967
|
if (!n.ok)
|
|
2970
2968
|
throw new Error(`HTTP error! status: ${n.status}`);
|
|
2971
2969
|
const s = n.headers.get("Cross-Origin-Opener-Policy");
|
|
2972
|
-
t = s ?? "null", t === "same-origin" && console.error(
|
|
2970
|
+
t = s ?? "null", t === "same-origin" && console.error(li);
|
|
2973
2971
|
} catch (e) {
|
|
2974
2972
|
console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error";
|
|
2975
2973
|
}
|
|
2976
2974
|
}
|
|
2977
2975
|
};
|
|
2978
|
-
}, { checkCrossOriginOpenerPolicy:
|
|
2979
|
-
function
|
|
2980
|
-
const e = (window.innerWidth -
|
|
2981
|
-
|
|
2982
|
-
const s = `wallet_${crypto.randomUUID()}`, i = window.open(t, s, `width=${
|
|
2976
|
+
}, { checkCrossOriginOpenerPolicy: hi, getCrossOriginOpenerPolicy: ui } = di(), At = 420, Mt = 540;
|
|
2977
|
+
function fi(t) {
|
|
2978
|
+
const e = (window.innerWidth - At) / 2 + window.screenX, n = (window.innerHeight - Mt) / 2 + window.screenY;
|
|
2979
|
+
gi(t);
|
|
2980
|
+
const s = `wallet_${crypto.randomUUID()}`, i = window.open(t, s, `width=${At}, height=${Mt}, left=${e}, top=${n}`);
|
|
2983
2981
|
if (i == null || i.focus(), !i)
|
|
2984
2982
|
throw b.rpc.internal("Pop up window failed to open");
|
|
2985
2983
|
return i;
|
|
2986
2984
|
}
|
|
2987
|
-
function
|
|
2985
|
+
function pi(t) {
|
|
2988
2986
|
t && !t.closed && t.close();
|
|
2989
2987
|
}
|
|
2990
|
-
function
|
|
2988
|
+
function gi(t) {
|
|
2991
2989
|
const e = {
|
|
2992
|
-
sdkName:
|
|
2993
|
-
sdkVersion:
|
|
2990
|
+
sdkName: Vt,
|
|
2991
|
+
sdkVersion: re,
|
|
2994
2992
|
origin: window.location.origin,
|
|
2995
|
-
coop:
|
|
2993
|
+
coop: ui()
|
|
2996
2994
|
};
|
|
2997
2995
|
for (const [n, s] of Object.entries(e))
|
|
2998
2996
|
t.searchParams.append(n, s.toString());
|
|
2999
2997
|
}
|
|
3000
|
-
class
|
|
3001
|
-
constructor({ url: e =
|
|
2998
|
+
class _i {
|
|
2999
|
+
constructor({ url: e = ti, metadata: n, preference: s }) {
|
|
3002
3000
|
this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => {
|
|
3003
3001
|
(await this.waitForPopupLoaded()).postMessage(i, this.url.origin);
|
|
3004
3002
|
}, this.postRequestAndWaitForResponse = async (i) => {
|
|
@@ -3013,15 +3011,15 @@ class mi {
|
|
|
3013
3011
|
};
|
|
3014
3012
|
window.addEventListener("message", a), this.listeners.set(a, { reject: o });
|
|
3015
3013
|
}), this.disconnect = () => {
|
|
3016
|
-
|
|
3014
|
+
pi(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, r) => {
|
|
3017
3015
|
i(b.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", r);
|
|
3018
3016
|
}), this.listeners.clear();
|
|
3019
|
-
}, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup =
|
|
3017
|
+
}, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = fi(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => {
|
|
3020
3018
|
}), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => {
|
|
3021
3019
|
this.postMessage({
|
|
3022
3020
|
requestId: i.id,
|
|
3023
3021
|
data: {
|
|
3024
|
-
version:
|
|
3022
|
+
version: re,
|
|
3025
3023
|
metadata: this.metadata,
|
|
3026
3024
|
preference: this.preference,
|
|
3027
3025
|
location: window.location.toString()
|
|
@@ -3034,13 +3032,13 @@ class mi {
|
|
|
3034
3032
|
})), this.url = new URL(e), this.metadata = n, this.preference = s;
|
|
3035
3033
|
}
|
|
3036
3034
|
}
|
|
3037
|
-
function
|
|
3038
|
-
const e =
|
|
3035
|
+
function mi(t) {
|
|
3036
|
+
const e = Sn(bi(t), {
|
|
3039
3037
|
shouldIncludeStack: !0
|
|
3040
3038
|
}), n = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");
|
|
3041
|
-
return n.searchParams.set("version",
|
|
3039
|
+
return n.searchParams.set("version", re), n.searchParams.set("code", e.code.toString()), n.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: n.href });
|
|
3042
3040
|
}
|
|
3043
|
-
function
|
|
3041
|
+
function bi(t) {
|
|
3044
3042
|
var e;
|
|
3045
3043
|
if (typeof t == "string")
|
|
3046
3044
|
return {
|
|
@@ -3057,7 +3055,7 @@ function wi(t) {
|
|
|
3057
3055
|
}
|
|
3058
3056
|
return t;
|
|
3059
3057
|
}
|
|
3060
|
-
var
|
|
3058
|
+
var kn = { exports: {} };
|
|
3061
3059
|
(function(t) {
|
|
3062
3060
|
var e = Object.prototype.hasOwnProperty, n = "~";
|
|
3063
3061
|
function s() {
|
|
@@ -3117,8 +3115,8 @@ var Cn = { exports: {} };
|
|
|
3117
3115
|
m[w - 1] = arguments[w];
|
|
3118
3116
|
p.fn.apply(p.context, m);
|
|
3119
3117
|
} else {
|
|
3120
|
-
var
|
|
3121
|
-
for (w = 0; w <
|
|
3118
|
+
var O = p.length, M;
|
|
3119
|
+
for (w = 0; w < O; w++)
|
|
3122
3120
|
switch (p[w].once && this.removeListener(l, p[w].fn, void 0, !0), _) {
|
|
3123
3121
|
case 1:
|
|
3124
3122
|
p[w].fn.call(p[w].context);
|
|
@@ -3133,8 +3131,8 @@ var Cn = { exports: {} };
|
|
|
3133
3131
|
p[w].fn.call(p[w].context, h, c, f);
|
|
3134
3132
|
break;
|
|
3135
3133
|
default:
|
|
3136
|
-
if (!m) for (
|
|
3137
|
-
m[
|
|
3134
|
+
if (!m) for (M = 1, m = new Array(_ - 1); M < _; M++)
|
|
3135
|
+
m[M - 1] = arguments[M];
|
|
3138
3136
|
p[w].fn.apply(p[w].context, m);
|
|
3139
3137
|
}
|
|
3140
3138
|
}
|
|
@@ -3161,12 +3159,12 @@ var Cn = { exports: {} };
|
|
|
3161
3159
|
var h;
|
|
3162
3160
|
return l ? (h = n ? n + l : l, this._events[h] && o(this, h)) : (this._events = new s(), this._eventsCount = 0), this;
|
|
3163
3161
|
}, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = n, a.EventEmitter = a, t.exports = a;
|
|
3164
|
-
})(
|
|
3165
|
-
var
|
|
3166
|
-
const
|
|
3167
|
-
class
|
|
3162
|
+
})(kn);
|
|
3163
|
+
var wi = kn.exports;
|
|
3164
|
+
const yi = /* @__PURE__ */ Lt(wi);
|
|
3165
|
+
class vi extends yi {
|
|
3168
3166
|
}
|
|
3169
|
-
var
|
|
3167
|
+
var ki = function(t, e) {
|
|
3170
3168
|
var n = {};
|
|
3171
3169
|
for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (n[s] = t[s]);
|
|
3172
3170
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -3174,24 +3172,24 @@ var Ei = function(t, e) {
|
|
|
3174
3172
|
e.indexOf(s[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[i]) && (n[s[i]] = t[s[i]]);
|
|
3175
3173
|
return n;
|
|
3176
3174
|
};
|
|
3177
|
-
class
|
|
3175
|
+
class Ei extends vi {
|
|
3178
3176
|
constructor(e) {
|
|
3179
|
-
var { metadata: n } = e, s = e.preference, { keysUrl: i } = s, r =
|
|
3180
|
-
super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = n, this.preference = r, this.communicator = new
|
|
3177
|
+
var { metadata: n } = e, s = e.preference, { keysUrl: i } = s, r = ki(s, ["keysUrl"]);
|
|
3178
|
+
super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = n, this.preference = r, this.communicator = new _i({
|
|
3181
3179
|
url: i,
|
|
3182
3180
|
metadata: n,
|
|
3183
3181
|
preference: r
|
|
3184
3182
|
});
|
|
3185
|
-
const o =
|
|
3183
|
+
const o = ii();
|
|
3186
3184
|
o && (this.signer = this.initSigner(o));
|
|
3187
3185
|
}
|
|
3188
3186
|
async request(e) {
|
|
3189
3187
|
try {
|
|
3190
|
-
if (
|
|
3188
|
+
if (Fn(e), !this.signer)
|
|
3191
3189
|
switch (e.method) {
|
|
3192
3190
|
case "eth_requestAccounts": {
|
|
3193
3191
|
const n = await this.requestSignerSelection(e), s = this.initSigner(n);
|
|
3194
|
-
await s.handshake(e), this.signer = s,
|
|
3192
|
+
await s.handshake(e), this.signer = s, ri(n);
|
|
3195
3193
|
break;
|
|
3196
3194
|
}
|
|
3197
3195
|
case "wallet_sendCalls": {
|
|
@@ -3201,18 +3199,18 @@ class Ci extends ki {
|
|
|
3201
3199
|
return await n.cleanup(), s;
|
|
3202
3200
|
}
|
|
3203
3201
|
case "wallet_getCallsStatus":
|
|
3204
|
-
return
|
|
3202
|
+
return $e(e, ni);
|
|
3205
3203
|
case "net_version":
|
|
3206
3204
|
return 1;
|
|
3207
3205
|
case "eth_chainId":
|
|
3208
|
-
return
|
|
3206
|
+
return F(1);
|
|
3209
3207
|
default:
|
|
3210
3208
|
throw b.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");
|
|
3211
3209
|
}
|
|
3212
3210
|
return await this.signer.request(e);
|
|
3213
3211
|
} catch (n) {
|
|
3214
3212
|
const { code: s } = n;
|
|
3215
|
-
return s === E.provider.unauthorized && this.disconnect(), Promise.reject(
|
|
3213
|
+
return s === E.provider.unauthorized && this.disconnect(), Promise.reject(mi(n));
|
|
3216
3214
|
}
|
|
3217
3215
|
}
|
|
3218
3216
|
/** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */
|
|
@@ -3223,10 +3221,10 @@ class Ci extends ki {
|
|
|
3223
3221
|
}
|
|
3224
3222
|
async disconnect() {
|
|
3225
3223
|
var e;
|
|
3226
|
-
await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null,
|
|
3224
|
+
await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, D.clearAll(), this.emit("disconnect", b.provider.disconnected("User initiated disconnection"));
|
|
3227
3225
|
}
|
|
3228
3226
|
requestSignerSelection(e) {
|
|
3229
|
-
return
|
|
3227
|
+
return oi({
|
|
3230
3228
|
communicator: this.communicator,
|
|
3231
3229
|
preference: this.preference,
|
|
3232
3230
|
metadata: this.metadata,
|
|
@@ -3235,7 +3233,7 @@ class Ci extends ki {
|
|
|
3235
3233
|
});
|
|
3236
3234
|
}
|
|
3237
3235
|
initSigner(e) {
|
|
3238
|
-
return
|
|
3236
|
+
return ai({
|
|
3239
3237
|
signerType: e,
|
|
3240
3238
|
metadata: this.metadata,
|
|
3241
3239
|
communicator: this.communicator,
|
|
@@ -3243,7 +3241,7 @@ class Ci extends ki {
|
|
|
3243
3241
|
});
|
|
3244
3242
|
}
|
|
3245
3243
|
}
|
|
3246
|
-
function
|
|
3244
|
+
function Ci(t) {
|
|
3247
3245
|
if (t) {
|
|
3248
3246
|
if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options))
|
|
3249
3247
|
throw new Error(`Invalid options: ${t.options}`);
|
|
@@ -3251,19 +3249,19 @@ function xi(t) {
|
|
|
3251
3249
|
throw new Error("Attribution cannot contain both auto and dataSuffix properties");
|
|
3252
3250
|
}
|
|
3253
3251
|
}
|
|
3254
|
-
class
|
|
3252
|
+
class Ii {
|
|
3255
3253
|
constructor(e) {
|
|
3256
3254
|
this.metadata = {
|
|
3257
3255
|
appName: e.appName || "Dapp",
|
|
3258
|
-
appLogoUrl: e.appLogoUrl ||
|
|
3256
|
+
appLogoUrl: e.appLogoUrl || Nn(),
|
|
3259
3257
|
appChainIds: e.appChainIds || []
|
|
3260
|
-
}, this.storeLatestVersion(),
|
|
3258
|
+
}, this.storeLatestVersion(), hi();
|
|
3261
3259
|
}
|
|
3262
3260
|
makeWeb3Provider(e = { options: "all" }) {
|
|
3263
3261
|
var n;
|
|
3264
|
-
|
|
3262
|
+
Ci(e);
|
|
3265
3263
|
const s = { metadata: this.metadata, preference: e };
|
|
3266
|
-
return (n =
|
|
3264
|
+
return (n = Kn(s)) !== null && n !== void 0 ? n : new Ei(s);
|
|
3267
3265
|
}
|
|
3268
3266
|
/**
|
|
3269
3267
|
* Official Coinbase Wallet logo for developers to use on their frontend
|
|
@@ -3272,13 +3270,13 @@ class Si {
|
|
|
3272
3270
|
* @returns SVG Data URI
|
|
3273
3271
|
*/
|
|
3274
3272
|
getCoinbaseWalletLogo(e, n = 240) {
|
|
3275
|
-
return
|
|
3273
|
+
return Cn(e, n);
|
|
3276
3274
|
}
|
|
3277
3275
|
storeLatestVersion() {
|
|
3278
|
-
new
|
|
3276
|
+
new D("CBWSDK").setItem("VERSION", re);
|
|
3279
3277
|
}
|
|
3280
3278
|
}
|
|
3281
3279
|
export {
|
|
3282
|
-
|
|
3283
|
-
|
|
3280
|
+
Ii as CoinbaseWalletSDK,
|
|
3281
|
+
Ii as default
|
|
3284
3282
|
};
|