@springmicro/auth 0.7.20 → 0.7.22
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-BXGGyb0l.js → Index-1e31d199-BKxhThhF.js} +1 -1
- package/dist/{Index-6078f122-DGZJdnAZ.js → Index-6078f122-DZtwh1V7.js} +1 -1
- package/dist/{Web3Auth-DG8Yz_cD.js → Web3Auth-CYZ2tXRd.js} +12 -14
- package/dist/hashTypedData-DSWDPZpk.js +2035 -0
- package/dist/{index-BYJic99M.js → index-BQclNTiM.js} +33 -33
- package/dist/index-C_5temok.js +15181 -0
- package/dist/{index-C8R4klyg.js → index-D43Guca7.js} +27 -27
- package/dist/{index-BXvsDp0W.js → index-DEONFj0_.js} +933 -1157
- package/dist/{index-B51q7F_W.js → index-DcaYmCtZ.js} +1419 -1384
- package/dist/index-k1B2fiIe.js +384 -0
- package/dist/{index-hDobpv7u.js → index-nqI1BAVh.js} +3 -3
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +279 -313
- package/dist/native-BXgFvfgl.js +15 -0
- package/dist/number-D7MFtzNG.js +1752 -0
- package/dist/{parseEther-C7cmMVOE.js → parseEther-B1tMovDx.js} +1 -1
- package/dist/sha256-D3FUdNrs.js +178 -0
- package/dist/utils-DbgAoL44.js +119 -0
- package/package.json +2 -2
- package/dist/hmac-CW2mnXa8.js +0 -47
- package/dist/index-Bfb6JoQf.js +0 -21225
- package/dist/index-CBbDq4vF.js +0 -13520
- package/dist/index-DbQi7wFl.js +0 -547
- package/dist/number-DvQcSzeP.js +0 -1512
- package/dist/sha256-C90UGNQg.js +0 -326
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { bJ as
|
|
2
|
-
|
|
1
|
+
import { bJ as gn, bK as Et } from "./Web3Auth-CYZ2tXRd.js";
|
|
2
|
+
import { s as _n } from "./sha256-D3FUdNrs.js";
|
|
3
|
+
import { b as mn } from "./utils-DbgAoL44.js";
|
|
4
|
+
const wn = (t, e) => {
|
|
3
5
|
let n;
|
|
4
6
|
switch (t) {
|
|
5
7
|
case "standard":
|
|
@@ -18,7 +20,7 @@ const Cn = (t, e) => {
|
|
|
18
20
|
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
21
|
}
|
|
20
22
|
};
|
|
21
|
-
class
|
|
23
|
+
class N {
|
|
22
24
|
constructor(e, n) {
|
|
23
25
|
this.scope = e, this.module = n;
|
|
24
26
|
}
|
|
@@ -50,7 +52,7 @@ class D {
|
|
|
50
52
|
return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`;
|
|
51
53
|
}
|
|
52
54
|
static clearAll() {
|
|
53
|
-
new
|
|
55
|
+
new N("CBWSDK").clear(), new N("walletlink").clear();
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
const E = {
|
|
@@ -75,7 +77,7 @@ const E = {
|
|
|
75
77
|
chainDisconnected: 4901,
|
|
76
78
|
unsupportedChain: 4902
|
|
77
79
|
}
|
|
78
|
-
},
|
|
80
|
+
}, Se = {
|
|
79
81
|
"-32700": {
|
|
80
82
|
standard: "JSON RPC 2.0",
|
|
81
83
|
message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
|
|
@@ -144,92 +146,92 @@ const E = {
|
|
|
144
146
|
standard: "EIP-3085",
|
|
145
147
|
message: "Unrecognized chain ID."
|
|
146
148
|
}
|
|
147
|
-
},
|
|
148
|
-
function
|
|
149
|
+
}, Ct = "Unspecified error message.", yn = "Unspecified server error.";
|
|
150
|
+
function Oe(t, e = Ct) {
|
|
149
151
|
if (t && Number.isInteger(t)) {
|
|
150
152
|
const n = t.toString();
|
|
151
|
-
if (
|
|
152
|
-
return
|
|
153
|
-
if (
|
|
154
|
-
return
|
|
153
|
+
if (xe(Se, n))
|
|
154
|
+
return Se[n].message;
|
|
155
|
+
if (It(t))
|
|
156
|
+
return yn;
|
|
155
157
|
}
|
|
156
158
|
return e;
|
|
157
159
|
}
|
|
158
|
-
function
|
|
160
|
+
function bn(t) {
|
|
159
161
|
if (!Number.isInteger(t))
|
|
160
162
|
return !1;
|
|
161
163
|
const e = t.toString();
|
|
162
|
-
return !!(
|
|
164
|
+
return !!(Se[e] || It(t));
|
|
163
165
|
}
|
|
164
|
-
function
|
|
166
|
+
function vn(t, { shouldIncludeStack: e = !1 } = {}) {
|
|
165
167
|
const n = {};
|
|
166
|
-
if (t && typeof t == "object" && !Array.isArray(t) &&
|
|
168
|
+
if (t && typeof t == "object" && !Array.isArray(t) && xe(t, "code") && bn(t.code)) {
|
|
167
169
|
const s = t;
|
|
168
|
-
n.code = s.code, s.message && typeof s.message == "string" ? (n.message = s.message,
|
|
170
|
+
n.code = s.code, s.message && typeof s.message == "string" ? (n.message = s.message, xe(s, "data") && (n.data = s.data)) : (n.message = Oe(n.code), n.data = { originalError: $e(t) });
|
|
169
171
|
} else
|
|
170
|
-
n.code = E.rpc.internal, n.message =
|
|
171
|
-
return e && (n.stack =
|
|
172
|
+
n.code = E.rpc.internal, n.message = Ze(t, "message") ? t.message : Ct, n.data = { originalError: $e(t) };
|
|
173
|
+
return e && (n.stack = Ze(t, "stack") ? t.stack : void 0), n;
|
|
172
174
|
}
|
|
173
|
-
function
|
|
175
|
+
function It(t) {
|
|
174
176
|
return t >= -32099 && t <= -32e3;
|
|
175
177
|
}
|
|
176
|
-
function
|
|
178
|
+
function $e(t) {
|
|
177
179
|
return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t;
|
|
178
180
|
}
|
|
179
|
-
function
|
|
181
|
+
function xe(t, e) {
|
|
180
182
|
return Object.prototype.hasOwnProperty.call(t, e);
|
|
181
183
|
}
|
|
182
|
-
function
|
|
184
|
+
function Ze(t, e) {
|
|
183
185
|
return typeof t == "object" && t !== null && e in t && typeof t[e] == "string";
|
|
184
186
|
}
|
|
185
|
-
const
|
|
187
|
+
const w = {
|
|
186
188
|
rpc: {
|
|
187
|
-
parse: (t) =>
|
|
188
|
-
invalidRequest: (t) =>
|
|
189
|
-
invalidParams: (t) =>
|
|
190
|
-
methodNotFound: (t) =>
|
|
191
|
-
internal: (t) =>
|
|
189
|
+
parse: (t) => M(E.rpc.parse, t),
|
|
190
|
+
invalidRequest: (t) => M(E.rpc.invalidRequest, t),
|
|
191
|
+
invalidParams: (t) => M(E.rpc.invalidParams, t),
|
|
192
|
+
methodNotFound: (t) => M(E.rpc.methodNotFound, t),
|
|
193
|
+
internal: (t) => M(E.rpc.internal, t),
|
|
192
194
|
server: (t) => {
|
|
193
195
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
194
196
|
throw new Error("Ethereum RPC Server errors must provide single object argument.");
|
|
195
197
|
const { code: e } = t;
|
|
196
198
|
if (!Number.isInteger(e) || e > -32005 || e < -32099)
|
|
197
199
|
throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');
|
|
198
|
-
return
|
|
200
|
+
return M(e, t);
|
|
199
201
|
},
|
|
200
|
-
invalidInput: (t) =>
|
|
201
|
-
resourceNotFound: (t) =>
|
|
202
|
-
resourceUnavailable: (t) =>
|
|
203
|
-
transactionRejected: (t) =>
|
|
204
|
-
methodNotSupported: (t) =>
|
|
205
|
-
limitExceeded: (t) =>
|
|
202
|
+
invalidInput: (t) => M(E.rpc.invalidInput, t),
|
|
203
|
+
resourceNotFound: (t) => M(E.rpc.resourceNotFound, t),
|
|
204
|
+
resourceUnavailable: (t) => M(E.rpc.resourceUnavailable, t),
|
|
205
|
+
transactionRejected: (t) => M(E.rpc.transactionRejected, t),
|
|
206
|
+
methodNotSupported: (t) => M(E.rpc.methodNotSupported, t),
|
|
207
|
+
limitExceeded: (t) => M(E.rpc.limitExceeded, t)
|
|
206
208
|
},
|
|
207
209
|
provider: {
|
|
208
|
-
userRejectedRequest: (t) =>
|
|
209
|
-
unauthorized: (t) =>
|
|
210
|
-
unsupportedMethod: (t) =>
|
|
211
|
-
disconnected: (t) =>
|
|
212
|
-
chainDisconnected: (t) =>
|
|
213
|
-
unsupportedChain: (t) =>
|
|
210
|
+
userRejectedRequest: (t) => F(E.provider.userRejectedRequest, t),
|
|
211
|
+
unauthorized: (t) => F(E.provider.unauthorized, t),
|
|
212
|
+
unsupportedMethod: (t) => F(E.provider.unsupportedMethod, t),
|
|
213
|
+
disconnected: (t) => F(E.provider.disconnected, t),
|
|
214
|
+
chainDisconnected: (t) => F(E.provider.chainDisconnected, t),
|
|
215
|
+
unsupportedChain: (t) => F(E.provider.unsupportedChain, t),
|
|
214
216
|
custom: (t) => {
|
|
215
217
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
216
218
|
throw new Error("Ethereum Provider custom errors must provide single object argument.");
|
|
217
219
|
const { code: e, message: n, data: s } = t;
|
|
218
220
|
if (!n || typeof n != "string")
|
|
219
221
|
throw new Error('"message" must be a nonempty string');
|
|
220
|
-
return new
|
|
222
|
+
return new Mt(e, n, s);
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
};
|
|
224
|
-
function
|
|
225
|
-
const [n, s] =
|
|
226
|
-
return new
|
|
226
|
+
function M(t, e) {
|
|
227
|
+
const [n, s] = St(e);
|
|
228
|
+
return new xt(t, n || Oe(t), s);
|
|
227
229
|
}
|
|
228
|
-
function
|
|
229
|
-
const [n, s] =
|
|
230
|
-
return new
|
|
230
|
+
function F(t, e) {
|
|
231
|
+
const [n, s] = St(e);
|
|
232
|
+
return new Mt(t, n || Oe(t), s);
|
|
231
233
|
}
|
|
232
|
-
function
|
|
234
|
+
function St(t) {
|
|
233
235
|
if (t) {
|
|
234
236
|
if (typeof t == "string")
|
|
235
237
|
return [t];
|
|
@@ -242,7 +244,7 @@ function Tt(t) {
|
|
|
242
244
|
}
|
|
243
245
|
return [];
|
|
244
246
|
}
|
|
245
|
-
class
|
|
247
|
+
class xt extends Error {
|
|
246
248
|
constructor(e, n, s) {
|
|
247
249
|
if (!Number.isInteger(e))
|
|
248
250
|
throw new Error('"code" must be an integer.');
|
|
@@ -251,145 +253,145 @@ class Nt extends Error {
|
|
|
251
253
|
super(n), this.code = e, s !== void 0 && (this.data = s);
|
|
252
254
|
}
|
|
253
255
|
}
|
|
254
|
-
class
|
|
256
|
+
class Mt extends xt {
|
|
255
257
|
/**
|
|
256
258
|
* Create an Ethereum Provider JSON-RPC error.
|
|
257
259
|
* `code` must be an integer in the 1000 <= 4999 range.
|
|
258
260
|
*/
|
|
259
261
|
constructor(e, n, s) {
|
|
260
|
-
if (!
|
|
262
|
+
if (!kn(e))
|
|
261
263
|
throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');
|
|
262
264
|
super(e, n, s);
|
|
263
265
|
}
|
|
264
266
|
}
|
|
265
|
-
function
|
|
267
|
+
function kn(t) {
|
|
266
268
|
return Number.isInteger(t) && t >= 1e3 && t <= 4999;
|
|
267
269
|
}
|
|
268
|
-
function
|
|
270
|
+
function je() {
|
|
269
271
|
return (t) => t;
|
|
270
272
|
}
|
|
271
|
-
const
|
|
272
|
-
function
|
|
273
|
+
const te = je(), En = je(), Cn = je();
|
|
274
|
+
function O(t) {
|
|
273
275
|
return Math.floor(t);
|
|
274
276
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
277
|
-
return
|
|
277
|
+
const At = /^[0-9]*$/, Lt = /^[a-f0-9]*$/;
|
|
278
|
+
function K(t) {
|
|
279
|
+
return Ue(crypto.getRandomValues(new Uint8Array(t)));
|
|
278
280
|
}
|
|
279
|
-
function
|
|
281
|
+
function Ue(t) {
|
|
280
282
|
return [...t].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
281
283
|
}
|
|
282
|
-
function
|
|
284
|
+
function ae(t) {
|
|
283
285
|
return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16)));
|
|
284
286
|
}
|
|
285
|
-
function
|
|
287
|
+
function J(t, e = !1) {
|
|
286
288
|
const n = t.toString("hex");
|
|
287
|
-
return
|
|
289
|
+
return te(e ? `0x${n}` : n);
|
|
288
290
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
291
|
+
function be(t) {
|
|
292
|
+
return J(Me(t), !0);
|
|
291
293
|
}
|
|
292
294
|
function R(t) {
|
|
293
|
-
return
|
|
295
|
+
return Cn(t.toString(10));
|
|
294
296
|
}
|
|
295
|
-
function
|
|
296
|
-
return
|
|
297
|
+
function q(t) {
|
|
298
|
+
return te(`0x${BigInt(t).toString(16)}`);
|
|
297
299
|
}
|
|
298
|
-
function
|
|
300
|
+
function Pt(t) {
|
|
299
301
|
return t.startsWith("0x") || t.startsWith("0X");
|
|
300
302
|
}
|
|
301
|
-
function
|
|
302
|
-
return
|
|
303
|
+
function We(t) {
|
|
304
|
+
return Pt(t) ? t.slice(2) : t;
|
|
303
305
|
}
|
|
304
|
-
function
|
|
305
|
-
return
|
|
306
|
+
function Rt(t) {
|
|
307
|
+
return Pt(t) ? `0x${t.slice(2)}` : `0x${t}`;
|
|
306
308
|
}
|
|
307
|
-
function
|
|
309
|
+
function pe(t) {
|
|
308
310
|
if (typeof t != "string")
|
|
309
311
|
return !1;
|
|
310
|
-
const e =
|
|
311
|
-
return
|
|
312
|
+
const e = We(t).toLowerCase();
|
|
313
|
+
return Lt.test(e);
|
|
312
314
|
}
|
|
313
|
-
function
|
|
315
|
+
function In(t, e = !1) {
|
|
314
316
|
if (typeof t == "string") {
|
|
315
|
-
const n =
|
|
316
|
-
if (
|
|
317
|
-
return
|
|
317
|
+
const n = We(t).toLowerCase();
|
|
318
|
+
if (Lt.test(n))
|
|
319
|
+
return te(e ? `0x${n}` : n);
|
|
318
320
|
}
|
|
319
|
-
throw
|
|
321
|
+
throw w.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`);
|
|
320
322
|
}
|
|
321
|
-
function
|
|
322
|
-
let n =
|
|
323
|
-
return n.length % 2 === 1 && (n =
|
|
323
|
+
function He(t, e = !1) {
|
|
324
|
+
let n = In(t, !1);
|
|
325
|
+
return n.length % 2 === 1 && (n = te(`0${n}`)), e ? te(`0x${n}`) : n;
|
|
324
326
|
}
|
|
325
|
-
function
|
|
327
|
+
function H(t) {
|
|
326
328
|
if (typeof t == "string") {
|
|
327
|
-
const e =
|
|
328
|
-
if (
|
|
329
|
-
return
|
|
329
|
+
const e = We(t).toLowerCase();
|
|
330
|
+
if (pe(e) && e.length === 40)
|
|
331
|
+
return En(Rt(e));
|
|
330
332
|
}
|
|
331
|
-
throw
|
|
333
|
+
throw w.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`);
|
|
332
334
|
}
|
|
333
|
-
function
|
|
335
|
+
function Me(t) {
|
|
334
336
|
if (Buffer.isBuffer(t))
|
|
335
337
|
return t;
|
|
336
338
|
if (typeof t == "string") {
|
|
337
|
-
if (
|
|
338
|
-
const e =
|
|
339
|
+
if (pe(t)) {
|
|
340
|
+
const e = He(t, !1);
|
|
339
341
|
return Buffer.from(e, "hex");
|
|
340
342
|
}
|
|
341
343
|
return Buffer.from(t, "utf8");
|
|
342
344
|
}
|
|
343
|
-
throw
|
|
345
|
+
throw w.rpc.invalidParams(`Not binary data: ${String(t)}`);
|
|
344
346
|
}
|
|
345
|
-
function
|
|
347
|
+
function Q(t) {
|
|
346
348
|
if (typeof t == "number" && Number.isInteger(t))
|
|
347
|
-
return
|
|
349
|
+
return O(t);
|
|
348
350
|
if (typeof t == "string") {
|
|
349
|
-
if (
|
|
350
|
-
return
|
|
351
|
-
if (
|
|
352
|
-
return
|
|
351
|
+
if (At.test(t))
|
|
352
|
+
return O(Number(t));
|
|
353
|
+
if (pe(t))
|
|
354
|
+
return O(Number(BigInt(He(t, !0))));
|
|
353
355
|
}
|
|
354
|
-
throw
|
|
356
|
+
throw w.rpc.invalidParams(`Not an integer: ${String(t)}`);
|
|
355
357
|
}
|
|
356
|
-
function
|
|
357
|
-
if (t !== null && (typeof t == "bigint" ||
|
|
358
|
+
function Y(t) {
|
|
359
|
+
if (t !== null && (typeof t == "bigint" || xn(t)))
|
|
358
360
|
return BigInt(t.toString(10));
|
|
359
361
|
if (typeof t == "number")
|
|
360
|
-
return BigInt(
|
|
362
|
+
return BigInt(Q(t));
|
|
361
363
|
if (typeof t == "string") {
|
|
362
|
-
if (
|
|
364
|
+
if (At.test(t))
|
|
363
365
|
return BigInt(t);
|
|
364
|
-
if (
|
|
365
|
-
return BigInt(
|
|
366
|
+
if (pe(t))
|
|
367
|
+
return BigInt(He(t, !0));
|
|
366
368
|
}
|
|
367
|
-
throw
|
|
369
|
+
throw w.rpc.invalidParams(`Not an integer: ${String(t)}`);
|
|
368
370
|
}
|
|
369
|
-
function
|
|
371
|
+
function Sn(t) {
|
|
370
372
|
if (typeof t == "string")
|
|
371
373
|
return JSON.parse(t);
|
|
372
374
|
if (typeof t == "object")
|
|
373
375
|
return t;
|
|
374
|
-
throw
|
|
376
|
+
throw w.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`);
|
|
375
377
|
}
|
|
376
|
-
function
|
|
378
|
+
function xn(t) {
|
|
377
379
|
if (t == null || typeof t.constructor != "function")
|
|
378
380
|
return !1;
|
|
379
381
|
const { constructor: e } = t;
|
|
380
382
|
return typeof e.config == "function" && typeof e.EUCLID == "number";
|
|
381
383
|
}
|
|
382
|
-
function
|
|
384
|
+
function Mn() {
|
|
383
385
|
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
386
|
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
387
|
}
|
|
386
|
-
async function
|
|
388
|
+
async function An() {
|
|
387
389
|
return crypto.subtle.generateKey({
|
|
388
390
|
name: "ECDH",
|
|
389
391
|
namedCurve: "P-256"
|
|
390
392
|
}, !0, ["deriveKey"]);
|
|
391
393
|
}
|
|
392
|
-
async function
|
|
394
|
+
async function Ln(t, e) {
|
|
393
395
|
return crypto.subtle.deriveKey({
|
|
394
396
|
name: "ECDH",
|
|
395
397
|
public: e
|
|
@@ -398,21 +400,21 @@ async function On(t, e) {
|
|
|
398
400
|
length: 256
|
|
399
401
|
}, !1, ["encrypt", "decrypt"]);
|
|
400
402
|
}
|
|
401
|
-
async function
|
|
403
|
+
async function Pn(t, e) {
|
|
402
404
|
const n = crypto.getRandomValues(new Uint8Array(12)), s = await crypto.subtle.encrypt({
|
|
403
405
|
name: "AES-GCM",
|
|
404
406
|
iv: n
|
|
405
407
|
}, t, new TextEncoder().encode(e));
|
|
406
408
|
return { iv: n, cipherText: s };
|
|
407
409
|
}
|
|
408
|
-
async function
|
|
410
|
+
async function Rn(t, { iv: e, cipherText: n }) {
|
|
409
411
|
const s = await crypto.subtle.decrypt({
|
|
410
412
|
name: "AES-GCM",
|
|
411
413
|
iv: e
|
|
412
414
|
}, t, n);
|
|
413
415
|
return new TextDecoder().decode(s);
|
|
414
416
|
}
|
|
415
|
-
function
|
|
417
|
+
function Tt(t) {
|
|
416
418
|
switch (t) {
|
|
417
419
|
case "public":
|
|
418
420
|
return "spki";
|
|
@@ -420,42 +422,42 @@ function Wt(t) {
|
|
|
420
422
|
return "pkcs8";
|
|
421
423
|
}
|
|
422
424
|
}
|
|
423
|
-
async function
|
|
424
|
-
const n =
|
|
425
|
-
return
|
|
425
|
+
async function Nt(t, e) {
|
|
426
|
+
const n = Tt(t), s = await crypto.subtle.exportKey(n, e);
|
|
427
|
+
return Ue(new Uint8Array(s));
|
|
426
428
|
}
|
|
427
|
-
async function
|
|
428
|
-
const n =
|
|
429
|
+
async function Dt(t, e) {
|
|
430
|
+
const n = Tt(t), s = ae(e).buffer;
|
|
429
431
|
return await crypto.subtle.importKey(n, new Uint8Array(s), {
|
|
430
432
|
name: "ECDH",
|
|
431
433
|
namedCurve: "P-256"
|
|
432
434
|
}, !0, t === "private" ? ["deriveKey"] : []);
|
|
433
435
|
}
|
|
434
|
-
async function
|
|
436
|
+
async function Tn(t, e) {
|
|
435
437
|
const n = JSON.stringify(t, (s, i) => {
|
|
436
438
|
if (!(i instanceof Error))
|
|
437
439
|
return i;
|
|
438
440
|
const r = i;
|
|
439
441
|
return Object.assign(Object.assign({}, r.code ? { code: r.code } : {}), { message: r.message });
|
|
440
442
|
});
|
|
441
|
-
return
|
|
443
|
+
return Pn(e, n);
|
|
442
444
|
}
|
|
443
|
-
async function
|
|
444
|
-
return JSON.parse(await
|
|
445
|
+
async function Nn(t, e) {
|
|
446
|
+
return JSON.parse(await Rn(e, t));
|
|
445
447
|
}
|
|
446
|
-
const
|
|
448
|
+
const ve = {
|
|
447
449
|
storageKey: "ownPrivateKey",
|
|
448
450
|
keyType: "private"
|
|
449
|
-
},
|
|
451
|
+
}, ke = {
|
|
450
452
|
storageKey: "ownPublicKey",
|
|
451
453
|
keyType: "public"
|
|
452
|
-
},
|
|
454
|
+
}, Ee = {
|
|
453
455
|
storageKey: "peerPublicKey",
|
|
454
456
|
keyType: "public"
|
|
455
457
|
};
|
|
456
|
-
class
|
|
458
|
+
class Dn {
|
|
457
459
|
constructor() {
|
|
458
|
-
this.storage = new
|
|
460
|
+
this.storage = new N("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null;
|
|
459
461
|
}
|
|
460
462
|
async getOwnPublicKey() {
|
|
461
463
|
return await this.loadKeysIfNeeded(), this.ownPublicKey;
|
|
@@ -465,52 +467,52 @@ class Bn {
|
|
|
465
467
|
return await this.loadKeysIfNeeded(), this.sharedSecret;
|
|
466
468
|
}
|
|
467
469
|
async setPeerPublicKey(e) {
|
|
468
|
-
this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(
|
|
470
|
+
this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(Ee, e), await this.loadKeysIfNeeded();
|
|
469
471
|
}
|
|
470
472
|
async clear() {
|
|
471
|
-
this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(
|
|
473
|
+
this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(ke.storageKey), this.storage.removeItem(ve.storageKey), this.storage.removeItem(Ee.storageKey);
|
|
472
474
|
}
|
|
473
475
|
async generateKeyPair() {
|
|
474
|
-
const e = await
|
|
475
|
-
this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(
|
|
476
|
+
const e = await An();
|
|
477
|
+
this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(ve, e.privateKey), await this.storeKey(ke, e.publicKey);
|
|
476
478
|
}
|
|
477
479
|
async loadKeysIfNeeded() {
|
|
478
|
-
if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(
|
|
480
|
+
if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(ve)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(ke)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Ee)), this.sharedSecret === null) {
|
|
479
481
|
if (this.ownPrivateKey === null || this.peerPublicKey === null)
|
|
480
482
|
return;
|
|
481
|
-
this.sharedSecret = await
|
|
483
|
+
this.sharedSecret = await Ln(this.ownPrivateKey, this.peerPublicKey);
|
|
482
484
|
}
|
|
483
485
|
}
|
|
484
486
|
// storage methods
|
|
485
487
|
async loadKey(e) {
|
|
486
488
|
const n = this.storage.getItem(e.storageKey);
|
|
487
|
-
return n ?
|
|
489
|
+
return n ? Dt(e.keyType, n) : null;
|
|
488
490
|
}
|
|
489
491
|
async storeKey(e, n) {
|
|
490
|
-
const s = await
|
|
492
|
+
const s = await Nt(e.keyType, n);
|
|
491
493
|
this.storage.setItem(e.storageKey, s);
|
|
492
494
|
}
|
|
493
495
|
}
|
|
494
|
-
const
|
|
495
|
-
async function
|
|
496
|
+
const ne = "4.3.0", Ot = "@coinbase/wallet-sdk";
|
|
497
|
+
async function Be(t, e) {
|
|
496
498
|
const n = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), s = await window.fetch(e, {
|
|
497
499
|
method: "POST",
|
|
498
500
|
body: JSON.stringify(n),
|
|
499
501
|
mode: "cors",
|
|
500
502
|
headers: {
|
|
501
503
|
"Content-Type": "application/json",
|
|
502
|
-
"X-Cbw-Sdk-Version":
|
|
503
|
-
"X-Cbw-Sdk-Platform":
|
|
504
|
+
"X-Cbw-Sdk-Version": ne,
|
|
505
|
+
"X-Cbw-Sdk-Platform": Ot
|
|
504
506
|
}
|
|
505
507
|
}), { result: i, error: r } = await s.json();
|
|
506
508
|
if (r)
|
|
507
509
|
throw r;
|
|
508
510
|
return i;
|
|
509
511
|
}
|
|
510
|
-
function
|
|
512
|
+
function On() {
|
|
511
513
|
return globalThis.coinbaseWalletExtension;
|
|
512
514
|
}
|
|
513
|
-
function
|
|
515
|
+
function jn() {
|
|
514
516
|
var t, e;
|
|
515
517
|
try {
|
|
516
518
|
const n = globalThis;
|
|
@@ -519,32 +521,32 @@ function Vn() {
|
|
|
519
521
|
return;
|
|
520
522
|
}
|
|
521
523
|
}
|
|
522
|
-
function
|
|
524
|
+
function Un({ metadata: t, preference: e }) {
|
|
523
525
|
var n, s;
|
|
524
|
-
const { appName: i, appLogoUrl: r, appChainIds:
|
|
526
|
+
const { appName: i, appLogoUrl: r, appChainIds: a } = t;
|
|
525
527
|
if (e.options !== "smartWalletOnly") {
|
|
526
|
-
const d =
|
|
528
|
+
const d = On();
|
|
527
529
|
if (d)
|
|
528
|
-
return (n = d.setAppInfo) === null || n === void 0 || n.call(d, i, r,
|
|
530
|
+
return (n = d.setAppInfo) === null || n === void 0 || n.call(d, i, r, a, e), d;
|
|
529
531
|
}
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
532
|
-
return (s =
|
|
532
|
+
const o = jn();
|
|
533
|
+
if (o != null && o.isCoinbaseBrowser)
|
|
534
|
+
return (s = o.setAppInfo) === null || s === void 0 || s.call(o, i, r, a, e), o;
|
|
533
535
|
}
|
|
534
|
-
function
|
|
536
|
+
function Wn(t) {
|
|
535
537
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
536
|
-
throw
|
|
538
|
+
throw w.rpc.invalidParams({
|
|
537
539
|
message: "Expected a single, non-array, object argument.",
|
|
538
540
|
data: t
|
|
539
541
|
});
|
|
540
542
|
const { method: e, params: n } = t;
|
|
541
543
|
if (typeof e != "string" || e.length === 0)
|
|
542
|
-
throw
|
|
544
|
+
throw w.rpc.invalidParams({
|
|
543
545
|
message: "'args.method' must be a non-empty string.",
|
|
544
546
|
data: t
|
|
545
547
|
});
|
|
546
548
|
if (n !== void 0 && !Array.isArray(n) && (typeof n != "object" || n === null))
|
|
547
|
-
throw
|
|
549
|
+
throw w.rpc.invalidParams({
|
|
548
550
|
message: "'args.params' must be an object or array if provided.",
|
|
549
551
|
data: t
|
|
550
552
|
});
|
|
@@ -553,37 +555,37 @@ function Fn(t) {
|
|
|
553
555
|
case "eth_signTypedData_v2":
|
|
554
556
|
case "eth_subscribe":
|
|
555
557
|
case "eth_unsubscribe":
|
|
556
|
-
throw
|
|
558
|
+
throw w.provider.unsupportedMethod();
|
|
557
559
|
}
|
|
558
560
|
}
|
|
559
|
-
const
|
|
560
|
-
class
|
|
561
|
+
const Ge = "accounts", Ye = "activeChain", Je = "availableChains", Qe = "walletCapabilities";
|
|
562
|
+
class Hn {
|
|
561
563
|
constructor(e) {
|
|
562
564
|
var n, s, i;
|
|
563
|
-
this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new
|
|
565
|
+
this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new Dn(), this.storage = new N("CBWSDK", "SCWStateManager"), this.accounts = (n = this.storage.loadObject(Ge)) !== null && n !== void 0 ? n : [], this.chain = this.storage.loadObject(Ye) || {
|
|
564
566
|
id: (i = (s = e.metadata.appChainIds) === null || s === void 0 ? void 0 : s[0]) !== null && i !== void 0 ? i : 1
|
|
565
567
|
}, 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
568
|
}
|
|
567
569
|
async handshake(e) {
|
|
568
570
|
var n, s, i, r;
|
|
569
571
|
await ((s = (n = this.communicator).waitForPopupLoaded) === null || s === void 0 ? void 0 : s.call(n));
|
|
570
|
-
const
|
|
572
|
+
const a = await this.createRequestMessage({
|
|
571
573
|
handshake: {
|
|
572
574
|
method: e.method,
|
|
573
575
|
params: Object.assign({}, this.metadata, (i = e.params) !== null && i !== void 0 ? i : {})
|
|
574
576
|
}
|
|
575
|
-
}),
|
|
576
|
-
if ("failure" in
|
|
577
|
-
throw
|
|
578
|
-
const d = await
|
|
577
|
+
}), o = await this.communicator.postRequestAndWaitForResponse(a);
|
|
578
|
+
if ("failure" in o.content)
|
|
579
|
+
throw o.content.failure;
|
|
580
|
+
const d = await Dt("public", o.sender);
|
|
579
581
|
await this.keyManager.setPeerPublicKey(d);
|
|
580
|
-
const h = (await this.decryptResponseMessage(
|
|
582
|
+
const h = (await this.decryptResponseMessage(o)).result;
|
|
581
583
|
if ("error" in h)
|
|
582
584
|
throw h.error;
|
|
583
585
|
switch (e.method) {
|
|
584
586
|
case "eth_requestAccounts": {
|
|
585
|
-
const
|
|
586
|
-
this.accounts =
|
|
587
|
+
const l = h.value;
|
|
588
|
+
this.accounts = l, this.storage.storeObject(Ge, l), (r = this.callback) === null || r === void 0 || r.call(this, "accountsChanged", l);
|
|
587
589
|
break;
|
|
588
590
|
}
|
|
589
591
|
}
|
|
@@ -595,11 +597,11 @@ class zn {
|
|
|
595
597
|
case "wallet_sendCalls":
|
|
596
598
|
return this.sendRequestToPopup(e);
|
|
597
599
|
default:
|
|
598
|
-
throw
|
|
600
|
+
throw w.provider.unauthorized();
|
|
599
601
|
}
|
|
600
602
|
switch (e.method) {
|
|
601
603
|
case "eth_requestAccounts":
|
|
602
|
-
return (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId:
|
|
604
|
+
return (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId: q(this.chain.id) }), this.accounts;
|
|
603
605
|
case "eth_accounts":
|
|
604
606
|
return this.accounts;
|
|
605
607
|
case "eth_coinbase":
|
|
@@ -607,9 +609,9 @@ class zn {
|
|
|
607
609
|
case "net_version":
|
|
608
610
|
return this.chain.id;
|
|
609
611
|
case "eth_chainId":
|
|
610
|
-
return
|
|
612
|
+
return q(this.chain.id);
|
|
611
613
|
case "wallet_getCapabilities":
|
|
612
|
-
return this.storage.loadObject(
|
|
614
|
+
return this.storage.loadObject(Qe);
|
|
613
615
|
case "wallet_switchEthereumChain":
|
|
614
616
|
return this.handleSwitchChainRequest(e);
|
|
615
617
|
case "eth_ecRecover":
|
|
@@ -630,17 +632,17 @@ class zn {
|
|
|
630
632
|
return this.sendRequestToPopup(e);
|
|
631
633
|
default:
|
|
632
634
|
if (!this.chain.rpcUrl)
|
|
633
|
-
throw
|
|
634
|
-
return
|
|
635
|
+
throw w.rpc.internal("No RPC URL set for chain");
|
|
636
|
+
return Be(e, this.chain.rpcUrl);
|
|
635
637
|
}
|
|
636
638
|
}
|
|
637
639
|
async sendRequestToPopup(e) {
|
|
638
640
|
var n, s;
|
|
639
641
|
await ((s = (n = this.communicator).waitForPopupLoaded) === null || s === void 0 ? void 0 : s.call(n));
|
|
640
|
-
const i = await this.sendEncryptedRequest(e),
|
|
641
|
-
if ("error" in
|
|
642
|
-
throw
|
|
643
|
-
return
|
|
642
|
+
const i = await this.sendEncryptedRequest(e), a = (await this.decryptResponseMessage(i)).result;
|
|
643
|
+
if ("error" in a)
|
|
644
|
+
throw a.error;
|
|
645
|
+
return a.value;
|
|
644
646
|
}
|
|
645
647
|
async cleanup() {
|
|
646
648
|
var e, n;
|
|
@@ -656,25 +658,25 @@ class zn {
|
|
|
656
658
|
var n;
|
|
657
659
|
const s = e.params;
|
|
658
660
|
if (!s || !(!((n = s[0]) === null || n === void 0) && n.chainId))
|
|
659
|
-
throw
|
|
660
|
-
const i =
|
|
661
|
+
throw w.rpc.invalidParams();
|
|
662
|
+
const i = Q(s[0].chainId);
|
|
661
663
|
if (this.updateChain(i))
|
|
662
664
|
return null;
|
|
663
|
-
const
|
|
664
|
-
return
|
|
665
|
+
const a = await this.sendRequestToPopup(e);
|
|
666
|
+
return a === null && this.updateChain(i), a;
|
|
665
667
|
}
|
|
666
668
|
async sendEncryptedRequest(e) {
|
|
667
669
|
const n = await this.keyManager.getSharedSecret();
|
|
668
670
|
if (!n)
|
|
669
|
-
throw
|
|
670
|
-
const s = await
|
|
671
|
+
throw w.provider.unauthorized("No valid session found, try requestAccounts before other methods");
|
|
672
|
+
const s = await Tn({
|
|
671
673
|
action: e,
|
|
672
674
|
chainId: this.chain.id
|
|
673
675
|
}, n), i = await this.createRequestMessage({ encrypted: s });
|
|
674
676
|
return this.communicator.postRequestAndWaitForResponse(i);
|
|
675
677
|
}
|
|
676
678
|
async createRequestMessage(e) {
|
|
677
|
-
const n = await
|
|
679
|
+
const n = await Nt("public", await this.keyManager.getOwnPublicKey());
|
|
678
680
|
return {
|
|
679
681
|
id: crypto.randomUUID(),
|
|
680
682
|
sender: n,
|
|
@@ -689,32 +691,32 @@ class zn {
|
|
|
689
691
|
throw i.failure;
|
|
690
692
|
const r = await this.keyManager.getSharedSecret();
|
|
691
693
|
if (!r)
|
|
692
|
-
throw
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
694
|
+
throw w.provider.unauthorized("Invalid session");
|
|
695
|
+
const a = await Nn(i.encrypted, r), o = (n = a.data) === null || n === void 0 ? void 0 : n.chains;
|
|
696
|
+
if (o) {
|
|
697
|
+
const c = Object.entries(o).map(([h, l]) => ({
|
|
696
698
|
id: Number(h),
|
|
697
|
-
rpcUrl:
|
|
699
|
+
rpcUrl: l
|
|
698
700
|
}));
|
|
699
|
-
this.storage.storeObject(
|
|
701
|
+
this.storage.storeObject(Je, c), this.updateChain(this.chain.id, c);
|
|
700
702
|
}
|
|
701
|
-
const d = (s =
|
|
702
|
-
return d && this.storage.storeObject(
|
|
703
|
+
const d = (s = a.data) === null || s === void 0 ? void 0 : s.capabilities;
|
|
704
|
+
return d && this.storage.storeObject(Qe, d), a;
|
|
703
705
|
}
|
|
704
706
|
updateChain(e, n) {
|
|
705
707
|
var s;
|
|
706
|
-
const i = n ?? this.storage.loadObject(
|
|
707
|
-
return r ? (r !== this.chain && (this.chain = r, this.storage.storeObject(
|
|
708
|
+
const i = n ?? this.storage.loadObject(Je), r = i == null ? void 0 : i.find((a) => a.id === e);
|
|
709
|
+
return r ? (r !== this.chain && (this.chain = r, this.storage.storeObject(Ye, r), (s = this.callback) === null || s === void 0 || s.call(this, "chainChanged", q(r.id))), !0) : !1;
|
|
708
710
|
}
|
|
709
711
|
}
|
|
710
|
-
const { keccak_256:
|
|
711
|
-
function
|
|
712
|
+
const { keccak_256: Bn } = gn;
|
|
713
|
+
function jt(t) {
|
|
712
714
|
return Buffer.allocUnsafe(t).fill(0);
|
|
713
715
|
}
|
|
714
|
-
function
|
|
716
|
+
function qn(t) {
|
|
715
717
|
return t.toString(2).length;
|
|
716
718
|
}
|
|
717
|
-
function
|
|
719
|
+
function Ut(t, e) {
|
|
718
720
|
let n = t.toString(16);
|
|
719
721
|
n.length % 2 !== 0 && (n = "0" + n);
|
|
720
722
|
const s = n.match(/.{1,2}/g).map((i) => parseInt(i, 16));
|
|
@@ -722,7 +724,7 @@ function Ft(t, e) {
|
|
|
722
724
|
s.unshift(0);
|
|
723
725
|
return Buffer.from(s);
|
|
724
726
|
}
|
|
725
|
-
function
|
|
727
|
+
function Kn(t, e) {
|
|
726
728
|
const n = t < 0n;
|
|
727
729
|
let s;
|
|
728
730
|
if (n) {
|
|
@@ -732,77 +734,77 @@ function Gn(t, e) {
|
|
|
732
734
|
s = t;
|
|
733
735
|
return s &= (1n << BigInt(e)) - 1n, s;
|
|
734
736
|
}
|
|
735
|
-
function
|
|
736
|
-
const s =
|
|
737
|
-
return t =
|
|
737
|
+
function Wt(t, e, n) {
|
|
738
|
+
const s = jt(e);
|
|
739
|
+
return t = ge(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
740
|
}
|
|
739
|
-
function
|
|
740
|
-
return
|
|
741
|
+
function Vn(t, e) {
|
|
742
|
+
return Wt(t, e, !0);
|
|
741
743
|
}
|
|
742
|
-
function
|
|
744
|
+
function ge(t) {
|
|
743
745
|
if (!Buffer.isBuffer(t))
|
|
744
746
|
if (Array.isArray(t))
|
|
745
747
|
t = Buffer.from(t);
|
|
746
748
|
else if (typeof t == "string")
|
|
747
|
-
|
|
749
|
+
Ht(t) ? t = Buffer.from($n(Bt(t)), "hex") : t = Buffer.from(t);
|
|
748
750
|
else if (typeof t == "number")
|
|
749
751
|
t = intToBuffer(t);
|
|
750
752
|
else if (t == null)
|
|
751
753
|
t = Buffer.allocUnsafe(0);
|
|
752
754
|
else if (typeof t == "bigint")
|
|
753
|
-
t =
|
|
755
|
+
t = Ut(t);
|
|
754
756
|
else if (t.toArray)
|
|
755
757
|
t = Buffer.from(t.toArray());
|
|
756
758
|
else
|
|
757
759
|
throw new Error("invalid type");
|
|
758
760
|
return t;
|
|
759
761
|
}
|
|
760
|
-
function
|
|
761
|
-
return t =
|
|
762
|
+
function zn(t) {
|
|
763
|
+
return t = ge(t), "0x" + t.toString("hex");
|
|
762
764
|
}
|
|
763
|
-
function
|
|
764
|
-
if (t =
|
|
765
|
+
function Fn(t, e) {
|
|
766
|
+
if (t = ge(t), e || (e = 256), e !== 256)
|
|
765
767
|
throw new Error("unsupported");
|
|
766
|
-
return Buffer.from(
|
|
768
|
+
return Buffer.from(Bn(new Uint8Array(t)));
|
|
767
769
|
}
|
|
768
|
-
function
|
|
770
|
+
function $n(t) {
|
|
769
771
|
return t.length % 2 ? "0" + t : t;
|
|
770
772
|
}
|
|
771
|
-
function
|
|
773
|
+
function Ht(t) {
|
|
772
774
|
return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/);
|
|
773
775
|
}
|
|
774
|
-
function
|
|
776
|
+
function Bt(t) {
|
|
775
777
|
return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t;
|
|
776
778
|
}
|
|
777
|
-
var
|
|
778
|
-
zeros:
|
|
779
|
-
setLength:
|
|
780
|
-
setLengthRight:
|
|
781
|
-
isHexString:
|
|
782
|
-
stripHexPrefix:
|
|
783
|
-
toBuffer:
|
|
784
|
-
bufferToHex:
|
|
785
|
-
keccak:
|
|
786
|
-
bitLengthFromBigInt:
|
|
787
|
-
bufferBEFromBigInt:
|
|
788
|
-
twosFromBigInt:
|
|
779
|
+
var qt = {
|
|
780
|
+
zeros: jt,
|
|
781
|
+
setLength: Wt,
|
|
782
|
+
setLengthRight: Vn,
|
|
783
|
+
isHexString: Ht,
|
|
784
|
+
stripHexPrefix: Bt,
|
|
785
|
+
toBuffer: ge,
|
|
786
|
+
bufferToHex: zn,
|
|
787
|
+
keccak: Fn,
|
|
788
|
+
bitLengthFromBigInt: qn,
|
|
789
|
+
bufferBEFromBigInt: Ut,
|
|
790
|
+
twosFromBigInt: Kn
|
|
789
791
|
};
|
|
790
|
-
const
|
|
791
|
-
function
|
|
792
|
+
const x = qt;
|
|
793
|
+
function Kt(t) {
|
|
792
794
|
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
795
|
}
|
|
794
|
-
function
|
|
796
|
+
function $(t) {
|
|
795
797
|
return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10);
|
|
796
798
|
}
|
|
797
|
-
function
|
|
799
|
+
function Xe(t) {
|
|
798
800
|
var e = /^\D+(\d+)x(\d+)$/.exec(t);
|
|
799
801
|
return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)];
|
|
800
802
|
}
|
|
801
|
-
function
|
|
803
|
+
function Vt(t) {
|
|
802
804
|
var e = t.match(/(.*)\[(.*?)\]$/);
|
|
803
805
|
return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null;
|
|
804
806
|
}
|
|
805
|
-
function
|
|
807
|
+
function V(t) {
|
|
806
808
|
var e = typeof t;
|
|
807
809
|
if (e === "string" || e === "number")
|
|
808
810
|
return BigInt(t);
|
|
@@ -810,124 +812,124 @@ function $(t) {
|
|
|
810
812
|
return t;
|
|
811
813
|
throw new Error("Argument is not a number");
|
|
812
814
|
}
|
|
813
|
-
function
|
|
815
|
+
function T(t, e) {
|
|
814
816
|
var n, s, i, r;
|
|
815
817
|
if (t === "address")
|
|
816
|
-
return
|
|
818
|
+
return T("uint160", V(e));
|
|
817
819
|
if (t === "bool")
|
|
818
|
-
return
|
|
820
|
+
return T("uint8", e ? 1 : 0);
|
|
819
821
|
if (t === "string")
|
|
820
|
-
return
|
|
821
|
-
if (
|
|
822
|
+
return T("bytes", new Buffer(e, "utf8"));
|
|
823
|
+
if (Gn(t)) {
|
|
822
824
|
if (typeof e.length > "u")
|
|
823
825
|
throw new Error("Not an array?");
|
|
824
|
-
if (n =
|
|
826
|
+
if (n = Vt(t), n !== "dynamic" && n !== 0 && e.length > n)
|
|
825
827
|
throw new Error("Elements exceed array size: " + n);
|
|
826
828
|
i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e));
|
|
827
829
|
for (r in e)
|
|
828
|
-
i.push(
|
|
830
|
+
i.push(T(t, e[r]));
|
|
829
831
|
if (n === "dynamic") {
|
|
830
|
-
var
|
|
831
|
-
i.unshift(
|
|
832
|
+
var a = T("uint256", e.length);
|
|
833
|
+
i.unshift(a);
|
|
832
834
|
}
|
|
833
835
|
return Buffer.concat(i);
|
|
834
836
|
} else {
|
|
835
837
|
if (t === "bytes")
|
|
836
|
-
return e = new Buffer(e), i = Buffer.concat([
|
|
838
|
+
return e = new Buffer(e), i = Buffer.concat([T("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, x.zeros(32 - e.length % 32)])), i;
|
|
837
839
|
if (t.startsWith("bytes")) {
|
|
838
|
-
if (n =
|
|
840
|
+
if (n = $(t), n < 1 || n > 32)
|
|
839
841
|
throw new Error("Invalid bytes<N> width: " + n);
|
|
840
|
-
return
|
|
842
|
+
return x.setLengthRight(e, 32);
|
|
841
843
|
} else if (t.startsWith("uint")) {
|
|
842
|
-
if (n =
|
|
844
|
+
if (n = $(t), n % 8 || n < 8 || n > 256)
|
|
843
845
|
throw new Error("Invalid uint<N> width: " + n);
|
|
844
|
-
s =
|
|
845
|
-
const
|
|
846
|
-
if (
|
|
847
|
-
throw new Error("Supplied uint exceeds width: " + n + " vs " +
|
|
846
|
+
s = V(e);
|
|
847
|
+
const o = x.bitLengthFromBigInt(s);
|
|
848
|
+
if (o > n)
|
|
849
|
+
throw new Error("Supplied uint exceeds width: " + n + " vs " + o);
|
|
848
850
|
if (s < 0)
|
|
849
851
|
throw new Error("Supplied uint is negative");
|
|
850
|
-
return
|
|
852
|
+
return x.bufferBEFromBigInt(s, 32);
|
|
851
853
|
} else if (t.startsWith("int")) {
|
|
852
|
-
if (n =
|
|
854
|
+
if (n = $(t), n % 8 || n < 8 || n > 256)
|
|
853
855
|
throw new Error("Invalid int<N> width: " + n);
|
|
854
|
-
s =
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
857
|
-
throw new Error("Supplied int exceeds width: " + n + " vs " +
|
|
858
|
-
const d =
|
|
859
|
-
return
|
|
856
|
+
s = V(e);
|
|
857
|
+
const o = x.bitLengthFromBigInt(s);
|
|
858
|
+
if (o > n)
|
|
859
|
+
throw new Error("Supplied int exceeds width: " + n + " vs " + o);
|
|
860
|
+
const d = x.twosFromBigInt(s, 256);
|
|
861
|
+
return x.bufferBEFromBigInt(d, 32);
|
|
860
862
|
} else if (t.startsWith("ufixed")) {
|
|
861
|
-
if (n =
|
|
863
|
+
if (n = Xe(t), s = V(e), s < 0)
|
|
862
864
|
throw new Error("Supplied ufixed is negative");
|
|
863
|
-
return
|
|
865
|
+
return T("uint256", s * BigInt(2) ** BigInt(n[1]));
|
|
864
866
|
} else if (t.startsWith("fixed"))
|
|
865
|
-
return n =
|
|
867
|
+
return n = Xe(t), T("int256", V(e) * BigInt(2) ** BigInt(n[1]));
|
|
866
868
|
}
|
|
867
869
|
throw new Error("Unsupported or invalid type: " + t);
|
|
868
870
|
}
|
|
869
|
-
function
|
|
870
|
-
return t === "string" || t === "bytes" ||
|
|
871
|
+
function Zn(t) {
|
|
872
|
+
return t === "string" || t === "bytes" || Vt(t) === "dynamic";
|
|
871
873
|
}
|
|
872
|
-
function
|
|
874
|
+
function Gn(t) {
|
|
873
875
|
return t.lastIndexOf("]") === t.length - 1;
|
|
874
876
|
}
|
|
875
|
-
function
|
|
877
|
+
function Yn(t, e) {
|
|
876
878
|
var n = [], s = [], i = 32 * t.length;
|
|
877
879
|
for (var r in t) {
|
|
878
|
-
var
|
|
879
|
-
|
|
880
|
+
var a = Kt(t[r]), o = e[r], d = T(a, o);
|
|
881
|
+
Zn(a) ? (n.push(T("uint256", i)), s.push(d), i += d.length) : n.push(d);
|
|
880
882
|
}
|
|
881
883
|
return Buffer.concat(n.concat(s));
|
|
882
884
|
}
|
|
883
|
-
function
|
|
885
|
+
function zt(t, e) {
|
|
884
886
|
if (t.length !== e.length)
|
|
885
887
|
throw new Error("Number of types are not matching the values");
|
|
886
888
|
for (var n, s, i = [], r = 0; r < t.length; r++) {
|
|
887
|
-
var
|
|
888
|
-
if (
|
|
889
|
-
i.push(
|
|
890
|
-
else if (
|
|
891
|
-
i.push(new Buffer(
|
|
892
|
-
else if (
|
|
893
|
-
i.push(new Buffer(
|
|
894
|
-
else if (
|
|
895
|
-
i.push(
|
|
896
|
-
else if (
|
|
897
|
-
if (n =
|
|
889
|
+
var a = Kt(t[r]), o = e[r];
|
|
890
|
+
if (a === "bytes")
|
|
891
|
+
i.push(o);
|
|
892
|
+
else if (a === "string")
|
|
893
|
+
i.push(new Buffer(o, "utf8"));
|
|
894
|
+
else if (a === "bool")
|
|
895
|
+
i.push(new Buffer(o ? "01" : "00", "hex"));
|
|
896
|
+
else if (a === "address")
|
|
897
|
+
i.push(x.setLength(o, 20));
|
|
898
|
+
else if (a.startsWith("bytes")) {
|
|
899
|
+
if (n = $(a), n < 1 || n > 32)
|
|
898
900
|
throw new Error("Invalid bytes<N> width: " + n);
|
|
899
|
-
i.push(
|
|
900
|
-
} else if (
|
|
901
|
-
if (n =
|
|
901
|
+
i.push(x.setLengthRight(o, n));
|
|
902
|
+
} else if (a.startsWith("uint")) {
|
|
903
|
+
if (n = $(a), n % 8 || n < 8 || n > 256)
|
|
902
904
|
throw new Error("Invalid uint<N> width: " + n);
|
|
903
|
-
s =
|
|
904
|
-
const d =
|
|
905
|
+
s = V(o);
|
|
906
|
+
const d = x.bitLengthFromBigInt(s);
|
|
905
907
|
if (d > n)
|
|
906
908
|
throw new Error("Supplied uint exceeds width: " + n + " vs " + d);
|
|
907
|
-
i.push(
|
|
908
|
-
} else if (
|
|
909
|
-
if (n =
|
|
909
|
+
i.push(x.bufferBEFromBigInt(s, n / 8));
|
|
910
|
+
} else if (a.startsWith("int")) {
|
|
911
|
+
if (n = $(a), n % 8 || n < 8 || n > 256)
|
|
910
912
|
throw new Error("Invalid int<N> width: " + n);
|
|
911
|
-
s =
|
|
912
|
-
const d =
|
|
913
|
+
s = V(o);
|
|
914
|
+
const d = x.bitLengthFromBigInt(s);
|
|
913
915
|
if (d > n)
|
|
914
916
|
throw new Error("Supplied int exceeds width: " + n + " vs " + d);
|
|
915
|
-
const
|
|
916
|
-
i.push(
|
|
917
|
+
const c = x.twosFromBigInt(s, n);
|
|
918
|
+
i.push(x.bufferBEFromBigInt(c, n / 8));
|
|
917
919
|
} else
|
|
918
|
-
throw new Error("Unsupported or invalid type: " +
|
|
920
|
+
throw new Error("Unsupported or invalid type: " + a);
|
|
919
921
|
}
|
|
920
922
|
return Buffer.concat(i);
|
|
921
923
|
}
|
|
922
|
-
function
|
|
923
|
-
return
|
|
924
|
+
function Jn(t, e) {
|
|
925
|
+
return x.keccak(zt(t, e));
|
|
924
926
|
}
|
|
925
|
-
var
|
|
926
|
-
rawEncode:
|
|
927
|
-
solidityPack:
|
|
928
|
-
soliditySHA3:
|
|
927
|
+
var Qn = {
|
|
928
|
+
rawEncode: Yn,
|
|
929
|
+
solidityPack: zt,
|
|
930
|
+
soliditySHA3: Jn
|
|
929
931
|
};
|
|
930
|
-
const L =
|
|
932
|
+
const L = qt, X = Qn, Ft = {
|
|
931
933
|
type: "object",
|
|
932
934
|
properties: {
|
|
933
935
|
types: {
|
|
@@ -949,7 +951,7 @@ const L = Gt, ne = is, Xt = {
|
|
|
949
951
|
message: { type: "object" }
|
|
950
952
|
},
|
|
951
953
|
required: ["types", "primaryType", "domain", "message"]
|
|
952
|
-
},
|
|
954
|
+
}, Ce = {
|
|
953
955
|
/**
|
|
954
956
|
* Encodes an object by encoding and concatenating each of its members
|
|
955
957
|
*
|
|
@@ -961,45 +963,45 @@ const L = Gt, ne = is, Xt = {
|
|
|
961
963
|
encodeData(t, e, n, s = !0) {
|
|
962
964
|
const i = ["bytes32"], r = [this.hashType(t, n)];
|
|
963
965
|
if (s) {
|
|
964
|
-
const
|
|
966
|
+
const a = (o, d, c) => {
|
|
965
967
|
if (n[d] !== void 0)
|
|
966
|
-
return ["bytes32",
|
|
967
|
-
if (
|
|
968
|
-
throw new Error(`missing value for field ${
|
|
968
|
+
return ["bytes32", c == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : L.keccak(this.encodeData(d, c, n, s))];
|
|
969
|
+
if (c === void 0)
|
|
970
|
+
throw new Error(`missing value for field ${o} of type ${d}`);
|
|
969
971
|
if (d === "bytes")
|
|
970
|
-
return ["bytes32", L.keccak(
|
|
972
|
+
return ["bytes32", L.keccak(c)];
|
|
971
973
|
if (d === "string")
|
|
972
|
-
return typeof
|
|
974
|
+
return typeof c == "string" && (c = Buffer.from(c, "utf8")), ["bytes32", L.keccak(c)];
|
|
973
975
|
if (d.lastIndexOf("]") === d.length - 1) {
|
|
974
|
-
const h = d.slice(0, d.lastIndexOf("[")),
|
|
975
|
-
return ["bytes32", L.keccak(
|
|
976
|
-
|
|
977
|
-
|
|
976
|
+
const h = d.slice(0, d.lastIndexOf("[")), l = c.map((f) => a(o, h, f));
|
|
977
|
+
return ["bytes32", L.keccak(X.rawEncode(
|
|
978
|
+
l.map(([f]) => f),
|
|
979
|
+
l.map(([, f]) => f)
|
|
978
980
|
))];
|
|
979
981
|
}
|
|
980
|
-
return [d,
|
|
982
|
+
return [d, c];
|
|
981
983
|
};
|
|
982
|
-
for (const
|
|
983
|
-
const [d,
|
|
984
|
-
i.push(d), r.push(
|
|
984
|
+
for (const o of n[t]) {
|
|
985
|
+
const [d, c] = a(o.name, o.type, e[o.name]);
|
|
986
|
+
i.push(d), r.push(c);
|
|
985
987
|
}
|
|
986
988
|
} else
|
|
987
|
-
for (const
|
|
988
|
-
let
|
|
989
|
-
if (
|
|
990
|
-
if (
|
|
991
|
-
i.push("bytes32"),
|
|
992
|
-
else if (
|
|
993
|
-
i.push("bytes32"), typeof
|
|
994
|
-
else if (n[
|
|
995
|
-
i.push("bytes32"),
|
|
989
|
+
for (const a of n[t]) {
|
|
990
|
+
let o = e[a.name];
|
|
991
|
+
if (o !== void 0)
|
|
992
|
+
if (a.type === "bytes")
|
|
993
|
+
i.push("bytes32"), o = L.keccak(o), r.push(o);
|
|
994
|
+
else if (a.type === "string")
|
|
995
|
+
i.push("bytes32"), typeof o == "string" && (o = Buffer.from(o, "utf8")), o = L.keccak(o), r.push(o);
|
|
996
|
+
else if (n[a.type] !== void 0)
|
|
997
|
+
i.push("bytes32"), o = L.keccak(this.encodeData(a.type, o, n, s)), r.push(o);
|
|
996
998
|
else {
|
|
997
|
-
if (
|
|
999
|
+
if (a.type.lastIndexOf("]") === a.type.length - 1)
|
|
998
1000
|
throw new Error("Arrays currently unimplemented in encodeData");
|
|
999
|
-
i.push(
|
|
1001
|
+
i.push(a.type), r.push(o);
|
|
1000
1002
|
}
|
|
1001
1003
|
}
|
|
1002
|
-
return
|
|
1004
|
+
return X.rawEncode(i, r);
|
|
1003
1005
|
},
|
|
1004
1006
|
/**
|
|
1005
1007
|
* Encodes the type of an object by encoding a comma delimited list of its members
|
|
@@ -1014,7 +1016,7 @@ const L = Gt, ne = is, Xt = {
|
|
|
1014
1016
|
for (const i of s) {
|
|
1015
1017
|
if (!e[i])
|
|
1016
1018
|
throw new Error("No type definition specified: " + i);
|
|
1017
|
-
n += i + "(" + e[i].map(({ name:
|
|
1019
|
+
n += i + "(" + e[i].map(({ name: a, type: o }) => o + " " + a).join(",") + ")";
|
|
1018
1020
|
}
|
|
1019
1021
|
return n;
|
|
1020
1022
|
},
|
|
@@ -1064,7 +1066,7 @@ const L = Gt, ne = is, Xt = {
|
|
|
1064
1066
|
*/
|
|
1065
1067
|
sanitizeData(t) {
|
|
1066
1068
|
const e = {};
|
|
1067
|
-
for (const n in
|
|
1069
|
+
for (const n in Ft.properties)
|
|
1068
1070
|
t[n] && (e[n] = t[n]);
|
|
1069
1071
|
return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e;
|
|
1070
1072
|
},
|
|
@@ -1079,20 +1081,20 @@ const L = Gt, ne = is, Xt = {
|
|
|
1079
1081
|
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
1082
|
}
|
|
1081
1083
|
};
|
|
1082
|
-
var
|
|
1083
|
-
TYPED_MESSAGE_SCHEMA:
|
|
1084
|
-
TypedDataUtils:
|
|
1084
|
+
var Xn = {
|
|
1085
|
+
TYPED_MESSAGE_SCHEMA: Ft,
|
|
1086
|
+
TypedDataUtils: Ce,
|
|
1085
1087
|
hashForSignTypedDataLegacy: function(t) {
|
|
1086
|
-
return
|
|
1088
|
+
return es(t.data);
|
|
1087
1089
|
},
|
|
1088
1090
|
hashForSignTypedData_v3: function(t) {
|
|
1089
|
-
return
|
|
1091
|
+
return Ce.hash(t.data, !1);
|
|
1090
1092
|
},
|
|
1091
1093
|
hashForSignTypedData_v4: function(t) {
|
|
1092
|
-
return
|
|
1094
|
+
return Ce.hash(t.data);
|
|
1093
1095
|
}
|
|
1094
1096
|
};
|
|
1095
|
-
function
|
|
1097
|
+
function es(t) {
|
|
1096
1098
|
const e = new Error("Expect argument to be non-empty array");
|
|
1097
1099
|
if (typeof t != "object" || !t.length) throw e;
|
|
1098
1100
|
const n = t.map(function(r) {
|
|
@@ -1103,19 +1105,19 @@ function os(t) {
|
|
|
1103
1105
|
if (!r.name) throw e;
|
|
1104
1106
|
return r.type + " " + r.name;
|
|
1105
1107
|
});
|
|
1106
|
-
return
|
|
1108
|
+
return X.soliditySHA3(
|
|
1107
1109
|
["bytes32", "bytes32"],
|
|
1108
1110
|
[
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
+
X.soliditySHA3(new Array(t.length).fill("string"), i),
|
|
1112
|
+
X.soliditySHA3(s, n)
|
|
1111
1113
|
]
|
|
1112
1114
|
);
|
|
1113
1115
|
}
|
|
1114
|
-
const
|
|
1115
|
-
function
|
|
1116
|
+
const ie = /* @__PURE__ */ Et(Xn), ts = "walletUsername", Ae = "Addresses", ns = "AppVersion";
|
|
1117
|
+
function S(t) {
|
|
1116
1118
|
return t.errorMessage !== void 0;
|
|
1117
1119
|
}
|
|
1118
|
-
class
|
|
1120
|
+
class ss {
|
|
1119
1121
|
// @param secret hex representation of 32-byte secret
|
|
1120
1122
|
constructor(e) {
|
|
1121
1123
|
this.secret = e;
|
|
@@ -1131,11 +1133,11 @@ class ls {
|
|
|
1131
1133
|
const n = this.secret;
|
|
1132
1134
|
if (n.length !== 64)
|
|
1133
1135
|
throw Error("secret must be 256 bits");
|
|
1134
|
-
const s = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw",
|
|
1136
|
+
const s = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", ae(n), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), r = new TextEncoder(), a = await window.crypto.subtle.encrypt({
|
|
1135
1137
|
name: "AES-GCM",
|
|
1136
1138
|
iv: s
|
|
1137
|
-
}, i, r.encode(e)),
|
|
1138
|
-
return
|
|
1139
|
+
}, i, r.encode(e)), o = 16, d = a.slice(a.byteLength - o), c = a.slice(0, a.byteLength - o), h = new Uint8Array(d), l = new Uint8Array(c), f = new Uint8Array([...s, ...h, ...l]);
|
|
1140
|
+
return Ue(f);
|
|
1139
1141
|
}
|
|
1140
1142
|
/**
|
|
1141
1143
|
*
|
|
@@ -1148,12 +1150,12 @@ class ls {
|
|
|
1148
1150
|
throw Error("secret must be 256 bits");
|
|
1149
1151
|
return new Promise((s, i) => {
|
|
1150
1152
|
(async function() {
|
|
1151
|
-
const r = await crypto.subtle.importKey("raw",
|
|
1153
|
+
const r = await crypto.subtle.importKey("raw", ae(n), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), a = ae(e), o = a.slice(0, 12), d = a.slice(12, 28), c = a.slice(28), h = new Uint8Array([...c, ...d]), l = {
|
|
1152
1154
|
name: "AES-GCM",
|
|
1153
|
-
iv: new Uint8Array(
|
|
1155
|
+
iv: new Uint8Array(o)
|
|
1154
1156
|
};
|
|
1155
1157
|
try {
|
|
1156
|
-
const f = await window.crypto.subtle.decrypt(
|
|
1158
|
+
const f = await window.crypto.subtle.decrypt(l, r, h), u = new TextDecoder();
|
|
1157
1159
|
s(u.decode(f));
|
|
1158
1160
|
} catch (f) {
|
|
1159
1161
|
i(f);
|
|
@@ -1162,7 +1164,7 @@ class ls {
|
|
|
1162
1164
|
});
|
|
1163
1165
|
}
|
|
1164
1166
|
}
|
|
1165
|
-
class
|
|
1167
|
+
class is {
|
|
1166
1168
|
constructor(e, n, s) {
|
|
1167
1169
|
this.linkAPIUrl = e, this.sessionId = n;
|
|
1168
1170
|
const i = `${n}:${s}`;
|
|
@@ -1188,23 +1190,23 @@ class ds {
|
|
|
1188
1190
|
const { events: s, error: i } = await n.json();
|
|
1189
1191
|
if (i)
|
|
1190
1192
|
throw new Error(`Check unseen events failed: ${i}`);
|
|
1191
|
-
const r = (e = s == null ? void 0 : s.filter((
|
|
1193
|
+
const r = (e = s == null ? void 0 : s.filter((a) => a.event === "Web3Response").map((a) => ({
|
|
1192
1194
|
type: "Event",
|
|
1193
1195
|
sessionId: this.sessionId,
|
|
1194
|
-
eventId:
|
|
1195
|
-
event:
|
|
1196
|
-
data:
|
|
1196
|
+
eventId: a.id,
|
|
1197
|
+
event: a.event,
|
|
1198
|
+
data: a.data
|
|
1197
1199
|
}))) !== null && e !== void 0 ? e : [];
|
|
1198
1200
|
return this.markUnseenEventsAsSeen(r), r;
|
|
1199
1201
|
}
|
|
1200
1202
|
throw new Error(`Check unseen events failed: ${n.status}`);
|
|
1201
1203
|
}
|
|
1202
1204
|
}
|
|
1203
|
-
var
|
|
1205
|
+
var U;
|
|
1204
1206
|
(function(t) {
|
|
1205
1207
|
t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED";
|
|
1206
|
-
})(
|
|
1207
|
-
class
|
|
1208
|
+
})(U || (U = {}));
|
|
1209
|
+
class rs {
|
|
1208
1210
|
setConnectionStateListener(e) {
|
|
1209
1211
|
this.connectionStateListener = e;
|
|
1210
1212
|
}
|
|
@@ -1235,22 +1237,22 @@ class hs {
|
|
|
1235
1237
|
n(r);
|
|
1236
1238
|
return;
|
|
1237
1239
|
}
|
|
1238
|
-
(s = this.connectionStateListener) === null || s === void 0 || s.call(this,
|
|
1239
|
-
var
|
|
1240
|
-
this.clearWebSocket(), n(new Error(`websocket error ${r.code}: ${r.reason}`)), (
|
|
1240
|
+
(s = this.connectionStateListener) === null || s === void 0 || s.call(this, U.CONNECTING), i.onclose = (r) => {
|
|
1241
|
+
var a;
|
|
1242
|
+
this.clearWebSocket(), n(new Error(`websocket error ${r.code}: ${r.reason}`)), (a = this.connectionStateListener) === null || a === void 0 || a.call(this, U.DISCONNECTED);
|
|
1241
1243
|
}, i.onopen = (r) => {
|
|
1242
|
-
var
|
|
1243
|
-
e(), (
|
|
1244
|
+
var a;
|
|
1245
|
+
e(), (a = this.connectionStateListener) === null || a === void 0 || a.call(this, U.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((d) => this.sendData(d)), this.pendingData = []);
|
|
1244
1246
|
}, i.onmessage = (r) => {
|
|
1245
|
-
var
|
|
1247
|
+
var a, o;
|
|
1246
1248
|
if (r.data === "h")
|
|
1247
|
-
(
|
|
1249
|
+
(a = this.incomingDataListener) === null || a === void 0 || a.call(this, {
|
|
1248
1250
|
type: "Heartbeat"
|
|
1249
1251
|
});
|
|
1250
1252
|
else
|
|
1251
1253
|
try {
|
|
1252
1254
|
const d = JSON.parse(r.data);
|
|
1253
|
-
(
|
|
1255
|
+
(o = this.incomingDataListener) === null || o === void 0 || o.call(this, d);
|
|
1254
1256
|
} catch {
|
|
1255
1257
|
}
|
|
1256
1258
|
};
|
|
@@ -1263,7 +1265,7 @@ class hs {
|
|
|
1263
1265
|
var e;
|
|
1264
1266
|
const { webSocket: n } = this;
|
|
1265
1267
|
if (n) {
|
|
1266
|
-
this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this,
|
|
1268
|
+
this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, U.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0;
|
|
1267
1269
|
try {
|
|
1268
1270
|
n.close();
|
|
1269
1271
|
} catch {
|
|
@@ -1287,8 +1289,8 @@ class hs {
|
|
|
1287
1289
|
e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null);
|
|
1288
1290
|
}
|
|
1289
1291
|
}
|
|
1290
|
-
const
|
|
1291
|
-
class
|
|
1292
|
+
const et = 1e4, as = 6e4;
|
|
1293
|
+
class os {
|
|
1292
1294
|
/**
|
|
1293
1295
|
* Constructor
|
|
1294
1296
|
* @param session Session
|
|
@@ -1297,7 +1299,7 @@ class fs {
|
|
|
1297
1299
|
* @param [WebSocketClass] Custom WebSocket implementation
|
|
1298
1300
|
*/
|
|
1299
1301
|
constructor({ session: e, linkAPIUrl: n, listener: s }) {
|
|
1300
|
-
this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId =
|
|
1302
|
+
this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = O(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (r) => {
|
|
1301
1303
|
if (!r)
|
|
1302
1304
|
return;
|
|
1303
1305
|
(/* @__PURE__ */ new Map([
|
|
@@ -1308,65 +1310,65 @@ class fs {
|
|
|
1308
1310
|
[
|
|
1309
1311
|
"ChainId",
|
|
1310
1312
|
// ChainId and JsonRpcUrl are always updated together
|
|
1311
|
-
(
|
|
1313
|
+
(o) => r.JsonRpcUrl && this.handleChainUpdated(o, r.JsonRpcUrl)
|
|
1312
1314
|
]
|
|
1313
|
-
])).forEach((
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1315
|
+
])).forEach((o, d) => {
|
|
1316
|
+
const c = r[d];
|
|
1317
|
+
c !== void 0 && o(c);
|
|
1316
1318
|
});
|
|
1317
1319
|
}, this.handleDestroyed = (r) => {
|
|
1318
|
-
var
|
|
1319
|
-
r === "1" && ((
|
|
1320
|
+
var a;
|
|
1321
|
+
r === "1" && ((a = this.listener) === null || a === void 0 || a.resetAndReload());
|
|
1320
1322
|
}, this.handleAccountUpdated = async (r) => {
|
|
1321
|
-
var o;
|
|
1322
|
-
const a = await this.cipher.decrypt(r);
|
|
1323
|
-
(o = this.listener) === null || o === void 0 || o.accountUpdated(a);
|
|
1324
|
-
}, this.handleMetadataUpdated = async (r, o) => {
|
|
1325
1323
|
var a;
|
|
1326
|
-
const
|
|
1327
|
-
(a = this.listener) === null || a === void 0 || a.
|
|
1324
|
+
const o = await this.cipher.decrypt(r);
|
|
1325
|
+
(a = this.listener) === null || a === void 0 || a.accountUpdated(o);
|
|
1326
|
+
}, this.handleMetadataUpdated = async (r, a) => {
|
|
1327
|
+
var o;
|
|
1328
|
+
const d = await this.cipher.decrypt(a);
|
|
1329
|
+
(o = this.listener) === null || o === void 0 || o.metadataUpdated(r, d);
|
|
1328
1330
|
}, this.handleWalletUsernameUpdated = async (r) => {
|
|
1329
|
-
this.handleMetadataUpdated(
|
|
1331
|
+
this.handleMetadataUpdated(ts, r);
|
|
1330
1332
|
}, this.handleAppVersionUpdated = async (r) => {
|
|
1331
|
-
this.handleMetadataUpdated(
|
|
1332
|
-
}, this.handleChainUpdated = async (r,
|
|
1333
|
-
var
|
|
1334
|
-
const d = await this.cipher.decrypt(r),
|
|
1335
|
-
(
|
|
1336
|
-
}, this.session = e, this.cipher = new
|
|
1337
|
-
const i = new
|
|
1333
|
+
this.handleMetadataUpdated(ns, r);
|
|
1334
|
+
}, this.handleChainUpdated = async (r, a) => {
|
|
1335
|
+
var o;
|
|
1336
|
+
const d = await this.cipher.decrypt(r), c = await this.cipher.decrypt(a);
|
|
1337
|
+
(o = this.listener) === null || o === void 0 || o.chainUpdated(d, c);
|
|
1338
|
+
}, this.session = e, this.cipher = new ss(e.secret), this.listener = s;
|
|
1339
|
+
const i = new rs(`${n}/rpc`, WebSocket);
|
|
1338
1340
|
i.setConnectionStateListener(async (r) => {
|
|
1339
|
-
let
|
|
1341
|
+
let a = !1;
|
|
1340
1342
|
switch (r) {
|
|
1341
|
-
case
|
|
1343
|
+
case U.DISCONNECTED:
|
|
1342
1344
|
if (!this.destroyed) {
|
|
1343
|
-
const
|
|
1345
|
+
const o = async () => {
|
|
1344
1346
|
await new Promise((d) => setTimeout(d, 5e3)), this.destroyed || i.connect().catch(() => {
|
|
1345
|
-
|
|
1347
|
+
o();
|
|
1346
1348
|
});
|
|
1347
1349
|
};
|
|
1348
|
-
|
|
1350
|
+
o();
|
|
1349
1351
|
}
|
|
1350
1352
|
break;
|
|
1351
|
-
case
|
|
1352
|
-
|
|
1353
|
+
case U.CONNECTED:
|
|
1354
|
+
a = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => {
|
|
1353
1355
|
this.heartbeat();
|
|
1354
|
-
},
|
|
1356
|
+
}, et), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI();
|
|
1355
1357
|
break;
|
|
1356
|
-
case
|
|
1358
|
+
case U.CONNECTING:
|
|
1357
1359
|
break;
|
|
1358
1360
|
}
|
|
1359
|
-
this.connected !==
|
|
1361
|
+
this.connected !== a && (this.connected = a);
|
|
1360
1362
|
}), i.setIncomingDataListener((r) => {
|
|
1361
|
-
var
|
|
1363
|
+
var a;
|
|
1362
1364
|
switch (r.type) {
|
|
1363
1365
|
case "Heartbeat":
|
|
1364
1366
|
this.updateLastHeartbeat();
|
|
1365
1367
|
return;
|
|
1366
1368
|
case "IsLinkedOK":
|
|
1367
1369
|
case "Linked": {
|
|
1368
|
-
const
|
|
1369
|
-
this.linked =
|
|
1370
|
+
const o = r.type === "IsLinkedOK" ? r.linked : void 0;
|
|
1371
|
+
this.linked = o || r.onlineGuests > 0;
|
|
1370
1372
|
break;
|
|
1371
1373
|
}
|
|
1372
1374
|
case "GetSessionConfigOK":
|
|
@@ -1379,8 +1381,8 @@ class fs {
|
|
|
1379
1381
|
break;
|
|
1380
1382
|
}
|
|
1381
1383
|
}
|
|
1382
|
-
r.id !== void 0 && ((
|
|
1383
|
-
}), this.ws = i, this.http = new
|
|
1384
|
+
r.id !== void 0 && ((a = this.requestResolutions.get(r.id)) === null || a === void 0 || a(r));
|
|
1385
|
+
}), this.ws = i, this.http = new is(n, e.id, e.key);
|
|
1384
1386
|
}
|
|
1385
1387
|
/**
|
|
1386
1388
|
* Make a connection to the server
|
|
@@ -1397,7 +1399,7 @@ class fs {
|
|
|
1397
1399
|
async destroy() {
|
|
1398
1400
|
this.destroyed || (await this.makeRequest({
|
|
1399
1401
|
type: "SetSessionConfig",
|
|
1400
|
-
id:
|
|
1402
|
+
id: O(this.nextReqId++),
|
|
1401
1403
|
sessionId: this.session.id,
|
|
1402
1404
|
metadata: { __destroyed: "1" }
|
|
1403
1405
|
}, { timeout: 1e3 }), this.destroyed = !0, this.ws.disconnect(), this.listener = void 0);
|
|
@@ -1429,8 +1431,8 @@ class fs {
|
|
|
1429
1431
|
const s = await this.cipher.decrypt(e.data), i = JSON.parse(s);
|
|
1430
1432
|
if (i.type !== "WEB3_RESPONSE")
|
|
1431
1433
|
return;
|
|
1432
|
-
const { id: r, response:
|
|
1433
|
-
(n = this.listener) === null || n === void 0 || n.handleWeb3ResponseMessage(r,
|
|
1434
|
+
const { id: r, response: a } = i;
|
|
1435
|
+
(n = this.listener) === null || n === void 0 || n.handleWeb3ResponseMessage(r, a);
|
|
1434
1436
|
}
|
|
1435
1437
|
async checkUnseenEvents() {
|
|
1436
1438
|
if (!this.connected) {
|
|
@@ -1457,17 +1459,17 @@ class fs {
|
|
|
1457
1459
|
async publishEvent(e, n, s = !1) {
|
|
1458
1460
|
const i = await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({}, n), { origin: location.origin, location: location.href, relaySource: "coinbaseWalletExtension" in window && window.coinbaseWalletExtension ? "injected_sdk" : "sdk" }))), r = {
|
|
1459
1461
|
type: "PublishEvent",
|
|
1460
|
-
id:
|
|
1462
|
+
id: O(this.nextReqId++),
|
|
1461
1463
|
sessionId: this.session.id,
|
|
1462
1464
|
event: e,
|
|
1463
1465
|
data: i,
|
|
1464
1466
|
callWebhook: s
|
|
1465
1467
|
};
|
|
1466
1468
|
return this.setOnceLinked(async () => {
|
|
1467
|
-
const
|
|
1468
|
-
if (
|
|
1469
|
-
throw new Error(
|
|
1470
|
-
return
|
|
1469
|
+
const a = await this.makeRequest(r);
|
|
1470
|
+
if (a.type === "Fail")
|
|
1471
|
+
throw new Error(a.error || "failed to publish event");
|
|
1472
|
+
return a.eventId;
|
|
1471
1473
|
});
|
|
1472
1474
|
}
|
|
1473
1475
|
sendData(e) {
|
|
@@ -1477,7 +1479,7 @@ class fs {
|
|
|
1477
1479
|
this.lastHeartbeatResponse = Date.now();
|
|
1478
1480
|
}
|
|
1479
1481
|
heartbeat() {
|
|
1480
|
-
if (Date.now() - this.lastHeartbeatResponse >
|
|
1482
|
+
if (Date.now() - this.lastHeartbeatResponse > et * 2) {
|
|
1481
1483
|
this.ws.disconnect();
|
|
1482
1484
|
return;
|
|
1483
1485
|
}
|
|
@@ -1486,19 +1488,19 @@ class fs {
|
|
|
1486
1488
|
} catch {
|
|
1487
1489
|
}
|
|
1488
1490
|
}
|
|
1489
|
-
async makeRequest(e, n = { timeout:
|
|
1491
|
+
async makeRequest(e, n = { timeout: as }) {
|
|
1490
1492
|
const s = e.id;
|
|
1491
1493
|
this.sendData(e);
|
|
1492
1494
|
let i;
|
|
1493
1495
|
return Promise.race([
|
|
1494
|
-
new Promise((r,
|
|
1496
|
+
new Promise((r, a) => {
|
|
1495
1497
|
i = window.setTimeout(() => {
|
|
1496
|
-
|
|
1498
|
+
a(new Error(`request ${s} timed out`));
|
|
1497
1499
|
}, n.timeout);
|
|
1498
1500
|
}),
|
|
1499
1501
|
new Promise((r) => {
|
|
1500
|
-
this.requestResolutions.set(s, (
|
|
1501
|
-
clearTimeout(i), r(
|
|
1502
|
+
this.requestResolutions.set(s, (a) => {
|
|
1503
|
+
clearTimeout(i), r(a), this.requestResolutions.delete(s);
|
|
1502
1504
|
});
|
|
1503
1505
|
})
|
|
1504
1506
|
]);
|
|
@@ -1506,268 +1508,42 @@ class fs {
|
|
|
1506
1508
|
async handleConnected() {
|
|
1507
1509
|
return (await this.makeRequest({
|
|
1508
1510
|
type: "HostSession",
|
|
1509
|
-
id:
|
|
1511
|
+
id: O(this.nextReqId++),
|
|
1510
1512
|
sessionId: this.session.id,
|
|
1511
1513
|
sessionKey: this.session.key
|
|
1512
1514
|
})).type === "Fail" ? !1 : (this.sendData({
|
|
1513
1515
|
type: "IsLinked",
|
|
1514
|
-
id:
|
|
1516
|
+
id: O(this.nextReqId++),
|
|
1515
1517
|
sessionId: this.session.id
|
|
1516
1518
|
}), this.sendData({
|
|
1517
1519
|
type: "GetSessionConfig",
|
|
1518
|
-
id:
|
|
1520
|
+
id: O(this.nextReqId++),
|
|
1519
1521
|
sessionId: this.session.id
|
|
1520
1522
|
}), !0);
|
|
1521
1523
|
}
|
|
1522
1524
|
}
|
|
1523
|
-
class
|
|
1525
|
+
class cs {
|
|
1524
1526
|
constructor() {
|
|
1525
1527
|
this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map();
|
|
1526
1528
|
}
|
|
1527
1529
|
makeRequestId() {
|
|
1528
1530
|
this._nextRequestId = (this._nextRequestId + 1) % 2147483647;
|
|
1529
|
-
const e = this._nextRequestId, n =
|
|
1531
|
+
const e = this._nextRequestId, n = Rt(e.toString(16));
|
|
1530
1532
|
return this.callbacks.get(n) && this.callbacks.delete(n), e;
|
|
1531
1533
|
}
|
|
1532
1534
|
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1536
|
-
}
|
|
1537
|
-
function we(t, ...e) {
|
|
1538
|
-
if (!gs(t))
|
|
1539
|
-
throw new Error("Uint8Array expected");
|
|
1540
|
-
if (e.length > 0 && !e.includes(t.length))
|
|
1541
|
-
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
1542
|
-
}
|
|
1543
|
-
function at(t, e = !0) {
|
|
1544
|
-
if (t.destroyed)
|
|
1545
|
-
throw new Error("Hash instance has been destroyed");
|
|
1546
|
-
if (e && t.finished)
|
|
1547
|
-
throw new Error("Hash#digest() has already been called");
|
|
1548
|
-
}
|
|
1549
|
-
function _s(t, e) {
|
|
1550
|
-
we(t);
|
|
1551
|
-
const n = e.outputLen;
|
|
1552
|
-
if (t.length < n)
|
|
1553
|
-
throw new Error("digestInto() expects output buffer of length at least " + n);
|
|
1554
|
-
}
|
|
1555
|
-
function De(...t) {
|
|
1556
|
-
for (let e = 0; e < t.length; e++)
|
|
1557
|
-
t[e].fill(0);
|
|
1558
|
-
}
|
|
1559
|
-
function Me(t) {
|
|
1560
|
-
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
1561
|
-
}
|
|
1562
|
-
function T(t, e) {
|
|
1563
|
-
return t << 32 - e | t >>> e;
|
|
1564
|
-
}
|
|
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
|
-
return t.toHex();
|
|
1569
|
-
let e = "";
|
|
1570
|
-
for (let n = 0; n < t.length; n++)
|
|
1571
|
-
e += bs[t[n]];
|
|
1572
|
-
return e;
|
|
1573
|
-
}
|
|
1574
|
-
function ys(t) {
|
|
1575
|
-
if (typeof t != "string")
|
|
1576
|
-
throw new Error("string expected");
|
|
1577
|
-
return new Uint8Array(new TextEncoder().encode(t));
|
|
1578
|
-
}
|
|
1579
|
-
function en(t) {
|
|
1580
|
-
return typeof t == "string" && (t = ys(t)), we(t), t;
|
|
1581
|
-
}
|
|
1582
|
-
class vs {
|
|
1583
|
-
}
|
|
1584
|
-
function ks(t) {
|
|
1585
|
-
const e = (s) => t().update(en(s)).digest(), n = t();
|
|
1586
|
-
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1587
|
-
}
|
|
1588
|
-
function Es(t, e, n, s) {
|
|
1589
|
-
if (typeof t.setBigUint64 == "function")
|
|
1590
|
-
return t.setBigUint64(e, n, s);
|
|
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
|
-
t.setUint32(e + d, o, s), t.setUint32(e + l, a, s);
|
|
1593
|
-
}
|
|
1594
|
-
function Cs(t, e, n) {
|
|
1595
|
-
return t & e ^ ~t & n;
|
|
1596
|
-
}
|
|
1597
|
-
function xs(t, e, n) {
|
|
1598
|
-
return t & e ^ t & n ^ e & n;
|
|
1599
|
-
}
|
|
1600
|
-
class Is extends vs {
|
|
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 = Me(this.buffer);
|
|
1603
|
-
}
|
|
1604
|
-
update(e) {
|
|
1605
|
-
at(this), e = en(e), we(e);
|
|
1606
|
-
const { view: n, buffer: s, blockLen: i } = this, r = e.length;
|
|
1607
|
-
for (let o = 0; o < r; ) {
|
|
1608
|
-
const a = Math.min(i - this.pos, r - o);
|
|
1609
|
-
if (a === i) {
|
|
1610
|
-
const d = Me(e);
|
|
1611
|
-
for (; i <= r - o; o += i)
|
|
1612
|
-
this.process(d, o);
|
|
1613
|
-
continue;
|
|
1614
|
-
}
|
|
1615
|
-
s.set(e.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === i && (this.process(n, 0), this.pos = 0);
|
|
1616
|
-
}
|
|
1617
|
-
return this.length += e.length, this.roundClean(), this;
|
|
1618
|
-
}
|
|
1619
|
-
digestInto(e) {
|
|
1620
|
-
at(this), _s(e, this), this.finished = !0;
|
|
1621
|
-
const { buffer: n, view: s, blockLen: i, isLE: r } = this;
|
|
1622
|
-
let { pos: o } = this;
|
|
1623
|
-
n[o++] = 128, De(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(s, 0), o = 0);
|
|
1624
|
-
for (let c = o; c < i; c++)
|
|
1625
|
-
n[c] = 0;
|
|
1626
|
-
Es(s, i - 8, BigInt(this.length * 8), r), this.process(s, 0);
|
|
1627
|
-
const a = Me(e), d = this.outputLen;
|
|
1628
|
-
if (d % 4)
|
|
1629
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
1630
|
-
const l = d / 4, h = this.get();
|
|
1631
|
-
if (l > h.length)
|
|
1632
|
-
throw new Error("_sha2: outputLen bigger than state");
|
|
1633
|
-
for (let c = 0; c < l; c++)
|
|
1634
|
-
a.setUint32(4 * c, h[c], r);
|
|
1635
|
-
}
|
|
1636
|
-
digest() {
|
|
1637
|
-
const { buffer: e, outputLen: n } = this;
|
|
1638
|
-
this.digestInto(e);
|
|
1639
|
-
const s = e.slice(0, n);
|
|
1640
|
-
return this.destroy(), s;
|
|
1641
|
-
}
|
|
1642
|
-
_cloneInto(e) {
|
|
1643
|
-
e || (e = new this.constructor()), e.set(...this.get());
|
|
1644
|
-
const { blockLen: n, buffer: s, length: i, finished: r, destroyed: o, pos: a } = this;
|
|
1645
|
-
return e.destroyed = o, e.finished = r, e.length = i, e.pos = a, i % n && e.buffer.set(s), e;
|
|
1646
|
-
}
|
|
1647
|
-
clone() {
|
|
1648
|
-
return this._cloneInto();
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
const q = /* @__PURE__ */ Uint32Array.from([
|
|
1652
|
-
1779033703,
|
|
1653
|
-
3144134277,
|
|
1654
|
-
1013904242,
|
|
1655
|
-
2773480762,
|
|
1656
|
-
1359893119,
|
|
1657
|
-
2600822924,
|
|
1658
|
-
528734635,
|
|
1659
|
-
1541459225
|
|
1660
|
-
]), Ss = /* @__PURE__ */ Uint32Array.from([
|
|
1661
|
-
1116352408,
|
|
1662
|
-
1899447441,
|
|
1663
|
-
3049323471,
|
|
1664
|
-
3921009573,
|
|
1665
|
-
961987163,
|
|
1666
|
-
1508970993,
|
|
1667
|
-
2453635748,
|
|
1668
|
-
2870763221,
|
|
1669
|
-
3624381080,
|
|
1670
|
-
310598401,
|
|
1671
|
-
607225278,
|
|
1672
|
-
1426881987,
|
|
1673
|
-
1925078388,
|
|
1674
|
-
2162078206,
|
|
1675
|
-
2614888103,
|
|
1676
|
-
3248222580,
|
|
1677
|
-
3835390401,
|
|
1678
|
-
4022224774,
|
|
1679
|
-
264347078,
|
|
1680
|
-
604807628,
|
|
1681
|
-
770255983,
|
|
1682
|
-
1249150122,
|
|
1683
|
-
1555081692,
|
|
1684
|
-
1996064986,
|
|
1685
|
-
2554220882,
|
|
1686
|
-
2821834349,
|
|
1687
|
-
2952996808,
|
|
1688
|
-
3210313671,
|
|
1689
|
-
3336571891,
|
|
1690
|
-
3584528711,
|
|
1691
|
-
113926993,
|
|
1692
|
-
338241895,
|
|
1693
|
-
666307205,
|
|
1694
|
-
773529912,
|
|
1695
|
-
1294757372,
|
|
1696
|
-
1396182291,
|
|
1697
|
-
1695183700,
|
|
1698
|
-
1986661051,
|
|
1699
|
-
2177026350,
|
|
1700
|
-
2456956037,
|
|
1701
|
-
2730485921,
|
|
1702
|
-
2820302411,
|
|
1703
|
-
3259730800,
|
|
1704
|
-
3345764771,
|
|
1705
|
-
3516065817,
|
|
1706
|
-
3600352804,
|
|
1707
|
-
4094571909,
|
|
1708
|
-
275423344,
|
|
1709
|
-
430227734,
|
|
1710
|
-
506948616,
|
|
1711
|
-
659060556,
|
|
1712
|
-
883997877,
|
|
1713
|
-
958139571,
|
|
1714
|
-
1322822218,
|
|
1715
|
-
1537002063,
|
|
1716
|
-
1747873779,
|
|
1717
|
-
1955562222,
|
|
1718
|
-
2024104815,
|
|
1719
|
-
2227730452,
|
|
1720
|
-
2361852424,
|
|
1721
|
-
2428436474,
|
|
1722
|
-
2756734187,
|
|
1723
|
-
3204031479,
|
|
1724
|
-
3329325298
|
|
1725
|
-
]), V = /* @__PURE__ */ new Uint32Array(64);
|
|
1726
|
-
class As extends Is {
|
|
1727
|
-
constructor(e = 32) {
|
|
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
|
-
}
|
|
1730
|
-
get() {
|
|
1731
|
-
const { A: e, B: n, C: s, D: i, E: r, F: o, G: a, H: d } = this;
|
|
1732
|
-
return [e, n, s, i, r, o, a, d];
|
|
1733
|
-
}
|
|
1734
|
-
// prettier-ignore
|
|
1735
|
-
set(e, n, s, i, r, o, a, d) {
|
|
1736
|
-
this.A = e | 0, this.B = n | 0, this.C = s | 0, this.D = i | 0, this.E = r | 0, this.F = o | 0, this.G = a | 0, this.H = d | 0;
|
|
1737
|
-
}
|
|
1738
|
-
process(e, n) {
|
|
1739
|
-
for (let c = 0; c < 16; c++, n += 4)
|
|
1740
|
-
V[c] = e.getUint32(n, !1);
|
|
1741
|
-
for (let c = 16; c < 64; c++) {
|
|
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
|
-
V[c] = v + V[c - 7] + g + V[c - 16] | 0;
|
|
1744
|
-
}
|
|
1745
|
-
let { A: s, B: i, C: r, D: o, E: a, F: d, G: l, H: h } = this;
|
|
1746
|
-
for (let c = 0; c < 64; c++) {
|
|
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
|
-
h = l, l = d, d = a, a = o + u | 0, o = r, r = i, i = s, s = u + v | 0;
|
|
1749
|
-
}
|
|
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
|
-
}
|
|
1752
|
-
roundClean() {
|
|
1753
|
-
De(V);
|
|
1754
|
-
}
|
|
1755
|
-
destroy() {
|
|
1756
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0), De(this.buffer);
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
const Ms = /* @__PURE__ */ ks(() => new As()), Ls = Ms, ct = "session:id", lt = "session:secret", dt = "session:linked";
|
|
1760
|
-
class J {
|
|
1535
|
+
const tt = "session:id", nt = "session:secret", st = "session:linked";
|
|
1536
|
+
class Z {
|
|
1761
1537
|
constructor(e, n, s, i = !1) {
|
|
1762
|
-
this.storage = e, this.id = n, this.secret = s, this.key =
|
|
1538
|
+
this.storage = e, this.id = n, this.secret = s, this.key = mn(_n(`${n}, ${s} WalletLink`)), this._linked = !!i;
|
|
1763
1539
|
}
|
|
1764
1540
|
static create(e) {
|
|
1765
|
-
const n =
|
|
1766
|
-
return new
|
|
1541
|
+
const n = K(16), s = K(32);
|
|
1542
|
+
return new Z(e, n, s).save();
|
|
1767
1543
|
}
|
|
1768
1544
|
static load(e) {
|
|
1769
|
-
const n = e.getItem(
|
|
1770
|
-
return n && i ? new
|
|
1545
|
+
const n = e.getItem(tt), s = e.getItem(st), i = e.getItem(nt);
|
|
1546
|
+
return n && i ? new Z(e, n, i, s === "1") : null;
|
|
1771
1547
|
}
|
|
1772
1548
|
get linked() {
|
|
1773
1549
|
return this._linked;
|
|
@@ -1776,142 +1552,142 @@ class J {
|
|
|
1776
1552
|
this._linked = e, this.persistLinked();
|
|
1777
1553
|
}
|
|
1778
1554
|
save() {
|
|
1779
|
-
return this.storage.setItem(
|
|
1555
|
+
return this.storage.setItem(tt, this.id), this.storage.setItem(nt, this.secret), this.persistLinked(), this;
|
|
1780
1556
|
}
|
|
1781
1557
|
persistLinked() {
|
|
1782
|
-
this.storage.setItem(
|
|
1558
|
+
this.storage.setItem(st, this._linked ? "1" : "0");
|
|
1783
1559
|
}
|
|
1784
1560
|
}
|
|
1785
|
-
function
|
|
1561
|
+
function ls() {
|
|
1786
1562
|
try {
|
|
1787
1563
|
return window.frameElement !== null;
|
|
1788
1564
|
} catch {
|
|
1789
1565
|
return !1;
|
|
1790
1566
|
}
|
|
1791
1567
|
}
|
|
1792
|
-
function
|
|
1568
|
+
function ds() {
|
|
1793
1569
|
try {
|
|
1794
|
-
return
|
|
1570
|
+
return ls() && window.top ? window.top.location : window.location;
|
|
1795
1571
|
} catch {
|
|
1796
1572
|
return window.location;
|
|
1797
1573
|
}
|
|
1798
1574
|
}
|
|
1799
|
-
function
|
|
1575
|
+
function hs() {
|
|
1800
1576
|
var t;
|
|
1801
1577
|
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
1578
|
}
|
|
1803
|
-
function
|
|
1579
|
+
function $t() {
|
|
1804
1580
|
var t, e;
|
|
1805
1581
|
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
1582
|
}
|
|
1807
|
-
const
|
|
1808
|
-
function
|
|
1583
|
+
const us = '@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}';
|
|
1584
|
+
function Zt() {
|
|
1809
1585
|
const t = document.createElement("style");
|
|
1810
|
-
t.type = "text/css", t.appendChild(document.createTextNode(
|
|
1586
|
+
t.type = "text/css", t.appendChild(document.createTextNode(us)), document.documentElement.appendChild(t);
|
|
1811
1587
|
}
|
|
1812
|
-
function
|
|
1588
|
+
function Gt(t) {
|
|
1813
1589
|
var e, n, s = "";
|
|
1814
1590
|
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 =
|
|
1591
|
+
else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (n = Gt(t[e])) && (s && (s += " "), s += n);
|
|
1816
1592
|
else for (e in t) t[e] && (s && (s += " "), s += e);
|
|
1817
1593
|
return s;
|
|
1818
1594
|
}
|
|
1819
|
-
function
|
|
1820
|
-
for (var t, e, n = 0, s = ""; n < arguments.length; ) (t = arguments[n++]) && (e =
|
|
1595
|
+
function ee() {
|
|
1596
|
+
for (var t, e, n = 0, s = ""; n < arguments.length; ) (t = arguments[n++]) && (e = Gt(t)) && (s && (s += " "), s += e);
|
|
1821
1597
|
return s;
|
|
1822
1598
|
}
|
|
1823
|
-
var
|
|
1599
|
+
var _e, v, Yt, B, it, Jt, Qt, Xt, qe, Le, Pe, de = {}, he = [], fs = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, me = Array.isArray;
|
|
1824
1600
|
function W(t, e) {
|
|
1825
1601
|
for (var n in e) t[n] = e[n];
|
|
1826
1602
|
return t;
|
|
1827
1603
|
}
|
|
1828
|
-
function
|
|
1604
|
+
function Ke(t) {
|
|
1829
1605
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
1830
1606
|
}
|
|
1831
|
-
function
|
|
1832
|
-
var s, i, r,
|
|
1833
|
-
for (r in e) r == "key" ? s = e[r] : r == "ref" ? i = e[r] :
|
|
1834
|
-
if (arguments.length > 2 && (
|
|
1835
|
-
return
|
|
1607
|
+
function b(t, e, n) {
|
|
1608
|
+
var s, i, r, a = {};
|
|
1609
|
+
for (r in e) r == "key" ? s = e[r] : r == "ref" ? i = e[r] : a[r] = e[r];
|
|
1610
|
+
if (arguments.length > 2 && (a.children = arguments.length > 3 ? _e.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (r in t.defaultProps) a[r] === void 0 && (a[r] = t.defaultProps[r]);
|
|
1611
|
+
return oe(t, a, s, i, null);
|
|
1836
1612
|
}
|
|
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 ?? ++
|
|
1839
|
-
return i == null &&
|
|
1613
|
+
function oe(t, e, n, s, i) {
|
|
1614
|
+
var r = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Yt, __i: -1, __u: 0 };
|
|
1615
|
+
return i == null && v.vnode != null && v.vnode(r), r;
|
|
1840
1616
|
}
|
|
1841
|
-
function
|
|
1617
|
+
function we(t) {
|
|
1842
1618
|
return t.children;
|
|
1843
1619
|
}
|
|
1844
|
-
function
|
|
1620
|
+
function ce(t, e) {
|
|
1845
1621
|
this.props = t, this.context = e;
|
|
1846
1622
|
}
|
|
1847
|
-
function
|
|
1848
|
-
if (e == null) return t.__ ?
|
|
1623
|
+
function G(t, e) {
|
|
1624
|
+
if (e == null) return t.__ ? G(t.__, t.__i + 1) : null;
|
|
1849
1625
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
1850
|
-
return typeof t.type == "function" ?
|
|
1626
|
+
return typeof t.type == "function" ? G(t) : null;
|
|
1851
1627
|
}
|
|
1852
|
-
function
|
|
1628
|
+
function ps(t) {
|
|
1853
1629
|
if (t.__P && t.__d) {
|
|
1854
1630
|
var e = t.__v, n = e.__e, s = [], i = [], r = W({}, e);
|
|
1855
|
-
r.__v = e.__v + 1,
|
|
1631
|
+
r.__v = e.__v + 1, v.vnode && v.vnode(r), Ve(t.__P, r, e, t.__n, t.__P.namespaceURI, 32 & e.__u ? [n] : null, s, n ?? G(e), !!(32 & e.__u), i), r.__v = e.__v, r.__.__k[r.__i] = r, sn(s, r, i), e.__e = e.__ = null, r.__e != n && en(r);
|
|
1856
1632
|
}
|
|
1857
1633
|
}
|
|
1858
|
-
function
|
|
1634
|
+
function en(t) {
|
|
1859
1635
|
if ((t = t.__) != null && t.__c != null) return t.__e = t.__c.base = null, t.__k.some(function(e) {
|
|
1860
1636
|
if (e != null && e.__e != null) return t.__e = t.__c.base = e.__e;
|
|
1861
|
-
}),
|
|
1637
|
+
}), en(t);
|
|
1862
1638
|
}
|
|
1863
|
-
function
|
|
1864
|
-
(!t.__d && (t.__d = !0) &&
|
|
1639
|
+
function rt(t) {
|
|
1640
|
+
(!t.__d && (t.__d = !0) && B.push(t) && !ue.__r++ || it != v.debounceRendering) && ((it = v.debounceRendering) || Jt)(ue);
|
|
1865
1641
|
}
|
|
1866
|
-
function
|
|
1642
|
+
function ue() {
|
|
1867
1643
|
try {
|
|
1868
|
-
for (var t, e = 1;
|
|
1644
|
+
for (var t, e = 1; B.length; ) B.length > e && B.sort(Qt), t = B.shift(), e = B.length, ps(t);
|
|
1869
1645
|
} finally {
|
|
1870
|
-
|
|
1646
|
+
B.length = ue.__r = 0;
|
|
1871
1647
|
}
|
|
1872
1648
|
}
|
|
1873
|
-
function
|
|
1874
|
-
var
|
|
1875
|
-
for (d =
|
|
1876
|
-
return n.__e =
|
|
1649
|
+
function tn(t, e, n, s, i, r, a, o, d, c, h) {
|
|
1650
|
+
var l, f, u, g, k, p, _, m = s && s.__k || he, y = e.length;
|
|
1651
|
+
for (d = gs(n, e, m, d, y), l = 0; l < y; l++) (u = n.__k[l]) != null && (f = u.__i != -1 && m[u.__i] || de, u.__i = l, p = Ve(t, u, f, i, r, a, o, d, c, h), g = u.__e, u.ref && f.ref != u.ref && (f.ref && ze(f.ref, null, u), h.push(u.ref, u.__c || g, u)), k == null && g != null && (k = g), (_ = !!(4 & u.__u)) || f.__k === u.__k ? d = nn(u, d, t, _) : typeof u.type == "function" && p !== void 0 ? d = p : g && (d = g.nextSibling), u.__u &= -7);
|
|
1652
|
+
return n.__e = k, d;
|
|
1877
1653
|
}
|
|
1878
|
-
function
|
|
1879
|
-
var r,
|
|
1880
|
-
for (t.__k = new Array(i), r = 0; r < i; r++) (
|
|
1881
|
-
if (
|
|
1654
|
+
function gs(t, e, n, s, i) {
|
|
1655
|
+
var r, a, o, d, c, h = n.length, l = h, f = 0;
|
|
1656
|
+
for (t.__k = new Array(i), r = 0; r < i; r++) (a = e[r]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = t.__k[r] = oe(null, a, null, null, null) : me(a) ? a = t.__k[r] = oe(we, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = t.__k[r] = oe(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : t.__k[r] = a, d = r + f, a.__ = t, a.__b = t.__b + 1, o = null, (c = a.__i = _s(a, n, d, l)) != -1 && (l--, (o = n[c]) && (o.__u |= 2)), o == null || o.__v == null ? (c == -1 && (i > h ? f-- : i < h && f++), typeof a.type != "function" && (a.__u |= 4)) : c != d && (c == d - 1 ? f-- : c == d + 1 ? f++ : (c > d ? f-- : f++, a.__u |= 4))) : t.__k[r] = null;
|
|
1657
|
+
if (l) for (r = 0; r < h; r++) (o = n[r]) != null && !(2 & o.__u) && (o.__e == s && (s = G(o)), an(o, o));
|
|
1882
1658
|
return s;
|
|
1883
1659
|
}
|
|
1884
|
-
function
|
|
1660
|
+
function nn(t, e, n, s) {
|
|
1885
1661
|
var i, r;
|
|
1886
1662
|
if (typeof t.type == "function") {
|
|
1887
|
-
for (i = t.__k, r = 0; i && r < i.length; r++) i[r] && (i[r].__ = t, e =
|
|
1663
|
+
for (i = t.__k, r = 0; i && r < i.length; r++) i[r] && (i[r].__ = t, e = nn(i[r], e, n, s));
|
|
1888
1664
|
return e;
|
|
1889
1665
|
}
|
|
1890
|
-
t.__e != e && (s && (e && t.type && !e.parentNode && (e =
|
|
1666
|
+
t.__e != e && (s && (e && t.type && !e.parentNode && (e = G(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
|
|
1891
1667
|
do
|
|
1892
1668
|
e = e && e.nextSibling;
|
|
1893
1669
|
while (e != null && e.nodeType == 8);
|
|
1894
1670
|
return e;
|
|
1895
1671
|
}
|
|
1896
|
-
function
|
|
1897
|
-
var i, r,
|
|
1898
|
-
if (
|
|
1672
|
+
function _s(t, e, n, s) {
|
|
1673
|
+
var i, r, a, o = t.key, d = t.type, c = e[n], h = c != null && (2 & c.__u) == 0;
|
|
1674
|
+
if (c === null && o == null || h && o == c.key && d == c.type) return n;
|
|
1899
1675
|
if (s > (h ? 1 : 0)) {
|
|
1900
|
-
for (i = n - 1, r = n + 1; i >= 0 || r < e.length; ) if ((
|
|
1676
|
+
for (i = n - 1, r = n + 1; i >= 0 || r < e.length; ) if ((c = e[a = i >= 0 ? i-- : r++]) != null && !(2 & c.__u) && o == c.key && d == c.type) return a;
|
|
1901
1677
|
}
|
|
1902
1678
|
return -1;
|
|
1903
1679
|
}
|
|
1904
|
-
function
|
|
1905
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" ||
|
|
1680
|
+
function at(t, e, n) {
|
|
1681
|
+
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || fs.test(e) ? n : n + "px";
|
|
1906
1682
|
}
|
|
1907
|
-
function
|
|
1908
|
-
var r,
|
|
1683
|
+
function re(t, e, n, s, i) {
|
|
1684
|
+
var r, a;
|
|
1909
1685
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
1910
1686
|
else {
|
|
1911
|
-
if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n ||
|
|
1912
|
-
if (n) for (e in n) s && n[e] == s[e] ||
|
|
1687
|
+
if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n || at(t.style, e, "");
|
|
1688
|
+
if (n) for (e in n) s && n[e] == s[e] || at(t.style, e, n[e]);
|
|
1913
1689
|
}
|
|
1914
|
-
else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(
|
|
1690
|
+
else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(Xt, "$1")), a = e.toLowerCase(), e = a in t || e == "onFocusOut" || e == "onFocusIn" ? a.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + r] = n, n ? s ? n.u = s.u : (n.u = qe, t.addEventListener(e, r ? Pe : Le, r)) : t.removeEventListener(e, r ? Pe : Le, r);
|
|
1915
1691
|
else {
|
|
1916
1692
|
if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
1917
1693
|
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 {
|
|
@@ -1922,261 +1698,261 @@ function ce(t, e, n, s, i) {
|
|
|
1922
1698
|
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
1923
1699
|
}
|
|
1924
1700
|
}
|
|
1925
|
-
function
|
|
1701
|
+
function ot(t) {
|
|
1926
1702
|
return function(e) {
|
|
1927
1703
|
if (this.l) {
|
|
1928
1704
|
var n = this.l[e.type + t];
|
|
1929
|
-
if (e.t == null) e.t =
|
|
1705
|
+
if (e.t == null) e.t = qe++;
|
|
1930
1706
|
else if (e.t < n.u) return;
|
|
1931
|
-
return n(
|
|
1707
|
+
return n(v.event ? v.event(e) : e);
|
|
1932
1708
|
}
|
|
1933
1709
|
};
|
|
1934
1710
|
}
|
|
1935
|
-
function
|
|
1936
|
-
var h,
|
|
1711
|
+
function Ve(t, e, n, s, i, r, a, o, d, c) {
|
|
1712
|
+
var h, l, f, u, g, k, p, _, m, y, D, A, Fe, se, ye, P = e.type;
|
|
1937
1713
|
if (e.constructor !== void 0) return null;
|
|
1938
|
-
128 & n.__u && (d = !!(32 & n.__u), r = [
|
|
1714
|
+
128 & n.__u && (d = !!(32 & n.__u), r = [o = e.__e = n.__e]), (h = v.__b) && h(e);
|
|
1939
1715
|
e: if (typeof P == "function") try {
|
|
1940
|
-
if (_ = e.props, m = P.prototype && P.prototype.render,
|
|
1716
|
+
if (_ = e.props, m = P.prototype && P.prototype.render, y = (h = P.contextType) && s[h.__c], D = h ? y ? y.props.value : h.__ : s, n.__c ? p = (l = e.__c = n.__c).__ = l.__E : (m ? e.__c = l = new P(_, D) : (e.__c = l = new ce(_, D), l.constructor = P, l.render = ws), y && y.sub(l), l.state || (l.state = {}), l.__n = s, f = l.__d = !0, l.__h = [], l._sb = []), m && l.__s == null && (l.__s = l.state), m && P.getDerivedStateFromProps != null && (l.__s == l.state && (l.__s = W({}, l.__s)), W(l.__s, P.getDerivedStateFromProps(_, l.__s))), u = l.props, g = l.state, l.__v = e, f) m && P.getDerivedStateFromProps == null && l.componentWillMount != null && l.componentWillMount(), m && l.componentDidMount != null && l.__h.push(l.componentDidMount);
|
|
1941
1717
|
else {
|
|
1942
|
-
if (m && P.getDerivedStateFromProps == null && _ !== u &&
|
|
1943
|
-
e.__v != n.__v && (
|
|
1944
|
-
|
|
1945
|
-
}),
|
|
1718
|
+
if (m && P.getDerivedStateFromProps == null && _ !== u && l.componentWillReceiveProps != null && l.componentWillReceiveProps(_, D), e.__v == n.__v || !l.__e && l.shouldComponentUpdate != null && l.shouldComponentUpdate(_, l.__s, D) === !1) {
|
|
1719
|
+
e.__v != n.__v && (l.props = _, l.state = l.__s, l.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(z) {
|
|
1720
|
+
z && (z.__ = e);
|
|
1721
|
+
}), he.push.apply(l.__h, l._sb), l._sb = [], l.__h.length && a.push(l);
|
|
1946
1722
|
break e;
|
|
1947
1723
|
}
|
|
1948
|
-
|
|
1949
|
-
|
|
1724
|
+
l.componentWillUpdate != null && l.componentWillUpdate(_, l.__s, D), m && l.componentDidUpdate != null && l.__h.push(function() {
|
|
1725
|
+
l.componentDidUpdate(u, g, k);
|
|
1950
1726
|
});
|
|
1951
1727
|
}
|
|
1952
|
-
if (
|
|
1728
|
+
if (l.context = D, l.props = _, l.__P = t, l.__e = !1, A = v.__r, Fe = 0, m) l.state = l.__s, l.__d = !1, A && A(e), h = l.render(l.props, l.state, l.context), he.push.apply(l.__h, l._sb), l._sb = [];
|
|
1953
1729
|
else do
|
|
1954
|
-
|
|
1955
|
-
while (
|
|
1956
|
-
|
|
1957
|
-
} catch (
|
|
1958
|
-
if (e.__v = null, d || r != null) if (
|
|
1959
|
-
for (e.__u |= d ? 160 : 128;
|
|
1960
|
-
r[r.indexOf(
|
|
1730
|
+
l.__d = !1, A && A(e), h = l.render(l.props, l.state, l.context), l.state = l.__s;
|
|
1731
|
+
while (l.__d && ++Fe < 25);
|
|
1732
|
+
l.state = l.__s, l.getChildContext != null && (s = W(W({}, s), l.getChildContext())), m && !f && l.getSnapshotBeforeUpdate != null && (k = l.getSnapshotBeforeUpdate(u, g)), se = h != null && h.type === we && h.key == null ? rn(h.props.children) : h, o = tn(t, me(se) ? se : [se], e, n, s, i, r, a, o, d, c), l.base = e.__e, e.__u &= -161, l.__h.length && a.push(l), p && (l.__E = l.__ = null);
|
|
1733
|
+
} catch (z) {
|
|
1734
|
+
if (e.__v = null, d || r != null) if (z.then) {
|
|
1735
|
+
for (e.__u |= d ? 160 : 128; o && o.nodeType == 8 && o.nextSibling; ) o = o.nextSibling;
|
|
1736
|
+
r[r.indexOf(o)] = null, e.__e = o;
|
|
1961
1737
|
} else {
|
|
1962
|
-
for (
|
|
1963
|
-
|
|
1738
|
+
for (ye = r.length; ye--; ) Ke(r[ye]);
|
|
1739
|
+
Re(e);
|
|
1964
1740
|
}
|
|
1965
|
-
else e.__e = n.__e, e.__k = n.__k,
|
|
1966
|
-
|
|
1741
|
+
else e.__e = n.__e, e.__k = n.__k, z.then || Re(e);
|
|
1742
|
+
v.__e(z, e, n);
|
|
1967
1743
|
}
|
|
1968
|
-
else r == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) :
|
|
1969
|
-
return (h =
|
|
1744
|
+
else r == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : o = e.__e = ms(n.__e, e, n, s, i, r, a, d, c);
|
|
1745
|
+
return (h = v.diffed) && h(e), 128 & e.__u ? void 0 : o;
|
|
1970
1746
|
}
|
|
1971
|
-
function
|
|
1972
|
-
t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(
|
|
1747
|
+
function Re(t) {
|
|
1748
|
+
t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(Re));
|
|
1973
1749
|
}
|
|
1974
|
-
function
|
|
1975
|
-
for (var s = 0; s < n.length; s++)
|
|
1976
|
-
|
|
1750
|
+
function sn(t, e, n) {
|
|
1751
|
+
for (var s = 0; s < n.length; s++) ze(n[s], n[++s], n[++s]);
|
|
1752
|
+
v.__c && v.__c(e, t), t.some(function(i) {
|
|
1977
1753
|
try {
|
|
1978
1754
|
t = i.__h, i.__h = [], t.some(function(r) {
|
|
1979
1755
|
r.call(i);
|
|
1980
1756
|
});
|
|
1981
1757
|
} catch (r) {
|
|
1982
|
-
|
|
1758
|
+
v.__e(r, i.__v);
|
|
1983
1759
|
}
|
|
1984
1760
|
});
|
|
1985
1761
|
}
|
|
1986
|
-
function
|
|
1987
|
-
return typeof t != "object" || t == null || t.__b > 0 ? t :
|
|
1762
|
+
function rn(t) {
|
|
1763
|
+
return typeof t != "object" || t == null || t.__b > 0 ? t : me(t) ? t.map(rn) : W({}, t);
|
|
1988
1764
|
}
|
|
1989
|
-
function
|
|
1990
|
-
var
|
|
1765
|
+
function ms(t, e, n, s, i, r, a, o, d) {
|
|
1766
|
+
var c, h, l, f, u, g, k, p = n.props || de, _ = e.props, m = e.type;
|
|
1991
1767
|
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) {
|
|
1992
|
-
for (
|
|
1993
|
-
t = u, r[
|
|
1768
|
+
for (c = 0; c < r.length; c++) if ((u = r[c]) && "setAttribute" in u == !!m && (m ? u.localName == m : u.nodeType == 3)) {
|
|
1769
|
+
t = u, r[c] = null;
|
|
1994
1770
|
break;
|
|
1995
1771
|
}
|
|
1996
1772
|
}
|
|
1997
1773
|
if (t == null) {
|
|
1998
1774
|
if (m == null) return document.createTextNode(_);
|
|
1999
|
-
t = document.createElementNS(i, m, _.is && _),
|
|
1775
|
+
t = document.createElementNS(i, m, _.is && _), o && (v.__m && v.__m(e, r), o = !1), r = null;
|
|
2000
1776
|
}
|
|
2001
|
-
if (m == null) p === _ ||
|
|
1777
|
+
if (m == null) p === _ || o && t.data == _ || (t.data = _);
|
|
2002
1778
|
else {
|
|
2003
|
-
if (r = r &&
|
|
2004
|
-
for (
|
|
2005
|
-
for (
|
|
2006
|
-
if (h)
|
|
2007
|
-
else if (
|
|
2008
|
-
|
|
1779
|
+
if (r = r && _e.call(t.childNodes), !o && r != null) for (p = {}, c = 0; c < t.attributes.length; c++) p[(u = t.attributes[c]).name] = u.value;
|
|
1780
|
+
for (c in p) u = p[c], c == "dangerouslySetInnerHTML" ? l = u : c == "children" || c in _ || c == "value" && "defaultValue" in _ || c == "checked" && "defaultChecked" in _ || re(t, c, null, u, i);
|
|
1781
|
+
for (c in _) u = _[c], c == "children" ? f = u : c == "dangerouslySetInnerHTML" ? h = u : c == "value" ? g = u : c == "checked" ? k = u : o && typeof u != "function" || p[c] === u || re(t, c, u, p[c], i);
|
|
1782
|
+
if (h) o || l && (h.__html == l.__html || h.__html == t.innerHTML) || (t.innerHTML = h.__html), e.__k = [];
|
|
1783
|
+
else if (l && (t.innerHTML = ""), tn(e.type == "template" ? t.content : t, me(f) ? f : [f], e, n, s, m == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, a, r ? r[0] : n.__k && G(n, 0), o, d), r != null) for (c = r.length; c--; ) Ke(r[c]);
|
|
1784
|
+
o || (c = "value", m == "progress" && g == null ? t.removeAttribute("value") : g != null && (g !== t[c] || m == "progress" && !g || m == "option" && g != p[c]) && re(t, c, g, p[c], i), c = "checked", k != null && k != t[c] && re(t, c, k, p[c], i));
|
|
2009
1785
|
}
|
|
2010
1786
|
return t;
|
|
2011
1787
|
}
|
|
2012
|
-
function
|
|
1788
|
+
function ze(t, e, n) {
|
|
2013
1789
|
try {
|
|
2014
1790
|
if (typeof t == "function") {
|
|
2015
1791
|
var s = typeof t.__u == "function";
|
|
2016
1792
|
s && t.__u(), s && e == null || (t.__u = t(e));
|
|
2017
1793
|
} else t.current = e;
|
|
2018
1794
|
} catch (i) {
|
|
2019
|
-
|
|
1795
|
+
v.__e(i, n);
|
|
2020
1796
|
}
|
|
2021
1797
|
}
|
|
2022
|
-
function
|
|
1798
|
+
function an(t, e, n) {
|
|
2023
1799
|
var s, i;
|
|
2024
|
-
if (
|
|
1800
|
+
if (v.unmount && v.unmount(t), (s = t.ref) && (s.current && s.current != t.__e || ze(s, null, e)), (s = t.__c) != null) {
|
|
2025
1801
|
if (s.componentWillUnmount) try {
|
|
2026
1802
|
s.componentWillUnmount();
|
|
2027
1803
|
} catch (r) {
|
|
2028
|
-
|
|
1804
|
+
v.__e(r, e);
|
|
2029
1805
|
}
|
|
2030
1806
|
s.base = s.__P = null;
|
|
2031
1807
|
}
|
|
2032
|
-
if (s = t.__k) for (i = 0; i < s.length; i++) s[i] &&
|
|
2033
|
-
n ||
|
|
1808
|
+
if (s = t.__k) for (i = 0; i < s.length; i++) s[i] && an(s[i], e, n || typeof t.type != "function");
|
|
1809
|
+
n || Ke(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
2034
1810
|
}
|
|
2035
|
-
function
|
|
1811
|
+
function ws(t, e, n) {
|
|
2036
1812
|
return this.constructor(t, n);
|
|
2037
1813
|
}
|
|
2038
|
-
function
|
|
2039
|
-
var s, i, r,
|
|
2040
|
-
e == document && (e = document.documentElement),
|
|
1814
|
+
function Te(t, e, n) {
|
|
1815
|
+
var s, i, r, a;
|
|
1816
|
+
e == document && (e = document.documentElement), v.__ && v.__(t, e), i = (s = !1) ? null : e.__k, r = [], a = [], Ve(e, t = e.__k = b(we, null, [t]), i || de, de, e.namespaceURI, i ? null : e.firstChild ? _e.call(e.childNodes) : null, r, i ? i.__e : e.firstChild, s, a), sn(r, t, a);
|
|
2041
1817
|
}
|
|
2042
|
-
|
|
2043
|
-
for (var i, r,
|
|
2044
|
-
if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(t)),
|
|
2045
|
-
} catch (
|
|
2046
|
-
t =
|
|
1818
|
+
_e = he.slice, v = { __e: function(t, e, n, s) {
|
|
1819
|
+
for (var i, r, a; e = e.__; ) if ((i = e.__c) && !i.__) try {
|
|
1820
|
+
if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(t)), a = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, s || {}), a = i.__d), a) return i.__E = i;
|
|
1821
|
+
} catch (o) {
|
|
1822
|
+
t = o;
|
|
2047
1823
|
}
|
|
2048
1824
|
throw t;
|
|
2049
|
-
} },
|
|
1825
|
+
} }, Yt = 0, ce.prototype.setState = function(t, e) {
|
|
2050
1826
|
var n;
|
|
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),
|
|
2052
|
-
},
|
|
2053
|
-
this.__v && (this.__e = !0, t && this.__h.push(t),
|
|
2054
|
-
},
|
|
1827
|
+
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), rt(this));
|
|
1828
|
+
}, ce.prototype.forceUpdate = function(t) {
|
|
1829
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), rt(this));
|
|
1830
|
+
}, ce.prototype.render = we, B = [], Jt = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Qt = function(t, e) {
|
|
2055
1831
|
return t.__v.__b - e.__v.__b;
|
|
2056
|
-
},
|
|
2057
|
-
var
|
|
2058
|
-
function
|
|
2059
|
-
|
|
1832
|
+
}, ue.__r = 0, Xt = /(PointerCapture)$|Capture$/i, qe = 0, Le = ot(!1), Pe = ot(!0);
|
|
1833
|
+
var fe, C, Ie, ct, Ne = 0, on = [], I = v, lt = I.__b, dt = I.__r, ht = I.diffed, ut = I.__c, ft = I.unmount, pt = I.__;
|
|
1834
|
+
function cn(t, e) {
|
|
1835
|
+
I.__h && I.__h(C, t, Ne || e), Ne = 0;
|
|
2060
1836
|
var n = C.__H || (C.__H = { __: [], __h: [] });
|
|
2061
1837
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
2062
1838
|
}
|
|
2063
|
-
function
|
|
2064
|
-
return
|
|
1839
|
+
function gt(t) {
|
|
1840
|
+
return Ne = 1, ys(ln, t);
|
|
2065
1841
|
}
|
|
2066
|
-
function
|
|
2067
|
-
var s =
|
|
2068
|
-
if (s.t = t, !s.__c && (s.__ = [
|
|
2069
|
-
var d = s.__N ? s.__N[0] : s.__[0],
|
|
2070
|
-
d !==
|
|
1842
|
+
function ys(t, e, n) {
|
|
1843
|
+
var s = cn(fe++, 2);
|
|
1844
|
+
if (s.t = t, !s.__c && (s.__ = [ln(void 0, e), function(o) {
|
|
1845
|
+
var d = s.__N ? s.__N[0] : s.__[0], c = s.t(d, o);
|
|
1846
|
+
d !== c && (s.__N = [c, s.__[1]], s.__c.setState({}));
|
|
2071
1847
|
}], s.__c = C, !C.__f)) {
|
|
2072
|
-
var i = function(
|
|
1848
|
+
var i = function(o, d, c) {
|
|
2073
1849
|
if (!s.__c.__H) return !0;
|
|
2074
1850
|
var h = s.__c.__H.__.filter(function(f) {
|
|
2075
1851
|
return f.__c;
|
|
2076
1852
|
});
|
|
2077
1853
|
if (h.every(function(f) {
|
|
2078
1854
|
return !f.__N;
|
|
2079
|
-
})) return !r || r.call(this,
|
|
2080
|
-
var
|
|
1855
|
+
})) return !r || r.call(this, o, d, c);
|
|
1856
|
+
var l = s.__c.props !== o;
|
|
2081
1857
|
return h.some(function(f) {
|
|
2082
1858
|
if (f.__N) {
|
|
2083
1859
|
var u = f.__[0];
|
|
2084
|
-
f.__ = f.__N, f.__N = void 0, u !== f.__[0] && (
|
|
1860
|
+
f.__ = f.__N, f.__N = void 0, u !== f.__[0] && (l = !0);
|
|
2085
1861
|
}
|
|
2086
|
-
}), r && r.call(this,
|
|
1862
|
+
}), r && r.call(this, o, d, c) || l;
|
|
2087
1863
|
};
|
|
2088
1864
|
C.__f = !0;
|
|
2089
|
-
var r = C.shouldComponentUpdate,
|
|
2090
|
-
C.componentWillUpdate = function(
|
|
1865
|
+
var r = C.shouldComponentUpdate, a = C.componentWillUpdate;
|
|
1866
|
+
C.componentWillUpdate = function(o, d, c) {
|
|
2091
1867
|
if (this.__e) {
|
|
2092
1868
|
var h = r;
|
|
2093
|
-
r = void 0, i(
|
|
1869
|
+
r = void 0, i(o, d, c), r = h;
|
|
2094
1870
|
}
|
|
2095
|
-
|
|
1871
|
+
a && a.call(this, o, d, c);
|
|
2096
1872
|
}, C.shouldComponentUpdate = i;
|
|
2097
1873
|
}
|
|
2098
1874
|
return s.__N || s.__;
|
|
2099
1875
|
}
|
|
2100
|
-
function
|
|
2101
|
-
var n =
|
|
2102
|
-
!
|
|
1876
|
+
function bs(t, e) {
|
|
1877
|
+
var n = cn(fe++, 3);
|
|
1878
|
+
!I.__s && Es(n.__H, e) && (n.__ = t, n.u = e, C.__H.__h.push(n));
|
|
2103
1879
|
}
|
|
2104
|
-
function
|
|
2105
|
-
for (var t; t =
|
|
1880
|
+
function vs() {
|
|
1881
|
+
for (var t; t = on.shift(); ) {
|
|
2106
1882
|
var e = t.__H;
|
|
2107
1883
|
if (t.__P && e) try {
|
|
2108
|
-
e.__h.some(
|
|
1884
|
+
e.__h.some(le), e.__h.some(De), e.__h = [];
|
|
2109
1885
|
} catch (n) {
|
|
2110
|
-
e.__h = [],
|
|
1886
|
+
e.__h = [], I.__e(n, t.__v);
|
|
2111
1887
|
}
|
|
2112
1888
|
}
|
|
2113
1889
|
}
|
|
2114
|
-
|
|
2115
|
-
C = null,
|
|
2116
|
-
},
|
|
2117
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
2118
|
-
},
|
|
2119
|
-
|
|
1890
|
+
I.__b = function(t) {
|
|
1891
|
+
C = null, lt && lt(t);
|
|
1892
|
+
}, I.__ = function(t, e) {
|
|
1893
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), pt && pt(t, e);
|
|
1894
|
+
}, I.__r = function(t) {
|
|
1895
|
+
dt && dt(t), fe = 0;
|
|
2120
1896
|
var e = (C = t.__c).__H;
|
|
2121
|
-
e && (
|
|
1897
|
+
e && (Ie === C ? (e.__h = [], C.__h = [], e.__.some(function(n) {
|
|
2122
1898
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
2123
|
-
})) : (e.__h.some(
|
|
2124
|
-
},
|
|
2125
|
-
|
|
1899
|
+
})) : (e.__h.some(le), e.__h.some(De), e.__h = [], fe = 0)), Ie = C;
|
|
1900
|
+
}, I.diffed = function(t) {
|
|
1901
|
+
ht && ht(t);
|
|
2126
1902
|
var e = t.__c;
|
|
2127
|
-
e && e.__H && (e.__H.__h.length && (
|
|
1903
|
+
e && e.__H && (e.__H.__h.length && (on.push(e) !== 1 && ct === I.requestAnimationFrame || ((ct = I.requestAnimationFrame) || ks)(vs)), e.__H.__.some(function(n) {
|
|
2128
1904
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
2129
|
-
})),
|
|
2130
|
-
},
|
|
1905
|
+
})), Ie = C = null;
|
|
1906
|
+
}, I.__c = function(t, e) {
|
|
2131
1907
|
e.some(function(n) {
|
|
2132
1908
|
try {
|
|
2133
|
-
n.__h.some(
|
|
2134
|
-
return !s.__ ||
|
|
1909
|
+
n.__h.some(le), n.__h = n.__h.filter(function(s) {
|
|
1910
|
+
return !s.__ || De(s);
|
|
2135
1911
|
});
|
|
2136
1912
|
} catch (s) {
|
|
2137
1913
|
e.some(function(i) {
|
|
2138
1914
|
i.__h && (i.__h = []);
|
|
2139
|
-
}), e = [],
|
|
1915
|
+
}), e = [], I.__e(s, n.__v);
|
|
2140
1916
|
}
|
|
2141
|
-
}),
|
|
2142
|
-
},
|
|
2143
|
-
|
|
1917
|
+
}), ut && ut(t, e);
|
|
1918
|
+
}, I.unmount = function(t) {
|
|
1919
|
+
ft && ft(t);
|
|
2144
1920
|
var e, n = t.__c;
|
|
2145
1921
|
n && n.__H && (n.__H.__.some(function(s) {
|
|
2146
1922
|
try {
|
|
2147
|
-
|
|
1923
|
+
le(s);
|
|
2148
1924
|
} catch (i) {
|
|
2149
1925
|
e = i;
|
|
2150
1926
|
}
|
|
2151
|
-
}), n.__H = void 0, e &&
|
|
1927
|
+
}), n.__H = void 0, e && I.__e(e, n.__v));
|
|
2152
1928
|
};
|
|
2153
|
-
var
|
|
2154
|
-
function
|
|
1929
|
+
var _t = typeof requestAnimationFrame == "function";
|
|
1930
|
+
function ks(t) {
|
|
2155
1931
|
var e, n = function() {
|
|
2156
|
-
clearTimeout(s),
|
|
1932
|
+
clearTimeout(s), _t && cancelAnimationFrame(e), setTimeout(t);
|
|
2157
1933
|
}, s = setTimeout(n, 35);
|
|
2158
|
-
|
|
1934
|
+
_t && (e = requestAnimationFrame(n));
|
|
2159
1935
|
}
|
|
2160
|
-
function
|
|
1936
|
+
function le(t) {
|
|
2161
1937
|
var e = C, n = t.__c;
|
|
2162
1938
|
typeof n == "function" && (t.__c = void 0, n()), C = e;
|
|
2163
1939
|
}
|
|
2164
|
-
function
|
|
1940
|
+
function De(t) {
|
|
2165
1941
|
var e = C;
|
|
2166
1942
|
t.__c = t.__(), C = e;
|
|
2167
1943
|
}
|
|
2168
|
-
function
|
|
1944
|
+
function Es(t, e) {
|
|
2169
1945
|
return !t || t.length !== e.length || e.some(function(n, s) {
|
|
2170
1946
|
return n !== t[s];
|
|
2171
1947
|
});
|
|
2172
1948
|
}
|
|
2173
|
-
function
|
|
1949
|
+
function ln(t, e) {
|
|
2174
1950
|
return typeof e == "function" ? e(t) : e;
|
|
2175
1951
|
}
|
|
2176
|
-
const
|
|
2177
|
-
class
|
|
1952
|
+
const Cs = ".-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}", Is = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", Ss = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";
|
|
1953
|
+
class xs {
|
|
2178
1954
|
constructor() {
|
|
2179
|
-
this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode =
|
|
1955
|
+
this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = $t();
|
|
2180
1956
|
}
|
|
2181
1957
|
attach(e) {
|
|
2182
1958
|
this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render();
|
|
@@ -2191,77 +1967,77 @@ class Gs {
|
|
|
2191
1967
|
this.items.clear(), this.render();
|
|
2192
1968
|
}
|
|
2193
1969
|
render() {
|
|
2194
|
-
this.root &&
|
|
1970
|
+
this.root && Te(b(
|
|
2195
1971
|
"div",
|
|
2196
1972
|
null,
|
|
2197
|
-
|
|
1973
|
+
b(dn, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, n]) => b(Ms, Object.assign({}, n, { key: e }))))
|
|
2198
1974
|
), this.root);
|
|
2199
1975
|
}
|
|
2200
1976
|
}
|
|
2201
|
-
const
|
|
1977
|
+
const dn = (t) => b(
|
|
2202
1978
|
"div",
|
|
2203
|
-
{ class:
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
),
|
|
2207
|
-
const [s, i] =
|
|
2208
|
-
|
|
1979
|
+
{ class: ee("-cbwsdk-snackbar-container") },
|
|
1980
|
+
b("style", null, Cs),
|
|
1981
|
+
b("div", { class: "-cbwsdk-snackbar" }, t.children)
|
|
1982
|
+
), Ms = ({ autoExpand: t, message: e, menuItems: n }) => {
|
|
1983
|
+
const [s, i] = gt(!0), [r, a] = gt(t ?? !1);
|
|
1984
|
+
bs(() => {
|
|
2209
1985
|
const d = [
|
|
2210
1986
|
window.setTimeout(() => {
|
|
2211
1987
|
i(!1);
|
|
2212
1988
|
}, 1),
|
|
2213
1989
|
window.setTimeout(() => {
|
|
2214
|
-
|
|
1990
|
+
a(!0);
|
|
2215
1991
|
}, 1e4)
|
|
2216
1992
|
];
|
|
2217
1993
|
return () => {
|
|
2218
1994
|
d.forEach(window.clearTimeout);
|
|
2219
1995
|
};
|
|
2220
1996
|
});
|
|
2221
|
-
const
|
|
2222
|
-
|
|
1997
|
+
const o = () => {
|
|
1998
|
+
a(!r);
|
|
2223
1999
|
};
|
|
2224
|
-
return
|
|
2000
|
+
return b(
|
|
2225
2001
|
"div",
|
|
2226
|
-
{ class:
|
|
2227
|
-
|
|
2002
|
+
{ class: ee("-cbwsdk-snackbar-instance", s && "-cbwsdk-snackbar-instance-hidden", r && "-cbwsdk-snackbar-instance-expanded") },
|
|
2003
|
+
b(
|
|
2228
2004
|
"div",
|
|
2229
|
-
{ class: "-cbwsdk-snackbar-instance-header", onClick:
|
|
2230
|
-
|
|
2005
|
+
{ class: "-cbwsdk-snackbar-instance-header", onClick: o },
|
|
2006
|
+
b("img", { src: Is, class: "-cbwsdk-snackbar-instance-header-cblogo" }),
|
|
2231
2007
|
" ",
|
|
2232
|
-
|
|
2233
|
-
|
|
2008
|
+
b("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e),
|
|
2009
|
+
b(
|
|
2234
2010
|
"div",
|
|
2235
2011
|
{ class: "-gear-container" },
|
|
2236
|
-
!r &&
|
|
2012
|
+
!r && b(
|
|
2237
2013
|
"svg",
|
|
2238
2014
|
{ width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
2239
|
-
|
|
2015
|
+
b("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" })
|
|
2240
2016
|
),
|
|
2241
|
-
|
|
2017
|
+
b("img", { src: Ss, class: "-gear-icon", title: "Expand" })
|
|
2242
2018
|
)
|
|
2243
2019
|
),
|
|
2244
|
-
n && n.length > 0 &&
|
|
2020
|
+
n && n.length > 0 && b("div", { class: "-cbwsdk-snackbar-instance-menu" }, n.map((d, c) => b(
|
|
2245
2021
|
"div",
|
|
2246
|
-
{ class:
|
|
2247
|
-
|
|
2022
|
+
{ class: ee("-cbwsdk-snackbar-instance-menu-item", d.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: d.onClick, key: c },
|
|
2023
|
+
b(
|
|
2248
2024
|
"svg",
|
|
2249
2025
|
{ width: d.svgWidth, height: d.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
2250
|
-
|
|
2026
|
+
b("path", { "fill-rule": d.defaultFillRule, "clip-rule": d.defaultClipRule, d: d.path, fill: "#AAAAAA" })
|
|
2251
2027
|
),
|
|
2252
|
-
|
|
2028
|
+
b("span", { class: ee("-cbwsdk-snackbar-instance-menu-item-info", d.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, d.info)
|
|
2253
2029
|
)))
|
|
2254
2030
|
);
|
|
2255
2031
|
};
|
|
2256
|
-
class
|
|
2032
|
+
class As {
|
|
2257
2033
|
constructor() {
|
|
2258
|
-
this.attached = !1, this.snackbar = new
|
|
2034
|
+
this.attached = !1, this.snackbar = new xs();
|
|
2259
2035
|
}
|
|
2260
2036
|
attach() {
|
|
2261
2037
|
if (this.attached)
|
|
2262
2038
|
throw new Error("Coinbase Wallet SDK UI is already attached");
|
|
2263
2039
|
const e = document.documentElement, n = document.createElement("div");
|
|
2264
|
-
n.className = "-cbwsdk-css-reset", e.appendChild(n), this.snackbar.attach(n), this.attached = !0,
|
|
2040
|
+
n.className = "-cbwsdk-css-reset", e.appendChild(n), this.snackbar.attach(n), this.attached = !0, Zt();
|
|
2265
2041
|
}
|
|
2266
2042
|
showConnecting(e) {
|
|
2267
2043
|
let n;
|
|
@@ -2307,14 +2083,14 @@ class Js {
|
|
|
2307
2083
|
}, this.snackbar.presentItem(n);
|
|
2308
2084
|
}
|
|
2309
2085
|
}
|
|
2310
|
-
const
|
|
2311
|
-
class
|
|
2086
|
+
const Ls = ".-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}";
|
|
2087
|
+
class Ps {
|
|
2312
2088
|
constructor() {
|
|
2313
|
-
this.root = null, this.darkMode =
|
|
2089
|
+
this.root = null, this.darkMode = $t();
|
|
2314
2090
|
}
|
|
2315
2091
|
attach() {
|
|
2316
2092
|
const e = document.documentElement;
|
|
2317
|
-
this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root),
|
|
2093
|
+
this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), Zt();
|
|
2318
2094
|
}
|
|
2319
2095
|
present(e) {
|
|
2320
2096
|
this.render(e);
|
|
@@ -2323,33 +2099,33 @@ class Xs {
|
|
|
2323
2099
|
this.render(null);
|
|
2324
2100
|
}
|
|
2325
2101
|
render(e) {
|
|
2326
|
-
this.root && (
|
|
2102
|
+
this.root && (Te(null, this.root), e && Te(b(Rs, Object.assign({}, e, { onDismiss: () => {
|
|
2327
2103
|
this.clear();
|
|
2328
2104
|
}, darkMode: this.darkMode })), this.root));
|
|
2329
2105
|
}
|
|
2330
2106
|
}
|
|
2331
|
-
const
|
|
2107
|
+
const Rs = ({ title: t, buttonText: e, darkMode: n, onButtonClick: s, onDismiss: i }) => {
|
|
2332
2108
|
const r = n ? "dark" : "light";
|
|
2333
|
-
return
|
|
2334
|
-
|
|
2109
|
+
return b(
|
|
2110
|
+
dn,
|
|
2335
2111
|
{ darkMode: n },
|
|
2336
|
-
|
|
2112
|
+
b(
|
|
2337
2113
|
"div",
|
|
2338
2114
|
{ class: "-cbwsdk-redirect-dialog" },
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2115
|
+
b("style", null, Ls),
|
|
2116
|
+
b("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }),
|
|
2117
|
+
b(
|
|
2342
2118
|
"div",
|
|
2343
|
-
{ class:
|
|
2344
|
-
|
|
2345
|
-
|
|
2119
|
+
{ class: ee("-cbwsdk-redirect-dialog-box", r) },
|
|
2120
|
+
b("p", null, t),
|
|
2121
|
+
b("button", { onClick: s }, e)
|
|
2346
2122
|
)
|
|
2347
2123
|
)
|
|
2348
2124
|
);
|
|
2349
|
-
},
|
|
2350
|
-
class
|
|
2125
|
+
}, Ts = "https://keys.coinbase.com/connect", Ns = "http://rpc.wallet.coinbase.com", mt = "https://www.walletlink.org", Ds = "https://go.cb-w.com/walletlink";
|
|
2126
|
+
class wt {
|
|
2351
2127
|
constructor() {
|
|
2352
|
-
this.attached = !1, this.redirectDialog = new
|
|
2128
|
+
this.attached = !1, this.redirectDialog = new Ps();
|
|
2353
2129
|
}
|
|
2354
2130
|
attach() {
|
|
2355
2131
|
if (this.attached)
|
|
@@ -2357,8 +2133,8 @@ class xt {
|
|
|
2357
2133
|
this.redirectDialog.attach(), this.attached = !0;
|
|
2358
2134
|
}
|
|
2359
2135
|
redirectToCoinbaseWallet(e) {
|
|
2360
|
-
const n = new URL(
|
|
2361
|
-
n.searchParams.append("redirect_url",
|
|
2136
|
+
const n = new URL(Ds);
|
|
2137
|
+
n.searchParams.append("redirect_url", ds().href), e && n.searchParams.append("wl_url", e);
|
|
2362
2138
|
const s = document.createElement("a");
|
|
2363
2139
|
s.target = "cbw-opener", s.href = n.href, s.rel = "noreferrer noopener", s.click();
|
|
2364
2140
|
}
|
|
@@ -2381,43 +2157,43 @@ class xt {
|
|
|
2381
2157
|
}
|
|
2382
2158
|
class j {
|
|
2383
2159
|
constructor(e) {
|
|
2384
|
-
this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb =
|
|
2160
|
+
this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = hs(), this.linkedUpdated = (r) => {
|
|
2385
2161
|
this.isLinked = r;
|
|
2386
|
-
const
|
|
2387
|
-
if (r && (this._session.linked = r), this.isUnlinkedErrorState = !1,
|
|
2388
|
-
const
|
|
2389
|
-
|
|
2162
|
+
const a = this.storage.getItem(Ae);
|
|
2163
|
+
if (r && (this._session.linked = r), this.isUnlinkedErrorState = !1, a) {
|
|
2164
|
+
const o = a.split(" "), d = this.storage.getItem("IsStandaloneSigning") === "true";
|
|
2165
|
+
o[0] !== "" && !r && this._session.linked && !d && (this.isUnlinkedErrorState = !0);
|
|
2390
2166
|
}
|
|
2391
|
-
}, this.metadataUpdated = (r,
|
|
2392
|
-
this.storage.setItem(r,
|
|
2393
|
-
}, this.chainUpdated = (r,
|
|
2394
|
-
this.chainCallbackParams.chainId === r && this.chainCallbackParams.jsonRpcUrl ===
|
|
2167
|
+
}, this.metadataUpdated = (r, a) => {
|
|
2168
|
+
this.storage.setItem(r, a);
|
|
2169
|
+
}, this.chainUpdated = (r, a) => {
|
|
2170
|
+
this.chainCallbackParams.chainId === r && this.chainCallbackParams.jsonRpcUrl === a || (this.chainCallbackParams = {
|
|
2395
2171
|
chainId: r,
|
|
2396
|
-
jsonRpcUrl:
|
|
2397
|
-
}, this.chainCallback && this.chainCallback(
|
|
2172
|
+
jsonRpcUrl: a
|
|
2173
|
+
}, this.chainCallback && this.chainCallback(a, Number.parseInt(r, 10)));
|
|
2398
2174
|
}, this.accountUpdated = (r) => {
|
|
2399
|
-
this.accountsCallback && this.accountsCallback([r]), j.accountRequestCallbackIds.size > 0 && (Array.from(j.accountRequestCallbackIds.values()).forEach((
|
|
2400
|
-
this.invokeCallback(
|
|
2175
|
+
this.accountsCallback && this.accountsCallback([r]), j.accountRequestCallbackIds.size > 0 && (Array.from(j.accountRequestCallbackIds.values()).forEach((a) => {
|
|
2176
|
+
this.invokeCallback(a, {
|
|
2401
2177
|
method: "requestEthereumAccounts",
|
|
2402
2178
|
result: [r]
|
|
2403
2179
|
});
|
|
2404
2180
|
}), j.accountRequestCallbackIds.clear());
|
|
2405
2181
|
}, 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;
|
|
2406
2182
|
const { session: n, ui: s, connection: i } = this.subscribe();
|
|
2407
|
-
this._session = n, this.connection = i, this.relayEventManager = new
|
|
2183
|
+
this._session = n, this.connection = i, this.relayEventManager = new cs(), this.ui = s, this.ui.attach();
|
|
2408
2184
|
}
|
|
2409
2185
|
subscribe() {
|
|
2410
|
-
const e =
|
|
2186
|
+
const e = Z.load(this.storage) || Z.create(this.storage), { linkAPIUrl: n } = this, s = new os({
|
|
2411
2187
|
session: e,
|
|
2412
2188
|
linkAPIUrl: n,
|
|
2413
2189
|
listener: this
|
|
2414
|
-
}), i = this.isMobileWeb ? new
|
|
2190
|
+
}), i = this.isMobileWeb ? new wt() : new As();
|
|
2415
2191
|
return s.connect(), { session: e, ui: i, connection: s };
|
|
2416
2192
|
}
|
|
2417
2193
|
resetAndReload() {
|
|
2418
2194
|
this.connection.destroy().then(() => {
|
|
2419
|
-
const e =
|
|
2420
|
-
(e == null ? void 0 : e.id) === this._session.id &&
|
|
2195
|
+
const e = Z.load(this.storage);
|
|
2196
|
+
(e == null ? void 0 : e.id) === this._session.id && N.clearAll(), document.location.reload();
|
|
2421
2197
|
}).catch((e) => {
|
|
2422
2198
|
});
|
|
2423
2199
|
}
|
|
@@ -2428,7 +2204,7 @@ class j {
|
|
|
2428
2204
|
fromAddress: e.fromAddress,
|
|
2429
2205
|
toAddress: e.toAddress,
|
|
2430
2206
|
weiValue: R(e.weiValue),
|
|
2431
|
-
data:
|
|
2207
|
+
data: J(e.data, !0),
|
|
2432
2208
|
nonce: e.nonce,
|
|
2433
2209
|
gasPriceInWei: e.gasPriceInWei ? R(e.gasPriceInWei) : null,
|
|
2434
2210
|
maxFeePerGas: e.gasPriceInWei ? R(e.gasPriceInWei) : null,
|
|
@@ -2446,7 +2222,7 @@ class j {
|
|
|
2446
2222
|
fromAddress: e.fromAddress,
|
|
2447
2223
|
toAddress: e.toAddress,
|
|
2448
2224
|
weiValue: R(e.weiValue),
|
|
2449
|
-
data:
|
|
2225
|
+
data: J(e.data, !0),
|
|
2450
2226
|
nonce: e.nonce,
|
|
2451
2227
|
gasPriceInWei: e.gasPriceInWei ? R(e.gasPriceInWei) : null,
|
|
2452
2228
|
maxFeePerGas: e.maxFeePerGas ? R(e.maxFeePerGas) : null,
|
|
@@ -2461,7 +2237,7 @@ class j {
|
|
|
2461
2237
|
return this.sendRequest({
|
|
2462
2238
|
method: "submitEthereumTransaction",
|
|
2463
2239
|
params: {
|
|
2464
|
-
signedTransaction:
|
|
2240
|
+
signedTransaction: J(e, !0),
|
|
2465
2241
|
chainId: n
|
|
2466
2242
|
}
|
|
2467
2243
|
});
|
|
@@ -2471,19 +2247,19 @@ class j {
|
|
|
2471
2247
|
}
|
|
2472
2248
|
sendRequest(e) {
|
|
2473
2249
|
let n = null;
|
|
2474
|
-
const s =
|
|
2250
|
+
const s = K(8), i = (r) => {
|
|
2475
2251
|
this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, e.method, r), n == null || n();
|
|
2476
2252
|
};
|
|
2477
|
-
return new Promise((r,
|
|
2253
|
+
return new Promise((r, a) => {
|
|
2478
2254
|
n = this.ui.showConnecting({
|
|
2479
2255
|
isUnlinkedErrorState: this.isUnlinkedErrorState,
|
|
2480
2256
|
onCancel: i,
|
|
2481
2257
|
onResetConnection: this.resetAndReload
|
|
2482
2258
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
2483
|
-
}), this.relayEventManager.callbacks.set(s, (
|
|
2484
|
-
if (n == null || n(),
|
|
2485
|
-
return
|
|
2486
|
-
r(
|
|
2259
|
+
}), this.relayEventManager.callbacks.set(s, (o) => {
|
|
2260
|
+
if (n == null || n(), S(o))
|
|
2261
|
+
return a(new Error(o.errorMessage));
|
|
2262
|
+
r(o);
|
|
2487
2263
|
}), this.publishWeb3RequestEvent(s, e);
|
|
2488
2264
|
});
|
|
2489
2265
|
}
|
|
@@ -2499,7 +2275,7 @@ class j {
|
|
|
2499
2275
|
}
|
|
2500
2276
|
// copied from MobileRelay
|
|
2501
2277
|
openCoinbaseWalletDeeplink(e) {
|
|
2502
|
-
if (this.ui instanceof
|
|
2278
|
+
if (this.ui instanceof wt)
|
|
2503
2279
|
switch (e) {
|
|
2504
2280
|
case "requestEthereumAccounts":
|
|
2505
2281
|
case "switchEthereumChain":
|
|
@@ -2549,17 +2325,17 @@ class j {
|
|
|
2549
2325
|
appName: e,
|
|
2550
2326
|
appLogoUrl: n
|
|
2551
2327
|
}
|
|
2552
|
-
}, i =
|
|
2553
|
-
return new Promise((r,
|
|
2554
|
-
this.relayEventManager.callbacks.set(i, (
|
|
2555
|
-
if (
|
|
2556
|
-
return
|
|
2557
|
-
r(
|
|
2328
|
+
}, i = K(8);
|
|
2329
|
+
return new Promise((r, a) => {
|
|
2330
|
+
this.relayEventManager.callbacks.set(i, (o) => {
|
|
2331
|
+
if (S(o))
|
|
2332
|
+
return a(new Error(o.errorMessage));
|
|
2333
|
+
r(o);
|
|
2558
2334
|
}), j.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, s);
|
|
2559
2335
|
});
|
|
2560
2336
|
}
|
|
2561
|
-
watchAsset(e, n, s, i, r,
|
|
2562
|
-
const
|
|
2337
|
+
watchAsset(e, n, s, i, r, a) {
|
|
2338
|
+
const o = {
|
|
2563
2339
|
method: "watchAsset",
|
|
2564
2340
|
params: {
|
|
2565
2341
|
type: e,
|
|
@@ -2569,28 +2345,28 @@ class j {
|
|
|
2569
2345
|
decimals: i,
|
|
2570
2346
|
image: r
|
|
2571
2347
|
},
|
|
2572
|
-
chainId:
|
|
2348
|
+
chainId: a
|
|
2573
2349
|
}
|
|
2574
2350
|
};
|
|
2575
2351
|
let d = null;
|
|
2576
|
-
const
|
|
2577
|
-
this.publishWeb3RequestCanceledEvent(
|
|
2352
|
+
const c = K(8), h = (l) => {
|
|
2353
|
+
this.publishWeb3RequestCanceledEvent(c), this.handleErrorResponse(c, o.method, l), d == null || d();
|
|
2578
2354
|
};
|
|
2579
2355
|
return d = this.ui.showConnecting({
|
|
2580
2356
|
isUnlinkedErrorState: this.isUnlinkedErrorState,
|
|
2581
2357
|
onCancel: h,
|
|
2582
2358
|
onResetConnection: this.resetAndReload
|
|
2583
2359
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
2584
|
-
}), new Promise((
|
|
2585
|
-
this.relayEventManager.callbacks.set(
|
|
2586
|
-
if (d == null || d(),
|
|
2360
|
+
}), new Promise((l, f) => {
|
|
2361
|
+
this.relayEventManager.callbacks.set(c, (u) => {
|
|
2362
|
+
if (d == null || d(), S(u))
|
|
2587
2363
|
return f(new Error(u.errorMessage));
|
|
2588
|
-
|
|
2589
|
-
}), this.publishWeb3RequestEvent(
|
|
2364
|
+
l(u);
|
|
2365
|
+
}), this.publishWeb3RequestEvent(c, o);
|
|
2590
2366
|
});
|
|
2591
2367
|
}
|
|
2592
|
-
addEthereumChain(e, n, s, i, r,
|
|
2593
|
-
const
|
|
2368
|
+
addEthereumChain(e, n, s, i, r, a) {
|
|
2369
|
+
const o = {
|
|
2594
2370
|
method: "addEthereumChain",
|
|
2595
2371
|
params: {
|
|
2596
2372
|
chainId: e,
|
|
@@ -2598,24 +2374,24 @@ class j {
|
|
|
2598
2374
|
blockExplorerUrls: i,
|
|
2599
2375
|
chainName: r,
|
|
2600
2376
|
iconUrls: s,
|
|
2601
|
-
nativeCurrency:
|
|
2377
|
+
nativeCurrency: a
|
|
2602
2378
|
}
|
|
2603
2379
|
};
|
|
2604
2380
|
let d = null;
|
|
2605
|
-
const
|
|
2606
|
-
this.publishWeb3RequestCanceledEvent(
|
|
2381
|
+
const c = K(8), h = (l) => {
|
|
2382
|
+
this.publishWeb3RequestCanceledEvent(c), this.handleErrorResponse(c, o.method, l), d == null || d();
|
|
2607
2383
|
};
|
|
2608
2384
|
return d = this.ui.showConnecting({
|
|
2609
2385
|
isUnlinkedErrorState: this.isUnlinkedErrorState,
|
|
2610
2386
|
onCancel: h,
|
|
2611
2387
|
onResetConnection: this.resetAndReload
|
|
2612
2388
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
2613
|
-
}), new Promise((
|
|
2614
|
-
this.relayEventManager.callbacks.set(
|
|
2615
|
-
if (d == null || d(),
|
|
2389
|
+
}), new Promise((l, f) => {
|
|
2390
|
+
this.relayEventManager.callbacks.set(c, (u) => {
|
|
2391
|
+
if (d == null || d(), S(u))
|
|
2616
2392
|
return f(new Error(u.errorMessage));
|
|
2617
|
-
|
|
2618
|
-
}), this.publishWeb3RequestEvent(
|
|
2393
|
+
l(u);
|
|
2394
|
+
}), this.publishWeb3RequestEvent(c, o);
|
|
2619
2395
|
});
|
|
2620
2396
|
}
|
|
2621
2397
|
switchEthereumChain(e, n) {
|
|
@@ -2624,37 +2400,37 @@ class j {
|
|
|
2624
2400
|
params: Object.assign({ chainId: e }, { address: n })
|
|
2625
2401
|
};
|
|
2626
2402
|
let i = null;
|
|
2627
|
-
const r =
|
|
2628
|
-
this.publishWeb3RequestCanceledEvent(r), this.handleErrorResponse(r, s.method,
|
|
2403
|
+
const r = K(8), a = (o) => {
|
|
2404
|
+
this.publishWeb3RequestCanceledEvent(r), this.handleErrorResponse(r, s.method, o), i == null || i();
|
|
2629
2405
|
};
|
|
2630
2406
|
return i = this.ui.showConnecting({
|
|
2631
2407
|
isUnlinkedErrorState: this.isUnlinkedErrorState,
|
|
2632
|
-
onCancel:
|
|
2408
|
+
onCancel: a,
|
|
2633
2409
|
onResetConnection: this.resetAndReload
|
|
2634
2410
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
2635
|
-
}), new Promise((
|
|
2636
|
-
this.relayEventManager.callbacks.set(r, (
|
|
2637
|
-
if (i == null || i(),
|
|
2638
|
-
return d(
|
|
2639
|
-
code:
|
|
2411
|
+
}), new Promise((o, d) => {
|
|
2412
|
+
this.relayEventManager.callbacks.set(r, (c) => {
|
|
2413
|
+
if (i == null || i(), S(c) && c.errorCode)
|
|
2414
|
+
return d(w.provider.custom({
|
|
2415
|
+
code: c.errorCode,
|
|
2640
2416
|
message: "Unrecognized chain ID. Try adding the chain using addEthereumChain first."
|
|
2641
2417
|
}));
|
|
2642
|
-
if (
|
|
2643
|
-
return d(new Error(
|
|
2644
|
-
|
|
2418
|
+
if (S(c))
|
|
2419
|
+
return d(new Error(c.errorMessage));
|
|
2420
|
+
o(c);
|
|
2645
2421
|
}), this.publishWeb3RequestEvent(r, s);
|
|
2646
2422
|
});
|
|
2647
2423
|
}
|
|
2648
2424
|
}
|
|
2649
2425
|
j.accountRequestCallbackIds = /* @__PURE__ */ new Set();
|
|
2650
|
-
const
|
|
2651
|
-
class
|
|
2426
|
+
const yt = "DefaultChainId", bt = "DefaultJsonRpcUrl";
|
|
2427
|
+
class hn {
|
|
2652
2428
|
constructor(e) {
|
|
2653
|
-
this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new
|
|
2654
|
-
const n = this._storage.getItem(
|
|
2429
|
+
this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new N("walletlink", mt), this.callback = e.callback || null;
|
|
2430
|
+
const n = this._storage.getItem(Ae);
|
|
2655
2431
|
if (n) {
|
|
2656
2432
|
const s = n.split(" ");
|
|
2657
|
-
s[0] !== "" && (this._addresses = s.map((i) =>
|
|
2433
|
+
s[0] !== "" && (this._addresses = s.map((i) => H(i)));
|
|
2658
2434
|
}
|
|
2659
2435
|
this.initializeRelay();
|
|
2660
2436
|
}
|
|
@@ -2670,55 +2446,55 @@ class wn {
|
|
|
2670
2446
|
}
|
|
2671
2447
|
get jsonRpcUrl() {
|
|
2672
2448
|
var e;
|
|
2673
|
-
return (e = this._storage.getItem(
|
|
2449
|
+
return (e = this._storage.getItem(bt)) !== null && e !== void 0 ? e : void 0;
|
|
2674
2450
|
}
|
|
2675
2451
|
set jsonRpcUrl(e) {
|
|
2676
|
-
this._storage.setItem(
|
|
2452
|
+
this._storage.setItem(bt, e);
|
|
2677
2453
|
}
|
|
2678
2454
|
updateProviderInfo(e, n) {
|
|
2679
2455
|
var s;
|
|
2680
2456
|
this.jsonRpcUrl = e;
|
|
2681
2457
|
const i = this.getChainId();
|
|
2682
|
-
this._storage.setItem(
|
|
2458
|
+
this._storage.setItem(yt, n.toString(10)), Q(n) !== i && ((s = this.callback) === null || s === void 0 || s.call(this, "chainChanged", q(n)));
|
|
2683
2459
|
}
|
|
2684
2460
|
async watchAsset(e) {
|
|
2685
2461
|
const n = Array.isArray(e) ? e[0] : e;
|
|
2686
2462
|
if (!n.type)
|
|
2687
|
-
throw
|
|
2463
|
+
throw w.rpc.invalidParams("Type is required");
|
|
2688
2464
|
if ((n == null ? void 0 : n.type) !== "ERC20")
|
|
2689
|
-
throw
|
|
2465
|
+
throw w.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);
|
|
2690
2466
|
if (!(n != null && n.options))
|
|
2691
|
-
throw
|
|
2467
|
+
throw w.rpc.invalidParams("Options are required");
|
|
2692
2468
|
if (!(n != null && n.options.address))
|
|
2693
|
-
throw
|
|
2694
|
-
const s = this.getChainId(), { address: i, symbol: r, image:
|
|
2695
|
-
return
|
|
2469
|
+
throw w.rpc.invalidParams("Address is required");
|
|
2470
|
+
const s = this.getChainId(), { address: i, symbol: r, image: a, decimals: o } = n.options, c = await this.initializeRelay().watchAsset(n.type, i, r, o, a, s == null ? void 0 : s.toString());
|
|
2471
|
+
return S(c) ? !1 : !!c.result;
|
|
2696
2472
|
}
|
|
2697
2473
|
async addEthereumChain(e) {
|
|
2698
2474
|
var n, s;
|
|
2699
2475
|
const i = e[0];
|
|
2700
2476
|
if (((n = i.rpcUrls) === null || n === void 0 ? void 0 : n.length) === 0)
|
|
2701
|
-
throw
|
|
2477
|
+
throw w.rpc.invalidParams("please pass in at least 1 rpcUrl");
|
|
2702
2478
|
if (!i.chainName || i.chainName.trim() === "")
|
|
2703
|
-
throw
|
|
2479
|
+
throw w.rpc.invalidParams("chainName is a required field");
|
|
2704
2480
|
if (!i.nativeCurrency)
|
|
2705
|
-
throw
|
|
2481
|
+
throw w.rpc.invalidParams("nativeCurrency is a required field");
|
|
2706
2482
|
const r = Number.parseInt(i.chainId, 16);
|
|
2707
2483
|
if (r === this.getChainId())
|
|
2708
2484
|
return !1;
|
|
2709
|
-
const
|
|
2710
|
-
if (
|
|
2485
|
+
const a = this.initializeRelay(), { rpcUrls: o = [], blockExplorerUrls: d = [], chainName: c, iconUrls: h = [], nativeCurrency: l } = i, f = await a.addEthereumChain(r.toString(), o, h, d, c, l);
|
|
2486
|
+
if (S(f))
|
|
2711
2487
|
return !1;
|
|
2712
2488
|
if (((s = f.result) === null || s === void 0 ? void 0 : s.isApproved) === !0)
|
|
2713
|
-
return this.updateProviderInfo(
|
|
2714
|
-
throw
|
|
2489
|
+
return this.updateProviderInfo(o[0], r), null;
|
|
2490
|
+
throw w.rpc.internal("unable to add ethereum chain");
|
|
2715
2491
|
}
|
|
2716
2492
|
async switchEthereumChain(e) {
|
|
2717
2493
|
const n = e[0], s = Number.parseInt(n.chainId, 16), r = await this.initializeRelay().switchEthereumChain(s.toString(10), this.selectedAddress || void 0);
|
|
2718
|
-
if (
|
|
2494
|
+
if (S(r))
|
|
2719
2495
|
throw r;
|
|
2720
|
-
const
|
|
2721
|
-
return
|
|
2496
|
+
const a = r.result;
|
|
2497
|
+
return a.isApproved && a.rpcUrl.length > 0 && this.updateProviderInfo(a.rpcUrl, s), null;
|
|
2722
2498
|
}
|
|
2723
2499
|
async cleanup() {
|
|
2724
2500
|
this.callback = null, this._relay && this._relay.resetAndReload(), this._storage.clear();
|
|
@@ -2727,8 +2503,8 @@ class wn {
|
|
|
2727
2503
|
var s;
|
|
2728
2504
|
if (!Array.isArray(e))
|
|
2729
2505
|
throw new Error("addresses is not an array");
|
|
2730
|
-
const i = e.map((r) =>
|
|
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(
|
|
2506
|
+
const i = e.map((r) => H(r));
|
|
2507
|
+
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(Ae, i.join(" ")));
|
|
2732
2508
|
}
|
|
2733
2509
|
async request(e) {
|
|
2734
2510
|
const n = e.params || [];
|
|
@@ -2740,7 +2516,7 @@ class wn {
|
|
|
2740
2516
|
case "net_version":
|
|
2741
2517
|
return this.getChainId().toString(10);
|
|
2742
2518
|
case "eth_chainId":
|
|
2743
|
-
return
|
|
2519
|
+
return q(this.getChainId());
|
|
2744
2520
|
case "eth_requestAccounts":
|
|
2745
2521
|
return this._eth_requestAccounts();
|
|
2746
2522
|
case "eth_ecRecover":
|
|
@@ -2767,133 +2543,133 @@ class wn {
|
|
|
2767
2543
|
return this.watchAsset(n);
|
|
2768
2544
|
default:
|
|
2769
2545
|
if (!this.jsonRpcUrl)
|
|
2770
|
-
throw
|
|
2771
|
-
return
|
|
2546
|
+
throw w.rpc.internal("No RPC URL set for chain");
|
|
2547
|
+
return Be(e, this.jsonRpcUrl);
|
|
2772
2548
|
}
|
|
2773
2549
|
}
|
|
2774
2550
|
_ensureKnownAddress(e) {
|
|
2775
|
-
const n =
|
|
2776
|
-
if (!this._addresses.map((i) =>
|
|
2551
|
+
const n = H(e);
|
|
2552
|
+
if (!this._addresses.map((i) => H(i)).includes(n))
|
|
2777
2553
|
throw new Error("Unknown Ethereum address");
|
|
2778
2554
|
}
|
|
2779
2555
|
_prepareTransactionParams(e) {
|
|
2780
|
-
const n = e.from ?
|
|
2556
|
+
const n = e.from ? H(e.from) : this.selectedAddress;
|
|
2781
2557
|
if (!n)
|
|
2782
2558
|
throw new Error("Ethereum address is unavailable");
|
|
2783
2559
|
this._ensureKnownAddress(n);
|
|
2784
|
-
const s = e.to ?
|
|
2560
|
+
const s = e.to ? H(e.to) : null, i = e.value != null ? Y(e.value) : BigInt(0), r = e.data ? Me(e.data) : Buffer.alloc(0), a = e.nonce != null ? Q(e.nonce) : null, o = e.gasPrice != null ? Y(e.gasPrice) : null, d = e.maxFeePerGas != null ? Y(e.maxFeePerGas) : null, c = e.maxPriorityFeePerGas != null ? Y(e.maxPriorityFeePerGas) : null, h = e.gas != null ? Y(e.gas) : null, l = e.chainId ? Q(e.chainId) : this.getChainId();
|
|
2785
2561
|
return {
|
|
2786
2562
|
fromAddress: n,
|
|
2787
2563
|
toAddress: s,
|
|
2788
2564
|
weiValue: i,
|
|
2789
2565
|
data: r,
|
|
2790
|
-
nonce:
|
|
2791
|
-
gasPriceInWei:
|
|
2566
|
+
nonce: a,
|
|
2567
|
+
gasPriceInWei: o,
|
|
2792
2568
|
maxFeePerGas: d,
|
|
2793
|
-
maxPriorityFeePerGas:
|
|
2569
|
+
maxPriorityFeePerGas: c,
|
|
2794
2570
|
gasLimit: h,
|
|
2795
|
-
chainId:
|
|
2571
|
+
chainId: l
|
|
2796
2572
|
};
|
|
2797
2573
|
}
|
|
2798
2574
|
async ecRecover(e) {
|
|
2799
2575
|
const { method: n, params: s } = e;
|
|
2800
2576
|
if (!Array.isArray(s))
|
|
2801
|
-
throw
|
|
2577
|
+
throw w.rpc.invalidParams();
|
|
2802
2578
|
const r = await this.initializeRelay().sendRequest({
|
|
2803
2579
|
method: "ethereumAddressFromSignedMessage",
|
|
2804
2580
|
params: {
|
|
2805
|
-
message:
|
|
2806
|
-
signature:
|
|
2581
|
+
message: be(s[0]),
|
|
2582
|
+
signature: be(s[1]),
|
|
2807
2583
|
addPrefix: n === "personal_ecRecover"
|
|
2808
2584
|
}
|
|
2809
2585
|
});
|
|
2810
|
-
if (
|
|
2586
|
+
if (S(r))
|
|
2811
2587
|
throw r;
|
|
2812
2588
|
return r.result;
|
|
2813
2589
|
}
|
|
2814
2590
|
getChainId() {
|
|
2815
2591
|
var e;
|
|
2816
|
-
return Number.parseInt((e = this._storage.getItem(
|
|
2592
|
+
return Number.parseInt((e = this._storage.getItem(yt)) !== null && e !== void 0 ? e : "1", 10);
|
|
2817
2593
|
}
|
|
2818
2594
|
async _eth_requestAccounts() {
|
|
2819
2595
|
var e, n;
|
|
2820
2596
|
if (this._addresses.length > 0)
|
|
2821
|
-
return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId:
|
|
2597
|
+
return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: q(this.getChainId()) }), this._addresses;
|
|
2822
2598
|
const i = await this.initializeRelay().requestEthereumAccounts();
|
|
2823
|
-
if (
|
|
2599
|
+
if (S(i))
|
|
2824
2600
|
throw i;
|
|
2825
2601
|
if (!i.result)
|
|
2826
2602
|
throw new Error("accounts received is empty");
|
|
2827
|
-
return this._setAddresses(i.result), (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId:
|
|
2603
|
+
return this._setAddresses(i.result), (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId: q(this.getChainId()) }), this._addresses;
|
|
2828
2604
|
}
|
|
2829
2605
|
async personalSign({ params: e }) {
|
|
2830
2606
|
if (!Array.isArray(e))
|
|
2831
|
-
throw
|
|
2607
|
+
throw w.rpc.invalidParams();
|
|
2832
2608
|
const n = e[1], s = e[0];
|
|
2833
2609
|
this._ensureKnownAddress(n);
|
|
2834
2610
|
const r = await this.initializeRelay().sendRequest({
|
|
2835
2611
|
method: "signEthereumMessage",
|
|
2836
2612
|
params: {
|
|
2837
|
-
address:
|
|
2838
|
-
message:
|
|
2613
|
+
address: H(n),
|
|
2614
|
+
message: be(s),
|
|
2839
2615
|
addPrefix: !0,
|
|
2840
2616
|
typedDataJson: null
|
|
2841
2617
|
}
|
|
2842
2618
|
});
|
|
2843
|
-
if (
|
|
2619
|
+
if (S(r))
|
|
2844
2620
|
throw r;
|
|
2845
2621
|
return r.result;
|
|
2846
2622
|
}
|
|
2847
2623
|
async _eth_signTransaction(e) {
|
|
2848
2624
|
const n = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signEthereumTransaction(n);
|
|
2849
|
-
if (
|
|
2625
|
+
if (S(i))
|
|
2850
2626
|
throw i;
|
|
2851
2627
|
return i.result;
|
|
2852
2628
|
}
|
|
2853
2629
|
async _eth_sendRawTransaction(e) {
|
|
2854
|
-
const n =
|
|
2855
|
-
if (
|
|
2630
|
+
const n = Me(e[0]), i = await this.initializeRelay().submitEthereumTransaction(n, this.getChainId());
|
|
2631
|
+
if (S(i))
|
|
2856
2632
|
throw i;
|
|
2857
2633
|
return i.result;
|
|
2858
2634
|
}
|
|
2859
2635
|
async _eth_sendTransaction(e) {
|
|
2860
2636
|
const n = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signAndSubmitEthereumTransaction(n);
|
|
2861
|
-
if (
|
|
2637
|
+
if (S(i))
|
|
2862
2638
|
throw i;
|
|
2863
2639
|
return i.result;
|
|
2864
2640
|
}
|
|
2865
2641
|
async signTypedData(e) {
|
|
2866
2642
|
const { method: n, params: s } = e;
|
|
2867
2643
|
if (!Array.isArray(s))
|
|
2868
|
-
throw
|
|
2869
|
-
const i = (
|
|
2644
|
+
throw w.rpc.invalidParams();
|
|
2645
|
+
const i = (c) => {
|
|
2870
2646
|
const h = {
|
|
2871
|
-
eth_signTypedData_v1:
|
|
2872
|
-
eth_signTypedData_v3:
|
|
2873
|
-
eth_signTypedData_v4:
|
|
2874
|
-
eth_signTypedData:
|
|
2647
|
+
eth_signTypedData_v1: ie.hashForSignTypedDataLegacy,
|
|
2648
|
+
eth_signTypedData_v3: ie.hashForSignTypedData_v3,
|
|
2649
|
+
eth_signTypedData_v4: ie.hashForSignTypedData_v4,
|
|
2650
|
+
eth_signTypedData: ie.hashForSignTypedData_v4
|
|
2875
2651
|
};
|
|
2876
|
-
return
|
|
2877
|
-
data:
|
|
2652
|
+
return J(h[n]({
|
|
2653
|
+
data: Sn(c)
|
|
2878
2654
|
}), !0);
|
|
2879
|
-
}, r = s[n === "eth_signTypedData_v1" ? 1 : 0],
|
|
2655
|
+
}, r = s[n === "eth_signTypedData_v1" ? 1 : 0], a = s[n === "eth_signTypedData_v1" ? 0 : 1];
|
|
2880
2656
|
this._ensureKnownAddress(r);
|
|
2881
2657
|
const d = await this.initializeRelay().sendRequest({
|
|
2882
2658
|
method: "signEthereumMessage",
|
|
2883
2659
|
params: {
|
|
2884
|
-
address:
|
|
2885
|
-
message: i(
|
|
2886
|
-
typedDataJson: JSON.stringify(
|
|
2660
|
+
address: H(r),
|
|
2661
|
+
message: i(a),
|
|
2662
|
+
typedDataJson: JSON.stringify(a, null, 2),
|
|
2887
2663
|
addPrefix: !1
|
|
2888
2664
|
}
|
|
2889
2665
|
});
|
|
2890
|
-
if (
|
|
2666
|
+
if (S(d))
|
|
2891
2667
|
throw d;
|
|
2892
2668
|
return d.result;
|
|
2893
2669
|
}
|
|
2894
2670
|
initializeRelay() {
|
|
2895
2671
|
return this._relay || (this._relay = new j({
|
|
2896
|
-
linkAPIUrl:
|
|
2672
|
+
linkAPIUrl: mt,
|
|
2897
2673
|
storage: this._storage,
|
|
2898
2674
|
metadata: this.metadata,
|
|
2899
2675
|
accountsCallback: this._setAddresses.bind(this),
|
|
@@ -2901,43 +2677,43 @@ class wn {
|
|
|
2901
2677
|
})), this._relay;
|
|
2902
2678
|
}
|
|
2903
2679
|
}
|
|
2904
|
-
const
|
|
2905
|
-
function
|
|
2906
|
-
return
|
|
2680
|
+
const un = "SignerType", fn = new N("CBWSDK", "SignerConfigurator");
|
|
2681
|
+
function Os() {
|
|
2682
|
+
return fn.getItem(un);
|
|
2907
2683
|
}
|
|
2908
|
-
function
|
|
2909
|
-
|
|
2684
|
+
function js(t) {
|
|
2685
|
+
fn.setItem(un, t);
|
|
2910
2686
|
}
|
|
2911
|
-
async function
|
|
2687
|
+
async function Us(t) {
|
|
2912
2688
|
const { communicator: e, metadata: n, handshakeRequest: s, callback: i } = t;
|
|
2913
|
-
|
|
2689
|
+
Hs(e, n, i).catch(() => {
|
|
2914
2690
|
});
|
|
2915
2691
|
const r = {
|
|
2916
2692
|
id: crypto.randomUUID(),
|
|
2917
2693
|
event: "selectSignerType",
|
|
2918
2694
|
data: Object.assign(Object.assign({}, t.preference), { handshakeRequest: s })
|
|
2919
|
-
}, { data:
|
|
2920
|
-
return
|
|
2695
|
+
}, { data: a } = await e.postRequestAndWaitForResponse(r);
|
|
2696
|
+
return a;
|
|
2921
2697
|
}
|
|
2922
|
-
function
|
|
2698
|
+
function Ws(t) {
|
|
2923
2699
|
const { signerType: e, metadata: n, communicator: s, callback: i } = t;
|
|
2924
2700
|
switch (e) {
|
|
2925
2701
|
case "scw":
|
|
2926
|
-
return new
|
|
2702
|
+
return new Hn({
|
|
2927
2703
|
metadata: n,
|
|
2928
2704
|
callback: i,
|
|
2929
2705
|
communicator: s
|
|
2930
2706
|
});
|
|
2931
2707
|
case "walletlink":
|
|
2932
|
-
return new
|
|
2708
|
+
return new hn({
|
|
2933
2709
|
metadata: n,
|
|
2934
2710
|
callback: i
|
|
2935
2711
|
});
|
|
2936
2712
|
}
|
|
2937
2713
|
}
|
|
2938
|
-
async function
|
|
2714
|
+
async function Hs(t, e, n) {
|
|
2939
2715
|
await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest");
|
|
2940
|
-
const s = new
|
|
2716
|
+
const s = new hn({
|
|
2941
2717
|
metadata: e,
|
|
2942
2718
|
callback: n
|
|
2943
2719
|
});
|
|
@@ -2949,9 +2725,9 @@ async function ci(t, e, n) {
|
|
|
2949
2725
|
data: { connected: !0 }
|
|
2950
2726
|
});
|
|
2951
2727
|
}
|
|
2952
|
-
const
|
|
2728
|
+
const Bs = `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.
|
|
2953
2729
|
|
|
2954
|
-
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,
|
|
2730
|
+
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, qs = () => {
|
|
2955
2731
|
let t;
|
|
2956
2732
|
return {
|
|
2957
2733
|
getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t,
|
|
@@ -2967,59 +2743,59 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene
|
|
|
2967
2743
|
if (!n.ok)
|
|
2968
2744
|
throw new Error(`HTTP error! status: ${n.status}`);
|
|
2969
2745
|
const s = n.headers.get("Cross-Origin-Opener-Policy");
|
|
2970
|
-
t = s ?? "null", t === "same-origin" && console.error(
|
|
2746
|
+
t = s ?? "null", t === "same-origin" && console.error(Bs);
|
|
2971
2747
|
} catch (e) {
|
|
2972
2748
|
console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error";
|
|
2973
2749
|
}
|
|
2974
2750
|
}
|
|
2975
2751
|
};
|
|
2976
|
-
}, { checkCrossOriginOpenerPolicy:
|
|
2977
|
-
function
|
|
2978
|
-
const e = (window.innerWidth -
|
|
2979
|
-
|
|
2980
|
-
const s = `wallet_${crypto.randomUUID()}`, i = window.open(t, s, `width=${
|
|
2752
|
+
}, { checkCrossOriginOpenerPolicy: Ks, getCrossOriginOpenerPolicy: Vs } = qs(), vt = 420, kt = 540;
|
|
2753
|
+
function zs(t) {
|
|
2754
|
+
const e = (window.innerWidth - vt) / 2 + window.screenX, n = (window.innerHeight - kt) / 2 + window.screenY;
|
|
2755
|
+
$s(t);
|
|
2756
|
+
const s = `wallet_${crypto.randomUUID()}`, i = window.open(t, s, `width=${vt}, height=${kt}, left=${e}, top=${n}`);
|
|
2981
2757
|
if (i == null || i.focus(), !i)
|
|
2982
|
-
throw
|
|
2758
|
+
throw w.rpc.internal("Pop up window failed to open");
|
|
2983
2759
|
return i;
|
|
2984
2760
|
}
|
|
2985
|
-
function
|
|
2761
|
+
function Fs(t) {
|
|
2986
2762
|
t && !t.closed && t.close();
|
|
2987
2763
|
}
|
|
2988
|
-
function
|
|
2764
|
+
function $s(t) {
|
|
2989
2765
|
const e = {
|
|
2990
|
-
sdkName:
|
|
2991
|
-
sdkVersion:
|
|
2766
|
+
sdkName: Ot,
|
|
2767
|
+
sdkVersion: ne,
|
|
2992
2768
|
origin: window.location.origin,
|
|
2993
|
-
coop:
|
|
2769
|
+
coop: Vs()
|
|
2994
2770
|
};
|
|
2995
2771
|
for (const [n, s] of Object.entries(e))
|
|
2996
2772
|
t.searchParams.append(n, s.toString());
|
|
2997
2773
|
}
|
|
2998
|
-
class
|
|
2999
|
-
constructor({ url: e =
|
|
2774
|
+
class Zs {
|
|
2775
|
+
constructor({ url: e = Ts, metadata: n, preference: s }) {
|
|
3000
2776
|
this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => {
|
|
3001
2777
|
(await this.waitForPopupLoaded()).postMessage(i, this.url.origin);
|
|
3002
2778
|
}, this.postRequestAndWaitForResponse = async (i) => {
|
|
3003
|
-
const r = this.onMessage(({ requestId:
|
|
2779
|
+
const r = this.onMessage(({ requestId: a }) => a === i.id);
|
|
3004
2780
|
return this.postMessage(i), await r;
|
|
3005
|
-
}, this.onMessage = async (i) => new Promise((r,
|
|
3006
|
-
const
|
|
2781
|
+
}, this.onMessage = async (i) => new Promise((r, a) => {
|
|
2782
|
+
const o = (d) => {
|
|
3007
2783
|
if (d.origin !== this.url.origin)
|
|
3008
2784
|
return;
|
|
3009
|
-
const
|
|
3010
|
-
i(
|
|
2785
|
+
const c = d.data;
|
|
2786
|
+
i(c) && (r(c), window.removeEventListener("message", o), this.listeners.delete(o));
|
|
3011
2787
|
};
|
|
3012
|
-
window.addEventListener("message",
|
|
2788
|
+
window.addEventListener("message", o), this.listeners.set(o, { reject: a });
|
|
3013
2789
|
}), this.disconnect = () => {
|
|
3014
|
-
|
|
3015
|
-
i(
|
|
2790
|
+
Fs(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, r) => {
|
|
2791
|
+
i(w.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", r);
|
|
3016
2792
|
}), this.listeners.clear();
|
|
3017
|
-
}, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup =
|
|
2793
|
+
}, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = zs(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => {
|
|
3018
2794
|
}), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => {
|
|
3019
2795
|
this.postMessage({
|
|
3020
2796
|
requestId: i.id,
|
|
3021
2797
|
data: {
|
|
3022
|
-
version:
|
|
2798
|
+
version: ne,
|
|
3023
2799
|
metadata: this.metadata,
|
|
3024
2800
|
preference: this.preference,
|
|
3025
2801
|
location: window.location.toString()
|
|
@@ -3027,25 +2803,25 @@ class _i {
|
|
|
3027
2803
|
});
|
|
3028
2804
|
}).then(() => {
|
|
3029
2805
|
if (!this.popup)
|
|
3030
|
-
throw
|
|
2806
|
+
throw w.rpc.internal();
|
|
3031
2807
|
return this.popup;
|
|
3032
2808
|
})), this.url = new URL(e), this.metadata = n, this.preference = s;
|
|
3033
2809
|
}
|
|
3034
2810
|
}
|
|
3035
|
-
function
|
|
3036
|
-
const e =
|
|
2811
|
+
function Gs(t) {
|
|
2812
|
+
const e = vn(Ys(t), {
|
|
3037
2813
|
shouldIncludeStack: !0
|
|
3038
2814
|
}), n = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");
|
|
3039
|
-
return n.searchParams.set("version",
|
|
2815
|
+
return n.searchParams.set("version", ne), n.searchParams.set("code", e.code.toString()), n.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: n.href });
|
|
3040
2816
|
}
|
|
3041
|
-
function
|
|
2817
|
+
function Ys(t) {
|
|
3042
2818
|
var e;
|
|
3043
2819
|
if (typeof t == "string")
|
|
3044
2820
|
return {
|
|
3045
2821
|
message: t,
|
|
3046
2822
|
code: E.rpc.internal
|
|
3047
2823
|
};
|
|
3048
|
-
if (
|
|
2824
|
+
if (S(t)) {
|
|
3049
2825
|
const n = t.errorMessage, s = (e = t.errorCode) !== null && e !== void 0 ? e : n.match(/(denied|rejected)/i) ? E.provider.userRejectedRequest : void 0;
|
|
3050
2826
|
return Object.assign(Object.assign({}, t), {
|
|
3051
2827
|
message: n,
|
|
@@ -3055,116 +2831,116 @@ function bi(t) {
|
|
|
3055
2831
|
}
|
|
3056
2832
|
return t;
|
|
3057
2833
|
}
|
|
3058
|
-
var
|
|
2834
|
+
var pn = { exports: {} };
|
|
3059
2835
|
(function(t) {
|
|
3060
2836
|
var e = Object.prototype.hasOwnProperty, n = "~";
|
|
3061
2837
|
function s() {
|
|
3062
2838
|
}
|
|
3063
2839
|
Object.create && (s.prototype = /* @__PURE__ */ Object.create(null), new s().__proto__ || (n = !1));
|
|
3064
|
-
function i(d,
|
|
3065
|
-
this.fn = d, this.context =
|
|
2840
|
+
function i(d, c, h) {
|
|
2841
|
+
this.fn = d, this.context = c, this.once = h || !1;
|
|
3066
2842
|
}
|
|
3067
|
-
function r(d,
|
|
2843
|
+
function r(d, c, h, l, f) {
|
|
3068
2844
|
if (typeof h != "function")
|
|
3069
2845
|
throw new TypeError("The listener must be a function");
|
|
3070
|
-
var u = new i(h,
|
|
2846
|
+
var u = new i(h, l || d, f), g = n ? n + c : c;
|
|
3071
2847
|
return d._events[g] ? d._events[g].fn ? d._events[g] = [d._events[g], u] : d._events[g].push(u) : (d._events[g] = u, d._eventsCount++), d;
|
|
3072
2848
|
}
|
|
3073
|
-
function
|
|
3074
|
-
--d._eventsCount === 0 ? d._events = new s() : delete d._events[
|
|
2849
|
+
function a(d, c) {
|
|
2850
|
+
--d._eventsCount === 0 ? d._events = new s() : delete d._events[c];
|
|
3075
2851
|
}
|
|
3076
|
-
function
|
|
2852
|
+
function o() {
|
|
3077
2853
|
this._events = new s(), this._eventsCount = 0;
|
|
3078
2854
|
}
|
|
3079
|
-
|
|
3080
|
-
var
|
|
3081
|
-
if (this._eventsCount === 0) return
|
|
3082
|
-
for (
|
|
3083
|
-
e.call(h,
|
|
3084
|
-
return Object.getOwnPropertySymbols ?
|
|
3085
|
-
},
|
|
3086
|
-
var h = n ? n +
|
|
3087
|
-
if (!
|
|
3088
|
-
if (
|
|
3089
|
-
for (var f = 0, u =
|
|
3090
|
-
g[f] =
|
|
2855
|
+
o.prototype.eventNames = function() {
|
|
2856
|
+
var c = [], h, l;
|
|
2857
|
+
if (this._eventsCount === 0) return c;
|
|
2858
|
+
for (l in h = this._events)
|
|
2859
|
+
e.call(h, l) && c.push(n ? l.slice(1) : l);
|
|
2860
|
+
return Object.getOwnPropertySymbols ? c.concat(Object.getOwnPropertySymbols(h)) : c;
|
|
2861
|
+
}, o.prototype.listeners = function(c) {
|
|
2862
|
+
var h = n ? n + c : c, l = this._events[h];
|
|
2863
|
+
if (!l) return [];
|
|
2864
|
+
if (l.fn) return [l.fn];
|
|
2865
|
+
for (var f = 0, u = l.length, g = new Array(u); f < u; f++)
|
|
2866
|
+
g[f] = l[f].fn;
|
|
3091
2867
|
return g;
|
|
3092
|
-
},
|
|
3093
|
-
var h = n ? n +
|
|
3094
|
-
return
|
|
3095
|
-
},
|
|
3096
|
-
var
|
|
3097
|
-
if (!this._events[
|
|
3098
|
-
var p = this._events[
|
|
2868
|
+
}, o.prototype.listenerCount = function(c) {
|
|
2869
|
+
var h = n ? n + c : c, l = this._events[h];
|
|
2870
|
+
return l ? l.fn ? 1 : l.length : 0;
|
|
2871
|
+
}, o.prototype.emit = function(c, h, l, f, u, g) {
|
|
2872
|
+
var k = n ? n + c : c;
|
|
2873
|
+
if (!this._events[k]) return !1;
|
|
2874
|
+
var p = this._events[k], _ = arguments.length, m, y;
|
|
3099
2875
|
if (p.fn) {
|
|
3100
|
-
switch (p.once && this.removeListener(
|
|
2876
|
+
switch (p.once && this.removeListener(c, p.fn, void 0, !0), _) {
|
|
3101
2877
|
case 1:
|
|
3102
2878
|
return p.fn.call(p.context), !0;
|
|
3103
2879
|
case 2:
|
|
3104
2880
|
return p.fn.call(p.context, h), !0;
|
|
3105
2881
|
case 3:
|
|
3106
|
-
return p.fn.call(p.context, h,
|
|
2882
|
+
return p.fn.call(p.context, h, l), !0;
|
|
3107
2883
|
case 4:
|
|
3108
|
-
return p.fn.call(p.context, h,
|
|
2884
|
+
return p.fn.call(p.context, h, l, f), !0;
|
|
3109
2885
|
case 5:
|
|
3110
|
-
return p.fn.call(p.context, h,
|
|
2886
|
+
return p.fn.call(p.context, h, l, f, u), !0;
|
|
3111
2887
|
case 6:
|
|
3112
|
-
return p.fn.call(p.context, h,
|
|
2888
|
+
return p.fn.call(p.context, h, l, f, u, g), !0;
|
|
3113
2889
|
}
|
|
3114
|
-
for (
|
|
3115
|
-
m[
|
|
2890
|
+
for (y = 1, m = new Array(_ - 1); y < _; y++)
|
|
2891
|
+
m[y - 1] = arguments[y];
|
|
3116
2892
|
p.fn.apply(p.context, m);
|
|
3117
2893
|
} else {
|
|
3118
|
-
var
|
|
3119
|
-
for (
|
|
3120
|
-
switch (p[
|
|
2894
|
+
var D = p.length, A;
|
|
2895
|
+
for (y = 0; y < D; y++)
|
|
2896
|
+
switch (p[y].once && this.removeListener(c, p[y].fn, void 0, !0), _) {
|
|
3121
2897
|
case 1:
|
|
3122
|
-
p[
|
|
2898
|
+
p[y].fn.call(p[y].context);
|
|
3123
2899
|
break;
|
|
3124
2900
|
case 2:
|
|
3125
|
-
p[
|
|
2901
|
+
p[y].fn.call(p[y].context, h);
|
|
3126
2902
|
break;
|
|
3127
2903
|
case 3:
|
|
3128
|
-
p[
|
|
2904
|
+
p[y].fn.call(p[y].context, h, l);
|
|
3129
2905
|
break;
|
|
3130
2906
|
case 4:
|
|
3131
|
-
p[
|
|
2907
|
+
p[y].fn.call(p[y].context, h, l, f);
|
|
3132
2908
|
break;
|
|
3133
2909
|
default:
|
|
3134
|
-
if (!m) for (
|
|
3135
|
-
m[
|
|
3136
|
-
p[
|
|
2910
|
+
if (!m) for (A = 1, m = new Array(_ - 1); A < _; A++)
|
|
2911
|
+
m[A - 1] = arguments[A];
|
|
2912
|
+
p[y].fn.apply(p[y].context, m);
|
|
3137
2913
|
}
|
|
3138
2914
|
}
|
|
3139
2915
|
return !0;
|
|
3140
|
-
},
|
|
3141
|
-
return r(this,
|
|
3142
|
-
},
|
|
3143
|
-
return r(this,
|
|
3144
|
-
},
|
|
3145
|
-
var u = n ? n +
|
|
2916
|
+
}, o.prototype.on = function(c, h, l) {
|
|
2917
|
+
return r(this, c, h, l, !1);
|
|
2918
|
+
}, o.prototype.once = function(c, h, l) {
|
|
2919
|
+
return r(this, c, h, l, !0);
|
|
2920
|
+
}, o.prototype.removeListener = function(c, h, l, f) {
|
|
2921
|
+
var u = n ? n + c : c;
|
|
3146
2922
|
if (!this._events[u]) return this;
|
|
3147
2923
|
if (!h)
|
|
3148
|
-
return
|
|
2924
|
+
return a(this, u), this;
|
|
3149
2925
|
var g = this._events[u];
|
|
3150
2926
|
if (g.fn)
|
|
3151
|
-
g.fn === h && (!f || g.once) && (!
|
|
2927
|
+
g.fn === h && (!f || g.once) && (!l || g.context === l) && a(this, u);
|
|
3152
2928
|
else {
|
|
3153
|
-
for (var
|
|
3154
|
-
(g[
|
|
3155
|
-
p.length ? this._events[u] = p.length === 1 ? p[0] : p :
|
|
2929
|
+
for (var k = 0, p = [], _ = g.length; k < _; k++)
|
|
2930
|
+
(g[k].fn !== h || f && !g[k].once || l && g[k].context !== l) && p.push(g[k]);
|
|
2931
|
+
p.length ? this._events[u] = p.length === 1 ? p[0] : p : a(this, u);
|
|
3156
2932
|
}
|
|
3157
2933
|
return this;
|
|
3158
|
-
},
|
|
2934
|
+
}, o.prototype.removeAllListeners = function(c) {
|
|
3159
2935
|
var h;
|
|
3160
|
-
return
|
|
3161
|
-
},
|
|
3162
|
-
})(
|
|
3163
|
-
var
|
|
3164
|
-
const
|
|
3165
|
-
class
|
|
3166
|
-
}
|
|
3167
|
-
var
|
|
2936
|
+
return c ? (h = n ? n + c : c, this._events[h] && a(this, h)) : (this._events = new s(), this._eventsCount = 0), this;
|
|
2937
|
+
}, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = n, o.EventEmitter = o, t.exports = o;
|
|
2938
|
+
})(pn);
|
|
2939
|
+
var Js = pn.exports;
|
|
2940
|
+
const Qs = /* @__PURE__ */ Et(Js);
|
|
2941
|
+
class Xs extends Qs {
|
|
2942
|
+
}
|
|
2943
|
+
var ei = function(t, e) {
|
|
3168
2944
|
var n = {};
|
|
3169
2945
|
for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (n[s] = t[s]);
|
|
3170
2946
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -3172,24 +2948,24 @@ var ki = function(t, e) {
|
|
|
3172
2948
|
e.indexOf(s[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[i]) && (n[s[i]] = t[s[i]]);
|
|
3173
2949
|
return n;
|
|
3174
2950
|
};
|
|
3175
|
-
class
|
|
2951
|
+
class ti extends Xs {
|
|
3176
2952
|
constructor(e) {
|
|
3177
|
-
var { metadata: n } = e, s = e.preference, { keysUrl: i } = s, r =
|
|
3178
|
-
super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = n, this.preference = r, this.communicator = new
|
|
2953
|
+
var { metadata: n } = e, s = e.preference, { keysUrl: i } = s, r = ei(s, ["keysUrl"]);
|
|
2954
|
+
super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = n, this.preference = r, this.communicator = new Zs({
|
|
3179
2955
|
url: i,
|
|
3180
2956
|
metadata: n,
|
|
3181
2957
|
preference: r
|
|
3182
2958
|
});
|
|
3183
|
-
const
|
|
3184
|
-
|
|
2959
|
+
const a = Os();
|
|
2960
|
+
a && (this.signer = this.initSigner(a));
|
|
3185
2961
|
}
|
|
3186
2962
|
async request(e) {
|
|
3187
2963
|
try {
|
|
3188
|
-
if (
|
|
2964
|
+
if (Wn(e), !this.signer)
|
|
3189
2965
|
switch (e.method) {
|
|
3190
2966
|
case "eth_requestAccounts": {
|
|
3191
2967
|
const n = await this.requestSignerSelection(e), s = this.initSigner(n);
|
|
3192
|
-
await s.handshake(e), this.signer = s,
|
|
2968
|
+
await s.handshake(e), this.signer = s, js(n);
|
|
3193
2969
|
break;
|
|
3194
2970
|
}
|
|
3195
2971
|
case "wallet_sendCalls": {
|
|
@@ -3199,18 +2975,18 @@ class Ei extends vi {
|
|
|
3199
2975
|
return await n.cleanup(), s;
|
|
3200
2976
|
}
|
|
3201
2977
|
case "wallet_getCallsStatus":
|
|
3202
|
-
return
|
|
2978
|
+
return Be(e, Ns);
|
|
3203
2979
|
case "net_version":
|
|
3204
2980
|
return 1;
|
|
3205
2981
|
case "eth_chainId":
|
|
3206
|
-
return
|
|
2982
|
+
return q(1);
|
|
3207
2983
|
default:
|
|
3208
|
-
throw
|
|
2984
|
+
throw w.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");
|
|
3209
2985
|
}
|
|
3210
2986
|
return await this.signer.request(e);
|
|
3211
2987
|
} catch (n) {
|
|
3212
2988
|
const { code: s } = n;
|
|
3213
|
-
return s === E.provider.unauthorized && this.disconnect(), Promise.reject(
|
|
2989
|
+
return s === E.provider.unauthorized && this.disconnect(), Promise.reject(Gs(n));
|
|
3214
2990
|
}
|
|
3215
2991
|
}
|
|
3216
2992
|
/** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */
|
|
@@ -3221,10 +2997,10 @@ class Ei extends vi {
|
|
|
3221
2997
|
}
|
|
3222
2998
|
async disconnect() {
|
|
3223
2999
|
var e;
|
|
3224
|
-
await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null,
|
|
3000
|
+
await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, N.clearAll(), this.emit("disconnect", w.provider.disconnected("User initiated disconnection"));
|
|
3225
3001
|
}
|
|
3226
3002
|
requestSignerSelection(e) {
|
|
3227
|
-
return
|
|
3003
|
+
return Us({
|
|
3228
3004
|
communicator: this.communicator,
|
|
3229
3005
|
preference: this.preference,
|
|
3230
3006
|
metadata: this.metadata,
|
|
@@ -3233,7 +3009,7 @@ class Ei extends vi {
|
|
|
3233
3009
|
});
|
|
3234
3010
|
}
|
|
3235
3011
|
initSigner(e) {
|
|
3236
|
-
return
|
|
3012
|
+
return Ws({
|
|
3237
3013
|
signerType: e,
|
|
3238
3014
|
metadata: this.metadata,
|
|
3239
3015
|
communicator: this.communicator,
|
|
@@ -3241,7 +3017,7 @@ class Ei extends vi {
|
|
|
3241
3017
|
});
|
|
3242
3018
|
}
|
|
3243
3019
|
}
|
|
3244
|
-
function
|
|
3020
|
+
function ni(t) {
|
|
3245
3021
|
if (t) {
|
|
3246
3022
|
if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options))
|
|
3247
3023
|
throw new Error(`Invalid options: ${t.options}`);
|
|
@@ -3249,19 +3025,19 @@ function Ci(t) {
|
|
|
3249
3025
|
throw new Error("Attribution cannot contain both auto and dataSuffix properties");
|
|
3250
3026
|
}
|
|
3251
3027
|
}
|
|
3252
|
-
class
|
|
3028
|
+
class ai {
|
|
3253
3029
|
constructor(e) {
|
|
3254
3030
|
this.metadata = {
|
|
3255
3031
|
appName: e.appName || "Dapp",
|
|
3256
|
-
appLogoUrl: e.appLogoUrl ||
|
|
3032
|
+
appLogoUrl: e.appLogoUrl || Mn(),
|
|
3257
3033
|
appChainIds: e.appChainIds || []
|
|
3258
|
-
}, this.storeLatestVersion(),
|
|
3034
|
+
}, this.storeLatestVersion(), Ks();
|
|
3259
3035
|
}
|
|
3260
3036
|
makeWeb3Provider(e = { options: "all" }) {
|
|
3261
3037
|
var n;
|
|
3262
|
-
|
|
3038
|
+
ni(e);
|
|
3263
3039
|
const s = { metadata: this.metadata, preference: e };
|
|
3264
|
-
return (n =
|
|
3040
|
+
return (n = Un(s)) !== null && n !== void 0 ? n : new ti(s);
|
|
3265
3041
|
}
|
|
3266
3042
|
/**
|
|
3267
3043
|
* Official Coinbase Wallet logo for developers to use on their frontend
|
|
@@ -3270,13 +3046,13 @@ class Ii {
|
|
|
3270
3046
|
* @returns SVG Data URI
|
|
3271
3047
|
*/
|
|
3272
3048
|
getCoinbaseWalletLogo(e, n = 240) {
|
|
3273
|
-
return
|
|
3049
|
+
return wn(e, n);
|
|
3274
3050
|
}
|
|
3275
3051
|
storeLatestVersion() {
|
|
3276
|
-
new
|
|
3052
|
+
new N("CBWSDK").setItem("VERSION", ne);
|
|
3277
3053
|
}
|
|
3278
3054
|
}
|
|
3279
3055
|
export {
|
|
3280
|
-
|
|
3281
|
-
|
|
3056
|
+
ai as CoinbaseWalletSDK,
|
|
3057
|
+
ai as default
|
|
3282
3058
|
};
|