@lydianpay/sdk-web 3.13.0 → 3.14.0
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/README.md +49 -12
- package/dist/chunks/browser-BFd9Zasn.js +33 -0
- package/dist/chunks/connect-multichain-W5NFpeTb.js +9971 -0
- package/dist/chunks/index-B2KlqxZz.js +5944 -0
- package/dist/chunks/index-B8vFbue_.js +114 -0
- package/dist/chunks/{index-DJbuCqvB.js → index-ChcFlkGu.js} +927 -1293
- package/dist/chunks/{index-DrpAyUns.js → index-DDKaYwMc.js} +101 -83
- package/dist/chunks/index-DhuuCvX-.js +4716 -0
- package/dist/chunks/index-FAg0du7P.js +595 -0
- package/dist/chunks/index-SMHjRBlL.js +314 -0
- package/dist/chunks/mm-install-modal_2.entry-Dhx9nDM_.js +1365 -0
- package/dist/chunks/{mountEngine-DoxKiMjy.js → mountEngine-0u7my-Xz.js} +5715 -5589
- package/dist/chunks/utils-Ca8X9WUu.js +264 -0
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +7 -0
- package/dist/types/ui/initConfig.d.ts +3 -0
- package/package.json +8 -4
- package/dist/chunks/metamask-sdk-C2ev3Ki6.js +0 -15037
|
@@ -1,120 +1,14 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!
|
|
6
|
-
throw new
|
|
1
|
+
import { i as Te, I as Xe, h as et, g as yn, b as vn, s as kn } from "./mountEngine-0u7my-Xz.js";
|
|
2
|
+
import { r as En, a as In } from "./utils-Ca8X9WUu.js";
|
|
3
|
+
import { E as Cn } from "./index-B8vFbue_.js";
|
|
4
|
+
function Sn(t, e) {
|
|
5
|
+
if (!Te(t, { strict: !1 }))
|
|
6
|
+
throw new Xe({ address: t });
|
|
7
|
+
if (!Te(e, { strict: !1 }))
|
|
8
|
+
throw new Xe({ address: e });
|
|
7
9
|
return t.toLowerCase() === e.toLowerCase();
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
function qn() {
|
|
11
|
-
return gt || (gt = 1, (function(t) {
|
|
12
|
-
var e = Object.prototype.hasOwnProperty, n = "~";
|
|
13
|
-
function s() {
|
|
14
|
-
}
|
|
15
|
-
Object.create && (s.prototype = /* @__PURE__ */ Object.create(null), new s().__proto__ || (n = !1));
|
|
16
|
-
function r(u, d, p) {
|
|
17
|
-
this.fn = u, this.context = d, this.once = p || !1;
|
|
18
|
-
}
|
|
19
|
-
function i(u, d, p, g, o) {
|
|
20
|
-
if (typeof p != "function")
|
|
21
|
-
throw new TypeError("The listener must be a function");
|
|
22
|
-
var c = new r(p, g || u, o), h = n ? n + d : d;
|
|
23
|
-
return u._events[h] ? u._events[h].fn ? u._events[h] = [u._events[h], c] : u._events[h].push(c) : (u._events[h] = c, u._eventsCount++), u;
|
|
24
|
-
}
|
|
25
|
-
function a(u, d) {
|
|
26
|
-
--u._eventsCount === 0 ? u._events = new s() : delete u._events[d];
|
|
27
|
-
}
|
|
28
|
-
function l() {
|
|
29
|
-
this._events = new s(), this._eventsCount = 0;
|
|
30
|
-
}
|
|
31
|
-
l.prototype.eventNames = function() {
|
|
32
|
-
var d = [], p, g;
|
|
33
|
-
if (this._eventsCount === 0) return d;
|
|
34
|
-
for (g in p = this._events)
|
|
35
|
-
e.call(p, g) && d.push(n ? g.slice(1) : g);
|
|
36
|
-
return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(p)) : d;
|
|
37
|
-
}, l.prototype.listeners = function(d) {
|
|
38
|
-
var p = n ? n + d : d, g = this._events[p];
|
|
39
|
-
if (!g) return [];
|
|
40
|
-
if (g.fn) return [g.fn];
|
|
41
|
-
for (var o = 0, c = g.length, h = new Array(c); o < c; o++)
|
|
42
|
-
h[o] = g[o].fn;
|
|
43
|
-
return h;
|
|
44
|
-
}, l.prototype.listenerCount = function(d) {
|
|
45
|
-
var p = n ? n + d : d, g = this._events[p];
|
|
46
|
-
return g ? g.fn ? 1 : g.length : 0;
|
|
47
|
-
}, l.prototype.emit = function(d, p, g, o, c, h) {
|
|
48
|
-
var k = n ? n + d : d;
|
|
49
|
-
if (!this._events[k]) return !1;
|
|
50
|
-
var _ = this._events[k], I = arguments.length, v, E;
|
|
51
|
-
if (_.fn) {
|
|
52
|
-
switch (_.once && this.removeListener(d, _.fn, void 0, !0), I) {
|
|
53
|
-
case 1:
|
|
54
|
-
return _.fn.call(_.context), !0;
|
|
55
|
-
case 2:
|
|
56
|
-
return _.fn.call(_.context, p), !0;
|
|
57
|
-
case 3:
|
|
58
|
-
return _.fn.call(_.context, p, g), !0;
|
|
59
|
-
case 4:
|
|
60
|
-
return _.fn.call(_.context, p, g, o), !0;
|
|
61
|
-
case 5:
|
|
62
|
-
return _.fn.call(_.context, p, g, o, c), !0;
|
|
63
|
-
case 6:
|
|
64
|
-
return _.fn.call(_.context, p, g, o, c, h), !0;
|
|
65
|
-
}
|
|
66
|
-
for (E = 1, v = new Array(I - 1); E < I; E++)
|
|
67
|
-
v[E - 1] = arguments[E];
|
|
68
|
-
_.fn.apply(_.context, v);
|
|
69
|
-
} else {
|
|
70
|
-
var C = _.length, y;
|
|
71
|
-
for (E = 0; E < C; E++)
|
|
72
|
-
switch (_[E].once && this.removeListener(d, _[E].fn, void 0, !0), I) {
|
|
73
|
-
case 1:
|
|
74
|
-
_[E].fn.call(_[E].context);
|
|
75
|
-
break;
|
|
76
|
-
case 2:
|
|
77
|
-
_[E].fn.call(_[E].context, p);
|
|
78
|
-
break;
|
|
79
|
-
case 3:
|
|
80
|
-
_[E].fn.call(_[E].context, p, g);
|
|
81
|
-
break;
|
|
82
|
-
case 4:
|
|
83
|
-
_[E].fn.call(_[E].context, p, g, o);
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
if (!v) for (y = 1, v = new Array(I - 1); y < I; y++)
|
|
87
|
-
v[y - 1] = arguments[y];
|
|
88
|
-
_[E].fn.apply(_[E].context, v);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return !0;
|
|
92
|
-
}, l.prototype.on = function(d, p, g) {
|
|
93
|
-
return i(this, d, p, g, !1);
|
|
94
|
-
}, l.prototype.once = function(d, p, g) {
|
|
95
|
-
return i(this, d, p, g, !0);
|
|
96
|
-
}, l.prototype.removeListener = function(d, p, g, o) {
|
|
97
|
-
var c = n ? n + d : d;
|
|
98
|
-
if (!this._events[c]) return this;
|
|
99
|
-
if (!p)
|
|
100
|
-
return a(this, c), this;
|
|
101
|
-
var h = this._events[c];
|
|
102
|
-
if (h.fn)
|
|
103
|
-
h.fn === p && (!o || h.once) && (!g || h.context === g) && a(this, c);
|
|
104
|
-
else {
|
|
105
|
-
for (var k = 0, _ = [], I = h.length; k < I; k++)
|
|
106
|
-
(h[k].fn !== p || o && !h[k].once || g && h[k].context !== g) && _.push(h[k]);
|
|
107
|
-
_.length ? this._events[c] = _.length === 1 ? _[0] : _ : a(this, c);
|
|
108
|
-
}
|
|
109
|
-
return this;
|
|
110
|
-
}, l.prototype.removeAllListeners = function(d) {
|
|
111
|
-
var p;
|
|
112
|
-
return d ? (p = n ? n + d : d, this._events[p] && a(this, p)) : (this._events = new s(), this._eventsCount = 0), this;
|
|
113
|
-
}, l.prototype.off = l.prototype.removeListener, l.prototype.addListener = l.prototype.on, l.prefixed = n, l.EventEmitter = l, t.exports = l;
|
|
114
|
-
})(Oe)), Oe.exports;
|
|
115
|
-
}
|
|
116
|
-
var Vn = qn();
|
|
117
|
-
const Kn = /* @__PURE__ */ Qt(Vn), Fn = (t, e) => {
|
|
11
|
+
const xn = (t, e) => {
|
|
118
12
|
let n;
|
|
119
13
|
switch (t) {
|
|
120
14
|
case "standard":
|
|
@@ -133,7 +27,7 @@ const Kn = /* @__PURE__ */ Qt(Vn), Fn = (t, e) => {
|
|
|
133
27
|
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 `;
|
|
134
28
|
}
|
|
135
29
|
};
|
|
136
|
-
class
|
|
30
|
+
class W {
|
|
137
31
|
constructor(e, n) {
|
|
138
32
|
this.scope = e, this.module = n;
|
|
139
33
|
}
|
|
@@ -165,10 +59,10 @@ class Y {
|
|
|
165
59
|
return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`;
|
|
166
60
|
}
|
|
167
61
|
static clearAll() {
|
|
168
|
-
new
|
|
62
|
+
new W("CBWSDK").clear(), new W("walletlink").clear();
|
|
169
63
|
}
|
|
170
64
|
}
|
|
171
|
-
const
|
|
65
|
+
const R = {
|
|
172
66
|
rpc: {
|
|
173
67
|
invalidInput: -32e3,
|
|
174
68
|
resourceNotFound: -32001,
|
|
@@ -190,7 +84,7 @@ const U = {
|
|
|
190
84
|
chainDisconnected: 4901,
|
|
191
85
|
unsupportedChain: 4902
|
|
192
86
|
}
|
|
193
|
-
},
|
|
87
|
+
}, Ne = {
|
|
194
88
|
"-32700": {
|
|
195
89
|
standard: "JSON RPC 2.0",
|
|
196
90
|
message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
|
|
@@ -259,92 +153,92 @@ const U = {
|
|
|
259
153
|
standard: "EIP-3085",
|
|
260
154
|
message: "Unrecognized chain ID."
|
|
261
155
|
}
|
|
262
|
-
},
|
|
263
|
-
function
|
|
156
|
+
}, Nt = "Unspecified error message.", An = "Unspecified server error.";
|
|
157
|
+
function Ke(t, e = Nt) {
|
|
264
158
|
if (t && Number.isInteger(t)) {
|
|
265
159
|
const n = t.toString();
|
|
266
|
-
if (
|
|
267
|
-
return
|
|
268
|
-
if (
|
|
269
|
-
return
|
|
160
|
+
if (De(Ne, n))
|
|
161
|
+
return Ne[n].message;
|
|
162
|
+
if (Dt(t))
|
|
163
|
+
return An;
|
|
270
164
|
}
|
|
271
165
|
return e;
|
|
272
166
|
}
|
|
273
|
-
function
|
|
167
|
+
function Mn(t) {
|
|
274
168
|
if (!Number.isInteger(t))
|
|
275
169
|
return !1;
|
|
276
170
|
const e = t.toString();
|
|
277
|
-
return !!(
|
|
171
|
+
return !!(Ne[e] || Dt(t));
|
|
278
172
|
}
|
|
279
|
-
function
|
|
173
|
+
function Pn(t, { shouldIncludeStack: e = !1 } = {}) {
|
|
280
174
|
const n = {};
|
|
281
|
-
if (t && typeof t == "object" && !Array.isArray(t) &&
|
|
175
|
+
if (t && typeof t == "object" && !Array.isArray(t) && De(t, "code") && Mn(t.code)) {
|
|
282
176
|
const s = t;
|
|
283
|
-
n.code = s.code, s.message && typeof s.message == "string" ? (n.message = s.message,
|
|
177
|
+
n.code = s.code, s.message && typeof s.message == "string" ? (n.message = s.message, De(s, "data") && (n.data = s.data)) : (n.message = Ke(n.code), n.data = { originalError: tt(t) });
|
|
284
178
|
} else
|
|
285
|
-
n.code =
|
|
286
|
-
return e && (n.stack =
|
|
179
|
+
n.code = R.rpc.internal, n.message = nt(t, "message") ? t.message : Nt, n.data = { originalError: tt(t) };
|
|
180
|
+
return e && (n.stack = nt(t, "stack") ? t.stack : void 0), n;
|
|
287
181
|
}
|
|
288
|
-
function
|
|
182
|
+
function Dt(t) {
|
|
289
183
|
return t >= -32099 && t <= -32e3;
|
|
290
184
|
}
|
|
291
|
-
function
|
|
185
|
+
function tt(t) {
|
|
292
186
|
return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t;
|
|
293
187
|
}
|
|
294
|
-
function
|
|
188
|
+
function De(t, e) {
|
|
295
189
|
return Object.prototype.hasOwnProperty.call(t, e);
|
|
296
190
|
}
|
|
297
|
-
function
|
|
191
|
+
function nt(t, e) {
|
|
298
192
|
return typeof t == "object" && t !== null && e in t && typeof t[e] == "string";
|
|
299
193
|
}
|
|
300
|
-
const
|
|
194
|
+
const E = {
|
|
301
195
|
rpc: {
|
|
302
|
-
parse: (t) =>
|
|
303
|
-
invalidRequest: (t) =>
|
|
304
|
-
invalidParams: (t) =>
|
|
305
|
-
methodNotFound: (t) =>
|
|
306
|
-
internal: (t) =>
|
|
196
|
+
parse: (t) => j(R.rpc.parse, t),
|
|
197
|
+
invalidRequest: (t) => j(R.rpc.invalidRequest, t),
|
|
198
|
+
invalidParams: (t) => j(R.rpc.invalidParams, t),
|
|
199
|
+
methodNotFound: (t) => j(R.rpc.methodNotFound, t),
|
|
200
|
+
internal: (t) => j(R.rpc.internal, t),
|
|
307
201
|
server: (t) => {
|
|
308
202
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
309
203
|
throw new Error("Ethereum RPC Server errors must provide single object argument.");
|
|
310
204
|
const { code: e } = t;
|
|
311
205
|
if (!Number.isInteger(e) || e > -32005 || e < -32099)
|
|
312
206
|
throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');
|
|
313
|
-
return
|
|
207
|
+
return j(e, t);
|
|
314
208
|
},
|
|
315
|
-
invalidInput: (t) =>
|
|
316
|
-
resourceNotFound: (t) =>
|
|
317
|
-
resourceUnavailable: (t) =>
|
|
318
|
-
transactionRejected: (t) =>
|
|
319
|
-
methodNotSupported: (t) =>
|
|
320
|
-
limitExceeded: (t) =>
|
|
209
|
+
invalidInput: (t) => j(R.rpc.invalidInput, t),
|
|
210
|
+
resourceNotFound: (t) => j(R.rpc.resourceNotFound, t),
|
|
211
|
+
resourceUnavailable: (t) => j(R.rpc.resourceUnavailable, t),
|
|
212
|
+
transactionRejected: (t) => j(R.rpc.transactionRejected, t),
|
|
213
|
+
methodNotSupported: (t) => j(R.rpc.methodNotSupported, t),
|
|
214
|
+
limitExceeded: (t) => j(R.rpc.limitExceeded, t)
|
|
321
215
|
},
|
|
322
216
|
provider: {
|
|
323
|
-
userRejectedRequest: (t) =>
|
|
324
|
-
unauthorized: (t) =>
|
|
325
|
-
unsupportedMethod: (t) =>
|
|
326
|
-
disconnected: (t) =>
|
|
327
|
-
chainDisconnected: (t) =>
|
|
328
|
-
unsupportedChain: (t) =>
|
|
217
|
+
userRejectedRequest: (t) => Y(R.provider.userRejectedRequest, t),
|
|
218
|
+
unauthorized: (t) => Y(R.provider.unauthorized, t),
|
|
219
|
+
unsupportedMethod: (t) => Y(R.provider.unsupportedMethod, t),
|
|
220
|
+
disconnected: (t) => Y(R.provider.disconnected, t),
|
|
221
|
+
chainDisconnected: (t) => Y(R.provider.chainDisconnected, t),
|
|
222
|
+
unsupportedChain: (t) => Y(R.provider.unsupportedChain, t),
|
|
329
223
|
custom: (t) => {
|
|
330
224
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
331
225
|
throw new Error("Ethereum Provider custom errors must provide single object argument.");
|
|
332
226
|
const { code: e, message: n, data: s } = t;
|
|
333
227
|
if (!n || typeof n != "string")
|
|
334
228
|
throw new Error('"message" must be a nonempty string');
|
|
335
|
-
return new
|
|
229
|
+
return new Ut(e, n, s);
|
|
336
230
|
}
|
|
337
231
|
}
|
|
338
232
|
};
|
|
339
|
-
function
|
|
340
|
-
const [n, s] =
|
|
341
|
-
return new
|
|
233
|
+
function j(t, e) {
|
|
234
|
+
const [n, s] = Ot(e);
|
|
235
|
+
return new jt(t, n || Ke(t), s);
|
|
342
236
|
}
|
|
343
|
-
function
|
|
344
|
-
const [n, s] =
|
|
345
|
-
return new
|
|
237
|
+
function Y(t, e) {
|
|
238
|
+
const [n, s] = Ot(e);
|
|
239
|
+
return new Ut(t, n || Ke(t), s);
|
|
346
240
|
}
|
|
347
|
-
function
|
|
241
|
+
function Ot(t) {
|
|
348
242
|
if (t) {
|
|
349
243
|
if (typeof t == "string")
|
|
350
244
|
return [t];
|
|
@@ -357,7 +251,7 @@ function tn(t) {
|
|
|
357
251
|
}
|
|
358
252
|
return [];
|
|
359
253
|
}
|
|
360
|
-
class
|
|
254
|
+
class jt extends Error {
|
|
361
255
|
constructor(e, n, s) {
|
|
362
256
|
if (!Number.isInteger(e))
|
|
363
257
|
throw new Error('"code" must be an integer.');
|
|
@@ -366,145 +260,145 @@ class nn extends Error {
|
|
|
366
260
|
super(n), this.code = e, s !== void 0 && (this.data = s);
|
|
367
261
|
}
|
|
368
262
|
}
|
|
369
|
-
class
|
|
263
|
+
class Ut extends jt {
|
|
370
264
|
/**
|
|
371
265
|
* Create an Ethereum Provider JSON-RPC error.
|
|
372
266
|
* `code` must be an integer in the 1000 <= 4999 range.
|
|
373
267
|
*/
|
|
374
268
|
constructor(e, n, s) {
|
|
375
|
-
if (!
|
|
269
|
+
if (!Ln(e))
|
|
376
270
|
throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');
|
|
377
271
|
super(e, n, s);
|
|
378
272
|
}
|
|
379
273
|
}
|
|
380
|
-
function
|
|
274
|
+
function Ln(t) {
|
|
381
275
|
return Number.isInteger(t) && t >= 1e3 && t <= 4999;
|
|
382
276
|
}
|
|
383
|
-
function
|
|
277
|
+
function Ve() {
|
|
384
278
|
return (t) => t;
|
|
385
279
|
}
|
|
386
|
-
const
|
|
387
|
-
function
|
|
280
|
+
const se = Ve(), Rn = Ve(), Tn = Ve();
|
|
281
|
+
function B(t) {
|
|
388
282
|
return Math.floor(t);
|
|
389
283
|
}
|
|
390
|
-
const
|
|
391
|
-
function
|
|
392
|
-
return
|
|
284
|
+
const Ht = /^[0-9]*$/, Wt = /^[a-f0-9]*$/;
|
|
285
|
+
function Z(t) {
|
|
286
|
+
return Fe(crypto.getRandomValues(new Uint8Array(t)));
|
|
393
287
|
}
|
|
394
|
-
function
|
|
288
|
+
function Fe(t) {
|
|
395
289
|
return [...t].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
396
290
|
}
|
|
397
|
-
function
|
|
291
|
+
function he(t) {
|
|
398
292
|
return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16)));
|
|
399
293
|
}
|
|
400
|
-
function
|
|
294
|
+
function X(t, e = !1) {
|
|
401
295
|
const n = t.toString("hex");
|
|
402
|
-
return
|
|
296
|
+
return se(e ? `0x${n}` : n);
|
|
403
297
|
}
|
|
404
|
-
function
|
|
405
|
-
return
|
|
298
|
+
function Ie(t) {
|
|
299
|
+
return X(Oe(t), !0);
|
|
406
300
|
}
|
|
407
|
-
function
|
|
408
|
-
return
|
|
301
|
+
function U(t) {
|
|
302
|
+
return Tn(t.toString(10));
|
|
409
303
|
}
|
|
410
|
-
function
|
|
411
|
-
return
|
|
304
|
+
function z(t) {
|
|
305
|
+
return se(`0x${BigInt(t).toString(16)}`);
|
|
412
306
|
}
|
|
413
|
-
function
|
|
307
|
+
function Bt(t) {
|
|
414
308
|
return t.startsWith("0x") || t.startsWith("0X");
|
|
415
309
|
}
|
|
416
|
-
function
|
|
417
|
-
return
|
|
310
|
+
function ze(t) {
|
|
311
|
+
return Bt(t) ? t.slice(2) : t;
|
|
418
312
|
}
|
|
419
|
-
function
|
|
420
|
-
return
|
|
313
|
+
function qt(t) {
|
|
314
|
+
return Bt(t) ? `0x${t.slice(2)}` : `0x${t}`;
|
|
421
315
|
}
|
|
422
|
-
function
|
|
316
|
+
function ye(t) {
|
|
423
317
|
if (typeof t != "string")
|
|
424
318
|
return !1;
|
|
425
|
-
const e =
|
|
426
|
-
return
|
|
319
|
+
const e = ze(t).toLowerCase();
|
|
320
|
+
return Wt.test(e);
|
|
427
321
|
}
|
|
428
|
-
function
|
|
322
|
+
function Nn(t, e = !1) {
|
|
429
323
|
if (typeof t == "string") {
|
|
430
|
-
const n =
|
|
431
|
-
if (
|
|
432
|
-
return
|
|
324
|
+
const n = ze(t).toLowerCase();
|
|
325
|
+
if (Wt.test(n))
|
|
326
|
+
return se(e ? `0x${n}` : n);
|
|
433
327
|
}
|
|
434
|
-
throw
|
|
328
|
+
throw E.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`);
|
|
435
329
|
}
|
|
436
|
-
function
|
|
437
|
-
let n =
|
|
438
|
-
return n.length % 2 === 1 && (n =
|
|
330
|
+
function $e(t, e = !1) {
|
|
331
|
+
let n = Nn(t, !1);
|
|
332
|
+
return n.length % 2 === 1 && (n = se(`0${n}`)), e ? se(`0x${n}`) : n;
|
|
439
333
|
}
|
|
440
|
-
function
|
|
334
|
+
function V(t) {
|
|
441
335
|
if (typeof t == "string") {
|
|
442
|
-
const e =
|
|
443
|
-
if (
|
|
444
|
-
return
|
|
336
|
+
const e = ze(t).toLowerCase();
|
|
337
|
+
if (ye(e) && e.length === 40)
|
|
338
|
+
return Rn(qt(e));
|
|
445
339
|
}
|
|
446
|
-
throw
|
|
340
|
+
throw E.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`);
|
|
447
341
|
}
|
|
448
|
-
function
|
|
342
|
+
function Oe(t) {
|
|
449
343
|
if (Buffer.isBuffer(t))
|
|
450
344
|
return t;
|
|
451
345
|
if (typeof t == "string") {
|
|
452
|
-
if (
|
|
453
|
-
const e =
|
|
346
|
+
if (ye(t)) {
|
|
347
|
+
const e = $e(t, !1);
|
|
454
348
|
return Buffer.from(e, "hex");
|
|
455
349
|
}
|
|
456
350
|
return Buffer.from(t, "utf8");
|
|
457
351
|
}
|
|
458
|
-
throw
|
|
352
|
+
throw E.rpc.invalidParams(`Not binary data: ${String(t)}`);
|
|
459
353
|
}
|
|
460
|
-
function
|
|
354
|
+
function ee(t) {
|
|
461
355
|
if (typeof t == "number" && Number.isInteger(t))
|
|
462
|
-
return
|
|
356
|
+
return B(t);
|
|
463
357
|
if (typeof t == "string") {
|
|
464
|
-
if (
|
|
465
|
-
return
|
|
466
|
-
if (
|
|
467
|
-
return
|
|
358
|
+
if (Ht.test(t))
|
|
359
|
+
return B(Number(t));
|
|
360
|
+
if (ye(t))
|
|
361
|
+
return B(Number(BigInt($e(t, !0))));
|
|
468
362
|
}
|
|
469
|
-
throw
|
|
363
|
+
throw E.rpc.invalidParams(`Not an integer: ${String(t)}`);
|
|
470
364
|
}
|
|
471
|
-
function
|
|
472
|
-
if (t !== null && (typeof t == "bigint" ||
|
|
365
|
+
function Q(t) {
|
|
366
|
+
if (t !== null && (typeof t == "bigint" || On(t)))
|
|
473
367
|
return BigInt(t.toString(10));
|
|
474
368
|
if (typeof t == "number")
|
|
475
|
-
return BigInt(
|
|
369
|
+
return BigInt(ee(t));
|
|
476
370
|
if (typeof t == "string") {
|
|
477
|
-
if (
|
|
371
|
+
if (Ht.test(t))
|
|
478
372
|
return BigInt(t);
|
|
479
|
-
if (
|
|
480
|
-
return BigInt(
|
|
373
|
+
if (ye(t))
|
|
374
|
+
return BigInt($e(t, !0));
|
|
481
375
|
}
|
|
482
|
-
throw
|
|
376
|
+
throw E.rpc.invalidParams(`Not an integer: ${String(t)}`);
|
|
483
377
|
}
|
|
484
|
-
function
|
|
378
|
+
function Dn(t) {
|
|
485
379
|
if (typeof t == "string")
|
|
486
380
|
return JSON.parse(t);
|
|
487
381
|
if (typeof t == "object")
|
|
488
382
|
return t;
|
|
489
|
-
throw
|
|
383
|
+
throw E.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`);
|
|
490
384
|
}
|
|
491
|
-
function
|
|
385
|
+
function On(t) {
|
|
492
386
|
if (t == null || typeof t.constructor != "function")
|
|
493
387
|
return !1;
|
|
494
388
|
const { constructor: e } = t;
|
|
495
389
|
return typeof e.config == "function" && typeof e.EUCLID == "number";
|
|
496
390
|
}
|
|
497
|
-
function
|
|
391
|
+
function jn() {
|
|
498
392
|
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;
|
|
499
393
|
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}`;
|
|
500
394
|
}
|
|
501
|
-
async function
|
|
395
|
+
async function Un() {
|
|
502
396
|
return crypto.subtle.generateKey({
|
|
503
397
|
name: "ECDH",
|
|
504
398
|
namedCurve: "P-256"
|
|
505
399
|
}, !0, ["deriveKey"]);
|
|
506
400
|
}
|
|
507
|
-
async function
|
|
401
|
+
async function Hn(t, e) {
|
|
508
402
|
return crypto.subtle.deriveKey({
|
|
509
403
|
name: "ECDH",
|
|
510
404
|
public: e
|
|
@@ -513,21 +407,21 @@ async function ss(t, e) {
|
|
|
513
407
|
length: 256
|
|
514
408
|
}, !1, ["encrypt", "decrypt"]);
|
|
515
409
|
}
|
|
516
|
-
async function
|
|
410
|
+
async function Wn(t, e) {
|
|
517
411
|
const n = crypto.getRandomValues(new Uint8Array(12)), s = await crypto.subtle.encrypt({
|
|
518
412
|
name: "AES-GCM",
|
|
519
413
|
iv: n
|
|
520
414
|
}, t, new TextEncoder().encode(e));
|
|
521
415
|
return { iv: n, cipherText: s };
|
|
522
416
|
}
|
|
523
|
-
async function
|
|
417
|
+
async function Bn(t, { iv: e, cipherText: n }) {
|
|
524
418
|
const s = await crypto.subtle.decrypt({
|
|
525
419
|
name: "AES-GCM",
|
|
526
420
|
iv: e
|
|
527
421
|
}, t, n);
|
|
528
422
|
return new TextDecoder().decode(s);
|
|
529
423
|
}
|
|
530
|
-
function
|
|
424
|
+
function Kt(t) {
|
|
531
425
|
switch (t) {
|
|
532
426
|
case "public":
|
|
533
427
|
return "spki";
|
|
@@ -535,42 +429,42 @@ function ln(t) {
|
|
|
535
429
|
return "pkcs8";
|
|
536
430
|
}
|
|
537
431
|
}
|
|
538
|
-
async function
|
|
539
|
-
const n =
|
|
540
|
-
return
|
|
432
|
+
async function Vt(t, e) {
|
|
433
|
+
const n = Kt(t), s = await crypto.subtle.exportKey(n, e);
|
|
434
|
+
return Fe(new Uint8Array(s));
|
|
541
435
|
}
|
|
542
|
-
async function
|
|
543
|
-
const n =
|
|
436
|
+
async function Ft(t, e) {
|
|
437
|
+
const n = Kt(t), s = he(e).buffer;
|
|
544
438
|
return await crypto.subtle.importKey(n, new Uint8Array(s), {
|
|
545
439
|
name: "ECDH",
|
|
546
440
|
namedCurve: "P-256"
|
|
547
441
|
}, !0, t === "private" ? ["deriveKey"] : []);
|
|
548
442
|
}
|
|
549
|
-
async function
|
|
443
|
+
async function qn(t, e) {
|
|
550
444
|
const n = JSON.stringify(t, (s, r) => {
|
|
551
445
|
if (!(r instanceof Error))
|
|
552
446
|
return r;
|
|
553
447
|
const i = r;
|
|
554
448
|
return Object.assign(Object.assign({}, i.code ? { code: i.code } : {}), { message: i.message });
|
|
555
449
|
});
|
|
556
|
-
return
|
|
450
|
+
return Wn(e, n);
|
|
557
451
|
}
|
|
558
|
-
async function
|
|
559
|
-
return JSON.parse(await
|
|
452
|
+
async function Kn(t, e) {
|
|
453
|
+
return JSON.parse(await Bn(e, t));
|
|
560
454
|
}
|
|
561
|
-
const
|
|
455
|
+
const Ce = {
|
|
562
456
|
storageKey: "ownPrivateKey",
|
|
563
457
|
keyType: "private"
|
|
564
|
-
},
|
|
458
|
+
}, Se = {
|
|
565
459
|
storageKey: "ownPublicKey",
|
|
566
460
|
keyType: "public"
|
|
567
|
-
},
|
|
461
|
+
}, xe = {
|
|
568
462
|
storageKey: "peerPublicKey",
|
|
569
463
|
keyType: "public"
|
|
570
464
|
};
|
|
571
|
-
class
|
|
465
|
+
class Vn {
|
|
572
466
|
constructor() {
|
|
573
|
-
this.storage = new
|
|
467
|
+
this.storage = new W("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null;
|
|
574
468
|
}
|
|
575
469
|
async getOwnPublicKey() {
|
|
576
470
|
return await this.loadKeysIfNeeded(), this.ownPublicKey;
|
|
@@ -580,63 +474,63 @@ class cs {
|
|
|
580
474
|
return await this.loadKeysIfNeeded(), this.sharedSecret;
|
|
581
475
|
}
|
|
582
476
|
async setPeerPublicKey(e) {
|
|
583
|
-
this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(
|
|
477
|
+
this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(xe, e), await this.loadKeysIfNeeded();
|
|
584
478
|
}
|
|
585
479
|
async clear() {
|
|
586
|
-
this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(
|
|
480
|
+
this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Se.storageKey), this.storage.removeItem(Ce.storageKey), this.storage.removeItem(xe.storageKey);
|
|
587
481
|
}
|
|
588
482
|
async generateKeyPair() {
|
|
589
|
-
const e = await
|
|
590
|
-
this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(
|
|
483
|
+
const e = await Un();
|
|
484
|
+
this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(Ce, e.privateKey), await this.storeKey(Se, e.publicKey);
|
|
591
485
|
}
|
|
592
486
|
async loadKeysIfNeeded() {
|
|
593
|
-
if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(
|
|
487
|
+
if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(Ce)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Se)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(xe)), this.sharedSecret === null) {
|
|
594
488
|
if (this.ownPrivateKey === null || this.peerPublicKey === null)
|
|
595
489
|
return;
|
|
596
|
-
this.sharedSecret = await
|
|
490
|
+
this.sharedSecret = await Hn(this.ownPrivateKey, this.peerPublicKey);
|
|
597
491
|
}
|
|
598
492
|
}
|
|
599
493
|
// storage methods
|
|
600
494
|
async loadKey(e) {
|
|
601
495
|
const n = this.storage.getItem(e.storageKey);
|
|
602
|
-
return n ?
|
|
496
|
+
return n ? Ft(e.keyType, n) : null;
|
|
603
497
|
}
|
|
604
498
|
async storeKey(e, n) {
|
|
605
|
-
const s = await
|
|
499
|
+
const s = await Vt(e.keyType, n);
|
|
606
500
|
this.storage.setItem(e.storageKey, s);
|
|
607
501
|
}
|
|
608
502
|
}
|
|
609
|
-
function
|
|
610
|
-
if (!t || !Array.isArray(t) || t.length !== 1 && t.length !== 2 || typeof t[0] != "string" || !
|
|
611
|
-
throw
|
|
503
|
+
function Fn(t) {
|
|
504
|
+
if (!t || !Array.isArray(t) || t.length !== 1 && t.length !== 2 || typeof t[0] != "string" || !Te(t[0]))
|
|
505
|
+
throw E.rpc.invalidParams();
|
|
612
506
|
if (t.length === 2) {
|
|
613
507
|
if (!Array.isArray(t[1]))
|
|
614
|
-
throw
|
|
508
|
+
throw E.rpc.invalidParams();
|
|
615
509
|
for (const e of t[1])
|
|
616
510
|
if (typeof e != "string" || !e.startsWith("0x"))
|
|
617
|
-
throw
|
|
511
|
+
throw E.rpc.invalidParams();
|
|
618
512
|
}
|
|
619
513
|
}
|
|
620
|
-
const
|
|
621
|
-
async function
|
|
514
|
+
const ie = "4.3.7", zt = "@coinbase/wallet-sdk";
|
|
515
|
+
async function Ze(t, e) {
|
|
622
516
|
const n = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), s = await window.fetch(e, {
|
|
623
517
|
method: "POST",
|
|
624
518
|
body: JSON.stringify(n),
|
|
625
519
|
mode: "cors",
|
|
626
520
|
headers: {
|
|
627
521
|
"Content-Type": "application/json",
|
|
628
|
-
"X-Cbw-Sdk-Version":
|
|
629
|
-
"X-Cbw-Sdk-Platform":
|
|
522
|
+
"X-Cbw-Sdk-Version": ie,
|
|
523
|
+
"X-Cbw-Sdk-Platform": zt
|
|
630
524
|
}
|
|
631
525
|
}), { result: r, error: i } = await s.json();
|
|
632
526
|
if (i)
|
|
633
527
|
throw i;
|
|
634
528
|
return r;
|
|
635
529
|
}
|
|
636
|
-
function
|
|
530
|
+
function zn() {
|
|
637
531
|
return globalThis.coinbaseWalletExtension;
|
|
638
532
|
}
|
|
639
|
-
function
|
|
533
|
+
function $n() {
|
|
640
534
|
var t, e;
|
|
641
535
|
try {
|
|
642
536
|
const n = globalThis;
|
|
@@ -645,32 +539,32 @@ function us() {
|
|
|
645
539
|
return;
|
|
646
540
|
}
|
|
647
541
|
}
|
|
648
|
-
function
|
|
542
|
+
function Zn({ metadata: t, preference: e }) {
|
|
649
543
|
var n, s;
|
|
650
544
|
const { appName: r, appLogoUrl: i, appChainIds: a } = t;
|
|
651
545
|
if (e.options !== "smartWalletOnly") {
|
|
652
|
-
const
|
|
653
|
-
if (
|
|
654
|
-
return (n =
|
|
546
|
+
const h = zn();
|
|
547
|
+
if (h)
|
|
548
|
+
return (n = h.setAppInfo) === null || n === void 0 || n.call(h, r, i, a, e), h;
|
|
655
549
|
}
|
|
656
|
-
const l =
|
|
550
|
+
const l = $n();
|
|
657
551
|
if (l != null && l.isCoinbaseBrowser)
|
|
658
552
|
return (s = l.setAppInfo) === null || s === void 0 || s.call(l, r, i, a, e), l;
|
|
659
553
|
}
|
|
660
|
-
function
|
|
554
|
+
function Gn(t) {
|
|
661
555
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
662
|
-
throw
|
|
556
|
+
throw E.rpc.invalidParams({
|
|
663
557
|
message: "Expected a single, non-array, object argument.",
|
|
664
558
|
data: t
|
|
665
559
|
});
|
|
666
560
|
const { method: e, params: n } = t;
|
|
667
561
|
if (typeof e != "string" || e.length === 0)
|
|
668
|
-
throw
|
|
562
|
+
throw E.rpc.invalidParams({
|
|
669
563
|
message: "'args.method' must be a non-empty string.",
|
|
670
564
|
data: t
|
|
671
565
|
});
|
|
672
566
|
if (n !== void 0 && !Array.isArray(n) && (typeof n != "object" || n === null))
|
|
673
|
-
throw
|
|
567
|
+
throw E.rpc.invalidParams({
|
|
674
568
|
message: "'args.params' must be an object or array if provided.",
|
|
675
569
|
data: t
|
|
676
570
|
});
|
|
@@ -679,14 +573,14 @@ function fs(t) {
|
|
|
679
573
|
case "eth_signTypedData_v2":
|
|
680
574
|
case "eth_subscribe":
|
|
681
575
|
case "eth_unsubscribe":
|
|
682
|
-
throw
|
|
576
|
+
throw E.provider.unsupportedMethod();
|
|
683
577
|
}
|
|
684
578
|
}
|
|
685
|
-
const
|
|
686
|
-
class
|
|
579
|
+
const st = "accounts", it = "activeChain", rt = "availableChains", at = "walletCapabilities";
|
|
580
|
+
class Yn {
|
|
687
581
|
constructor(e) {
|
|
688
582
|
var n, s, r;
|
|
689
|
-
this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new
|
|
583
|
+
this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new Vn(), this.storage = new W("CBWSDK", "SCWStateManager"), this.accounts = (n = this.storage.loadObject(st)) !== null && n !== void 0 ? n : [], this.chain = this.storage.loadObject(it) || {
|
|
690
584
|
id: (r = (s = e.metadata.appChainIds) === null || s === void 0 ? void 0 : s[0]) !== null && r !== void 0 ? r : 1
|
|
691
585
|
}, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this);
|
|
692
586
|
}
|
|
@@ -701,15 +595,15 @@ class ps {
|
|
|
701
595
|
}), l = await this.communicator.postRequestAndWaitForResponse(a);
|
|
702
596
|
if ("failure" in l.content)
|
|
703
597
|
throw l.content.failure;
|
|
704
|
-
const
|
|
705
|
-
await this.keyManager.setPeerPublicKey(
|
|
706
|
-
const
|
|
707
|
-
if ("error" in
|
|
708
|
-
throw
|
|
598
|
+
const h = await Ft("public", l.sender);
|
|
599
|
+
await this.keyManager.setPeerPublicKey(h);
|
|
600
|
+
const f = (await this.decryptResponseMessage(l)).result;
|
|
601
|
+
if ("error" in f)
|
|
602
|
+
throw f.error;
|
|
709
603
|
switch (e.method) {
|
|
710
604
|
case "eth_requestAccounts": {
|
|
711
|
-
const g =
|
|
712
|
-
this.accounts = g, this.storage.storeObject(
|
|
605
|
+
const g = f.value;
|
|
606
|
+
this.accounts = g, this.storage.storeObject(st, g), (i = this.callback) === null || i === void 0 || i.call(this, "accountsChanged", g);
|
|
713
607
|
break;
|
|
714
608
|
}
|
|
715
609
|
}
|
|
@@ -721,11 +615,11 @@ class ps {
|
|
|
721
615
|
case "wallet_sendCalls":
|
|
722
616
|
return this.sendRequestToPopup(e);
|
|
723
617
|
default:
|
|
724
|
-
throw
|
|
618
|
+
throw E.provider.unauthorized();
|
|
725
619
|
}
|
|
726
620
|
switch (e.method) {
|
|
727
621
|
case "eth_requestAccounts":
|
|
728
|
-
return (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId:
|
|
622
|
+
return (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId: z(this.chain.id) }), this.accounts;
|
|
729
623
|
case "eth_accounts":
|
|
730
624
|
return this.accounts;
|
|
731
625
|
case "eth_coinbase":
|
|
@@ -733,7 +627,7 @@ class ps {
|
|
|
733
627
|
case "net_version":
|
|
734
628
|
return this.chain.id;
|
|
735
629
|
case "eth_chainId":
|
|
736
|
-
return
|
|
630
|
+
return z(this.chain.id);
|
|
737
631
|
case "wallet_getCapabilities":
|
|
738
632
|
return this.handleGetCapabilitiesRequest(e);
|
|
739
633
|
case "wallet_switchEthereumChain":
|
|
@@ -756,8 +650,8 @@ class ps {
|
|
|
756
650
|
return this.sendRequestToPopup(e);
|
|
757
651
|
default:
|
|
758
652
|
if (!this.chain.rpcUrl)
|
|
759
|
-
throw
|
|
760
|
-
return
|
|
653
|
+
throw E.rpc.internal("No RPC URL set for chain");
|
|
654
|
+
return Ze(e, this.chain.rpcUrl);
|
|
761
655
|
}
|
|
762
656
|
}
|
|
763
657
|
async sendRequestToPopup(e) {
|
|
@@ -782,28 +676,28 @@ class ps {
|
|
|
782
676
|
var n;
|
|
783
677
|
const s = e.params;
|
|
784
678
|
if (!s || !(!((n = s[0]) === null || n === void 0) && n.chainId))
|
|
785
|
-
throw
|
|
786
|
-
const r =
|
|
679
|
+
throw E.rpc.invalidParams();
|
|
680
|
+
const r = ee(s[0].chainId);
|
|
787
681
|
if (this.updateChain(r))
|
|
788
682
|
return null;
|
|
789
683
|
const a = await this.sendRequestToPopup(e);
|
|
790
684
|
return a === null && this.updateChain(r), a;
|
|
791
685
|
}
|
|
792
686
|
async handleGetCapabilitiesRequest(e) {
|
|
793
|
-
|
|
687
|
+
Fn(e.params);
|
|
794
688
|
const n = e.params[0], s = e.params[1];
|
|
795
|
-
if (!this.accounts.some((l) =>
|
|
796
|
-
throw
|
|
797
|
-
const r = this.storage.loadObject(
|
|
689
|
+
if (!this.accounts.some((l) => Sn(l, n)))
|
|
690
|
+
throw E.provider.unauthorized("no active account found");
|
|
691
|
+
const r = this.storage.loadObject(at);
|
|
798
692
|
if (!r)
|
|
799
693
|
return {};
|
|
800
694
|
if (!s || s.length === 0)
|
|
801
695
|
return r;
|
|
802
|
-
const i = new Set(s.map((l) =>
|
|
696
|
+
const i = new Set(s.map((l) => et(l)));
|
|
803
697
|
return Object.fromEntries(Object.entries(r).filter(([l]) => {
|
|
804
698
|
try {
|
|
805
|
-
const
|
|
806
|
-
return i.has(
|
|
699
|
+
const h = et(l);
|
|
700
|
+
return i.has(h);
|
|
807
701
|
} catch {
|
|
808
702
|
return !1;
|
|
809
703
|
}
|
|
@@ -812,15 +706,15 @@ class ps {
|
|
|
812
706
|
async sendEncryptedRequest(e) {
|
|
813
707
|
const n = await this.keyManager.getSharedSecret();
|
|
814
708
|
if (!n)
|
|
815
|
-
throw
|
|
816
|
-
const s = await
|
|
709
|
+
throw E.provider.unauthorized("No valid session found, try requestAccounts before other methods");
|
|
710
|
+
const s = await qn({
|
|
817
711
|
action: e,
|
|
818
712
|
chainId: this.chain.id
|
|
819
713
|
}, n), r = await this.createRequestMessage({ encrypted: s });
|
|
820
714
|
return this.communicator.postRequestAndWaitForResponse(r);
|
|
821
715
|
}
|
|
822
716
|
async createRequestMessage(e) {
|
|
823
|
-
const n = await
|
|
717
|
+
const n = await Vt("public", await this.keyManager.getOwnPublicKey());
|
|
824
718
|
return {
|
|
825
719
|
id: crypto.randomUUID(),
|
|
826
720
|
sender: n,
|
|
@@ -835,326 +729,66 @@ class ps {
|
|
|
835
729
|
throw r.failure;
|
|
836
730
|
const i = await this.keyManager.getSharedSecret();
|
|
837
731
|
if (!i)
|
|
838
|
-
throw
|
|
839
|
-
const a = await
|
|
732
|
+
throw E.provider.unauthorized("Invalid session");
|
|
733
|
+
const a = await Kn(r.encrypted, i), l = (n = a.data) === null || n === void 0 ? void 0 : n.chains;
|
|
840
734
|
if (l) {
|
|
841
|
-
const d = Object.entries(l).map(([
|
|
842
|
-
id: Number(
|
|
735
|
+
const d = Object.entries(l).map(([f, g]) => ({
|
|
736
|
+
id: Number(f),
|
|
843
737
|
rpcUrl: g
|
|
844
738
|
}));
|
|
845
|
-
this.storage.storeObject(
|
|
739
|
+
this.storage.storeObject(rt, d), this.updateChain(this.chain.id, d);
|
|
846
740
|
}
|
|
847
|
-
const
|
|
848
|
-
return
|
|
741
|
+
const h = (s = a.data) === null || s === void 0 ? void 0 : s.capabilities;
|
|
742
|
+
return h && this.storage.storeObject(at, h), a;
|
|
849
743
|
}
|
|
850
744
|
updateChain(e, n) {
|
|
851
745
|
var s;
|
|
852
|
-
const r = n ?? this.storage.loadObject(
|
|
853
|
-
return i ? (i !== this.chain && (this.chain = i, this.storage.storeObject(
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
var
|
|
857
|
-
function
|
|
858
|
-
if (
|
|
859
|
-
|
|
860
|
-
const t = /* @__PURE__ */
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
x.shrSL = a;
|
|
879
|
-
const l = (b, m, w) => b >>> w | m << 32 - w;
|
|
880
|
-
x.rotrSH = l;
|
|
881
|
-
const u = (b, m, w) => b << 32 - w | m >>> w;
|
|
882
|
-
x.rotrSL = u;
|
|
883
|
-
const d = (b, m, w) => b << 64 - w | m >>> w - 32;
|
|
884
|
-
x.rotrBH = d;
|
|
885
|
-
const p = (b, m, w) => b >>> w - 32 | m << 64 - w;
|
|
886
|
-
x.rotrBL = p;
|
|
887
|
-
const g = (b, m) => m;
|
|
888
|
-
x.rotr32H = g;
|
|
889
|
-
const o = (b, m) => b;
|
|
890
|
-
x.rotr32L = o;
|
|
891
|
-
const c = (b, m, w) => b << w | m >>> 32 - w;
|
|
892
|
-
x.rotlSH = c;
|
|
893
|
-
const h = (b, m, w) => m << w | b >>> 32 - w;
|
|
894
|
-
x.rotlSL = h;
|
|
895
|
-
const k = (b, m, w) => m << w - 32 | b >>> 64 - w;
|
|
896
|
-
x.rotlBH = k;
|
|
897
|
-
const _ = (b, m, w) => b << w - 32 | m >>> 64 - w;
|
|
898
|
-
x.rotlBL = _;
|
|
899
|
-
function I(b, m, w, H) {
|
|
900
|
-
const W = (m >>> 0) + (H >>> 0);
|
|
901
|
-
return { h: b + w + (W / 2 ** 32 | 0) | 0, l: W | 0 };
|
|
902
|
-
}
|
|
903
|
-
const v = (b, m, w) => (b >>> 0) + (m >>> 0) + (w >>> 0);
|
|
904
|
-
x.add3L = v;
|
|
905
|
-
const E = (b, m, w, H) => m + w + H + (b / 2 ** 32 | 0) | 0;
|
|
906
|
-
x.add3H = E;
|
|
907
|
-
const C = (b, m, w, H) => (b >>> 0) + (m >>> 0) + (w >>> 0) + (H >>> 0);
|
|
908
|
-
x.add4L = C;
|
|
909
|
-
const y = (b, m, w, H, W) => m + w + H + W + (b / 2 ** 32 | 0) | 0;
|
|
910
|
-
x.add4H = y;
|
|
911
|
-
const A = (b, m, w, H, W) => (b >>> 0) + (m >>> 0) + (w >>> 0) + (H >>> 0) + (W >>> 0);
|
|
912
|
-
x.add5L = A;
|
|
913
|
-
const M = (b, m, w, H, W, q) => m + w + H + W + q + (b / 2 ** 32 | 0) | 0;
|
|
914
|
-
x.add5H = M;
|
|
915
|
-
const P = {
|
|
916
|
-
fromBig: n,
|
|
917
|
-
split: s,
|
|
918
|
-
toBig: r,
|
|
919
|
-
shrSH: i,
|
|
920
|
-
shrSL: a,
|
|
921
|
-
rotrSH: l,
|
|
922
|
-
rotrSL: u,
|
|
923
|
-
rotrBH: d,
|
|
924
|
-
rotrBL: p,
|
|
925
|
-
rotr32H: g,
|
|
926
|
-
rotr32L: o,
|
|
927
|
-
rotlSH: c,
|
|
928
|
-
rotlSL: h,
|
|
929
|
-
rotlBH: k,
|
|
930
|
-
rotlBL: _,
|
|
931
|
-
add: I,
|
|
932
|
-
add3L: v,
|
|
933
|
-
add3H: E,
|
|
934
|
-
add4L: C,
|
|
935
|
-
add4H: y,
|
|
936
|
-
add5H: M,
|
|
937
|
-
add5L: A
|
|
938
|
-
};
|
|
939
|
-
return x.default = P, x;
|
|
940
|
-
}
|
|
941
|
-
var je = {}, ue = {}, Et;
|
|
942
|
-
function _s() {
|
|
943
|
-
return Et || (Et = 1, Object.defineProperty(ue, "__esModule", { value: !0 }), ue.crypto = void 0, ue.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0), ue;
|
|
944
|
-
}
|
|
945
|
-
var It;
|
|
946
|
-
function ms() {
|
|
947
|
-
return It || (It = 1, (function(t) {
|
|
948
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
949
|
-
Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = n, t.anumber = s, t.abytes = r, t.ahash = i, t.aexists = a, t.aoutput = l, t.u8 = u, t.u32 = d, t.clean = p, t.createView = g, t.rotr = o, t.rotl = c, t.byteSwap = h, t.byteSwap32 = k, t.bytesToHex = v, t.hexToBytes = y, t.asyncLoop = M, t.utf8ToBytes = P, t.bytesToUtf8 = b, t.toBytes = m, t.kdfInputToBytes = w, t.concatBytes = H, t.checkOpts = W, t.createHasher = ae, t.createOptHasher = oe, t.createXOFer = se, t.randomBytes = Hn;
|
|
950
|
-
const e = /* @__PURE__ */ _s();
|
|
951
|
-
function n(f) {
|
|
952
|
-
return f instanceof Uint8Array || ArrayBuffer.isView(f) && f.constructor.name === "Uint8Array";
|
|
953
|
-
}
|
|
954
|
-
function s(f) {
|
|
955
|
-
if (!Number.isSafeInteger(f) || f < 0)
|
|
956
|
-
throw new Error("positive integer expected, got " + f);
|
|
957
|
-
}
|
|
958
|
-
function r(f, ...S) {
|
|
959
|
-
if (!n(f))
|
|
960
|
-
throw new Error("Uint8Array expected");
|
|
961
|
-
if (S.length > 0 && !S.includes(f.length))
|
|
962
|
-
throw new Error("Uint8Array expected of length " + S + ", got length=" + f.length);
|
|
963
|
-
}
|
|
964
|
-
function i(f) {
|
|
965
|
-
if (typeof f != "function" || typeof f.create != "function")
|
|
966
|
-
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
967
|
-
s(f.outputLen), s(f.blockLen);
|
|
968
|
-
}
|
|
969
|
-
function a(f, S = !0) {
|
|
970
|
-
if (f.destroyed)
|
|
971
|
-
throw new Error("Hash instance has been destroyed");
|
|
972
|
-
if (S && f.finished)
|
|
973
|
-
throw new Error("Hash#digest() has already been called");
|
|
974
|
-
}
|
|
975
|
-
function l(f, S) {
|
|
976
|
-
r(f);
|
|
977
|
-
const N = S.outputLen;
|
|
978
|
-
if (f.length < N)
|
|
979
|
-
throw new Error("digestInto() expects output buffer of length at least " + N);
|
|
980
|
-
}
|
|
981
|
-
function u(f) {
|
|
982
|
-
return new Uint8Array(f.buffer, f.byteOffset, f.byteLength);
|
|
983
|
-
}
|
|
984
|
-
function d(f) {
|
|
985
|
-
return new Uint32Array(f.buffer, f.byteOffset, Math.floor(f.byteLength / 4));
|
|
986
|
-
}
|
|
987
|
-
function p(...f) {
|
|
988
|
-
for (let S = 0; S < f.length; S++)
|
|
989
|
-
f[S].fill(0);
|
|
990
|
-
}
|
|
991
|
-
function g(f) {
|
|
992
|
-
return new DataView(f.buffer, f.byteOffset, f.byteLength);
|
|
993
|
-
}
|
|
994
|
-
function o(f, S) {
|
|
995
|
-
return f << 32 - S | f >>> S;
|
|
996
|
-
}
|
|
997
|
-
function c(f, S) {
|
|
998
|
-
return f << S | f >>> 32 - S >>> 0;
|
|
999
|
-
}
|
|
1000
|
-
t.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
1001
|
-
function h(f) {
|
|
1002
|
-
return f << 24 & 4278190080 | f << 8 & 16711680 | f >>> 8 & 65280 | f >>> 24 & 255;
|
|
1003
|
-
}
|
|
1004
|
-
t.swap8IfBE = t.isLE ? (f) => f : (f) => h(f), t.byteSwapIfBE = t.swap8IfBE;
|
|
1005
|
-
function k(f) {
|
|
1006
|
-
for (let S = 0; S < f.length; S++)
|
|
1007
|
-
f[S] = h(f[S]);
|
|
1008
|
-
return f;
|
|
1009
|
-
}
|
|
1010
|
-
t.swap32IfBE = t.isLE ? (f) => f : k;
|
|
1011
|
-
const _ = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", I = /* @__PURE__ */ Array.from({ length: 256 }, (f, S) => S.toString(16).padStart(2, "0"));
|
|
1012
|
-
function v(f) {
|
|
1013
|
-
if (r(f), _)
|
|
1014
|
-
return f.toHex();
|
|
1015
|
-
let S = "";
|
|
1016
|
-
for (let N = 0; N < f.length; N++)
|
|
1017
|
-
S += I[f[N]];
|
|
1018
|
-
return S;
|
|
1019
|
-
}
|
|
1020
|
-
const E = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
1021
|
-
function C(f) {
|
|
1022
|
-
if (f >= E._0 && f <= E._9)
|
|
1023
|
-
return f - E._0;
|
|
1024
|
-
if (f >= E.A && f <= E.F)
|
|
1025
|
-
return f - (E.A - 10);
|
|
1026
|
-
if (f >= E.a && f <= E.f)
|
|
1027
|
-
return f - (E.a - 10);
|
|
1028
|
-
}
|
|
1029
|
-
function y(f) {
|
|
1030
|
-
if (typeof f != "string")
|
|
1031
|
-
throw new Error("hex string expected, got " + typeof f);
|
|
1032
|
-
if (_)
|
|
1033
|
-
return Uint8Array.fromHex(f);
|
|
1034
|
-
const S = f.length, N = S / 2;
|
|
1035
|
-
if (S % 2)
|
|
1036
|
-
throw new Error("hex string expected, got unpadded hex of length " + S);
|
|
1037
|
-
const D = new Uint8Array(N);
|
|
1038
|
-
for (let V = 0, F = 0; V < N; V++, F += 2) {
|
|
1039
|
-
const ut = C(f.charCodeAt(F)), ht = C(f.charCodeAt(F + 1));
|
|
1040
|
-
if (ut === void 0 || ht === void 0) {
|
|
1041
|
-
const Un = f[F] + f[F + 1];
|
|
1042
|
-
throw new Error('hex string expected, got non-hex character "' + Un + '" at index ' + F);
|
|
1043
|
-
}
|
|
1044
|
-
D[V] = ut * 16 + ht;
|
|
1045
|
-
}
|
|
1046
|
-
return D;
|
|
1047
|
-
}
|
|
1048
|
-
const A = async () => {
|
|
1049
|
-
};
|
|
1050
|
-
t.nextTick = A;
|
|
1051
|
-
async function M(f, S, N) {
|
|
1052
|
-
let D = Date.now();
|
|
1053
|
-
for (let V = 0; V < f; V++) {
|
|
1054
|
-
N(V);
|
|
1055
|
-
const F = Date.now() - D;
|
|
1056
|
-
F >= 0 && F < S || (await (0, t.nextTick)(), D += F);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
function P(f) {
|
|
1060
|
-
if (typeof f != "string")
|
|
1061
|
-
throw new Error("string expected");
|
|
1062
|
-
return new Uint8Array(new TextEncoder().encode(f));
|
|
1063
|
-
}
|
|
1064
|
-
function b(f) {
|
|
1065
|
-
return new TextDecoder().decode(f);
|
|
1066
|
-
}
|
|
1067
|
-
function m(f) {
|
|
1068
|
-
return typeof f == "string" && (f = P(f)), r(f), f;
|
|
1069
|
-
}
|
|
1070
|
-
function w(f) {
|
|
1071
|
-
return typeof f == "string" && (f = P(f)), r(f), f;
|
|
1072
|
-
}
|
|
1073
|
-
function H(...f) {
|
|
1074
|
-
let S = 0;
|
|
1075
|
-
for (let D = 0; D < f.length; D++) {
|
|
1076
|
-
const V = f[D];
|
|
1077
|
-
r(V), S += V.length;
|
|
1078
|
-
}
|
|
1079
|
-
const N = new Uint8Array(S);
|
|
1080
|
-
for (let D = 0, V = 0; D < f.length; D++) {
|
|
1081
|
-
const F = f[D];
|
|
1082
|
-
N.set(F, V), V += F.length;
|
|
1083
|
-
}
|
|
1084
|
-
return N;
|
|
1085
|
-
}
|
|
1086
|
-
function W(f, S) {
|
|
1087
|
-
if (S !== void 0 && {}.toString.call(S) !== "[object Object]")
|
|
1088
|
-
throw new Error("options should be object or undefined");
|
|
1089
|
-
return Object.assign(f, S);
|
|
1090
|
-
}
|
|
1091
|
-
class q {
|
|
1092
|
-
}
|
|
1093
|
-
t.Hash = q;
|
|
1094
|
-
function ae(f) {
|
|
1095
|
-
const S = (D) => f().update(m(D)).digest(), N = f();
|
|
1096
|
-
return S.outputLen = N.outputLen, S.blockLen = N.blockLen, S.create = () => f(), S;
|
|
1097
|
-
}
|
|
1098
|
-
function oe(f) {
|
|
1099
|
-
const S = (D, V) => f(V).update(m(D)).digest(), N = f({});
|
|
1100
|
-
return S.outputLen = N.outputLen, S.blockLen = N.blockLen, S.create = (D) => f(D), S;
|
|
1101
|
-
}
|
|
1102
|
-
function se(f) {
|
|
1103
|
-
const S = (D, V) => f(V).update(m(D)).digest(), N = f({});
|
|
1104
|
-
return S.outputLen = N.outputLen, S.blockLen = N.blockLen, S.create = (D) => f(D), S;
|
|
1105
|
-
}
|
|
1106
|
-
t.wrapConstructor = ae, t.wrapConstructorWithOpts = oe, t.wrapXOFConstructorWithOpts = se;
|
|
1107
|
-
function Hn(f = 32) {
|
|
1108
|
-
if (e.crypto && typeof e.crypto.getRandomValues == "function")
|
|
1109
|
-
return e.crypto.getRandomValues(new Uint8Array(f));
|
|
1110
|
-
if (e.crypto && typeof e.crypto.randomBytes == "function")
|
|
1111
|
-
return Uint8Array.from(e.crypto.randomBytes(f));
|
|
1112
|
-
throw new Error("crypto.getRandomValues must be defined");
|
|
1113
|
-
}
|
|
1114
|
-
})(je)), je;
|
|
1115
|
-
}
|
|
1116
|
-
var Ct;
|
|
1117
|
-
function ys() {
|
|
1118
|
-
if (Ct) return T;
|
|
1119
|
-
Ct = 1, Object.defineProperty(T, "__esModule", { value: !0 }), T.shake256 = T.shake128 = T.keccak_512 = T.keccak_384 = T.keccak_256 = T.keccak_224 = T.sha3_512 = T.sha3_384 = T.sha3_256 = T.sha3_224 = T.Keccak = void 0, T.keccakP = _;
|
|
1120
|
-
const t = /* @__PURE__ */ gs(), e = /* @__PURE__ */ ms(), n = BigInt(0), s = BigInt(1), r = BigInt(2), i = BigInt(7), a = BigInt(256), l = BigInt(113), u = [], d = [], p = [];
|
|
1121
|
-
for (let C = 0, y = s, A = 1, M = 0; C < 24; C++) {
|
|
1122
|
-
[A, M] = [M, (2 * A + 3 * M) % 5], u.push(2 * (5 * M + A)), d.push((C + 1) * (C + 2) / 2 % 64);
|
|
1123
|
-
let P = n;
|
|
1124
|
-
for (let b = 0; b < 7; b++)
|
|
1125
|
-
y = (y << s ^ (y >> i) * l) % a, y & r && (P ^= s << (s << /* @__PURE__ */ BigInt(b)) - s);
|
|
1126
|
-
p.push(P);
|
|
1127
|
-
}
|
|
1128
|
-
const g = (0, t.split)(p, !0), o = g[0], c = g[1], h = (C, y, A) => A > 32 ? (0, t.rotlBH)(C, y, A) : (0, t.rotlSH)(C, y, A), k = (C, y, A) => A > 32 ? (0, t.rotlBL)(C, y, A) : (0, t.rotlSL)(C, y, A);
|
|
1129
|
-
function _(C, y = 24) {
|
|
1130
|
-
const A = new Uint32Array(10);
|
|
1131
|
-
for (let M = 24 - y; M < 24; M++) {
|
|
1132
|
-
for (let m = 0; m < 10; m++)
|
|
1133
|
-
A[m] = C[m] ^ C[m + 10] ^ C[m + 20] ^ C[m + 30] ^ C[m + 40];
|
|
1134
|
-
for (let m = 0; m < 10; m += 2) {
|
|
1135
|
-
const w = (m + 8) % 10, H = (m + 2) % 10, W = A[H], q = A[H + 1], ae = h(W, q, 1) ^ A[w], oe = k(W, q, 1) ^ A[w + 1];
|
|
1136
|
-
for (let se = 0; se < 50; se += 10)
|
|
1137
|
-
C[m + se] ^= ae, C[m + se + 1] ^= oe;
|
|
746
|
+
const r = n ?? this.storage.loadObject(rt), i = r == null ? void 0 : r.find((a) => a.id === e);
|
|
747
|
+
return i ? (i !== this.chain && (this.chain = i, this.storage.storeObject(it, i), (s = this.callback) === null || s === void 0 || s.call(this, "chainChanged", z(i.id))), !0) : !1;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
var M = {}, ot;
|
|
751
|
+
function Jn() {
|
|
752
|
+
if (ot) return M;
|
|
753
|
+
ot = 1, Object.defineProperty(M, "__esModule", { value: !0 }), M.shake256 = M.shake128 = M.keccak_512 = M.keccak_384 = M.keccak_256 = M.keccak_224 = M.sha3_512 = M.sha3_384 = M.sha3_256 = M.sha3_224 = M.Keccak = void 0, M.keccakP = _;
|
|
754
|
+
const t = /* @__PURE__ */ En(), e = /* @__PURE__ */ In(), n = BigInt(0), s = BigInt(1), r = BigInt(2), i = BigInt(7), a = BigInt(256), l = BigInt(113), h = [], d = [], f = [];
|
|
755
|
+
for (let w = 0, p = s, k = 1, C = 0; w < 24; w++) {
|
|
756
|
+
[k, C] = [C, (2 * k + 3 * C) % 5], h.push(2 * (5 * C + k)), d.push((w + 1) * (w + 2) / 2 % 64);
|
|
757
|
+
let x = n;
|
|
758
|
+
for (let L = 0; L < 7; L++)
|
|
759
|
+
p = (p << s ^ (p >> i) * l) % a, p & r && (x ^= s << (s << /* @__PURE__ */ BigInt(L)) - s);
|
|
760
|
+
f.push(x);
|
|
761
|
+
}
|
|
762
|
+
const g = (0, t.split)(f, !0), o = g[0], c = g[1], u = (w, p, k) => k > 32 ? (0, t.rotlBH)(w, p, k) : (0, t.rotlSH)(w, p, k), b = (w, p, k) => k > 32 ? (0, t.rotlBL)(w, p, k) : (0, t.rotlSL)(w, p, k);
|
|
763
|
+
function _(w, p = 24) {
|
|
764
|
+
const k = new Uint32Array(10);
|
|
765
|
+
for (let C = 24 - p; C < 24; C++) {
|
|
766
|
+
for (let v = 0; v < 10; v++)
|
|
767
|
+
k[v] = w[v] ^ w[v + 10] ^ w[v + 20] ^ w[v + 30] ^ w[v + 40];
|
|
768
|
+
for (let v = 0; v < 10; v += 2) {
|
|
769
|
+
const A = (v + 8) % 10, re = (v + 2) % 10, ae = k[re], $ = k[re + 1], wn = u(ae, $, 1) ^ k[A], bn = b(ae, $, 1) ^ k[A + 1];
|
|
770
|
+
for (let oe = 0; oe < 50; oe += 10)
|
|
771
|
+
w[v + oe] ^= wn, w[v + oe + 1] ^= bn;
|
|
1138
772
|
}
|
|
1139
|
-
let
|
|
1140
|
-
for (let
|
|
1141
|
-
const
|
|
1142
|
-
|
|
773
|
+
let x = w[2], L = w[3];
|
|
774
|
+
for (let v = 0; v < 24; v++) {
|
|
775
|
+
const A = d[v], re = u(x, L, A), ae = b(x, L, A), $ = h[v];
|
|
776
|
+
x = w[$], L = w[$ + 1], w[$] = re, w[$ + 1] = ae;
|
|
1143
777
|
}
|
|
1144
|
-
for (let
|
|
1145
|
-
for (let
|
|
1146
|
-
A
|
|
1147
|
-
for (let
|
|
1148
|
-
|
|
778
|
+
for (let v = 0; v < 50; v += 10) {
|
|
779
|
+
for (let A = 0; A < 10; A++)
|
|
780
|
+
k[A] = w[v + A];
|
|
781
|
+
for (let A = 0; A < 10; A++)
|
|
782
|
+
w[v + A] ^= ~k[(A + 2) % 10] & k[(A + 4) % 10];
|
|
1149
783
|
}
|
|
1150
|
-
|
|
784
|
+
w[0] ^= o[C], w[1] ^= c[C];
|
|
1151
785
|
}
|
|
1152
|
-
(0, e.clean)(
|
|
786
|
+
(0, e.clean)(k);
|
|
1153
787
|
}
|
|
1154
|
-
class
|
|
788
|
+
class y extends e.Hash {
|
|
1155
789
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1156
|
-
constructor(
|
|
1157
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen =
|
|
790
|
+
constructor(p, k, C, x = !1, L = 24) {
|
|
791
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = p, this.suffix = k, this.outputLen = C, this.enableXOF = x, this.rounds = L, (0, e.anumber)(C), !(0 < p && p < 200))
|
|
1158
792
|
throw new Error("only keccak-f1600 function is supported");
|
|
1159
793
|
this.state = new Uint8Array(200), this.state32 = (0, e.u32)(this.state);
|
|
1160
794
|
}
|
|
@@ -1164,14 +798,14 @@ function ys() {
|
|
|
1164
798
|
keccak() {
|
|
1165
799
|
(0, e.swap32IfBE)(this.state32), _(this.state32, this.rounds), (0, e.swap32IfBE)(this.state32), this.posOut = 0, this.pos = 0;
|
|
1166
800
|
}
|
|
1167
|
-
update(
|
|
1168
|
-
(0, e.aexists)(this),
|
|
1169
|
-
const { blockLen:
|
|
1170
|
-
for (let
|
|
1171
|
-
const
|
|
1172
|
-
for (let
|
|
1173
|
-
|
|
1174
|
-
this.pos ===
|
|
801
|
+
update(p) {
|
|
802
|
+
(0, e.aexists)(this), p = (0, e.toBytes)(p), (0, e.abytes)(p);
|
|
803
|
+
const { blockLen: k, state: C } = this, x = p.length;
|
|
804
|
+
for (let L = 0; L < x; ) {
|
|
805
|
+
const v = Math.min(k - this.pos, x - L);
|
|
806
|
+
for (let A = 0; A < v; A++)
|
|
807
|
+
C[this.pos++] ^= p[L++];
|
|
808
|
+
this.pos === k && this.keccak();
|
|
1175
809
|
}
|
|
1176
810
|
return this;
|
|
1177
811
|
}
|
|
@@ -1179,31 +813,31 @@ function ys() {
|
|
|
1179
813
|
if (this.finished)
|
|
1180
814
|
return;
|
|
1181
815
|
this.finished = !0;
|
|
1182
|
-
const { state:
|
|
1183
|
-
|
|
1184
|
-
}
|
|
1185
|
-
writeInto(
|
|
1186
|
-
(0, e.aexists)(this, !1), (0, e.abytes)(
|
|
1187
|
-
const
|
|
1188
|
-
for (let
|
|
1189
|
-
this.posOut >=
|
|
1190
|
-
const
|
|
1191
|
-
|
|
816
|
+
const { state: p, suffix: k, pos: C, blockLen: x } = this;
|
|
817
|
+
p[C] ^= k, (k & 128) !== 0 && C === x - 1 && this.keccak(), p[x - 1] ^= 128, this.keccak();
|
|
818
|
+
}
|
|
819
|
+
writeInto(p) {
|
|
820
|
+
(0, e.aexists)(this, !1), (0, e.abytes)(p), this.finish();
|
|
821
|
+
const k = this.state, { blockLen: C } = this;
|
|
822
|
+
for (let x = 0, L = p.length; x < L; ) {
|
|
823
|
+
this.posOut >= C && this.keccak();
|
|
824
|
+
const v = Math.min(C - this.posOut, L - x);
|
|
825
|
+
p.set(k.subarray(this.posOut, this.posOut + v), x), this.posOut += v, x += v;
|
|
1192
826
|
}
|
|
1193
|
-
return
|
|
827
|
+
return p;
|
|
1194
828
|
}
|
|
1195
|
-
xofInto(
|
|
829
|
+
xofInto(p) {
|
|
1196
830
|
if (!this.enableXOF)
|
|
1197
831
|
throw new Error("XOF is not possible for this instance");
|
|
1198
|
-
return this.writeInto(
|
|
832
|
+
return this.writeInto(p);
|
|
1199
833
|
}
|
|
1200
|
-
xof(
|
|
1201
|
-
return (0, e.anumber)(
|
|
834
|
+
xof(p) {
|
|
835
|
+
return (0, e.anumber)(p), this.xofInto(new Uint8Array(p));
|
|
1202
836
|
}
|
|
1203
|
-
digestInto(
|
|
1204
|
-
if ((0, e.aoutput)(
|
|
837
|
+
digestInto(p) {
|
|
838
|
+
if ((0, e.aoutput)(p, this), this.finished)
|
|
1205
839
|
throw new Error("digest() was already called");
|
|
1206
|
-
return this.writeInto(
|
|
840
|
+
return this.writeInto(p), this.destroy(), p;
|
|
1207
841
|
}
|
|
1208
842
|
digest() {
|
|
1209
843
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
@@ -1211,59 +845,59 @@ function ys() {
|
|
|
1211
845
|
destroy() {
|
|
1212
846
|
this.destroyed = !0, (0, e.clean)(this.state);
|
|
1213
847
|
}
|
|
1214
|
-
_cloneInto(
|
|
1215
|
-
const { blockLen:
|
|
1216
|
-
return
|
|
848
|
+
_cloneInto(p) {
|
|
849
|
+
const { blockLen: k, suffix: C, outputLen: x, rounds: L, enableXOF: v } = this;
|
|
850
|
+
return p || (p = new y(k, C, x, v, L)), p.state32.set(this.state32), p.pos = this.pos, p.posOut = this.posOut, p.finished = this.finished, p.rounds = L, p.suffix = C, p.outputLen = x, p.enableXOF = v, p.destroyed = this.destroyed, p;
|
|
1217
851
|
}
|
|
1218
852
|
}
|
|
1219
|
-
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1224
|
-
}
|
|
1225
|
-
var
|
|
1226
|
-
function
|
|
1227
|
-
if (
|
|
1228
|
-
|
|
1229
|
-
const { keccak_256: t } = /* @__PURE__ */
|
|
853
|
+
M.Keccak = y;
|
|
854
|
+
const m = (w, p, k) => (0, e.createHasher)(() => new y(p, w, k));
|
|
855
|
+
M.sha3_224 = m(6, 144, 224 / 8), M.sha3_256 = m(6, 136, 256 / 8), M.sha3_384 = m(6, 104, 384 / 8), M.sha3_512 = m(6, 72, 512 / 8), M.keccak_224 = m(1, 144, 224 / 8), M.keccak_256 = m(1, 136, 256 / 8), M.keccak_384 = m(1, 104, 384 / 8), M.keccak_512 = m(1, 72, 512 / 8);
|
|
856
|
+
const I = (w, p, k) => (0, e.createXOFer)((C = {}) => new y(p, w, C.dkLen === void 0 ? k : C.dkLen, !0));
|
|
857
|
+
return M.shake128 = I(31, 168, 128 / 8), M.shake256 = I(31, 136, 256 / 8), M;
|
|
858
|
+
}
|
|
859
|
+
var Ae, ct;
|
|
860
|
+
function $t() {
|
|
861
|
+
if (ct) return Ae;
|
|
862
|
+
ct = 1;
|
|
863
|
+
const { keccak_256: t } = /* @__PURE__ */ Jn();
|
|
1230
864
|
function e(c) {
|
|
1231
865
|
return Buffer.allocUnsafe(c).fill(0);
|
|
1232
866
|
}
|
|
1233
867
|
function n(c) {
|
|
1234
868
|
return c.toString(2).length;
|
|
1235
869
|
}
|
|
1236
|
-
function s(c,
|
|
1237
|
-
let
|
|
1238
|
-
|
|
1239
|
-
const _ =
|
|
1240
|
-
for (; _.length <
|
|
870
|
+
function s(c, u) {
|
|
871
|
+
let b = c.toString(16);
|
|
872
|
+
b.length % 2 !== 0 && (b = "0" + b);
|
|
873
|
+
const _ = b.match(/.{1,2}/g).map((y) => parseInt(y, 16));
|
|
874
|
+
for (; _.length < u; )
|
|
1241
875
|
_.unshift(0);
|
|
1242
876
|
return Buffer.from(_);
|
|
1243
877
|
}
|
|
1244
|
-
function r(c,
|
|
1245
|
-
const
|
|
878
|
+
function r(c, u) {
|
|
879
|
+
const b = c < 0n;
|
|
1246
880
|
let _;
|
|
1247
|
-
if (
|
|
1248
|
-
const
|
|
1249
|
-
_ = (~c &
|
|
881
|
+
if (b) {
|
|
882
|
+
const y = (1n << BigInt(u)) - 1n;
|
|
883
|
+
_ = (~c & y) + 1n;
|
|
1250
884
|
} else
|
|
1251
885
|
_ = c;
|
|
1252
|
-
return _ &= (1n << BigInt(
|
|
886
|
+
return _ &= (1n << BigInt(u)) - 1n, _;
|
|
1253
887
|
}
|
|
1254
|
-
function i(c,
|
|
1255
|
-
const _ = e(
|
|
1256
|
-
return c = l(c),
|
|
888
|
+
function i(c, u, b) {
|
|
889
|
+
const _ = e(u);
|
|
890
|
+
return c = l(c), b ? c.length < u ? (c.copy(_), _) : c.slice(0, u) : c.length < u ? (c.copy(_, u - c.length), _) : c.slice(-u);
|
|
1257
891
|
}
|
|
1258
|
-
function a(c,
|
|
1259
|
-
return i(c,
|
|
892
|
+
function a(c, u) {
|
|
893
|
+
return i(c, u, !0);
|
|
1260
894
|
}
|
|
1261
895
|
function l(c) {
|
|
1262
896
|
if (!Buffer.isBuffer(c))
|
|
1263
897
|
if (Array.isArray(c))
|
|
1264
898
|
c = Buffer.from(c);
|
|
1265
899
|
else if (typeof c == "string")
|
|
1266
|
-
g(c) ? c = Buffer.from(
|
|
900
|
+
g(c) ? c = Buffer.from(f(o(c)), "hex") : c = Buffer.from(c);
|
|
1267
901
|
else if (typeof c == "number")
|
|
1268
902
|
c = intToBuffer(c);
|
|
1269
903
|
else if (c == null)
|
|
@@ -1276,15 +910,15 @@ function fn() {
|
|
|
1276
910
|
throw new Error("invalid type");
|
|
1277
911
|
return c;
|
|
1278
912
|
}
|
|
1279
|
-
function
|
|
913
|
+
function h(c) {
|
|
1280
914
|
return c = l(c), "0x" + c.toString("hex");
|
|
1281
915
|
}
|
|
1282
|
-
function d(c,
|
|
1283
|
-
if (c = l(c),
|
|
916
|
+
function d(c, u) {
|
|
917
|
+
if (c = l(c), u || (u = 256), u !== 256)
|
|
1284
918
|
throw new Error("unsupported");
|
|
1285
919
|
return Buffer.from(t(new Uint8Array(c)));
|
|
1286
920
|
}
|
|
1287
|
-
function
|
|
921
|
+
function f(c) {
|
|
1288
922
|
return c.length % 2 ? "0" + c : c;
|
|
1289
923
|
}
|
|
1290
924
|
function g(c) {
|
|
@@ -1293,25 +927,25 @@ function fn() {
|
|
|
1293
927
|
function o(c) {
|
|
1294
928
|
return typeof c == "string" && c.startsWith("0x") ? c.slice(2) : c;
|
|
1295
929
|
}
|
|
1296
|
-
return
|
|
930
|
+
return Ae = {
|
|
1297
931
|
zeros: e,
|
|
1298
932
|
setLength: i,
|
|
1299
933
|
setLengthRight: a,
|
|
1300
934
|
isHexString: g,
|
|
1301
935
|
stripHexPrefix: o,
|
|
1302
936
|
toBuffer: l,
|
|
1303
|
-
bufferToHex:
|
|
937
|
+
bufferToHex: h,
|
|
1304
938
|
keccak: d,
|
|
1305
939
|
bitLengthFromBigInt: n,
|
|
1306
940
|
bufferBEFromBigInt: s,
|
|
1307
941
|
twosFromBigInt: r
|
|
1308
|
-
},
|
|
942
|
+
}, Ae;
|
|
1309
943
|
}
|
|
1310
|
-
var
|
|
1311
|
-
function
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1314
|
-
const t = /* @__PURE__ */
|
|
944
|
+
var Me, lt;
|
|
945
|
+
function Qn() {
|
|
946
|
+
if (lt) return Me;
|
|
947
|
+
lt = 1;
|
|
948
|
+
const t = /* @__PURE__ */ $t();
|
|
1315
949
|
function e(o) {
|
|
1316
950
|
return o.startsWith("int[") ? "int256" + o.slice(3) : o === "int" ? "int256" : o.startsWith("uint[") ? "uint256" + o.slice(4) : o === "uint" ? "uint256" : o.startsWith("fixed[") ? "fixed128x128" + o.slice(5) : o === "fixed" ? "fixed128x128" : o.startsWith("ufixed[") ? "ufixed128x128" + o.slice(6) : o === "ufixed" ? "ufixed128x128" : o;
|
|
1317
951
|
}
|
|
@@ -1335,128 +969,128 @@ function ws() {
|
|
|
1335
969
|
throw new Error("Argument is not a number");
|
|
1336
970
|
}
|
|
1337
971
|
function a(o, c) {
|
|
1338
|
-
var
|
|
972
|
+
var u, b, _, y;
|
|
1339
973
|
if (o === "address")
|
|
1340
974
|
return a("uint160", i(c));
|
|
1341
975
|
if (o === "bool")
|
|
1342
976
|
return a("uint8", c ? 1 : 0);
|
|
1343
977
|
if (o === "string")
|
|
1344
978
|
return a("bytes", new Buffer(c, "utf8"));
|
|
1345
|
-
if (
|
|
979
|
+
if (h(o)) {
|
|
1346
980
|
if (typeof c.length > "u")
|
|
1347
981
|
throw new Error("Not an array?");
|
|
1348
|
-
if (
|
|
1349
|
-
throw new Error("Elements exceed array size: " +
|
|
982
|
+
if (u = r(o), u !== "dynamic" && u !== 0 && c.length > u)
|
|
983
|
+
throw new Error("Elements exceed array size: " + u);
|
|
1350
984
|
_ = [], o = o.slice(0, o.lastIndexOf("[")), typeof c == "string" && (c = JSON.parse(c));
|
|
1351
|
-
for (
|
|
1352
|
-
_.push(a(o, c[
|
|
1353
|
-
if (
|
|
1354
|
-
var
|
|
1355
|
-
_.unshift(
|
|
985
|
+
for (y in c)
|
|
986
|
+
_.push(a(o, c[y]));
|
|
987
|
+
if (u === "dynamic") {
|
|
988
|
+
var m = a("uint256", c.length);
|
|
989
|
+
_.unshift(m);
|
|
1356
990
|
}
|
|
1357
991
|
return Buffer.concat(_);
|
|
1358
992
|
} else {
|
|
1359
993
|
if (o === "bytes")
|
|
1360
994
|
return c = new Buffer(c), _ = Buffer.concat([a("uint256", c.length), c]), c.length % 32 !== 0 && (_ = Buffer.concat([_, t.zeros(32 - c.length % 32)])), _;
|
|
1361
995
|
if (o.startsWith("bytes")) {
|
|
1362
|
-
if (
|
|
1363
|
-
throw new Error("Invalid bytes<N> width: " +
|
|
996
|
+
if (u = n(o), u < 1 || u > 32)
|
|
997
|
+
throw new Error("Invalid bytes<N> width: " + u);
|
|
1364
998
|
return t.setLengthRight(c, 32);
|
|
1365
999
|
} else if (o.startsWith("uint")) {
|
|
1366
|
-
if (
|
|
1367
|
-
throw new Error("Invalid uint<N> width: " +
|
|
1368
|
-
|
|
1369
|
-
const
|
|
1370
|
-
if (
|
|
1371
|
-
throw new Error("Supplied uint exceeds width: " +
|
|
1372
|
-
if (
|
|
1000
|
+
if (u = n(o), u % 8 || u < 8 || u > 256)
|
|
1001
|
+
throw new Error("Invalid uint<N> width: " + u);
|
|
1002
|
+
b = i(c);
|
|
1003
|
+
const I = t.bitLengthFromBigInt(b);
|
|
1004
|
+
if (I > u)
|
|
1005
|
+
throw new Error("Supplied uint exceeds width: " + u + " vs " + I);
|
|
1006
|
+
if (b < 0)
|
|
1373
1007
|
throw new Error("Supplied uint is negative");
|
|
1374
|
-
return t.bufferBEFromBigInt(
|
|
1008
|
+
return t.bufferBEFromBigInt(b, 32);
|
|
1375
1009
|
} else if (o.startsWith("int")) {
|
|
1376
|
-
if (
|
|
1377
|
-
throw new Error("Invalid int<N> width: " +
|
|
1378
|
-
|
|
1379
|
-
const
|
|
1380
|
-
if (
|
|
1381
|
-
throw new Error("Supplied int exceeds width: " +
|
|
1382
|
-
const
|
|
1383
|
-
return t.bufferBEFromBigInt(
|
|
1010
|
+
if (u = n(o), u % 8 || u < 8 || u > 256)
|
|
1011
|
+
throw new Error("Invalid int<N> width: " + u);
|
|
1012
|
+
b = i(c);
|
|
1013
|
+
const I = t.bitLengthFromBigInt(b);
|
|
1014
|
+
if (I > u)
|
|
1015
|
+
throw new Error("Supplied int exceeds width: " + u + " vs " + I);
|
|
1016
|
+
const w = t.twosFromBigInt(b, 256);
|
|
1017
|
+
return t.bufferBEFromBigInt(w, 32);
|
|
1384
1018
|
} else if (o.startsWith("ufixed")) {
|
|
1385
|
-
if (
|
|
1019
|
+
if (u = s(o), b = i(c), b < 0)
|
|
1386
1020
|
throw new Error("Supplied ufixed is negative");
|
|
1387
|
-
return a("uint256",
|
|
1021
|
+
return a("uint256", b * BigInt(2) ** BigInt(u[1]));
|
|
1388
1022
|
} else if (o.startsWith("fixed"))
|
|
1389
|
-
return
|
|
1023
|
+
return u = s(o), a("int256", i(c) * BigInt(2) ** BigInt(u[1]));
|
|
1390
1024
|
}
|
|
1391
1025
|
throw new Error("Unsupported or invalid type: " + o);
|
|
1392
1026
|
}
|
|
1393
1027
|
function l(o) {
|
|
1394
1028
|
return o === "string" || o === "bytes" || r(o) === "dynamic";
|
|
1395
1029
|
}
|
|
1396
|
-
function
|
|
1030
|
+
function h(o) {
|
|
1397
1031
|
return o.lastIndexOf("]") === o.length - 1;
|
|
1398
1032
|
}
|
|
1399
1033
|
function d(o, c) {
|
|
1400
|
-
var
|
|
1401
|
-
for (var
|
|
1402
|
-
var
|
|
1403
|
-
l(
|
|
1034
|
+
var u = [], b = [], _ = 32 * o.length;
|
|
1035
|
+
for (var y in o) {
|
|
1036
|
+
var m = e(o[y]), I = c[y], w = a(m, I);
|
|
1037
|
+
l(m) ? (u.push(a("uint256", _)), b.push(w), _ += w.length) : u.push(w);
|
|
1404
1038
|
}
|
|
1405
|
-
return Buffer.concat(
|
|
1039
|
+
return Buffer.concat(u.concat(b));
|
|
1406
1040
|
}
|
|
1407
|
-
function
|
|
1041
|
+
function f(o, c) {
|
|
1408
1042
|
if (o.length !== c.length)
|
|
1409
1043
|
throw new Error("Number of types are not matching the values");
|
|
1410
|
-
for (var
|
|
1411
|
-
var
|
|
1412
|
-
if (
|
|
1413
|
-
_.push(
|
|
1414
|
-
else if (
|
|
1415
|
-
_.push(new Buffer(
|
|
1416
|
-
else if (
|
|
1417
|
-
_.push(new Buffer(
|
|
1418
|
-
else if (
|
|
1419
|
-
_.push(t.setLength(
|
|
1420
|
-
else if (
|
|
1421
|
-
if (
|
|
1422
|
-
throw new Error("Invalid bytes<N> width: " +
|
|
1423
|
-
_.push(t.setLengthRight(
|
|
1424
|
-
} else if (
|
|
1425
|
-
if (
|
|
1426
|
-
throw new Error("Invalid uint<N> width: " +
|
|
1427
|
-
|
|
1428
|
-
const
|
|
1429
|
-
if (
|
|
1430
|
-
throw new Error("Supplied uint exceeds width: " +
|
|
1431
|
-
_.push(t.bufferBEFromBigInt(
|
|
1432
|
-
} else if (
|
|
1433
|
-
if (
|
|
1434
|
-
throw new Error("Invalid int<N> width: " +
|
|
1435
|
-
|
|
1436
|
-
const
|
|
1437
|
-
if (
|
|
1438
|
-
throw new Error("Supplied int exceeds width: " +
|
|
1439
|
-
const
|
|
1440
|
-
_.push(t.bufferBEFromBigInt(
|
|
1044
|
+
for (var u, b, _ = [], y = 0; y < o.length; y++) {
|
|
1045
|
+
var m = e(o[y]), I = c[y];
|
|
1046
|
+
if (m === "bytes")
|
|
1047
|
+
_.push(I);
|
|
1048
|
+
else if (m === "string")
|
|
1049
|
+
_.push(new Buffer(I, "utf8"));
|
|
1050
|
+
else if (m === "bool")
|
|
1051
|
+
_.push(new Buffer(I ? "01" : "00", "hex"));
|
|
1052
|
+
else if (m === "address")
|
|
1053
|
+
_.push(t.setLength(I, 20));
|
|
1054
|
+
else if (m.startsWith("bytes")) {
|
|
1055
|
+
if (u = n(m), u < 1 || u > 32)
|
|
1056
|
+
throw new Error("Invalid bytes<N> width: " + u);
|
|
1057
|
+
_.push(t.setLengthRight(I, u));
|
|
1058
|
+
} else if (m.startsWith("uint")) {
|
|
1059
|
+
if (u = n(m), u % 8 || u < 8 || u > 256)
|
|
1060
|
+
throw new Error("Invalid uint<N> width: " + u);
|
|
1061
|
+
b = i(I);
|
|
1062
|
+
const w = t.bitLengthFromBigInt(b);
|
|
1063
|
+
if (w > u)
|
|
1064
|
+
throw new Error("Supplied uint exceeds width: " + u + " vs " + w);
|
|
1065
|
+
_.push(t.bufferBEFromBigInt(b, u / 8));
|
|
1066
|
+
} else if (m.startsWith("int")) {
|
|
1067
|
+
if (u = n(m), u % 8 || u < 8 || u > 256)
|
|
1068
|
+
throw new Error("Invalid int<N> width: " + u);
|
|
1069
|
+
b = i(I);
|
|
1070
|
+
const w = t.bitLengthFromBigInt(b);
|
|
1071
|
+
if (w > u)
|
|
1072
|
+
throw new Error("Supplied int exceeds width: " + u + " vs " + w);
|
|
1073
|
+
const p = t.twosFromBigInt(b, u);
|
|
1074
|
+
_.push(t.bufferBEFromBigInt(p, u / 8));
|
|
1441
1075
|
} else
|
|
1442
|
-
throw new Error("Unsupported or invalid type: " +
|
|
1076
|
+
throw new Error("Unsupported or invalid type: " + m);
|
|
1443
1077
|
}
|
|
1444
1078
|
return Buffer.concat(_);
|
|
1445
1079
|
}
|
|
1446
1080
|
function g(o, c) {
|
|
1447
|
-
return t.keccak(
|
|
1081
|
+
return t.keccak(f(o, c));
|
|
1448
1082
|
}
|
|
1449
|
-
return
|
|
1083
|
+
return Me = {
|
|
1450
1084
|
rawEncode: d,
|
|
1451
|
-
solidityPack:
|
|
1085
|
+
solidityPack: f,
|
|
1452
1086
|
soliditySHA3: g
|
|
1453
|
-
},
|
|
1087
|
+
}, Me;
|
|
1454
1088
|
}
|
|
1455
|
-
var
|
|
1456
|
-
function
|
|
1457
|
-
if (
|
|
1458
|
-
|
|
1459
|
-
const t = /* @__PURE__ */
|
|
1089
|
+
var Pe, dt;
|
|
1090
|
+
function Xn() {
|
|
1091
|
+
if (dt) return Pe;
|
|
1092
|
+
dt = 1;
|
|
1093
|
+
const t = /* @__PURE__ */ $t(), e = /* @__PURE__ */ Qn(), n = {
|
|
1460
1094
|
type: "object",
|
|
1461
1095
|
properties: {
|
|
1462
1096
|
types: {
|
|
@@ -1487,48 +1121,48 @@ function bs() {
|
|
|
1487
1121
|
* @param {Object} types - Type definitions
|
|
1488
1122
|
* @returns {string} - Encoded representation of an object
|
|
1489
1123
|
*/
|
|
1490
|
-
encodeData(i, a, l,
|
|
1491
|
-
const d = ["bytes32"],
|
|
1492
|
-
if (
|
|
1493
|
-
const g = (o, c,
|
|
1124
|
+
encodeData(i, a, l, h = !0) {
|
|
1125
|
+
const d = ["bytes32"], f = [this.hashType(i, l)];
|
|
1126
|
+
if (h) {
|
|
1127
|
+
const g = (o, c, u) => {
|
|
1494
1128
|
if (l[c] !== void 0)
|
|
1495
|
-
return ["bytes32",
|
|
1496
|
-
if (
|
|
1129
|
+
return ["bytes32", u == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : t.keccak(this.encodeData(c, u, l, h))];
|
|
1130
|
+
if (u === void 0)
|
|
1497
1131
|
throw new Error(`missing value for field ${o} of type ${c}`);
|
|
1498
1132
|
if (c === "bytes")
|
|
1499
|
-
return ["bytes32", t.keccak(
|
|
1133
|
+
return ["bytes32", t.keccak(u)];
|
|
1500
1134
|
if (c === "string")
|
|
1501
|
-
return typeof
|
|
1135
|
+
return typeof u == "string" && (u = Buffer.from(u, "utf8")), ["bytes32", t.keccak(u)];
|
|
1502
1136
|
if (c.lastIndexOf("]") === c.length - 1) {
|
|
1503
|
-
const
|
|
1137
|
+
const b = c.slice(0, c.lastIndexOf("[")), _ = u.map((y) => g(o, b, y));
|
|
1504
1138
|
return ["bytes32", t.keccak(e.rawEncode(
|
|
1505
|
-
_.map(([
|
|
1506
|
-
_.map(([,
|
|
1139
|
+
_.map(([y]) => y),
|
|
1140
|
+
_.map(([, y]) => y)
|
|
1507
1141
|
))];
|
|
1508
1142
|
}
|
|
1509
|
-
return [c,
|
|
1143
|
+
return [c, u];
|
|
1510
1144
|
};
|
|
1511
1145
|
for (const o of l[i]) {
|
|
1512
|
-
const [c,
|
|
1513
|
-
d.push(c),
|
|
1146
|
+
const [c, u] = g(o.name, o.type, a[o.name]);
|
|
1147
|
+
d.push(c), f.push(u);
|
|
1514
1148
|
}
|
|
1515
1149
|
} else
|
|
1516
1150
|
for (const g of l[i]) {
|
|
1517
1151
|
let o = a[g.name];
|
|
1518
1152
|
if (o !== void 0)
|
|
1519
1153
|
if (g.type === "bytes")
|
|
1520
|
-
d.push("bytes32"), o = t.keccak(o),
|
|
1154
|
+
d.push("bytes32"), o = t.keccak(o), f.push(o);
|
|
1521
1155
|
else if (g.type === "string")
|
|
1522
|
-
d.push("bytes32"), typeof o == "string" && (o = Buffer.from(o, "utf8")), o = t.keccak(o),
|
|
1156
|
+
d.push("bytes32"), typeof o == "string" && (o = Buffer.from(o, "utf8")), o = t.keccak(o), f.push(o);
|
|
1523
1157
|
else if (l[g.type] !== void 0)
|
|
1524
|
-
d.push("bytes32"), o = t.keccak(this.encodeData(g.type, o, l,
|
|
1158
|
+
d.push("bytes32"), o = t.keccak(this.encodeData(g.type, o, l, h)), f.push(o);
|
|
1525
1159
|
else {
|
|
1526
1160
|
if (g.type.lastIndexOf("]") === g.type.length - 1)
|
|
1527
1161
|
throw new Error("Arrays currently unimplemented in encodeData");
|
|
1528
|
-
d.push(g.type),
|
|
1162
|
+
d.push(g.type), f.push(o);
|
|
1529
1163
|
}
|
|
1530
1164
|
}
|
|
1531
|
-
return e.rawEncode(d,
|
|
1165
|
+
return e.rawEncode(d, f);
|
|
1532
1166
|
},
|
|
1533
1167
|
/**
|
|
1534
1168
|
* Encodes the type of an object by encoding a comma delimited list of its members
|
|
@@ -1538,9 +1172,9 @@ function bs() {
|
|
|
1538
1172
|
* @returns {string} - Encoded representation of the type of an object
|
|
1539
1173
|
*/
|
|
1540
1174
|
encodeType(i, a) {
|
|
1541
|
-
let l = "",
|
|
1542
|
-
|
|
1543
|
-
for (const d of
|
|
1175
|
+
let l = "", h = this.findTypeDependencies(i, a).filter((d) => d !== i);
|
|
1176
|
+
h = [i].concat(h.sort());
|
|
1177
|
+
for (const d of h) {
|
|
1544
1178
|
if (!a[d])
|
|
1545
1179
|
throw new Error("No type definition specified: " + d);
|
|
1546
1180
|
l += d + "(" + a[d].map(({ name: g, type: o }) => o + " " + g).join(",") + ")";
|
|
@@ -1559,8 +1193,8 @@ function bs() {
|
|
|
1559
1193
|
if (i = i.match(/^\w*/)[0], l.includes(i) || a[i] === void 0)
|
|
1560
1194
|
return l;
|
|
1561
1195
|
l.push(i);
|
|
1562
|
-
for (const
|
|
1563
|
-
for (const d of this.findTypeDependencies(
|
|
1196
|
+
for (const h of a[i])
|
|
1197
|
+
for (const d of this.findTypeDependencies(h.type, a, l))
|
|
1564
1198
|
!l.includes(d) && l.push(d);
|
|
1565
1199
|
return l;
|
|
1566
1200
|
},
|
|
@@ -1572,8 +1206,8 @@ function bs() {
|
|
|
1572
1206
|
* @param {Object} types - Type definitions
|
|
1573
1207
|
* @returns {Buffer} - Hash of an object
|
|
1574
1208
|
*/
|
|
1575
|
-
hashStruct(i, a, l,
|
|
1576
|
-
return t.keccak(this.encodeData(i, a, l,
|
|
1209
|
+
hashStruct(i, a, l, h = !0) {
|
|
1210
|
+
return t.keccak(this.encodeData(i, a, l, h));
|
|
1577
1211
|
},
|
|
1578
1212
|
/**
|
|
1579
1213
|
* Hashes the type of an object
|
|
@@ -1604,11 +1238,11 @@ function bs() {
|
|
|
1604
1238
|
* @returns {string} - sha3 hash for signing
|
|
1605
1239
|
*/
|
|
1606
1240
|
hash(i, a = !0) {
|
|
1607
|
-
const l = this.sanitizeData(i),
|
|
1608
|
-
return
|
|
1241
|
+
const l = this.sanitizeData(i), h = [Buffer.from("1901", "hex")];
|
|
1242
|
+
return h.push(this.hashStruct("EIP712Domain", l.domain, l.types, a)), l.primaryType !== "EIP712Domain" && h.push(this.hashStruct(l.primaryType, l.message, l.types, a)), t.keccak(Buffer.concat(h));
|
|
1609
1243
|
}
|
|
1610
1244
|
};
|
|
1611
|
-
|
|
1245
|
+
Pe = {
|
|
1612
1246
|
TYPED_MESSAGE_SCHEMA: n,
|
|
1613
1247
|
TypedDataUtils: s,
|
|
1614
1248
|
hashForSignTypedDataLegacy: function(i) {
|
|
@@ -1624,30 +1258,30 @@ function bs() {
|
|
|
1624
1258
|
function r(i) {
|
|
1625
1259
|
const a = new Error("Expect argument to be non-empty array");
|
|
1626
1260
|
if (typeof i != "object" || !i.length) throw a;
|
|
1627
|
-
const l = i.map(function(
|
|
1628
|
-
return
|
|
1629
|
-
}),
|
|
1630
|
-
return
|
|
1631
|
-
}), d = i.map(function(
|
|
1632
|
-
if (!
|
|
1633
|
-
return
|
|
1261
|
+
const l = i.map(function(f) {
|
|
1262
|
+
return f.type === "bytes" ? t.toBuffer(f.value) : f.value;
|
|
1263
|
+
}), h = i.map(function(f) {
|
|
1264
|
+
return f.type;
|
|
1265
|
+
}), d = i.map(function(f) {
|
|
1266
|
+
if (!f.name) throw a;
|
|
1267
|
+
return f.type + " " + f.name;
|
|
1634
1268
|
});
|
|
1635
1269
|
return e.soliditySHA3(
|
|
1636
1270
|
["bytes32", "bytes32"],
|
|
1637
1271
|
[
|
|
1638
1272
|
e.soliditySHA3(new Array(i.length).fill("string"), d),
|
|
1639
|
-
e.soliditySHA3(
|
|
1273
|
+
e.soliditySHA3(h, l)
|
|
1640
1274
|
]
|
|
1641
1275
|
);
|
|
1642
1276
|
}
|
|
1643
|
-
return
|
|
1277
|
+
return Pe;
|
|
1644
1278
|
}
|
|
1645
|
-
var
|
|
1646
|
-
const
|
|
1647
|
-
function
|
|
1279
|
+
var es = /* @__PURE__ */ Xn();
|
|
1280
|
+
const ce = /* @__PURE__ */ yn(es), ts = "walletUsername", je = "Addresses", ns = "AppVersion";
|
|
1281
|
+
function D(t) {
|
|
1648
1282
|
return t.errorMessage !== void 0;
|
|
1649
1283
|
}
|
|
1650
|
-
class
|
|
1284
|
+
class ss {
|
|
1651
1285
|
// @param secret hex representation of 32-byte secret
|
|
1652
1286
|
constructor(e) {
|
|
1653
1287
|
this.secret = e;
|
|
@@ -1663,11 +1297,11 @@ class Is {
|
|
|
1663
1297
|
const n = this.secret;
|
|
1664
1298
|
if (n.length !== 64)
|
|
1665
1299
|
throw Error("secret must be 256 bits");
|
|
1666
|
-
const s = crypto.getRandomValues(new Uint8Array(12)), r = await crypto.subtle.importKey("raw",
|
|
1300
|
+
const s = crypto.getRandomValues(new Uint8Array(12)), r = await crypto.subtle.importKey("raw", he(n), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), i = new TextEncoder(), a = await window.crypto.subtle.encrypt({
|
|
1667
1301
|
name: "AES-GCM",
|
|
1668
1302
|
iv: s
|
|
1669
|
-
}, r, i.encode(e)), l = 16,
|
|
1670
|
-
return
|
|
1303
|
+
}, r, i.encode(e)), l = 16, h = a.slice(a.byteLength - l), d = a.slice(0, a.byteLength - l), f = new Uint8Array(h), g = new Uint8Array(d), o = new Uint8Array([...s, ...f, ...g]);
|
|
1304
|
+
return Fe(o);
|
|
1671
1305
|
}
|
|
1672
1306
|
/**
|
|
1673
1307
|
*
|
|
@@ -1680,12 +1314,12 @@ class Is {
|
|
|
1680
1314
|
throw Error("secret must be 256 bits");
|
|
1681
1315
|
return new Promise((s, r) => {
|
|
1682
1316
|
(async function() {
|
|
1683
|
-
const i = await crypto.subtle.importKey("raw",
|
|
1317
|
+
const i = await crypto.subtle.importKey("raw", he(n), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), a = he(e), l = a.slice(0, 12), h = a.slice(12, 28), d = a.slice(28), f = new Uint8Array([...d, ...h]), g = {
|
|
1684
1318
|
name: "AES-GCM",
|
|
1685
1319
|
iv: new Uint8Array(l)
|
|
1686
1320
|
};
|
|
1687
1321
|
try {
|
|
1688
|
-
const o = await window.crypto.subtle.decrypt(g, i,
|
|
1322
|
+
const o = await window.crypto.subtle.decrypt(g, i, f), c = new TextDecoder();
|
|
1689
1323
|
s(c.decode(o));
|
|
1690
1324
|
} catch (o) {
|
|
1691
1325
|
r(o);
|
|
@@ -1694,7 +1328,7 @@ class Is {
|
|
|
1694
1328
|
});
|
|
1695
1329
|
}
|
|
1696
1330
|
}
|
|
1697
|
-
class
|
|
1331
|
+
class is {
|
|
1698
1332
|
constructor(e, n, s) {
|
|
1699
1333
|
this.linkAPIUrl = e, this.sessionId = n;
|
|
1700
1334
|
const r = `${n}:${s}`;
|
|
@@ -1732,11 +1366,11 @@ class Cs {
|
|
|
1732
1366
|
throw new Error(`Check unseen events failed: ${n.status}`);
|
|
1733
1367
|
}
|
|
1734
1368
|
}
|
|
1735
|
-
var
|
|
1369
|
+
var H;
|
|
1736
1370
|
(function(t) {
|
|
1737
1371
|
t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED";
|
|
1738
|
-
})(
|
|
1739
|
-
class
|
|
1372
|
+
})(H || (H = {}));
|
|
1373
|
+
class O {
|
|
1740
1374
|
setConnectionStateListener(e) {
|
|
1741
1375
|
this.connectionStateListener = e;
|
|
1742
1376
|
}
|
|
@@ -1749,7 +1383,7 @@ class z {
|
|
|
1749
1383
|
* @param [WebSocketClass] Custom WebSocket implementation
|
|
1750
1384
|
*/
|
|
1751
1385
|
constructor(e, n = WebSocket) {
|
|
1752
|
-
this.WebSocketClass = n, this.webSocket = null, this.isDisconnecting = !1, this.url = e.replace(/^http/, "ws"), this.instanceId =
|
|
1386
|
+
this.WebSocketClass = n, this.webSocket = null, this.isDisconnecting = !1, this.url = e.replace(/^http/, "ws"), this.instanceId = O.instanceCounter++, O.activeInstances.add(this.instanceId);
|
|
1753
1387
|
}
|
|
1754
1388
|
/**
|
|
1755
1389
|
* Make a websocket connection
|
|
@@ -1769,12 +1403,12 @@ class z {
|
|
|
1769
1403
|
n(i);
|
|
1770
1404
|
return;
|
|
1771
1405
|
}
|
|
1772
|
-
(s = this.connectionStateListener) === null || s === void 0 || s.call(this,
|
|
1406
|
+
(s = this.connectionStateListener) === null || s === void 0 || s.call(this, H.CONNECTING), r.onclose = (i) => {
|
|
1773
1407
|
var a;
|
|
1774
|
-
this.clearWebSocket(), r.readyState !== WebSocket.OPEN && n(new Error(`websocket error ${i.code}: ${i.reason}`)), (a = this.connectionStateListener) === null || a === void 0 || a.call(this,
|
|
1408
|
+
this.clearWebSocket(), r.readyState !== WebSocket.OPEN && n(new Error(`websocket error ${i.code}: ${i.reason}`)), (a = this.connectionStateListener) === null || a === void 0 || a.call(this, H.DISCONNECTED);
|
|
1775
1409
|
}, r.onopen = (i) => {
|
|
1776
1410
|
var a;
|
|
1777
|
-
e(), (a = this.connectionStateListener) === null || a === void 0 || a.call(this,
|
|
1411
|
+
e(), (a = this.connectionStateListener) === null || a === void 0 || a.call(this, H.CONNECTED), O.pendingData.length > 0 && ([...O.pendingData].forEach((h) => this.sendData(h)), O.pendingData = []);
|
|
1778
1412
|
}, r.onmessage = (i) => {
|
|
1779
1413
|
var a, l;
|
|
1780
1414
|
if (i.data === "h")
|
|
@@ -1783,8 +1417,8 @@ class z {
|
|
|
1783
1417
|
});
|
|
1784
1418
|
else
|
|
1785
1419
|
try {
|
|
1786
|
-
const
|
|
1787
|
-
(l = this.incomingDataListener) === null || l === void 0 || l.call(this,
|
|
1420
|
+
const h = JSON.parse(i.data);
|
|
1421
|
+
(l = this.incomingDataListener) === null || l === void 0 || l.call(this, h);
|
|
1788
1422
|
} catch {
|
|
1789
1423
|
}
|
|
1790
1424
|
};
|
|
@@ -1797,7 +1431,7 @@ class z {
|
|
|
1797
1431
|
var e;
|
|
1798
1432
|
const { webSocket: n } = this;
|
|
1799
1433
|
if (n) {
|
|
1800
|
-
this.isDisconnecting = !0, this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this,
|
|
1434
|
+
this.isDisconnecting = !0, this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, H.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0;
|
|
1801
1435
|
try {
|
|
1802
1436
|
n.close();
|
|
1803
1437
|
} catch {
|
|
@@ -1811,11 +1445,11 @@ class z {
|
|
|
1811
1445
|
sendData(e) {
|
|
1812
1446
|
const { webSocket: n } = this;
|
|
1813
1447
|
if (!n) {
|
|
1814
|
-
|
|
1448
|
+
O.pendingData.push(e), this.isDisconnecting || this.connect();
|
|
1815
1449
|
return;
|
|
1816
1450
|
}
|
|
1817
1451
|
if (n.readyState !== WebSocket.OPEN) {
|
|
1818
|
-
|
|
1452
|
+
O.pendingData.push(e);
|
|
1819
1453
|
return;
|
|
1820
1454
|
}
|
|
1821
1455
|
n.send(e);
|
|
@@ -1828,14 +1462,14 @@ class z {
|
|
|
1828
1462
|
* remove ws from active instances
|
|
1829
1463
|
*/
|
|
1830
1464
|
cleanup() {
|
|
1831
|
-
|
|
1465
|
+
O.activeInstances.delete(this.instanceId);
|
|
1832
1466
|
}
|
|
1833
1467
|
}
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
const
|
|
1838
|
-
class
|
|
1468
|
+
O.instanceCounter = 0;
|
|
1469
|
+
O.activeInstances = /* @__PURE__ */ new Set();
|
|
1470
|
+
O.pendingData = [];
|
|
1471
|
+
const ht = 1e4, rs = 6e4;
|
|
1472
|
+
class as {
|
|
1839
1473
|
/**
|
|
1840
1474
|
* Constructor
|
|
1841
1475
|
* @param session Session
|
|
@@ -1844,7 +1478,7 @@ class As {
|
|
|
1844
1478
|
* @param [WebSocketClass] Custom WebSocket implementation
|
|
1845
1479
|
*/
|
|
1846
1480
|
constructor({ session: e, linkAPIUrl: n, listener: s }) {
|
|
1847
|
-
this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId =
|
|
1481
|
+
this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = B(1), this.reconnectAttempts = 0, this.isReconnecting = !1, this._connected = !1, this._linked = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (i) => {
|
|
1848
1482
|
if (!i)
|
|
1849
1483
|
return;
|
|
1850
1484
|
(/* @__PURE__ */ new Map([
|
|
@@ -1857,8 +1491,8 @@ class As {
|
|
|
1857
1491
|
// ChainId and JsonRpcUrl are always updated together
|
|
1858
1492
|
(l) => i.JsonRpcUrl && this.handleChainUpdated(l, i.JsonRpcUrl)
|
|
1859
1493
|
]
|
|
1860
|
-
])).forEach((l,
|
|
1861
|
-
const d = i[
|
|
1494
|
+
])).forEach((l, h) => {
|
|
1495
|
+
const d = i[h];
|
|
1862
1496
|
d !== void 0 && l(d);
|
|
1863
1497
|
});
|
|
1864
1498
|
}, this.handleDestroyed = (i) => {
|
|
@@ -1874,33 +1508,33 @@ class As {
|
|
|
1874
1508
|
}, this.handleMetadataUpdated = async (i, a) => {
|
|
1875
1509
|
var l;
|
|
1876
1510
|
try {
|
|
1877
|
-
const
|
|
1878
|
-
(l = this.listener) === null || l === void 0 || l.metadataUpdated(i,
|
|
1511
|
+
const h = await this.cipher.decrypt(a);
|
|
1512
|
+
(l = this.listener) === null || l === void 0 || l.metadataUpdated(i, h);
|
|
1879
1513
|
} catch {
|
|
1880
1514
|
}
|
|
1881
1515
|
}, this.handleWalletUsernameUpdated = async (i) => {
|
|
1882
|
-
this.handleMetadataUpdated(
|
|
1516
|
+
this.handleMetadataUpdated(ts, i);
|
|
1883
1517
|
}, this.handleAppVersionUpdated = async (i) => {
|
|
1884
|
-
this.handleMetadataUpdated(
|
|
1518
|
+
this.handleMetadataUpdated(ns, i);
|
|
1885
1519
|
}, this.handleChainUpdated = async (i, a) => {
|
|
1886
1520
|
var l;
|
|
1887
1521
|
try {
|
|
1888
|
-
const
|
|
1889
|
-
(l = this.listener) === null || l === void 0 || l.chainUpdated(
|
|
1522
|
+
const h = await this.cipher.decrypt(i), d = await this.cipher.decrypt(a);
|
|
1523
|
+
(l = this.listener) === null || l === void 0 || l.chainUpdated(h, d);
|
|
1890
1524
|
} catch {
|
|
1891
1525
|
}
|
|
1892
|
-
}, this.session = e, this.cipher = new
|
|
1526
|
+
}, this.session = e, this.cipher = new ss(e.secret), this.listener = s, this.linkAPIUrl = n, this.WebSocketClass = WebSocket;
|
|
1893
1527
|
const r = this.createWebSocket();
|
|
1894
|
-
this.ws = r, this.http = new
|
|
1528
|
+
this.ws = r, this.http = new is(n, e.id, e.key), this.setupVisibilityChangeHandler();
|
|
1895
1529
|
}
|
|
1896
1530
|
createWebSocket() {
|
|
1897
|
-
const e = new
|
|
1531
|
+
const e = new O(`${this.linkAPIUrl}/rpc`, this.WebSocketClass);
|
|
1898
1532
|
return this.activeWsInstance = e, e.setConnectionStateListener(async (n) => {
|
|
1899
1533
|
if (e !== this.activeWsInstance)
|
|
1900
1534
|
return;
|
|
1901
1535
|
let s = !1;
|
|
1902
1536
|
switch (n) {
|
|
1903
|
-
case
|
|
1537
|
+
case H.DISCONNECTED:
|
|
1904
1538
|
this.heartbeatIntervalId && (clearInterval(this.heartbeatIntervalId), this.heartbeatIntervalId = void 0), this.lastHeartbeatResponse = 0, s = !1, this.destroyed || (async () => {
|
|
1905
1539
|
if (this.isReconnecting)
|
|
1906
1540
|
return;
|
|
@@ -1912,7 +1546,7 @@ class As {
|
|
|
1912
1546
|
})) : this.isReconnecting = !1;
|
|
1913
1547
|
})();
|
|
1914
1548
|
break;
|
|
1915
|
-
case
|
|
1549
|
+
case H.CONNECTED:
|
|
1916
1550
|
this.reconnectAttempts = 0;
|
|
1917
1551
|
try {
|
|
1918
1552
|
s = await this.handleConnected(), this.fetchUnseenEventsAPI().catch(() => {
|
|
@@ -1922,14 +1556,14 @@ class As {
|
|
|
1922
1556
|
}
|
|
1923
1557
|
this.connected = s, this.updateLastHeartbeat(), this.heartbeatIntervalId && clearInterval(this.heartbeatIntervalId), this.heartbeatIntervalId = window.setInterval(() => {
|
|
1924
1558
|
this.heartbeat();
|
|
1925
|
-
},
|
|
1559
|
+
}, ht), setTimeout(() => {
|
|
1926
1560
|
this.heartbeat();
|
|
1927
1561
|
}, 100);
|
|
1928
1562
|
break;
|
|
1929
|
-
case
|
|
1563
|
+
case H.CONNECTING:
|
|
1930
1564
|
break;
|
|
1931
1565
|
}
|
|
1932
|
-
n !==
|
|
1566
|
+
n !== H.CONNECTED && (this.connected = s);
|
|
1933
1567
|
}), e.setIncomingDataListener((n) => {
|
|
1934
1568
|
var s;
|
|
1935
1569
|
switch (n.type) {
|
|
@@ -1989,7 +1623,7 @@ class As {
|
|
|
1989
1623
|
async destroy() {
|
|
1990
1624
|
this.destroyed || (await this.makeRequest({
|
|
1991
1625
|
type: "SetSessionConfig",
|
|
1992
|
-
id:
|
|
1626
|
+
id: B(this.nextReqId++),
|
|
1993
1627
|
sessionId: this.session.id,
|
|
1994
1628
|
metadata: { __destroyed: "1" }
|
|
1995
1629
|
}, { timeout: 1e3 }), this.destroyed = !0, this.activeWsInstance = void 0, this.heartbeatIntervalId && (clearInterval(this.heartbeatIntervalId), this.heartbeatIntervalId = void 0), this.visibilityChangeHandler && document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.focusHandler && window.removeEventListener("focus", this.focusHandler), this.ws.disconnect(), "cleanup" in this.ws && typeof this.ws.cleanup == "function" && this.ws.cleanup(), this.listener = void 0);
|
|
@@ -2051,7 +1685,7 @@ class As {
|
|
|
2051
1685
|
async publishEvent(e, n, s = !1) {
|
|
2052
1686
|
const r = 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" }))), i = {
|
|
2053
1687
|
type: "PublishEvent",
|
|
2054
|
-
id:
|
|
1688
|
+
id: B(this.nextReqId++),
|
|
2055
1689
|
sessionId: this.session.id,
|
|
2056
1690
|
event: e,
|
|
2057
1691
|
data: r,
|
|
@@ -2071,7 +1705,7 @@ class As {
|
|
|
2071
1705
|
this.lastHeartbeatResponse = Date.now();
|
|
2072
1706
|
}
|
|
2073
1707
|
heartbeat() {
|
|
2074
|
-
if (Date.now() - this.lastHeartbeatResponse >
|
|
1708
|
+
if (Date.now() - this.lastHeartbeatResponse > ht * 2) {
|
|
2075
1709
|
this.ws.disconnect();
|
|
2076
1710
|
return;
|
|
2077
1711
|
}
|
|
@@ -2081,7 +1715,7 @@ class As {
|
|
|
2081
1715
|
} catch {
|
|
2082
1716
|
}
|
|
2083
1717
|
}
|
|
2084
|
-
async makeRequest(e, n = { timeout:
|
|
1718
|
+
async makeRequest(e, n = { timeout: rs }) {
|
|
2085
1719
|
const s = e.id;
|
|
2086
1720
|
this.sendData(e);
|
|
2087
1721
|
let r;
|
|
@@ -2101,42 +1735,42 @@ class As {
|
|
|
2101
1735
|
async handleConnected() {
|
|
2102
1736
|
return (await this.makeRequest({
|
|
2103
1737
|
type: "HostSession",
|
|
2104
|
-
id:
|
|
1738
|
+
id: B(this.nextReqId++),
|
|
2105
1739
|
sessionId: this.session.id,
|
|
2106
1740
|
sessionKey: this.session.key
|
|
2107
1741
|
})).type === "Fail" ? !1 : (this.sendData({
|
|
2108
1742
|
type: "IsLinked",
|
|
2109
|
-
id:
|
|
1743
|
+
id: B(this.nextReqId++),
|
|
2110
1744
|
sessionId: this.session.id
|
|
2111
1745
|
}), this.sendData({
|
|
2112
1746
|
type: "GetSessionConfig",
|
|
2113
|
-
id:
|
|
1747
|
+
id: B(this.nextReqId++),
|
|
2114
1748
|
sessionId: this.session.id
|
|
2115
1749
|
}), !0);
|
|
2116
1750
|
}
|
|
2117
1751
|
}
|
|
2118
|
-
class
|
|
1752
|
+
class os {
|
|
2119
1753
|
constructor() {
|
|
2120
1754
|
this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map();
|
|
2121
1755
|
}
|
|
2122
1756
|
makeRequestId() {
|
|
2123
1757
|
this._nextRequestId = (this._nextRequestId + 1) % 2147483647;
|
|
2124
|
-
const e = this._nextRequestId, n =
|
|
1758
|
+
const e = this._nextRequestId, n = qt(e.toString(16));
|
|
2125
1759
|
return this.callbacks.get(n) && this.callbacks.delete(n), e;
|
|
2126
1760
|
}
|
|
2127
1761
|
}
|
|
2128
|
-
const
|
|
2129
|
-
class
|
|
1762
|
+
const ut = "session:id", ft = "session:secret", pt = "session:linked";
|
|
1763
|
+
class J {
|
|
2130
1764
|
constructor(e, n, s, r = !1) {
|
|
2131
|
-
this.storage = e, this.id = n, this.secret = s, this.key =
|
|
1765
|
+
this.storage = e, this.id = n, this.secret = s, this.key = vn(kn(`${n}, ${s} WalletLink`)), this._linked = !!r;
|
|
2132
1766
|
}
|
|
2133
1767
|
static create(e) {
|
|
2134
|
-
const n =
|
|
2135
|
-
return new
|
|
1768
|
+
const n = Z(16), s = Z(32);
|
|
1769
|
+
return new J(e, n, s).save();
|
|
2136
1770
|
}
|
|
2137
1771
|
static load(e) {
|
|
2138
|
-
const n = e.getItem(
|
|
2139
|
-
return n && r ? new
|
|
1772
|
+
const n = e.getItem(ut), s = e.getItem(pt), r = e.getItem(ft);
|
|
1773
|
+
return n && r ? new J(e, n, r, s === "1") : null;
|
|
2140
1774
|
}
|
|
2141
1775
|
get linked() {
|
|
2142
1776
|
return this._linked;
|
|
@@ -2145,142 +1779,142 @@ class le {
|
|
|
2145
1779
|
this._linked = e, this.persistLinked();
|
|
2146
1780
|
}
|
|
2147
1781
|
save() {
|
|
2148
|
-
return this.storage.setItem(
|
|
1782
|
+
return this.storage.setItem(ut, this.id), this.storage.setItem(ft, this.secret), this.persistLinked(), this;
|
|
2149
1783
|
}
|
|
2150
1784
|
persistLinked() {
|
|
2151
|
-
this.storage.setItem(
|
|
1785
|
+
this.storage.setItem(pt, this._linked ? "1" : "0");
|
|
2152
1786
|
}
|
|
2153
1787
|
}
|
|
2154
|
-
function
|
|
1788
|
+
function cs() {
|
|
2155
1789
|
try {
|
|
2156
1790
|
return window.frameElement !== null;
|
|
2157
1791
|
} catch {
|
|
2158
1792
|
return !1;
|
|
2159
1793
|
}
|
|
2160
1794
|
}
|
|
2161
|
-
function
|
|
1795
|
+
function ls() {
|
|
2162
1796
|
try {
|
|
2163
|
-
return
|
|
1797
|
+
return cs() && window.top ? window.top.location : window.location;
|
|
2164
1798
|
} catch {
|
|
2165
1799
|
return window.location;
|
|
2166
1800
|
}
|
|
2167
1801
|
}
|
|
2168
|
-
function
|
|
1802
|
+
function ds() {
|
|
2169
1803
|
var t;
|
|
2170
1804
|
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);
|
|
2171
1805
|
}
|
|
2172
|
-
function
|
|
1806
|
+
function Zt() {
|
|
2173
1807
|
var t, e;
|
|
2174
1808
|
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;
|
|
2175
1809
|
}
|
|
2176
|
-
const
|
|
2177
|
-
function
|
|
1810
|
+
const hs = '@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}';
|
|
1811
|
+
function Gt() {
|
|
2178
1812
|
const t = document.createElement("style");
|
|
2179
|
-
t.type = "text/css", t.appendChild(document.createTextNode(
|
|
1813
|
+
t.type = "text/css", t.appendChild(document.createTextNode(hs)), document.documentElement.appendChild(t);
|
|
2180
1814
|
}
|
|
2181
|
-
function
|
|
1815
|
+
function Yt(t) {
|
|
2182
1816
|
var e, n, s = "";
|
|
2183
1817
|
if (typeof t == "string" || typeof t == "number") s += t;
|
|
2184
|
-
else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (n =
|
|
1818
|
+
else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (n = Yt(t[e])) && (s && (s += " "), s += n);
|
|
2185
1819
|
else for (e in t) t[e] && (s && (s += " "), s += e);
|
|
2186
1820
|
return s;
|
|
2187
1821
|
}
|
|
2188
|
-
function
|
|
2189
|
-
for (var t, e, n = 0, s = ""; n < arguments.length; ) (t = arguments[n++]) && (e =
|
|
1822
|
+
function te() {
|
|
1823
|
+
for (var t, e, n = 0, s = ""; n < arguments.length; ) (t = arguments[n++]) && (e = Yt(t)) && (s && (s += " "), s += e);
|
|
2190
1824
|
return s;
|
|
2191
1825
|
}
|
|
2192
|
-
var
|
|
2193
|
-
function
|
|
1826
|
+
var ve, P, Jt, F, gt, Qt, Xt, Le, ue, ne, en, Ge, Ue, He, _e = {}, me = [], us = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ke = Array.isArray;
|
|
1827
|
+
function K(t, e) {
|
|
2194
1828
|
for (var n in e) t[n] = e[n];
|
|
2195
1829
|
return t;
|
|
2196
1830
|
}
|
|
2197
|
-
function
|
|
1831
|
+
function Ye(t) {
|
|
2198
1832
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
2199
1833
|
}
|
|
2200
|
-
function
|
|
1834
|
+
function S(t, e, n) {
|
|
2201
1835
|
var s, r, i, a = {};
|
|
2202
1836
|
for (i in e) i == "key" ? s = e[i] : i == "ref" ? r = e[i] : a[i] = e[i];
|
|
2203
|
-
if (arguments.length > 2 && (a.children = arguments.length > 3 ?
|
|
2204
|
-
return
|
|
1837
|
+
if (arguments.length > 2 && (a.children = arguments.length > 3 ? ve.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (i in t.defaultProps) a[i] === void 0 && (a[i] = t.defaultProps[i]);
|
|
1838
|
+
return fe(t, a, s, r, null);
|
|
2205
1839
|
}
|
|
2206
|
-
function
|
|
2207
|
-
var i = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: r ?? ++
|
|
2208
|
-
return r == null &&
|
|
1840
|
+
function fe(t, e, n, s, r) {
|
|
1841
|
+
var i = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: r ?? ++Jt, __i: -1, __u: 0 };
|
|
1842
|
+
return r == null && P.vnode != null && P.vnode(i), i;
|
|
2209
1843
|
}
|
|
2210
|
-
function
|
|
1844
|
+
function Ee(t) {
|
|
2211
1845
|
return t.children;
|
|
2212
1846
|
}
|
|
2213
|
-
function
|
|
1847
|
+
function pe(t, e) {
|
|
2214
1848
|
this.props = t, this.context = e;
|
|
2215
1849
|
}
|
|
2216
|
-
function
|
|
2217
|
-
if (e == null) return t.__ ?
|
|
1850
|
+
function G(t, e) {
|
|
1851
|
+
if (e == null) return t.__ ? G(t.__, t.__i + 1) : null;
|
|
2218
1852
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
2219
|
-
return typeof t.type == "function" ?
|
|
1853
|
+
return typeof t.type == "function" ? G(t) : null;
|
|
2220
1854
|
}
|
|
2221
|
-
function
|
|
1855
|
+
function fs(t) {
|
|
2222
1856
|
if (t.__P && t.__d) {
|
|
2223
|
-
var e = t.__v, n = e.__e, s = [], r = [], i =
|
|
2224
|
-
i.__v = e.__v + 1,
|
|
1857
|
+
var e = t.__v, n = e.__e, s = [], r = [], i = K({}, e);
|
|
1858
|
+
i.__v = e.__v + 1, P.vnode && P.vnode(i), Je(t.__P, i, e, t.__n, t.__P.namespaceURI, 32 & e.__u ? [n] : null, s, n ?? G(e), !!(32 & e.__u), r), i.__v = e.__v, i.__.__k[i.__i] = i, an(s, i, r), e.__e = e.__ = null, i.__e != n && tn(i);
|
|
2225
1859
|
}
|
|
2226
1860
|
}
|
|
2227
|
-
function
|
|
1861
|
+
function tn(t) {
|
|
2228
1862
|
if ((t = t.__) != null && t.__c != null) return t.__e = t.__c.base = null, t.__k.some(function(e) {
|
|
2229
1863
|
if (e != null && e.__e != null) return t.__e = t.__c.base = e.__e;
|
|
2230
|
-
}),
|
|
1864
|
+
}), tn(t);
|
|
2231
1865
|
}
|
|
2232
|
-
function
|
|
2233
|
-
(!t.__d && (t.__d = !0) &&
|
|
1866
|
+
function _t(t) {
|
|
1867
|
+
(!t.__d && (t.__d = !0) && F.push(t) && !we.__r++ || gt != P.debounceRendering) && ((gt = P.debounceRendering) || Qt)(we);
|
|
2234
1868
|
}
|
|
2235
|
-
function
|
|
1869
|
+
function we() {
|
|
2236
1870
|
try {
|
|
2237
|
-
for (var t, e = 1;
|
|
1871
|
+
for (var t, e = 1; F.length; ) F.length > e && F.sort(Xt), t = F.shift(), e = F.length, fs(t);
|
|
2238
1872
|
} finally {
|
|
2239
|
-
|
|
1873
|
+
F.length = we.__r = 0;
|
|
2240
1874
|
}
|
|
2241
1875
|
}
|
|
2242
|
-
function
|
|
2243
|
-
var g, o, c,
|
|
2244
|
-
for (
|
|
2245
|
-
return n.__e =
|
|
1876
|
+
function nn(t, e, n, s, r, i, a, l, h, d, f) {
|
|
1877
|
+
var g, o, c, u, b, _, y = s && s.__k || me, m = e.length;
|
|
1878
|
+
for (h = ps(n, e, y, h, m), g = 0; g < m; g++) (c = n.__k[g]) != null && (o = c.__i != -1 && y[c.__i] || _e, c.__i = g, _ = Je(t, c, o, r, i, a, l, h, d, f), u = c.__e, c.ref && o.ref != c.ref && (o.ref && Qe(o.ref, null, c), f.push(c.ref, c.__c || u, c)), b == null && u != null && (b = u), 4 & c.__u ? (h = sn(c, h, t), o.__e && (o.__e = null)) : typeof c.type == "function" && _ !== void 0 ? h = _ : u && (h = u.nextSibling), c.__u &= -7);
|
|
1879
|
+
return n.__e = b, h;
|
|
2246
1880
|
}
|
|
2247
|
-
function
|
|
2248
|
-
var i, a, l,
|
|
2249
|
-
for (t.__k = new Array(r), i = 0; i < r; i++) (a = e[i]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = t.__k[i] =
|
|
2250
|
-
if (g) for (i = 0; i <
|
|
1881
|
+
function ps(t, e, n, s, r) {
|
|
1882
|
+
var i, a, l, h, d, f = n.length, g = f, o = 0;
|
|
1883
|
+
for (t.__k = new Array(r), i = 0; i < r; i++) (a = e[i]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = t.__k[i] = fe(null, a, null, null, null) : ke(a) ? a = t.__k[i] = fe(Ee, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = t.__k[i] = fe(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : t.__k[i] = a, h = i + o, a.__ = t, a.__b = t.__b + 1, l = null, (d = a.__i = gs(a, n, h, g)) != -1 && (g--, (l = n[d]) && (l.__u |= 2)), l == null || l.__v == null ? (d == -1 && (r > f ? o-- : r < f && o++), typeof a.type != "function" && (a.__u |= 4)) : d != h && (d == h - 1 ? o-- : d == h + 1 ? o++ : (d > h ? o-- : o++, a.__u |= 4))) : t.__k[i] = null;
|
|
1884
|
+
if (g) for (i = 0; i < f; i++) (l = n[i]) != null && (2 & l.__u) == 0 && (l.__e == s && (s = G(l)), cn(l, l));
|
|
2251
1885
|
return s;
|
|
2252
1886
|
}
|
|
2253
|
-
function
|
|
1887
|
+
function sn(t, e, n) {
|
|
2254
1888
|
var s, r;
|
|
2255
1889
|
if (typeof t.type == "function") {
|
|
2256
|
-
for (s = t.__k, r = 0; s && r < s.length; r++) s[r] && (s[r].__ = t, e =
|
|
1890
|
+
for (s = t.__k, r = 0; s && r < s.length; r++) s[r] && (s[r].__ = t, e = sn(s[r], e, n));
|
|
2257
1891
|
return e;
|
|
2258
1892
|
}
|
|
2259
|
-
t.__e != e && (e && t.type && !e.parentNode && (e =
|
|
1893
|
+
t.__e != e && (e && t.type && !e.parentNode && (e = G(t)), e = n.insertBefore(t.__e, e || null));
|
|
2260
1894
|
do
|
|
2261
1895
|
e = e && e.nextSibling;
|
|
2262
1896
|
while (e != null && e.nodeType == 8);
|
|
2263
1897
|
return e;
|
|
2264
1898
|
}
|
|
2265
|
-
function
|
|
2266
|
-
var r, i, a, l = t.key,
|
|
2267
|
-
if (d === null && l == null ||
|
|
2268
|
-
if (s > (
|
|
2269
|
-
for (r = n - 1, i = n + 1; r >= 0 || i < e.length; ) if ((d = e[a = r >= 0 ? r-- : i++]) != null && (2 & d.__u) == 0 && l == d.key &&
|
|
1899
|
+
function gs(t, e, n, s) {
|
|
1900
|
+
var r, i, a, l = t.key, h = t.type, d = e[n], f = d != null && (2 & d.__u) == 0;
|
|
1901
|
+
if (d === null && l == null || f && l == d.key && h == d.type) return n;
|
|
1902
|
+
if (s > (f ? 1 : 0)) {
|
|
1903
|
+
for (r = n - 1, i = n + 1; r >= 0 || i < e.length; ) if ((d = e[a = r >= 0 ? r-- : i++]) != null && (2 & d.__u) == 0 && l == d.key && h == d.type) return a;
|
|
2270
1904
|
}
|
|
2271
1905
|
return -1;
|
|
2272
1906
|
}
|
|
2273
|
-
function
|
|
2274
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" ||
|
|
1907
|
+
function mt(t, e, n) {
|
|
1908
|
+
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || us.test(e) ? n : n + "px";
|
|
2275
1909
|
}
|
|
2276
|
-
function
|
|
1910
|
+
function le(t, e, n, s, r) {
|
|
2277
1911
|
var i, a;
|
|
2278
1912
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
2279
1913
|
else {
|
|
2280
|
-
if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n ||
|
|
2281
|
-
if (n) for (e in n) s && n[e] == s[e] ||
|
|
1914
|
+
if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n || mt(t.style, e, "");
|
|
1915
|
+
if (n) for (e in n) s && n[e] == s[e] || mt(t.style, e, n[e]);
|
|
2282
1916
|
}
|
|
2283
|
-
else if (e[0] == "o" && e[1] == "n") i = e != (e = e.replace(
|
|
1917
|
+
else if (e[0] == "o" && e[1] == "n") i = e != (e = e.replace(en, "$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 + i] = n, n ? s ? n[ne] = s[ne] : (n[ne] = Ge, t.addEventListener(e, i ? He : Ue, i)) : t.removeEventListener(e, i ? He : Ue, i);
|
|
2284
1918
|
else {
|
|
2285
1919
|
if (r == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
2286
1920
|
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 {
|
|
@@ -2291,260 +1925,260 @@ function we(t, e, n, s, r) {
|
|
|
2291
1925
|
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
2292
1926
|
}
|
|
2293
1927
|
}
|
|
2294
|
-
function
|
|
1928
|
+
function wt(t) {
|
|
2295
1929
|
return function(e) {
|
|
2296
1930
|
if (this.l) {
|
|
2297
1931
|
var n = this.l[e.type + t];
|
|
2298
|
-
if (e[
|
|
2299
|
-
else if (e[
|
|
2300
|
-
return n(
|
|
1932
|
+
if (e[ue] == null) e[ue] = Ge++;
|
|
1933
|
+
else if (e[ue] < n[ne]) return;
|
|
1934
|
+
return n(P.event ? P.event(e) : e);
|
|
2301
1935
|
}
|
|
2302
1936
|
};
|
|
2303
1937
|
}
|
|
2304
|
-
function
|
|
2305
|
-
var
|
|
1938
|
+
function Je(t, e, n, s, r, i, a, l, h, d) {
|
|
1939
|
+
var f, g, o, c, u, b, _, y, m, I, w, p, k, C, x, L, v = e.type;
|
|
2306
1940
|
if (e.constructor !== void 0) return null;
|
|
2307
|
-
128 & n.__u && (
|
|
2308
|
-
e: if (typeof
|
|
1941
|
+
128 & n.__u && (h = !!(32 & n.__u), i = [l = e.__e = n.__e]), (f = P.__b) && f(e);
|
|
1942
|
+
e: if (typeof v == "function") {
|
|
2309
1943
|
g = a.length;
|
|
2310
1944
|
try {
|
|
2311
|
-
if (
|
|
1945
|
+
if (m = e.props, I = v.prototype && v.prototype.render, w = (f = v.contextType) && s[f.__c], p = f ? w ? w.props.value : f.__ : s, n.__c ? y = (o = e.__c = n.__c).__ = o.__E : (I ? e.__c = o = new v(m, p) : (e.__c = o = new pe(m, p), o.constructor = v, o.render = ms), w && w.sub(o), o.state || (o.state = {}), o.__n = s, c = o.__d = !0, o.__h = [], o._sb = []), I && o.__s == null && (o.__s = o.state), I && v.getDerivedStateFromProps != null && (o.__s == o.state && (o.__s = K({}, o.__s)), K(o.__s, v.getDerivedStateFromProps(m, o.__s))), u = o.props, b = o.state, o.__v = e, c) I && v.getDerivedStateFromProps == null && o.componentWillMount != null && o.componentWillMount(), I && o.componentDidMount != null && o.__h.push(o.componentDidMount);
|
|
2312
1946
|
else {
|
|
2313
|
-
if (
|
|
2314
|
-
e.__v != n.__v && (o.props =
|
|
2315
|
-
|
|
2316
|
-
}),
|
|
1947
|
+
if (I && v.getDerivedStateFromProps == null && m !== u && o.componentWillReceiveProps != null && o.componentWillReceiveProps(m, p), e.__v == n.__v || !o.__e && o.shouldComponentUpdate != null && o.shouldComponentUpdate(m, o.__s, p) === !1) {
|
|
1948
|
+
e.__v != n.__v && (o.props = m, o.state = o.__s, o.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(A) {
|
|
1949
|
+
A && (A.__ = e);
|
|
1950
|
+
}), me.push.apply(o.__h, o._sb), o._sb = [], o.__h.length && a.push(o), l = G(n);
|
|
2317
1951
|
break e;
|
|
2318
1952
|
}
|
|
2319
|
-
o.componentWillUpdate != null && o.componentWillUpdate(
|
|
2320
|
-
o.componentDidUpdate(
|
|
1953
|
+
o.componentWillUpdate != null && o.componentWillUpdate(m, o.__s, p), I && o.componentDidUpdate != null && o.__h.push(function() {
|
|
1954
|
+
o.componentDidUpdate(u, b, _);
|
|
2321
1955
|
});
|
|
2322
1956
|
}
|
|
2323
|
-
if (o.context =
|
|
1957
|
+
if (o.context = p, o.props = m, o.__P = t, o.__e = !1, k = P.__r, C = 0, I) o.state = o.__s, o.__d = !1, k && k(e), f = o.render(o.props, o.state, o.context), me.push.apply(o.__h, o._sb), o._sb = [];
|
|
2324
1958
|
else do
|
|
2325
|
-
o.__d = !1,
|
|
2326
|
-
while (o.__d && ++
|
|
2327
|
-
o.state = o.__s, o.getChildContext != null && (s =
|
|
2328
|
-
} catch (
|
|
2329
|
-
if (a.length = g, e.__v = null,
|
|
2330
|
-
if (
|
|
2331
|
-
for (e.__u |=
|
|
1959
|
+
o.__d = !1, k && k(e), f = o.render(o.props, o.state, o.context), o.state = o.__s;
|
|
1960
|
+
while (o.__d && ++C < 25);
|
|
1961
|
+
o.state = o.__s, o.getChildContext != null && (s = K(K({}, s), o.getChildContext())), I && !c && o.getSnapshotBeforeUpdate != null && (_ = o.getSnapshotBeforeUpdate(u, b)), x = f != null && f.type === Ee && f.key == null ? on(f.props.children) : f, l = nn(t, ke(x) ? x : [x], e, n, s, r, i, a, l, h, d), o.base = e.__e, e.__u &= -161, o.__h.length && a.push(o), y && (o.__E = o.__ = null);
|
|
1962
|
+
} catch (A) {
|
|
1963
|
+
if (a.length = g, e.__v = null, h || i != null) {
|
|
1964
|
+
if (A.then) {
|
|
1965
|
+
for (e.__u |= h ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
2332
1966
|
i != null && (i[i.indexOf(l)] = null), e.__e = l;
|
|
2333
|
-
} else if (i != null) for (
|
|
1967
|
+
} else if (i != null) for (L = i.length; L--; ) Ye(i[L]);
|
|
2334
1968
|
} else e.__e = n.__e;
|
|
2335
|
-
e.__k == null && (e.__k = n.__k || []),
|
|
1969
|
+
e.__k == null && (e.__k = n.__k || []), A.then || rn(e), P.__e(A, e, n);
|
|
2336
1970
|
}
|
|
2337
|
-
} else i == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e =
|
|
2338
|
-
return (
|
|
1971
|
+
} else i == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = _s(n.__e, e, n, s, r, i, a, h, d);
|
|
1972
|
+
return (f = P.diffed) && f(e), 128 & e.__u ? void 0 : l;
|
|
2339
1973
|
}
|
|
2340
|
-
function
|
|
2341
|
-
t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(
|
|
1974
|
+
function rn(t) {
|
|
1975
|
+
t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(rn));
|
|
2342
1976
|
}
|
|
2343
|
-
function
|
|
2344
|
-
for (var s = 0; s < n.length; s++)
|
|
2345
|
-
|
|
1977
|
+
function an(t, e, n) {
|
|
1978
|
+
for (var s = 0; s < n.length; s++) Qe(n[s], n[++s], n[++s]);
|
|
1979
|
+
P.__c && P.__c(e, t), t.some(function(r) {
|
|
2346
1980
|
try {
|
|
2347
1981
|
t = r.__h, r.__h = [], t.some(function(i) {
|
|
2348
1982
|
i.call(r);
|
|
2349
1983
|
});
|
|
2350
1984
|
} catch (i) {
|
|
2351
|
-
|
|
1985
|
+
P.__e(i, r.__v);
|
|
2352
1986
|
}
|
|
2353
1987
|
});
|
|
2354
1988
|
}
|
|
2355
|
-
function
|
|
2356
|
-
return typeof t != "object" || t == null || t.__b > 0 ? t :
|
|
1989
|
+
function on(t) {
|
|
1990
|
+
return typeof t != "object" || t == null || t.__b > 0 ? t : ke(t) ? t.map(on) : t.constructor !== void 0 ? null : K({}, t);
|
|
2357
1991
|
}
|
|
2358
|
-
function
|
|
2359
|
-
var d,
|
|
2360
|
-
if (
|
|
2361
|
-
for (d = 0; d < i.length; d++) if ((c = i[d]) && "setAttribute" in c == !!
|
|
1992
|
+
function _s(t, e, n, s, r, i, a, l, h) {
|
|
1993
|
+
var d, f, g, o, c, u, b, _ = n.props || _e, y = e.props, m = e.type;
|
|
1994
|
+
if (m == "svg" ? r = "http://www.w3.org/2000/svg" : m == "math" ? r = "http://www.w3.org/1998/Math/MathML" : r || (r = "http://www.w3.org/1999/xhtml"), i != null) {
|
|
1995
|
+
for (d = 0; d < i.length; d++) if ((c = i[d]) && "setAttribute" in c == !!m && (m ? c.localName == m : c.nodeType == 3)) {
|
|
2362
1996
|
t = c, i[d] = null;
|
|
2363
1997
|
break;
|
|
2364
1998
|
}
|
|
2365
1999
|
}
|
|
2366
2000
|
if (t == null) {
|
|
2367
|
-
if (
|
|
2368
|
-
t = document.createElementNS(r,
|
|
2001
|
+
if (m == null) return document.createTextNode(y);
|
|
2002
|
+
t = document.createElementNS(r, m, y.is && y), l && (P.__m && P.__m(e, i), l = !1), i = null;
|
|
2369
2003
|
}
|
|
2370
|
-
if (
|
|
2004
|
+
if (m == null) _ === y || l && t.data == y || (t.data = y);
|
|
2371
2005
|
else {
|
|
2372
|
-
if (i =
|
|
2373
|
-
for (d in _) c = _[d], d == "dangerouslySetInnerHTML" ? g = c : d == "children" || d in
|
|
2374
|
-
for (d in
|
|
2375
|
-
if (
|
|
2376
|
-
else if (g && (t.innerHTML = ""),
|
|
2377
|
-
l &&
|
|
2006
|
+
if (i = m == "textarea" && y.defaultValue != null ? null : i && ve.call(t.childNodes), !l && i != null) for (_ = {}, d = 0; d < t.attributes.length; d++) _[(c = t.attributes[d]).name] = c.value;
|
|
2007
|
+
for (d in _) c = _[d], d == "dangerouslySetInnerHTML" ? g = c : d == "children" || d in y || d == "value" && "defaultValue" in y || d == "checked" && "defaultChecked" in y || le(t, d, null, c, r);
|
|
2008
|
+
for (d in y) c = y[d], d == "children" ? o = c : d == "dangerouslySetInnerHTML" ? f = c : d == "value" ? u = c : d == "checked" ? b = c : l && typeof c != "function" || _[d] === c || le(t, d, c, _[d], r);
|
|
2009
|
+
if (f) l || g && (f.__html == g.__html || f.__html == t.innerHTML) || (t.innerHTML = f.__html), e.__k = [];
|
|
2010
|
+
else if (g && (t.innerHTML = ""), nn(e.type == "template" ? t.content : t, ke(o) ? o : [o], e, n, s, m == "foreignObject" ? "http://www.w3.org/1999/xhtml" : r, i, a, i ? i[0] : n.__k && G(n, 0), l, h), i != null) for (d = i.length; d--; ) Ye(i[d]);
|
|
2011
|
+
l && m != "textarea" || (d = "value", m == "progress" && u == null ? t.removeAttribute("value") : u != null && (u !== t[d] || m == "progress" && !u || m == "option" && u != _[d]) && le(t, d, u, _[d], r), d = "checked", b != null && b != t[d] && le(t, d, b, _[d], r));
|
|
2378
2012
|
}
|
|
2379
2013
|
return t;
|
|
2380
2014
|
}
|
|
2381
|
-
function
|
|
2015
|
+
function Qe(t, e, n) {
|
|
2382
2016
|
try {
|
|
2383
2017
|
if (typeof t == "function") {
|
|
2384
2018
|
var s = typeof t.__u == "function";
|
|
2385
2019
|
s && t.__u(), s && e == null || (t.__u = t(e));
|
|
2386
2020
|
} else t.current = e;
|
|
2387
2021
|
} catch (r) {
|
|
2388
|
-
|
|
2022
|
+
P.__e(r, n);
|
|
2389
2023
|
}
|
|
2390
2024
|
}
|
|
2391
|
-
function
|
|
2025
|
+
function cn(t, e, n) {
|
|
2392
2026
|
var s, r;
|
|
2393
|
-
if (
|
|
2027
|
+
if (P.unmount && P.unmount(t), (s = t.ref) && (s.current && s.current != t.__e || Qe(s, null, e)), (s = t.__c) != null) {
|
|
2394
2028
|
if (s.componentWillUnmount) try {
|
|
2395
2029
|
s.componentWillUnmount();
|
|
2396
2030
|
} catch (i) {
|
|
2397
|
-
|
|
2031
|
+
P.__e(i, e);
|
|
2398
2032
|
}
|
|
2399
2033
|
s.base = s.__P = s.__n = null;
|
|
2400
2034
|
}
|
|
2401
|
-
if (s = t.__k) for (r = 0; r < s.length; r++) s[r] &&
|
|
2402
|
-
n ||
|
|
2035
|
+
if (s = t.__k) for (r = 0; r < s.length; r++) s[r] && cn(s[r], e, n || typeof t.type != "function");
|
|
2036
|
+
n || Ye(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
2403
2037
|
}
|
|
2404
|
-
function
|
|
2038
|
+
function ms(t, e, n) {
|
|
2405
2039
|
return this.constructor(t, n);
|
|
2406
2040
|
}
|
|
2407
|
-
function
|
|
2041
|
+
function We(t, e, n) {
|
|
2408
2042
|
var s, r, i, a;
|
|
2409
|
-
e == document && (e = document.documentElement),
|
|
2043
|
+
e == document && (e = document.documentElement), P.__ && P.__(t, e), r = (s = !1) ? null : e.__k, i = [], a = [], Je(e, t = e.__k = S(Ee, null, [t]), r || _e, _e, e.namespaceURI, r ? null : e.firstChild ? ve.call(e.childNodes) : null, i, r ? r.__e : e.firstChild, s, a), an(i, t, a), t.props.children = null;
|
|
2410
2044
|
}
|
|
2411
|
-
|
|
2045
|
+
ve = me.slice, P = { __e: function(t, e, n, s) {
|
|
2412
2046
|
for (var r, i, a; e = e.__; ) if ((r = e.__c) && !r.__) try {
|
|
2413
2047
|
if ((i = r.constructor) && i.getDerivedStateFromError != null && (r.setState(i.getDerivedStateFromError(t)), a = r.__d), r.componentDidCatch != null && (r.componentDidCatch(t, s || {}), a = r.__d), a) return r.__E = r;
|
|
2414
2048
|
} catch (l) {
|
|
2415
2049
|
t = l;
|
|
2416
2050
|
}
|
|
2417
2051
|
throw t;
|
|
2418
|
-
} },
|
|
2052
|
+
} }, Jt = 0, pe.prototype.setState = function(t, e) {
|
|
2419
2053
|
var n;
|
|
2420
|
-
n = this.__s != null && this.__s != this.state ? this.__s : this.__s =
|
|
2421
|
-
},
|
|
2422
|
-
this.__v && (this.__e = !0, t && this.__h.push(t),
|
|
2423
|
-
},
|
|
2054
|
+
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = K({}, this.state), typeof t == "function" && (t = t(K({}, n), this.props)), t && K(n, t), t != null && this.__v && (e && this._sb.push(e), _t(this));
|
|
2055
|
+
}, pe.prototype.forceUpdate = function(t) {
|
|
2056
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), _t(this));
|
|
2057
|
+
}, pe.prototype.render = Ee, F = [], Qt = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Xt = function(t, e) {
|
|
2424
2058
|
return t.__v.__b - e.__v.__b;
|
|
2425
|
-
},
|
|
2426
|
-
var
|
|
2427
|
-
function
|
|
2428
|
-
|
|
2429
|
-
var n =
|
|
2059
|
+
}, we.__r = 0, Le = Math.random().toString(8), ue = "__d" + Le, ne = "__a" + Le, en = /(PointerCapture)$|Capture$/i, Ge = 0, Ue = wt(!1), He = wt(!0);
|
|
2060
|
+
var be, T, Re, bt, Be = 0, ln = [], N = P, yt = N.__b, vt = N.__r, kt = N.diffed, Et = N.__c, It = N.unmount, Ct = N.__;
|
|
2061
|
+
function dn(t, e) {
|
|
2062
|
+
N.__h && N.__h(T, t, Be || e), Be = 0;
|
|
2063
|
+
var n = T.__H || (T.__H = { __: [], __h: [] });
|
|
2430
2064
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
2431
2065
|
}
|
|
2432
|
-
function
|
|
2433
|
-
return
|
|
2434
|
-
}
|
|
2435
|
-
function
|
|
2436
|
-
var s =
|
|
2437
|
-
if (s.t = t, !s.__c && (s.__ = [
|
|
2438
|
-
var
|
|
2439
|
-
|
|
2440
|
-
}], s.__c =
|
|
2441
|
-
var r = function(l,
|
|
2066
|
+
function St(t) {
|
|
2067
|
+
return Be = 1, ws(hn, t);
|
|
2068
|
+
}
|
|
2069
|
+
function ws(t, e, n) {
|
|
2070
|
+
var s = dn(be++, 2);
|
|
2071
|
+
if (s.t = t, !s.__c && (s.__ = [hn(void 0, e), function(l) {
|
|
2072
|
+
var h = s.__N ? s.__N[0] : s.__[0], d = s.t(h, l);
|
|
2073
|
+
h !== d && (s.__N = [d, s.__[1]], s.__c.setState({}));
|
|
2074
|
+
}], s.__c = T, !T.__f)) {
|
|
2075
|
+
var r = function(l, h, d) {
|
|
2442
2076
|
if (!s.__c.__H) return !0;
|
|
2443
|
-
var
|
|
2077
|
+
var f = !1, g = s.__c.props !== l;
|
|
2444
2078
|
if (s.__c.__H.__.some(function(c) {
|
|
2445
2079
|
if (c.__N) {
|
|
2446
|
-
|
|
2447
|
-
var
|
|
2448
|
-
c.__ = c.__N, c.__N = void 0,
|
|
2080
|
+
f = !0;
|
|
2081
|
+
var u = c.__[0];
|
|
2082
|
+
c.__ = c.__N, c.__N = void 0, u !== c.__[0] && (g = !0);
|
|
2449
2083
|
}
|
|
2450
2084
|
}), i) {
|
|
2451
|
-
var o = i.call(this, l,
|
|
2452
|
-
return
|
|
2085
|
+
var o = i.call(this, l, h, d);
|
|
2086
|
+
return f ? o || g : o;
|
|
2453
2087
|
}
|
|
2454
|
-
return !
|
|
2088
|
+
return !f || g;
|
|
2455
2089
|
};
|
|
2456
|
-
|
|
2457
|
-
var i =
|
|
2458
|
-
|
|
2090
|
+
T.__f = !0;
|
|
2091
|
+
var i = T.shouldComponentUpdate, a = T.componentWillUpdate;
|
|
2092
|
+
T.componentWillUpdate = function(l, h, d) {
|
|
2459
2093
|
if (this.__e) {
|
|
2460
|
-
var
|
|
2461
|
-
i = void 0, r(l,
|
|
2094
|
+
var f = i;
|
|
2095
|
+
i = void 0, r(l, h, d), i = f;
|
|
2462
2096
|
}
|
|
2463
|
-
a && a.call(this, l,
|
|
2464
|
-
},
|
|
2097
|
+
a && a.call(this, l, h, d);
|
|
2098
|
+
}, T.shouldComponentUpdate = r;
|
|
2465
2099
|
}
|
|
2466
2100
|
return s.__N || s.__;
|
|
2467
2101
|
}
|
|
2468
|
-
function
|
|
2469
|
-
var n =
|
|
2470
|
-
!
|
|
2102
|
+
function bs(t, e) {
|
|
2103
|
+
var n = dn(be++, 3);
|
|
2104
|
+
!N.__s && ks(n.__H, e) && (n.__ = t, n.u = e, T.__H.__h.push(n));
|
|
2471
2105
|
}
|
|
2472
|
-
function
|
|
2473
|
-
for (var t; t =
|
|
2106
|
+
function ys() {
|
|
2107
|
+
for (var t; t = ln.shift(); ) {
|
|
2474
2108
|
var e = t.__H;
|
|
2475
2109
|
if (t.__P && e) try {
|
|
2476
|
-
e.__h.some(
|
|
2110
|
+
e.__h.some(ge), e.__h.some(qe), e.__h = [];
|
|
2477
2111
|
} catch (n) {
|
|
2478
|
-
e.__h = [],
|
|
2112
|
+
e.__h = [], N.__e(n, t.__v);
|
|
2479
2113
|
}
|
|
2480
2114
|
}
|
|
2481
2115
|
}
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
},
|
|
2485
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
2486
|
-
},
|
|
2487
|
-
|
|
2488
|
-
var e = (
|
|
2489
|
-
e && (
|
|
2116
|
+
N.__b = function(t) {
|
|
2117
|
+
T = null, yt && yt(t);
|
|
2118
|
+
}, N.__ = function(t, e) {
|
|
2119
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Ct && Ct(t, e);
|
|
2120
|
+
}, N.__r = function(t) {
|
|
2121
|
+
vt && vt(t), be = 0;
|
|
2122
|
+
var e = (T = t.__c).__H;
|
|
2123
|
+
e && (Re === T ? (e.__h = [], T.__h = [], e.__.some(function(n) {
|
|
2490
2124
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
2491
|
-
})) : (e.__h.some(
|
|
2492
|
-
},
|
|
2493
|
-
|
|
2125
|
+
})) : (e.__h.some(ge), e.__h.some(qe), e.__h = [], be = 0)), Re = T;
|
|
2126
|
+
}, N.diffed = function(t) {
|
|
2127
|
+
kt && kt(t);
|
|
2494
2128
|
var e = t.__c;
|
|
2495
|
-
e && e.__H && (e.__H.__h.length && (
|
|
2129
|
+
e && e.__H && (e.__H.__h.length && (ln.push(e) !== 1 && bt === N.requestAnimationFrame || ((bt = N.requestAnimationFrame) || vs)(ys)), e.__H.__.some(function(n) {
|
|
2496
2130
|
n.u && (n.__H = n.u, n.u = void 0);
|
|
2497
|
-
})),
|
|
2498
|
-
},
|
|
2131
|
+
})), Re = T = null;
|
|
2132
|
+
}, N.__c = function(t, e) {
|
|
2499
2133
|
e.some(function(n) {
|
|
2500
2134
|
try {
|
|
2501
|
-
n.__h.some(
|
|
2502
|
-
return !s.__ ||
|
|
2135
|
+
n.__h.some(ge), n.__h = n.__h.filter(function(s) {
|
|
2136
|
+
return !s.__ || qe(s);
|
|
2503
2137
|
});
|
|
2504
2138
|
} catch (s) {
|
|
2505
2139
|
e.some(function(r) {
|
|
2506
2140
|
r.__h && (r.__h = []);
|
|
2507
|
-
}), e = [],
|
|
2141
|
+
}), e = [], N.__e(s, n.__v);
|
|
2508
2142
|
}
|
|
2509
|
-
}),
|
|
2510
|
-
},
|
|
2511
|
-
|
|
2143
|
+
}), Et && Et(t, e);
|
|
2144
|
+
}, N.unmount = function(t) {
|
|
2145
|
+
It && It(t);
|
|
2512
2146
|
var e, n = t.__c;
|
|
2513
2147
|
n && n.__H && (n.__H.__.some(function(s) {
|
|
2514
2148
|
try {
|
|
2515
|
-
|
|
2149
|
+
ge(s);
|
|
2516
2150
|
} catch (r) {
|
|
2517
2151
|
e = r;
|
|
2518
2152
|
}
|
|
2519
|
-
}), n.__H = void 0, e &&
|
|
2153
|
+
}), n.__H = void 0, e && N.__e(e, n.__v));
|
|
2520
2154
|
};
|
|
2521
|
-
var
|
|
2522
|
-
function
|
|
2155
|
+
var xt = typeof requestAnimationFrame == "function";
|
|
2156
|
+
function vs(t) {
|
|
2523
2157
|
var e, n = function() {
|
|
2524
|
-
clearTimeout(s),
|
|
2158
|
+
clearTimeout(s), xt && cancelAnimationFrame(e), setTimeout(t);
|
|
2525
2159
|
}, s = setTimeout(n, 35);
|
|
2526
|
-
|
|
2160
|
+
xt && (e = requestAnimationFrame(n));
|
|
2527
2161
|
}
|
|
2528
|
-
function
|
|
2529
|
-
var e =
|
|
2530
|
-
typeof n == "function" && (t.__c = void 0, n()),
|
|
2162
|
+
function ge(t) {
|
|
2163
|
+
var e = T, n = t.__c;
|
|
2164
|
+
typeof n == "function" && (t.__c = void 0, n()), T = e;
|
|
2531
2165
|
}
|
|
2532
|
-
function
|
|
2533
|
-
var e =
|
|
2534
|
-
t.__c = t.__(),
|
|
2166
|
+
function qe(t) {
|
|
2167
|
+
var e = T;
|
|
2168
|
+
t.__c = t.__(), T = e;
|
|
2535
2169
|
}
|
|
2536
|
-
function
|
|
2170
|
+
function ks(t, e) {
|
|
2537
2171
|
return !t || t.length !== e.length || e.some(function(n, s) {
|
|
2538
2172
|
return n !== t[s];
|
|
2539
2173
|
});
|
|
2540
2174
|
}
|
|
2541
|
-
function
|
|
2175
|
+
function hn(t, e) {
|
|
2542
2176
|
return typeof e == "function" ? e(t) : e;
|
|
2543
2177
|
}
|
|
2544
|
-
const
|
|
2545
|
-
class
|
|
2178
|
+
const Es = ".-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+", Cs = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";
|
|
2179
|
+
class un {
|
|
2546
2180
|
constructor() {
|
|
2547
|
-
this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode =
|
|
2181
|
+
this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = Zt();
|
|
2548
2182
|
}
|
|
2549
2183
|
attach(e) {
|
|
2550
2184
|
this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render();
|
|
@@ -2559,22 +2193,22 @@ class Pn {
|
|
|
2559
2193
|
this.items.clear(), this.render();
|
|
2560
2194
|
}
|
|
2561
2195
|
render() {
|
|
2562
|
-
this.root &&
|
|
2196
|
+
this.root && We(S(
|
|
2563
2197
|
"div",
|
|
2564
2198
|
null,
|
|
2565
|
-
|
|
2199
|
+
S(fn, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, n]) => S(Ss, Object.assign({}, n, { key: e }))))
|
|
2566
2200
|
), this.root);
|
|
2567
2201
|
}
|
|
2568
2202
|
}
|
|
2569
|
-
const
|
|
2203
|
+
const fn = (t) => S(
|
|
2570
2204
|
"div",
|
|
2571
|
-
{ class:
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
),
|
|
2575
|
-
const [s, r] =
|
|
2576
|
-
|
|
2577
|
-
const
|
|
2205
|
+
{ class: te("-cbwsdk-snackbar-container") },
|
|
2206
|
+
S("style", null, Es),
|
|
2207
|
+
S("div", { class: "-cbwsdk-snackbar" }, t.children)
|
|
2208
|
+
), Ss = ({ autoExpand: t, message: e, menuItems: n }) => {
|
|
2209
|
+
const [s, r] = St(!0), [i, a] = St(t ?? !1);
|
|
2210
|
+
bs(() => {
|
|
2211
|
+
const h = [
|
|
2578
2212
|
window.setTimeout(() => {
|
|
2579
2213
|
r(!1);
|
|
2580
2214
|
}, 1),
|
|
@@ -2583,53 +2217,53 @@ const Rn = (t) => R(
|
|
|
2583
2217
|
}, 1e4)
|
|
2584
2218
|
];
|
|
2585
2219
|
return () => {
|
|
2586
|
-
|
|
2220
|
+
h.forEach(window.clearTimeout);
|
|
2587
2221
|
};
|
|
2588
2222
|
});
|
|
2589
2223
|
const l = () => {
|
|
2590
2224
|
a(!i);
|
|
2591
2225
|
};
|
|
2592
|
-
return
|
|
2226
|
+
return S(
|
|
2593
2227
|
"div",
|
|
2594
|
-
{ class:
|
|
2595
|
-
|
|
2228
|
+
{ class: te("-cbwsdk-snackbar-instance", s && "-cbwsdk-snackbar-instance-hidden", i && "-cbwsdk-snackbar-instance-expanded") },
|
|
2229
|
+
S(
|
|
2596
2230
|
"div",
|
|
2597
2231
|
{ class: "-cbwsdk-snackbar-instance-header", onClick: l },
|
|
2598
|
-
|
|
2232
|
+
S("img", { src: Is, class: "-cbwsdk-snackbar-instance-header-cblogo" }),
|
|
2599
2233
|
" ",
|
|
2600
|
-
|
|
2601
|
-
|
|
2234
|
+
S("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e),
|
|
2235
|
+
S(
|
|
2602
2236
|
"div",
|
|
2603
2237
|
{ class: "-gear-container" },
|
|
2604
|
-
!i &&
|
|
2238
|
+
!i && S(
|
|
2605
2239
|
"svg",
|
|
2606
2240
|
{ width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
2607
|
-
|
|
2241
|
+
S("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" })
|
|
2608
2242
|
),
|
|
2609
|
-
|
|
2243
|
+
S("img", { src: Cs, class: "-gear-icon", title: "Expand" })
|
|
2610
2244
|
)
|
|
2611
2245
|
),
|
|
2612
|
-
n && n.length > 0 &&
|
|
2246
|
+
n && n.length > 0 && S("div", { class: "-cbwsdk-snackbar-instance-menu" }, n.map((h, d) => S(
|
|
2613
2247
|
"div",
|
|
2614
|
-
{ class:
|
|
2615
|
-
|
|
2248
|
+
{ class: te("-cbwsdk-snackbar-instance-menu-item", h.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: h.onClick, key: d },
|
|
2249
|
+
S(
|
|
2616
2250
|
"svg",
|
|
2617
|
-
{ width:
|
|
2618
|
-
|
|
2251
|
+
{ width: h.svgWidth, height: h.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
2252
|
+
S("path", { "fill-rule": h.defaultFillRule, "clip-rule": h.defaultClipRule, d: h.path, fill: "#AAAAAA" })
|
|
2619
2253
|
),
|
|
2620
|
-
|
|
2254
|
+
S("span", { class: te("-cbwsdk-snackbar-instance-menu-item-info", h.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, h.info)
|
|
2621
2255
|
)))
|
|
2622
2256
|
);
|
|
2623
|
-
},
|
|
2624
|
-
class
|
|
2257
|
+
}, pn = "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z";
|
|
2258
|
+
class xs {
|
|
2625
2259
|
constructor() {
|
|
2626
|
-
this.attached = !1, this.snackbar = new
|
|
2260
|
+
this.attached = !1, this.snackbar = new un();
|
|
2627
2261
|
}
|
|
2628
2262
|
attach() {
|
|
2629
2263
|
if (this.attached)
|
|
2630
2264
|
throw new Error("Coinbase Wallet SDK UI is already attached");
|
|
2631
2265
|
const e = document.documentElement, n = document.createElement("div");
|
|
2632
|
-
n.className = "-cbwsdk-css-reset", e.appendChild(n), this.snackbar.attach(n), this.attached = !0,
|
|
2266
|
+
n.className = "-cbwsdk-css-reset", e.appendChild(n), this.snackbar.attach(n), this.attached = !0, Gt();
|
|
2633
2267
|
}
|
|
2634
2268
|
showConnecting(e) {
|
|
2635
2269
|
let n;
|
|
@@ -2666,7 +2300,7 @@ class Zs {
|
|
|
2666
2300
|
info: "Reset connection",
|
|
2667
2301
|
svgWidth: "10",
|
|
2668
2302
|
svgHeight: "11",
|
|
2669
|
-
path:
|
|
2303
|
+
path: pn,
|
|
2670
2304
|
defaultFillRule: "evenodd",
|
|
2671
2305
|
defaultClipRule: "evenodd",
|
|
2672
2306
|
onClick: e.onResetConnection
|
|
@@ -2675,14 +2309,14 @@ class Zs {
|
|
|
2675
2309
|
}, this.snackbar.presentItem(n);
|
|
2676
2310
|
}
|
|
2677
2311
|
}
|
|
2678
|
-
const
|
|
2679
|
-
class
|
|
2312
|
+
const As = ".-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}";
|
|
2313
|
+
class Ms {
|
|
2680
2314
|
constructor() {
|
|
2681
|
-
this.root = null, this.darkMode =
|
|
2315
|
+
this.root = null, this.darkMode = Zt();
|
|
2682
2316
|
}
|
|
2683
2317
|
attach() {
|
|
2684
2318
|
const e = document.documentElement;
|
|
2685
|
-
this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root),
|
|
2319
|
+
this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), Gt();
|
|
2686
2320
|
}
|
|
2687
2321
|
present(e) {
|
|
2688
2322
|
this.render(e);
|
|
@@ -2691,33 +2325,33 @@ class Ys {
|
|
|
2691
2325
|
this.render(null);
|
|
2692
2326
|
}
|
|
2693
2327
|
render(e) {
|
|
2694
|
-
this.root && (
|
|
2328
|
+
this.root && (We(null, this.root), e && We(S(Ps, Object.assign({}, e, { onDismiss: () => {
|
|
2695
2329
|
this.clear();
|
|
2696
2330
|
}, darkMode: this.darkMode })), this.root));
|
|
2697
2331
|
}
|
|
2698
2332
|
}
|
|
2699
|
-
const
|
|
2333
|
+
const Ps = ({ title: t, buttonText: e, darkMode: n, onButtonClick: s, onDismiss: r }) => {
|
|
2700
2334
|
const i = n ? "dark" : "light";
|
|
2701
|
-
return
|
|
2702
|
-
|
|
2335
|
+
return S(
|
|
2336
|
+
fn,
|
|
2703
2337
|
{ darkMode: n },
|
|
2704
|
-
|
|
2338
|
+
S(
|
|
2705
2339
|
"div",
|
|
2706
2340
|
{ class: "-cbwsdk-redirect-dialog" },
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2341
|
+
S("style", null, As),
|
|
2342
|
+
S("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: r }),
|
|
2343
|
+
S(
|
|
2710
2344
|
"div",
|
|
2711
|
-
{ class:
|
|
2712
|
-
|
|
2713
|
-
|
|
2345
|
+
{ class: te("-cbwsdk-redirect-dialog-box", i) },
|
|
2346
|
+
S("p", null, t),
|
|
2347
|
+
S("button", { onClick: s }, e)
|
|
2714
2348
|
)
|
|
2715
2349
|
)
|
|
2716
2350
|
);
|
|
2717
|
-
},
|
|
2718
|
-
class
|
|
2351
|
+
}, Ls = "https://keys.coinbase.com/connect", Rs = "https://rpc.wallet.coinbase.com", At = "https://www.walletlink.org", Ts = "https://go.cb-w.com/walletlink";
|
|
2352
|
+
class Mt {
|
|
2719
2353
|
constructor() {
|
|
2720
|
-
this.attached = !1, this.redirectDialog = new
|
|
2354
|
+
this.attached = !1, this.redirectDialog = new Ms();
|
|
2721
2355
|
}
|
|
2722
2356
|
attach() {
|
|
2723
2357
|
if (this.attached)
|
|
@@ -2725,8 +2359,8 @@ class $t {
|
|
|
2725
2359
|
this.redirectDialog.attach(), this.attached = !0;
|
|
2726
2360
|
}
|
|
2727
2361
|
redirectToCoinbaseWallet(e) {
|
|
2728
|
-
const n = new URL(
|
|
2729
|
-
n.searchParams.append("redirect_url",
|
|
2362
|
+
const n = new URL(Ts);
|
|
2363
|
+
n.searchParams.append("redirect_url", ls().href), e && n.searchParams.append("wl_url", e);
|
|
2730
2364
|
const s = document.createElement("a");
|
|
2731
2365
|
s.target = "cbw-opener", s.href = n.href, s.rel = "noreferrer noopener", s.click();
|
|
2732
2366
|
}
|
|
@@ -2747,14 +2381,14 @@ class $t {
|
|
|
2747
2381
|
};
|
|
2748
2382
|
}
|
|
2749
2383
|
}
|
|
2750
|
-
class
|
|
2384
|
+
class q {
|
|
2751
2385
|
constructor(e) {
|
|
2752
|
-
this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb =
|
|
2386
|
+
this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = ds(), this.linkedUpdated = (i) => {
|
|
2753
2387
|
this.isLinked = i;
|
|
2754
|
-
const a = this.storage.getItem(
|
|
2388
|
+
const a = this.storage.getItem(je);
|
|
2755
2389
|
if (i && (this._session.linked = i), this.isUnlinkedErrorState = !1, a) {
|
|
2756
|
-
const l = a.split(" "),
|
|
2757
|
-
l[0] !== "" && !i && this._session.linked && !
|
|
2390
|
+
const l = a.split(" "), h = this.storage.getItem("IsStandaloneSigning") === "true";
|
|
2391
|
+
l[0] !== "" && !i && this._session.linked && !h && (this.isUnlinkedErrorState = !0);
|
|
2758
2392
|
}
|
|
2759
2393
|
}, this.metadataUpdated = (i, a) => {
|
|
2760
2394
|
this.storage.setItem(i, a);
|
|
@@ -2764,28 +2398,28 @@ class Q {
|
|
|
2764
2398
|
jsonRpcUrl: a
|
|
2765
2399
|
}, this.chainCallback && this.chainCallback(a, Number.parseInt(i, 10)));
|
|
2766
2400
|
}, this.accountUpdated = (i) => {
|
|
2767
|
-
this.accountsCallback && this.accountsCallback([i]),
|
|
2401
|
+
this.accountsCallback && this.accountsCallback([i]), q.accountRequestCallbackIds.size > 0 && (Array.from(q.accountRequestCallbackIds.values()).forEach((a) => {
|
|
2768
2402
|
this.invokeCallback(a, {
|
|
2769
2403
|
method: "requestEthereumAccounts",
|
|
2770
2404
|
result: [i]
|
|
2771
2405
|
});
|
|
2772
|
-
}),
|
|
2406
|
+
}), q.accountRequestCallbackIds.clear());
|
|
2773
2407
|
}, 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;
|
|
2774
2408
|
const { session: n, ui: s, connection: r } = this.subscribe();
|
|
2775
|
-
this._session = n, this.connection = r, this.relayEventManager = new
|
|
2409
|
+
this._session = n, this.connection = r, this.relayEventManager = new os(), this.ui = s, this.ui.attach();
|
|
2776
2410
|
}
|
|
2777
2411
|
subscribe() {
|
|
2778
|
-
const e =
|
|
2412
|
+
const e = J.load(this.storage) || J.create(this.storage), { linkAPIUrl: n } = this, s = new as({
|
|
2779
2413
|
session: e,
|
|
2780
2414
|
linkAPIUrl: n,
|
|
2781
2415
|
listener: this
|
|
2782
|
-
}), r = this.isMobileWeb ? new
|
|
2416
|
+
}), r = this.isMobileWeb ? new Mt() : new xs();
|
|
2783
2417
|
return s.connect(), { session: e, ui: r, connection: s };
|
|
2784
2418
|
}
|
|
2785
2419
|
resetAndReload() {
|
|
2786
2420
|
this.connection.destroy().then(() => {
|
|
2787
|
-
const e =
|
|
2788
|
-
(e == null ? void 0 : e.id) === this._session.id &&
|
|
2421
|
+
const e = J.load(this.storage);
|
|
2422
|
+
(e == null ? void 0 : e.id) === this._session.id && W.clearAll(), document.location.reload();
|
|
2789
2423
|
}).catch((e) => {
|
|
2790
2424
|
});
|
|
2791
2425
|
}
|
|
@@ -2795,13 +2429,13 @@ class Q {
|
|
|
2795
2429
|
params: {
|
|
2796
2430
|
fromAddress: e.fromAddress,
|
|
2797
2431
|
toAddress: e.toAddress,
|
|
2798
|
-
weiValue:
|
|
2799
|
-
data:
|
|
2432
|
+
weiValue: U(e.weiValue),
|
|
2433
|
+
data: X(e.data, !0),
|
|
2800
2434
|
nonce: e.nonce,
|
|
2801
|
-
gasPriceInWei: e.gasPriceInWei ?
|
|
2802
|
-
maxFeePerGas: e.gasPriceInWei ?
|
|
2803
|
-
maxPriorityFeePerGas: e.gasPriceInWei ?
|
|
2804
|
-
gasLimit: e.gasLimit ?
|
|
2435
|
+
gasPriceInWei: e.gasPriceInWei ? U(e.gasPriceInWei) : null,
|
|
2436
|
+
maxFeePerGas: e.gasPriceInWei ? U(e.gasPriceInWei) : null,
|
|
2437
|
+
maxPriorityFeePerGas: e.gasPriceInWei ? U(e.gasPriceInWei) : null,
|
|
2438
|
+
gasLimit: e.gasLimit ? U(e.gasLimit) : null,
|
|
2805
2439
|
chainId: e.chainId,
|
|
2806
2440
|
shouldSubmit: !1
|
|
2807
2441
|
}
|
|
@@ -2813,13 +2447,13 @@ class Q {
|
|
|
2813
2447
|
params: {
|
|
2814
2448
|
fromAddress: e.fromAddress,
|
|
2815
2449
|
toAddress: e.toAddress,
|
|
2816
|
-
weiValue:
|
|
2817
|
-
data:
|
|
2450
|
+
weiValue: U(e.weiValue),
|
|
2451
|
+
data: X(e.data, !0),
|
|
2818
2452
|
nonce: e.nonce,
|
|
2819
|
-
gasPriceInWei: e.gasPriceInWei ?
|
|
2820
|
-
maxFeePerGas: e.maxFeePerGas ?
|
|
2821
|
-
maxPriorityFeePerGas: e.maxPriorityFeePerGas ?
|
|
2822
|
-
gasLimit: e.gasLimit ?
|
|
2453
|
+
gasPriceInWei: e.gasPriceInWei ? U(e.gasPriceInWei) : null,
|
|
2454
|
+
maxFeePerGas: e.maxFeePerGas ? U(e.maxFeePerGas) : null,
|
|
2455
|
+
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? U(e.maxPriorityFeePerGas) : null,
|
|
2456
|
+
gasLimit: e.gasLimit ? U(e.gasLimit) : null,
|
|
2823
2457
|
chainId: e.chainId,
|
|
2824
2458
|
shouldSubmit: !0
|
|
2825
2459
|
}
|
|
@@ -2829,7 +2463,7 @@ class Q {
|
|
|
2829
2463
|
return this.sendRequest({
|
|
2830
2464
|
method: "submitEthereumTransaction",
|
|
2831
2465
|
params: {
|
|
2832
|
-
signedTransaction:
|
|
2466
|
+
signedTransaction: X(e, !0),
|
|
2833
2467
|
chainId: n
|
|
2834
2468
|
}
|
|
2835
2469
|
});
|
|
@@ -2839,7 +2473,7 @@ class Q {
|
|
|
2839
2473
|
}
|
|
2840
2474
|
sendRequest(e) {
|
|
2841
2475
|
let n = null;
|
|
2842
|
-
const s =
|
|
2476
|
+
const s = Z(8), r = (i) => {
|
|
2843
2477
|
this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, e.method, i), n == null || n();
|
|
2844
2478
|
};
|
|
2845
2479
|
return new Promise((i, a) => {
|
|
@@ -2849,7 +2483,7 @@ class Q {
|
|
|
2849
2483
|
onResetConnection: this.resetAndReload
|
|
2850
2484
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
2851
2485
|
}), this.relayEventManager.callbacks.set(s, (l) => {
|
|
2852
|
-
if (n == null || n(),
|
|
2486
|
+
if (n == null || n(), D(l))
|
|
2853
2487
|
return a(new Error(l.errorMessage));
|
|
2854
2488
|
i(l);
|
|
2855
2489
|
}), this.publishWeb3RequestEvent(s, e);
|
|
@@ -2867,7 +2501,7 @@ class Q {
|
|
|
2867
2501
|
}
|
|
2868
2502
|
// copied from MobileRelay
|
|
2869
2503
|
openCoinbaseWalletDeeplink(e) {
|
|
2870
|
-
if (this.ui instanceof
|
|
2504
|
+
if (this.ui instanceof Mt)
|
|
2871
2505
|
switch (e) {
|
|
2872
2506
|
case "requestEthereumAccounts":
|
|
2873
2507
|
// requestEthereumAccounts is handled via popup
|
|
@@ -2894,7 +2528,7 @@ class Q {
|
|
|
2894
2528
|
}
|
|
2895
2529
|
handleWeb3ResponseMessage(e, n) {
|
|
2896
2530
|
if (n.method === "requestEthereumAccounts") {
|
|
2897
|
-
|
|
2531
|
+
q.accountRequestCallbackIds.forEach((s) => this.invokeCallback(s, n)), q.accountRequestCallbackIds.clear();
|
|
2898
2532
|
return;
|
|
2899
2533
|
}
|
|
2900
2534
|
this.invokeCallback(e, n);
|
|
@@ -2918,13 +2552,13 @@ class Q {
|
|
|
2918
2552
|
appName: e,
|
|
2919
2553
|
appLogoUrl: n
|
|
2920
2554
|
}
|
|
2921
|
-
}, r =
|
|
2555
|
+
}, r = Z(8);
|
|
2922
2556
|
return new Promise((i, a) => {
|
|
2923
2557
|
this.relayEventManager.callbacks.set(r, (l) => {
|
|
2924
|
-
if (
|
|
2558
|
+
if (D(l))
|
|
2925
2559
|
return a(new Error(l.errorMessage));
|
|
2926
2560
|
i(l);
|
|
2927
|
-
}),
|
|
2561
|
+
}), q.accountRequestCallbackIds.add(r), this.publishWeb3RequestEvent(r, s);
|
|
2928
2562
|
});
|
|
2929
2563
|
}
|
|
2930
2564
|
watchAsset(e, n, s, r, i, a) {
|
|
@@ -2941,18 +2575,18 @@ class Q {
|
|
|
2941
2575
|
chainId: a
|
|
2942
2576
|
}
|
|
2943
2577
|
};
|
|
2944
|
-
let
|
|
2945
|
-
const d =
|
|
2946
|
-
this.publishWeb3RequestCanceledEvent(d), this.handleErrorResponse(d, l.method, g),
|
|
2578
|
+
let h = null;
|
|
2579
|
+
const d = Z(8), f = (g) => {
|
|
2580
|
+
this.publishWeb3RequestCanceledEvent(d), this.handleErrorResponse(d, l.method, g), h == null || h();
|
|
2947
2581
|
};
|
|
2948
|
-
return
|
|
2582
|
+
return h = this.ui.showConnecting({
|
|
2949
2583
|
isUnlinkedErrorState: this.isUnlinkedErrorState,
|
|
2950
|
-
onCancel:
|
|
2584
|
+
onCancel: f,
|
|
2951
2585
|
onResetConnection: this.resetAndReload
|
|
2952
2586
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
2953
2587
|
}), new Promise((g, o) => {
|
|
2954
2588
|
this.relayEventManager.callbacks.set(d, (c) => {
|
|
2955
|
-
if (
|
|
2589
|
+
if (h == null || h(), D(c))
|
|
2956
2590
|
return o(new Error(c.errorMessage));
|
|
2957
2591
|
g(c);
|
|
2958
2592
|
}), this.publishWeb3RequestEvent(d, l);
|
|
@@ -2970,18 +2604,18 @@ class Q {
|
|
|
2970
2604
|
nativeCurrency: a
|
|
2971
2605
|
}
|
|
2972
2606
|
};
|
|
2973
|
-
let
|
|
2974
|
-
const d =
|
|
2975
|
-
this.publishWeb3RequestCanceledEvent(d), this.handleErrorResponse(d, l.method, g),
|
|
2607
|
+
let h = null;
|
|
2608
|
+
const d = Z(8), f = (g) => {
|
|
2609
|
+
this.publishWeb3RequestCanceledEvent(d), this.handleErrorResponse(d, l.method, g), h == null || h();
|
|
2976
2610
|
};
|
|
2977
|
-
return
|
|
2611
|
+
return h = this.ui.showConnecting({
|
|
2978
2612
|
isUnlinkedErrorState: this.isUnlinkedErrorState,
|
|
2979
|
-
onCancel:
|
|
2613
|
+
onCancel: f,
|
|
2980
2614
|
onResetConnection: this.resetAndReload
|
|
2981
2615
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
2982
2616
|
}), new Promise((g, o) => {
|
|
2983
2617
|
this.relayEventManager.callbacks.set(d, (c) => {
|
|
2984
|
-
if (
|
|
2618
|
+
if (h == null || h(), D(c))
|
|
2985
2619
|
return o(new Error(c.errorMessage));
|
|
2986
2620
|
g(c);
|
|
2987
2621
|
}), this.publishWeb3RequestEvent(d, l);
|
|
@@ -2993,7 +2627,7 @@ class Q {
|
|
|
2993
2627
|
params: Object.assign({ chainId: e }, { address: n })
|
|
2994
2628
|
};
|
|
2995
2629
|
let r = null;
|
|
2996
|
-
const i =
|
|
2630
|
+
const i = Z(8), a = (l) => {
|
|
2997
2631
|
this.publishWeb3RequestCanceledEvent(i), this.handleErrorResponse(i, s.method, l), r == null || r();
|
|
2998
2632
|
};
|
|
2999
2633
|
return r = this.ui.showConnecting({
|
|
@@ -3001,29 +2635,29 @@ class Q {
|
|
|
3001
2635
|
onCancel: a,
|
|
3002
2636
|
onResetConnection: this.resetAndReload
|
|
3003
2637
|
// eslint-disable-line @typescript-eslint/unbound-method
|
|
3004
|
-
}), new Promise((l,
|
|
2638
|
+
}), new Promise((l, h) => {
|
|
3005
2639
|
this.relayEventManager.callbacks.set(i, (d) => {
|
|
3006
|
-
if (r == null || r(),
|
|
3007
|
-
return
|
|
2640
|
+
if (r == null || r(), D(d) && d.errorCode)
|
|
2641
|
+
return h(E.provider.custom({
|
|
3008
2642
|
code: d.errorCode,
|
|
3009
2643
|
message: "Unrecognized chain ID. Try adding the chain using addEthereumChain first."
|
|
3010
2644
|
}));
|
|
3011
|
-
if (
|
|
3012
|
-
return
|
|
2645
|
+
if (D(d))
|
|
2646
|
+
return h(new Error(d.errorMessage));
|
|
3013
2647
|
l(d);
|
|
3014
2648
|
}), this.publishWeb3RequestEvent(i, s);
|
|
3015
2649
|
});
|
|
3016
2650
|
}
|
|
3017
2651
|
}
|
|
3018
|
-
|
|
3019
|
-
const
|
|
3020
|
-
class
|
|
2652
|
+
q.accountRequestCallbackIds = /* @__PURE__ */ new Set();
|
|
2653
|
+
const Pt = "DefaultChainId", Lt = "DefaultJsonRpcUrl";
|
|
2654
|
+
class gn {
|
|
3021
2655
|
constructor(e) {
|
|
3022
|
-
this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new
|
|
3023
|
-
const n = this._storage.getItem(
|
|
2656
|
+
this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new W("walletlink", At), this.callback = e.callback || null;
|
|
2657
|
+
const n = this._storage.getItem(je);
|
|
3024
2658
|
if (n) {
|
|
3025
2659
|
const s = n.split(" ");
|
|
3026
|
-
s[0] !== "" && (this._addresses = s.map((r) =>
|
|
2660
|
+
s[0] !== "" && (this._addresses = s.map((r) => V(r)));
|
|
3027
2661
|
}
|
|
3028
2662
|
this.initializeRelay();
|
|
3029
2663
|
}
|
|
@@ -3039,52 +2673,52 @@ class On {
|
|
|
3039
2673
|
}
|
|
3040
2674
|
get jsonRpcUrl() {
|
|
3041
2675
|
var e;
|
|
3042
|
-
return (e = this._storage.getItem(
|
|
2676
|
+
return (e = this._storage.getItem(Lt)) !== null && e !== void 0 ? e : void 0;
|
|
3043
2677
|
}
|
|
3044
2678
|
set jsonRpcUrl(e) {
|
|
3045
|
-
this._storage.setItem(
|
|
2679
|
+
this._storage.setItem(Lt, e);
|
|
3046
2680
|
}
|
|
3047
2681
|
updateProviderInfo(e, n) {
|
|
3048
2682
|
var s;
|
|
3049
2683
|
this.jsonRpcUrl = e;
|
|
3050
2684
|
const r = this.getChainId();
|
|
3051
|
-
this._storage.setItem(
|
|
2685
|
+
this._storage.setItem(Pt, n.toString(10)), ee(n) !== r && ((s = this.callback) === null || s === void 0 || s.call(this, "chainChanged", z(n)));
|
|
3052
2686
|
}
|
|
3053
2687
|
async watchAsset(e) {
|
|
3054
2688
|
const n = Array.isArray(e) ? e[0] : e;
|
|
3055
2689
|
if (!n.type)
|
|
3056
|
-
throw
|
|
2690
|
+
throw E.rpc.invalidParams("Type is required");
|
|
3057
2691
|
if ((n == null ? void 0 : n.type) !== "ERC20")
|
|
3058
|
-
throw
|
|
2692
|
+
throw E.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);
|
|
3059
2693
|
if (!(n != null && n.options))
|
|
3060
|
-
throw
|
|
2694
|
+
throw E.rpc.invalidParams("Options are required");
|
|
3061
2695
|
if (!(n != null && n.options.address))
|
|
3062
|
-
throw
|
|
2696
|
+
throw E.rpc.invalidParams("Address is required");
|
|
3063
2697
|
const s = this.getChainId(), { address: r, symbol: i, image: a, decimals: l } = n.options, d = await this.initializeRelay().watchAsset(n.type, r, i, l, a, s == null ? void 0 : s.toString());
|
|
3064
|
-
return
|
|
2698
|
+
return D(d) ? !1 : !!d.result;
|
|
3065
2699
|
}
|
|
3066
2700
|
async addEthereumChain(e) {
|
|
3067
2701
|
var n, s;
|
|
3068
2702
|
const r = e[0];
|
|
3069
2703
|
if (((n = r.rpcUrls) === null || n === void 0 ? void 0 : n.length) === 0)
|
|
3070
|
-
throw
|
|
2704
|
+
throw E.rpc.invalidParams("please pass in at least 1 rpcUrl");
|
|
3071
2705
|
if (!r.chainName || r.chainName.trim() === "")
|
|
3072
|
-
throw
|
|
2706
|
+
throw E.rpc.invalidParams("chainName is a required field");
|
|
3073
2707
|
if (!r.nativeCurrency)
|
|
3074
|
-
throw
|
|
2708
|
+
throw E.rpc.invalidParams("nativeCurrency is a required field");
|
|
3075
2709
|
const i = Number.parseInt(r.chainId, 16);
|
|
3076
2710
|
if (i === this.getChainId())
|
|
3077
2711
|
return !1;
|
|
3078
|
-
const a = this.initializeRelay(), { rpcUrls: l = [], blockExplorerUrls:
|
|
3079
|
-
if (
|
|
2712
|
+
const a = this.initializeRelay(), { rpcUrls: l = [], blockExplorerUrls: h = [], chainName: d, iconUrls: f = [], nativeCurrency: g } = r, o = await a.addEthereumChain(i.toString(), l, f, h, d, g);
|
|
2713
|
+
if (D(o))
|
|
3080
2714
|
return !1;
|
|
3081
2715
|
if (((s = o.result) === null || s === void 0 ? void 0 : s.isApproved) === !0)
|
|
3082
2716
|
return this.updateProviderInfo(l[0], i), null;
|
|
3083
|
-
throw
|
|
2717
|
+
throw E.rpc.internal("unable to add ethereum chain");
|
|
3084
2718
|
}
|
|
3085
2719
|
async switchEthereumChain(e) {
|
|
3086
2720
|
const n = e[0], s = Number.parseInt(n.chainId, 16), i = await this.initializeRelay().switchEthereumChain(s.toString(10), this.selectedAddress || void 0);
|
|
3087
|
-
if (
|
|
2721
|
+
if (D(i))
|
|
3088
2722
|
throw i;
|
|
3089
2723
|
const a = i.result;
|
|
3090
2724
|
return a.isApproved && a.rpcUrl.length > 0 && this.updateProviderInfo(a.rpcUrl, s), null;
|
|
@@ -3096,8 +2730,8 @@ class On {
|
|
|
3096
2730
|
var s;
|
|
3097
2731
|
if (!Array.isArray(e))
|
|
3098
2732
|
throw new Error("addresses is not an array");
|
|
3099
|
-
const r = e.map((i) =>
|
|
3100
|
-
JSON.stringify(r) !== JSON.stringify(this._addresses) && (this._addresses = r, (s = this.callback) === null || s === void 0 || s.call(this, "accountsChanged", r), this._storage.setItem(
|
|
2733
|
+
const r = e.map((i) => V(i));
|
|
2734
|
+
JSON.stringify(r) !== JSON.stringify(this._addresses) && (this._addresses = r, (s = this.callback) === null || s === void 0 || s.call(this, "accountsChanged", r), this._storage.setItem(je, r.join(" ")));
|
|
3101
2735
|
}
|
|
3102
2736
|
async request(e) {
|
|
3103
2737
|
const n = e.params || [];
|
|
@@ -3109,7 +2743,7 @@ class On {
|
|
|
3109
2743
|
case "net_version":
|
|
3110
2744
|
return this.getChainId().toString(10);
|
|
3111
2745
|
case "eth_chainId":
|
|
3112
|
-
return
|
|
2746
|
+
return z(this.getChainId());
|
|
3113
2747
|
case "eth_requestAccounts":
|
|
3114
2748
|
return this._eth_requestAccounts();
|
|
3115
2749
|
case "eth_ecRecover":
|
|
@@ -3136,21 +2770,21 @@ class On {
|
|
|
3136
2770
|
return this.watchAsset(n);
|
|
3137
2771
|
default:
|
|
3138
2772
|
if (!this.jsonRpcUrl)
|
|
3139
|
-
throw
|
|
3140
|
-
return
|
|
2773
|
+
throw E.rpc.internal("No RPC URL set for chain");
|
|
2774
|
+
return Ze(e, this.jsonRpcUrl);
|
|
3141
2775
|
}
|
|
3142
2776
|
}
|
|
3143
2777
|
_ensureKnownAddress(e) {
|
|
3144
|
-
const n =
|
|
3145
|
-
if (!this._addresses.map((r) =>
|
|
2778
|
+
const n = V(e);
|
|
2779
|
+
if (!this._addresses.map((r) => V(r)).includes(n))
|
|
3146
2780
|
throw new Error("Unknown Ethereum address");
|
|
3147
2781
|
}
|
|
3148
2782
|
_prepareTransactionParams(e) {
|
|
3149
|
-
const n = e.from ?
|
|
2783
|
+
const n = e.from ? V(e.from) : this.selectedAddress;
|
|
3150
2784
|
if (!n)
|
|
3151
2785
|
throw new Error("Ethereum address is unavailable");
|
|
3152
2786
|
this._ensureKnownAddress(n);
|
|
3153
|
-
const s = e.to ?
|
|
2787
|
+
const s = e.to ? V(e.to) : null, r = e.value != null ? Q(e.value) : BigInt(0), i = e.data ? Oe(e.data) : Buffer.alloc(0), a = e.nonce != null ? ee(e.nonce) : null, l = e.gasPrice != null ? Q(e.gasPrice) : null, h = e.maxFeePerGas != null ? Q(e.maxFeePerGas) : null, d = e.maxPriorityFeePerGas != null ? Q(e.maxPriorityFeePerGas) : null, f = e.gas != null ? Q(e.gas) : null, g = e.chainId ? ee(e.chainId) : this.getChainId();
|
|
3154
2788
|
return {
|
|
3155
2789
|
fromAddress: n,
|
|
3156
2790
|
toAddress: s,
|
|
@@ -3158,111 +2792,111 @@ class On {
|
|
|
3158
2792
|
data: i,
|
|
3159
2793
|
nonce: a,
|
|
3160
2794
|
gasPriceInWei: l,
|
|
3161
|
-
maxFeePerGas:
|
|
2795
|
+
maxFeePerGas: h,
|
|
3162
2796
|
maxPriorityFeePerGas: d,
|
|
3163
|
-
gasLimit:
|
|
2797
|
+
gasLimit: f,
|
|
3164
2798
|
chainId: g
|
|
3165
2799
|
};
|
|
3166
2800
|
}
|
|
3167
2801
|
async ecRecover(e) {
|
|
3168
2802
|
const { method: n, params: s } = e;
|
|
3169
2803
|
if (!Array.isArray(s))
|
|
3170
|
-
throw
|
|
2804
|
+
throw E.rpc.invalidParams();
|
|
3171
2805
|
const i = await this.initializeRelay().sendRequest({
|
|
3172
2806
|
method: "ethereumAddressFromSignedMessage",
|
|
3173
2807
|
params: {
|
|
3174
|
-
message:
|
|
3175
|
-
signature:
|
|
2808
|
+
message: Ie(s[0]),
|
|
2809
|
+
signature: Ie(s[1]),
|
|
3176
2810
|
addPrefix: n === "personal_ecRecover"
|
|
3177
2811
|
}
|
|
3178
2812
|
});
|
|
3179
|
-
if (
|
|
2813
|
+
if (D(i))
|
|
3180
2814
|
throw i;
|
|
3181
2815
|
return i.result;
|
|
3182
2816
|
}
|
|
3183
2817
|
getChainId() {
|
|
3184
2818
|
var e;
|
|
3185
|
-
return Number.parseInt((e = this._storage.getItem(
|
|
2819
|
+
return Number.parseInt((e = this._storage.getItem(Pt)) !== null && e !== void 0 ? e : "1", 10);
|
|
3186
2820
|
}
|
|
3187
2821
|
async _eth_requestAccounts() {
|
|
3188
2822
|
var e, n;
|
|
3189
2823
|
if (this._addresses.length > 0)
|
|
3190
|
-
return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId:
|
|
2824
|
+
return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: z(this.getChainId()) }), this._addresses;
|
|
3191
2825
|
const r = await this.initializeRelay().requestEthereumAccounts();
|
|
3192
|
-
if (
|
|
2826
|
+
if (D(r))
|
|
3193
2827
|
throw r;
|
|
3194
2828
|
if (!r.result)
|
|
3195
2829
|
throw new Error("accounts received is empty");
|
|
3196
|
-
return this._setAddresses(r.result), (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId:
|
|
2830
|
+
return this._setAddresses(r.result), (n = this.callback) === null || n === void 0 || n.call(this, "connect", { chainId: z(this.getChainId()) }), this._addresses;
|
|
3197
2831
|
}
|
|
3198
2832
|
async personalSign({ params: e }) {
|
|
3199
2833
|
if (!Array.isArray(e))
|
|
3200
|
-
throw
|
|
2834
|
+
throw E.rpc.invalidParams();
|
|
3201
2835
|
const n = e[1], s = e[0];
|
|
3202
2836
|
this._ensureKnownAddress(n);
|
|
3203
2837
|
const i = await this.initializeRelay().sendRequest({
|
|
3204
2838
|
method: "signEthereumMessage",
|
|
3205
2839
|
params: {
|
|
3206
|
-
address:
|
|
3207
|
-
message:
|
|
2840
|
+
address: V(n),
|
|
2841
|
+
message: Ie(s),
|
|
3208
2842
|
addPrefix: !0,
|
|
3209
2843
|
typedDataJson: null
|
|
3210
2844
|
}
|
|
3211
2845
|
});
|
|
3212
|
-
if (
|
|
2846
|
+
if (D(i))
|
|
3213
2847
|
throw i;
|
|
3214
2848
|
return i.result;
|
|
3215
2849
|
}
|
|
3216
2850
|
async _eth_signTransaction(e) {
|
|
3217
2851
|
const n = this._prepareTransactionParams(e[0] || {}), r = await this.initializeRelay().signEthereumTransaction(n);
|
|
3218
|
-
if (
|
|
2852
|
+
if (D(r))
|
|
3219
2853
|
throw r;
|
|
3220
2854
|
return r.result;
|
|
3221
2855
|
}
|
|
3222
2856
|
async _eth_sendRawTransaction(e) {
|
|
3223
|
-
const n =
|
|
3224
|
-
if (
|
|
2857
|
+
const n = Oe(e[0]), r = await this.initializeRelay().submitEthereumTransaction(n, this.getChainId());
|
|
2858
|
+
if (D(r))
|
|
3225
2859
|
throw r;
|
|
3226
2860
|
return r.result;
|
|
3227
2861
|
}
|
|
3228
2862
|
async _eth_sendTransaction(e) {
|
|
3229
2863
|
const n = this._prepareTransactionParams(e[0] || {}), r = await this.initializeRelay().signAndSubmitEthereumTransaction(n);
|
|
3230
|
-
if (
|
|
2864
|
+
if (D(r))
|
|
3231
2865
|
throw r;
|
|
3232
2866
|
return r.result;
|
|
3233
2867
|
}
|
|
3234
2868
|
async signTypedData(e) {
|
|
3235
2869
|
const { method: n, params: s } = e;
|
|
3236
2870
|
if (!Array.isArray(s))
|
|
3237
|
-
throw
|
|
2871
|
+
throw E.rpc.invalidParams();
|
|
3238
2872
|
const r = (d) => {
|
|
3239
|
-
const
|
|
3240
|
-
eth_signTypedData_v1:
|
|
3241
|
-
eth_signTypedData_v3:
|
|
3242
|
-
eth_signTypedData_v4:
|
|
3243
|
-
eth_signTypedData:
|
|
2873
|
+
const f = {
|
|
2874
|
+
eth_signTypedData_v1: ce.hashForSignTypedDataLegacy,
|
|
2875
|
+
eth_signTypedData_v3: ce.hashForSignTypedData_v3,
|
|
2876
|
+
eth_signTypedData_v4: ce.hashForSignTypedData_v4,
|
|
2877
|
+
eth_signTypedData: ce.hashForSignTypedData_v4
|
|
3244
2878
|
};
|
|
3245
|
-
return
|
|
3246
|
-
data:
|
|
2879
|
+
return X(f[n]({
|
|
2880
|
+
data: Dn(d)
|
|
3247
2881
|
}), !0);
|
|
3248
2882
|
}, i = s[n === "eth_signTypedData_v1" ? 1 : 0], a = s[n === "eth_signTypedData_v1" ? 0 : 1];
|
|
3249
2883
|
this._ensureKnownAddress(i);
|
|
3250
|
-
const
|
|
2884
|
+
const h = await this.initializeRelay().sendRequest({
|
|
3251
2885
|
method: "signEthereumMessage",
|
|
3252
2886
|
params: {
|
|
3253
|
-
address:
|
|
2887
|
+
address: V(i),
|
|
3254
2888
|
message: r(a),
|
|
3255
2889
|
typedDataJson: JSON.stringify(a, null, 2),
|
|
3256
2890
|
addPrefix: !1
|
|
3257
2891
|
}
|
|
3258
2892
|
});
|
|
3259
|
-
if (
|
|
3260
|
-
throw
|
|
3261
|
-
return
|
|
2893
|
+
if (D(h))
|
|
2894
|
+
throw h;
|
|
2895
|
+
return h.result;
|
|
3262
2896
|
}
|
|
3263
2897
|
initializeRelay() {
|
|
3264
|
-
return this._relay || (this._relay = new
|
|
3265
|
-
linkAPIUrl:
|
|
2898
|
+
return this._relay || (this._relay = new q({
|
|
2899
|
+
linkAPIUrl: At,
|
|
3266
2900
|
storage: this._storage,
|
|
3267
2901
|
metadata: this.metadata,
|
|
3268
2902
|
accountsCallback: this._setAddresses.bind(this),
|
|
@@ -3270,16 +2904,16 @@ class On {
|
|
|
3270
2904
|
})), this._relay;
|
|
3271
2905
|
}
|
|
3272
2906
|
}
|
|
3273
|
-
const
|
|
3274
|
-
function
|
|
3275
|
-
return
|
|
2907
|
+
const _n = "SignerType", mn = new W("CBWSDK", "SignerConfigurator");
|
|
2908
|
+
function Ns() {
|
|
2909
|
+
return mn.getItem(_n);
|
|
3276
2910
|
}
|
|
3277
|
-
function
|
|
3278
|
-
|
|
2911
|
+
function Ds(t) {
|
|
2912
|
+
mn.setItem(_n, t);
|
|
3279
2913
|
}
|
|
3280
|
-
async function
|
|
2914
|
+
async function Os(t) {
|
|
3281
2915
|
const { communicator: e, metadata: n, handshakeRequest: s, callback: r } = t;
|
|
3282
|
-
|
|
2916
|
+
Us(e, n, r).catch(() => {
|
|
3283
2917
|
});
|
|
3284
2918
|
const i = {
|
|
3285
2919
|
id: crypto.randomUUID(),
|
|
@@ -3288,25 +2922,25 @@ async function si(t) {
|
|
|
3288
2922
|
}, { data: a } = await e.postRequestAndWaitForResponse(i);
|
|
3289
2923
|
return a;
|
|
3290
2924
|
}
|
|
3291
|
-
function
|
|
2925
|
+
function js(t) {
|
|
3292
2926
|
const { signerType: e, metadata: n, communicator: s, callback: r } = t;
|
|
3293
2927
|
switch (e) {
|
|
3294
2928
|
case "scw":
|
|
3295
|
-
return new
|
|
2929
|
+
return new Yn({
|
|
3296
2930
|
metadata: n,
|
|
3297
2931
|
callback: r,
|
|
3298
2932
|
communicator: s
|
|
3299
2933
|
});
|
|
3300
2934
|
case "walletlink":
|
|
3301
|
-
return new
|
|
2935
|
+
return new gn({
|
|
3302
2936
|
metadata: n,
|
|
3303
2937
|
callback: r
|
|
3304
2938
|
});
|
|
3305
2939
|
}
|
|
3306
2940
|
}
|
|
3307
|
-
async function
|
|
2941
|
+
async function Us(t, e, n) {
|
|
3308
2942
|
await t.onMessage(({ event: r }) => r === "WalletLinkSessionRequest");
|
|
3309
|
-
const s = new
|
|
2943
|
+
const s = new gn({
|
|
3310
2944
|
metadata: e,
|
|
3311
2945
|
callback: n
|
|
3312
2946
|
});
|
|
@@ -3318,9 +2952,9 @@ async function ri(t, e, n) {
|
|
|
3318
2952
|
data: { connected: !0 }
|
|
3319
2953
|
});
|
|
3320
2954
|
}
|
|
3321
|
-
const
|
|
2955
|
+
const Hs = `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.
|
|
3322
2956
|
|
|
3323
|
-
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,
|
|
2957
|
+
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, Ws = () => {
|
|
3324
2958
|
let t;
|
|
3325
2959
|
return {
|
|
3326
2960
|
getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t,
|
|
@@ -3336,39 +2970,39 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene
|
|
|
3336
2970
|
if (!n.ok)
|
|
3337
2971
|
throw new Error(`HTTP error! status: ${n.status}`);
|
|
3338
2972
|
const s = n.headers.get("Cross-Origin-Opener-Policy");
|
|
3339
|
-
t = s ?? "null", t === "same-origin" && console.error(
|
|
2973
|
+
t = s ?? "null", t === "same-origin" && console.error(Hs);
|
|
3340
2974
|
} catch (e) {
|
|
3341
2975
|
console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error";
|
|
3342
2976
|
}
|
|
3343
2977
|
}
|
|
3344
2978
|
};
|
|
3345
|
-
}, { checkCrossOriginOpenerPolicy:
|
|
2979
|
+
}, { checkCrossOriginOpenerPolicy: Bs, getCrossOriginOpenerPolicy: qs } = Ws(), Rt = 420, Tt = 540, Ks = {
|
|
3346
2980
|
isRed: !1,
|
|
3347
2981
|
info: "Retry",
|
|
3348
2982
|
svgWidth: "10",
|
|
3349
2983
|
svgHeight: "11",
|
|
3350
|
-
path:
|
|
2984
|
+
path: pn,
|
|
3351
2985
|
defaultFillRule: "evenodd",
|
|
3352
2986
|
defaultClipRule: "evenodd"
|
|
3353
|
-
},
|
|
3354
|
-
let
|
|
3355
|
-
function
|
|
3356
|
-
const e = (window.innerWidth -
|
|
3357
|
-
|
|
2987
|
+
}, Vs = "Popup was blocked. Try again.";
|
|
2988
|
+
let de = null;
|
|
2989
|
+
function Fs(t) {
|
|
2990
|
+
const e = (window.innerWidth - Rt) / 2 + window.screenX, n = (window.innerHeight - Tt) / 2 + window.screenY;
|
|
2991
|
+
$s(t);
|
|
3358
2992
|
function s() {
|
|
3359
|
-
const i = `wallet_${crypto.randomUUID()}`, a = window.open(t, i, `width=${
|
|
2993
|
+
const i = `wallet_${crypto.randomUUID()}`, a = window.open(t, i, `width=${Rt}, height=${Tt}, left=${e}, top=${n}`);
|
|
3360
2994
|
return a == null || a.focus(), a || null;
|
|
3361
2995
|
}
|
|
3362
2996
|
let r = s();
|
|
3363
2997
|
if (!r) {
|
|
3364
|
-
const i =
|
|
2998
|
+
const i = Zs();
|
|
3365
2999
|
return new Promise((a, l) => {
|
|
3366
3000
|
i.presentItem({
|
|
3367
3001
|
autoExpand: !0,
|
|
3368
|
-
message:
|
|
3002
|
+
message: Vs,
|
|
3369
3003
|
menuItems: [
|
|
3370
|
-
Object.assign(Object.assign({},
|
|
3371
|
-
r = s(), r ? a(r) : l(
|
|
3004
|
+
Object.assign(Object.assign({}, Ks), { onClick: () => {
|
|
3005
|
+
r = s(), r ? a(r) : l(E.rpc.internal("Popup window was blocked")), i.clear();
|
|
3372
3006
|
} })
|
|
3373
3007
|
]
|
|
3374
3008
|
});
|
|
@@ -3376,51 +3010,51 @@ function hi(t) {
|
|
|
3376
3010
|
}
|
|
3377
3011
|
return Promise.resolve(r);
|
|
3378
3012
|
}
|
|
3379
|
-
function
|
|
3013
|
+
function zs(t) {
|
|
3380
3014
|
t && !t.closed && t.close();
|
|
3381
3015
|
}
|
|
3382
|
-
function
|
|
3016
|
+
function $s(t) {
|
|
3383
3017
|
const e = {
|
|
3384
|
-
sdkName:
|
|
3385
|
-
sdkVersion:
|
|
3018
|
+
sdkName: zt,
|
|
3019
|
+
sdkVersion: ie,
|
|
3386
3020
|
origin: window.location.origin,
|
|
3387
|
-
coop:
|
|
3021
|
+
coop: qs()
|
|
3388
3022
|
};
|
|
3389
3023
|
for (const [n, s] of Object.entries(e))
|
|
3390
3024
|
t.searchParams.append(n, s.toString());
|
|
3391
3025
|
}
|
|
3392
|
-
function
|
|
3393
|
-
if (!
|
|
3026
|
+
function Zs() {
|
|
3027
|
+
if (!de) {
|
|
3394
3028
|
const t = document.createElement("div");
|
|
3395
|
-
t.className = "-cbwsdk-css-reset", document.body.appendChild(t),
|
|
3029
|
+
t.className = "-cbwsdk-css-reset", document.body.appendChild(t), de = new un(), de.attach(t);
|
|
3396
3030
|
}
|
|
3397
|
-
return
|
|
3031
|
+
return de;
|
|
3398
3032
|
}
|
|
3399
|
-
class
|
|
3400
|
-
constructor({ url: e =
|
|
3033
|
+
class Gs {
|
|
3034
|
+
constructor({ url: e = Ls, metadata: n, preference: s }) {
|
|
3401
3035
|
this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (r) => {
|
|
3402
3036
|
(await this.waitForPopupLoaded()).postMessage(r, this.url.origin);
|
|
3403
3037
|
}, this.postRequestAndWaitForResponse = async (r) => {
|
|
3404
3038
|
const i = this.onMessage(({ requestId: a }) => a === r.id);
|
|
3405
3039
|
return this.postMessage(r), await i;
|
|
3406
3040
|
}, this.onMessage = async (r) => new Promise((i, a) => {
|
|
3407
|
-
const l = (
|
|
3408
|
-
if (
|
|
3041
|
+
const l = (h) => {
|
|
3042
|
+
if (h.origin !== this.url.origin)
|
|
3409
3043
|
return;
|
|
3410
|
-
const d =
|
|
3044
|
+
const d = h.data;
|
|
3411
3045
|
r(d) && (i(d), window.removeEventListener("message", l), this.listeners.delete(l));
|
|
3412
3046
|
};
|
|
3413
3047
|
window.addEventListener("message", l), this.listeners.set(l, { reject: a });
|
|
3414
3048
|
}), this.disconnect = () => {
|
|
3415
|
-
|
|
3416
|
-
r(
|
|
3049
|
+
zs(this.popup), this.popup = null, this.listeners.forEach(({ reject: r }, i) => {
|
|
3050
|
+
r(E.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", i);
|
|
3417
3051
|
}), this.listeners.clear();
|
|
3418
|
-
}, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = await
|
|
3052
|
+
}, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = await Fs(this.url), this.onMessage(({ event: r }) => r === "PopupUnload").then(this.disconnect).catch(() => {
|
|
3419
3053
|
}), this.onMessage(({ event: r }) => r === "PopupLoaded").then((r) => {
|
|
3420
3054
|
this.postMessage({
|
|
3421
3055
|
requestId: r.id,
|
|
3422
3056
|
data: {
|
|
3423
|
-
version:
|
|
3057
|
+
version: ie,
|
|
3424
3058
|
metadata: this.metadata,
|
|
3425
3059
|
preference: this.preference,
|
|
3426
3060
|
location: window.location.toString()
|
|
@@ -3428,26 +3062,26 @@ class _i {
|
|
|
3428
3062
|
});
|
|
3429
3063
|
}).then(() => {
|
|
3430
3064
|
if (!this.popup)
|
|
3431
|
-
throw
|
|
3065
|
+
throw E.rpc.internal();
|
|
3432
3066
|
return this.popup;
|
|
3433
3067
|
})), this.url = new URL(e), this.metadata = n, this.preference = s;
|
|
3434
3068
|
}
|
|
3435
3069
|
}
|
|
3436
|
-
function
|
|
3437
|
-
const e =
|
|
3070
|
+
function Ys(t) {
|
|
3071
|
+
const e = Pn(Js(t), {
|
|
3438
3072
|
shouldIncludeStack: !0
|
|
3439
3073
|
}), n = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");
|
|
3440
|
-
return n.searchParams.set("version",
|
|
3074
|
+
return n.searchParams.set("version", ie), n.searchParams.set("code", e.code.toString()), n.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: n.href });
|
|
3441
3075
|
}
|
|
3442
|
-
function
|
|
3076
|
+
function Js(t) {
|
|
3443
3077
|
var e;
|
|
3444
3078
|
if (typeof t == "string")
|
|
3445
3079
|
return {
|
|
3446
3080
|
message: t,
|
|
3447
|
-
code:
|
|
3081
|
+
code: R.rpc.internal
|
|
3448
3082
|
};
|
|
3449
|
-
if (
|
|
3450
|
-
const n = t.errorMessage, s = (e = t.errorCode) !== null && e !== void 0 ? e : n.match(/(denied|rejected)/i) ?
|
|
3083
|
+
if (D(t)) {
|
|
3084
|
+
const n = t.errorMessage, s = (e = t.errorCode) !== null && e !== void 0 ? e : n.match(/(denied|rejected)/i) ? R.provider.userRejectedRequest : void 0;
|
|
3451
3085
|
return Object.assign(Object.assign({}, t), {
|
|
3452
3086
|
message: n,
|
|
3453
3087
|
code: s,
|
|
@@ -3456,9 +3090,9 @@ function yi(t) {
|
|
|
3456
3090
|
}
|
|
3457
3091
|
return t;
|
|
3458
3092
|
}
|
|
3459
|
-
class
|
|
3093
|
+
class Qs extends Cn {
|
|
3460
3094
|
}
|
|
3461
|
-
var
|
|
3095
|
+
var Xs = function(t, e) {
|
|
3462
3096
|
var n = {};
|
|
3463
3097
|
for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (n[s] = t[s]);
|
|
3464
3098
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -3466,24 +3100,24 @@ var bi = function(t, e) {
|
|
|
3466
3100
|
e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[r]) && (n[s[r]] = t[s[r]]);
|
|
3467
3101
|
return n;
|
|
3468
3102
|
};
|
|
3469
|
-
class
|
|
3103
|
+
class ei extends Qs {
|
|
3470
3104
|
constructor(e) {
|
|
3471
|
-
var { metadata: n } = e, s = e.preference, { keysUrl: r } = s, i =
|
|
3472
|
-
super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = n, this.preference = i, this.communicator = new
|
|
3105
|
+
var { metadata: n } = e, s = e.preference, { keysUrl: r } = s, i = Xs(s, ["keysUrl"]);
|
|
3106
|
+
super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = n, this.preference = i, this.communicator = new Gs({
|
|
3473
3107
|
url: r,
|
|
3474
3108
|
metadata: n,
|
|
3475
3109
|
preference: i
|
|
3476
3110
|
});
|
|
3477
|
-
const a =
|
|
3111
|
+
const a = Ns();
|
|
3478
3112
|
a && (this.signer = this.initSigner(a));
|
|
3479
3113
|
}
|
|
3480
3114
|
async request(e) {
|
|
3481
3115
|
try {
|
|
3482
|
-
if (
|
|
3116
|
+
if (Gn(e), !this.signer)
|
|
3483
3117
|
switch (e.method) {
|
|
3484
3118
|
case "eth_requestAccounts": {
|
|
3485
3119
|
const n = await this.requestSignerSelection(e), s = this.initSigner(n);
|
|
3486
|
-
await s.handshake(e), this.signer = s,
|
|
3120
|
+
await s.handshake(e), this.signer = s, Ds(n);
|
|
3487
3121
|
break;
|
|
3488
3122
|
}
|
|
3489
3123
|
case "wallet_sendCalls": {
|
|
@@ -3493,20 +3127,20 @@ class vi extends wi {
|
|
|
3493
3127
|
return await n.cleanup(), s;
|
|
3494
3128
|
}
|
|
3495
3129
|
case "wallet_getCallsStatus":
|
|
3496
|
-
return
|
|
3130
|
+
return Ze(e, Rs);
|
|
3497
3131
|
case "net_version":
|
|
3498
3132
|
return 1;
|
|
3499
3133
|
// default value
|
|
3500
3134
|
case "eth_chainId":
|
|
3501
|
-
return
|
|
3135
|
+
return z(1);
|
|
3502
3136
|
// default value
|
|
3503
3137
|
default:
|
|
3504
|
-
throw
|
|
3138
|
+
throw E.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");
|
|
3505
3139
|
}
|
|
3506
3140
|
return await this.signer.request(e);
|
|
3507
3141
|
} catch (n) {
|
|
3508
3142
|
const { code: s } = n;
|
|
3509
|
-
return s ===
|
|
3143
|
+
return s === R.provider.unauthorized && this.disconnect(), Promise.reject(Ys(n));
|
|
3510
3144
|
}
|
|
3511
3145
|
}
|
|
3512
3146
|
/** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */
|
|
@@ -3517,10 +3151,10 @@ class vi extends wi {
|
|
|
3517
3151
|
}
|
|
3518
3152
|
async disconnect() {
|
|
3519
3153
|
var e;
|
|
3520
|
-
await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null,
|
|
3154
|
+
await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, W.clearAll(), this.emit("disconnect", E.provider.disconnected("User initiated disconnection"));
|
|
3521
3155
|
}
|
|
3522
3156
|
requestSignerSelection(e) {
|
|
3523
|
-
return
|
|
3157
|
+
return Os({
|
|
3524
3158
|
communicator: this.communicator,
|
|
3525
3159
|
preference: this.preference,
|
|
3526
3160
|
metadata: this.metadata,
|
|
@@ -3529,7 +3163,7 @@ class vi extends wi {
|
|
|
3529
3163
|
});
|
|
3530
3164
|
}
|
|
3531
3165
|
initSigner(e) {
|
|
3532
|
-
return
|
|
3166
|
+
return js({
|
|
3533
3167
|
signerType: e,
|
|
3534
3168
|
metadata: this.metadata,
|
|
3535
3169
|
communicator: this.communicator,
|
|
@@ -3537,7 +3171,7 @@ class vi extends wi {
|
|
|
3537
3171
|
});
|
|
3538
3172
|
}
|
|
3539
3173
|
}
|
|
3540
|
-
function
|
|
3174
|
+
function ti(t) {
|
|
3541
3175
|
if (t) {
|
|
3542
3176
|
if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options))
|
|
3543
3177
|
throw new Error(`Invalid options: ${t.options}`);
|
|
@@ -3545,19 +3179,19 @@ function ki(t) {
|
|
|
3545
3179
|
throw new Error("Attribution cannot contain both auto and dataSuffix properties");
|
|
3546
3180
|
}
|
|
3547
3181
|
}
|
|
3548
|
-
class
|
|
3182
|
+
class ri {
|
|
3549
3183
|
constructor(e) {
|
|
3550
3184
|
this.metadata = {
|
|
3551
3185
|
appName: e.appName || "Dapp",
|
|
3552
|
-
appLogoUrl: e.appLogoUrl ||
|
|
3186
|
+
appLogoUrl: e.appLogoUrl || jn(),
|
|
3553
3187
|
appChainIds: e.appChainIds || []
|
|
3554
|
-
}, this.storeLatestVersion(),
|
|
3188
|
+
}, this.storeLatestVersion(), Bs();
|
|
3555
3189
|
}
|
|
3556
3190
|
makeWeb3Provider(e = { options: "all" }) {
|
|
3557
3191
|
var n;
|
|
3558
|
-
|
|
3192
|
+
ti(e);
|
|
3559
3193
|
const s = { metadata: this.metadata, preference: e };
|
|
3560
|
-
return (n =
|
|
3194
|
+
return (n = Zn(s)) !== null && n !== void 0 ? n : new ei(s);
|
|
3561
3195
|
}
|
|
3562
3196
|
/**
|
|
3563
3197
|
* Official Coinbase Wallet logo for developers to use on their frontend
|
|
@@ -3566,13 +3200,13 @@ class Ii {
|
|
|
3566
3200
|
* @returns SVG Data URI
|
|
3567
3201
|
*/
|
|
3568
3202
|
getCoinbaseWalletLogo(e, n = 240) {
|
|
3569
|
-
return
|
|
3203
|
+
return xn(e, n);
|
|
3570
3204
|
}
|
|
3571
3205
|
storeLatestVersion() {
|
|
3572
|
-
new
|
|
3206
|
+
new W("CBWSDK").setItem("VERSION", ie);
|
|
3573
3207
|
}
|
|
3574
3208
|
}
|
|
3575
3209
|
export {
|
|
3576
|
-
|
|
3577
|
-
|
|
3210
|
+
ri as CoinbaseWalletSDK,
|
|
3211
|
+
ri as default
|
|
3578
3212
|
};
|