@depay/web3-wallets-evm 16.2.10 → 16.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.evm.js +179 -106
- package/dist/esm/index.js +195 -122
- package/dist/umd/index.evm.js +179 -106
- package/dist/umd/index.js +195 -122
- package/package.json +1 -1
package/dist/esm/index.evm.js
CHANGED
|
@@ -9,7 +9,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanch
|
|
|
9
9
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
|
|
10
10
|
supported$1.solana = [];
|
|
11
11
|
|
|
12
|
-
function _optionalChain$
|
|
12
|
+
function _optionalChain$g(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
13
13
|
class Transaction {
|
|
14
14
|
|
|
15
15
|
constructor({
|
|
@@ -34,7 +34,7 @@ class Transaction {
|
|
|
34
34
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
35
35
|
|
|
36
36
|
// optional
|
|
37
|
-
this.value = _optionalChain$
|
|
37
|
+
this.value = _optionalChain$g([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
38
38
|
this.api = api;
|
|
39
39
|
this.method = method;
|
|
40
40
|
this.params = params;
|
|
@@ -74,7 +74,7 @@ class Transaction {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
getParamType(param) {
|
|
77
|
-
if(_optionalChain$
|
|
77
|
+
if(_optionalChain$g([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
78
78
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
79
79
|
} else {
|
|
80
80
|
return param.type
|
|
@@ -166,7 +166,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
166
166
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
167
167
|
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
168
168
|
if (transaction.sent) transaction.sent(transaction);
|
|
169
|
-
sentTransaction
|
|
169
|
+
retrieveConfirmedTransaction$3(sentTransaction).then(() => {
|
|
170
170
|
transaction._succeeded = true;
|
|
171
171
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
172
172
|
}).catch((error)=>{
|
|
@@ -194,6 +194,35 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
194
194
|
return transaction
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
+
const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
|
|
198
|
+
return new Promise((resolve, reject)=>{
|
|
199
|
+
try {
|
|
200
|
+
|
|
201
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
202
|
+
if(error && error.toString().match('undefined')) {
|
|
203
|
+
setTimeout(()=>{
|
|
204
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
205
|
+
.then(resolve)
|
|
206
|
+
.catch(reject);
|
|
207
|
+
}, 500);
|
|
208
|
+
} else {
|
|
209
|
+
reject(error);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
} catch(error) {
|
|
213
|
+
if(error && error.toString().match('undefined')) {
|
|
214
|
+
setTimeout(()=>{
|
|
215
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
216
|
+
.then(resolve)
|
|
217
|
+
.catch(reject);
|
|
218
|
+
}, 500);
|
|
219
|
+
} else {
|
|
220
|
+
reject(error);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
};
|
|
225
|
+
|
|
197
226
|
const submit$3 = ({ transaction, provider, signer }) => {
|
|
198
227
|
if(transaction.method) {
|
|
199
228
|
return submitContractInteraction$3({ transaction, signer, provider })
|
|
@@ -224,7 +253,7 @@ const submitSimpleTransfer$3 = ({ transaction, signer })=>{
|
|
|
224
253
|
})
|
|
225
254
|
};
|
|
226
255
|
|
|
227
|
-
function _optionalChain$
|
|
256
|
+
function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
228
257
|
|
|
229
258
|
class WindowEthereum {
|
|
230
259
|
|
|
@@ -236,31 +265,31 @@ class WindowEthereum {
|
|
|
236
265
|
|
|
237
266
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
238
267
|
return (
|
|
239
|
-
_optionalChain$
|
|
268
|
+
_optionalChain$f([window, 'optionalAccess', _31 => _31.ethereum]) &&
|
|
240
269
|
// not MetaMask
|
|
241
|
-
!(_optionalChain$
|
|
270
|
+
!(_optionalChain$f([window, 'optionalAccess', _32 => _32.ethereum, 'optionalAccess', _33 => _33.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1) &&
|
|
242
271
|
// not Coin98
|
|
243
|
-
!_optionalChain$
|
|
272
|
+
!_optionalChain$f([window, 'optionalAccess', _34 => _34.coin98]) &&
|
|
244
273
|
// not Trust Wallet
|
|
245
|
-
!(_optionalChain$
|
|
274
|
+
!(_optionalChain$f([window, 'optionalAccess', _35 => _35.ethereum, 'optionalAccess', _36 => _36.isTrust]) || _optionalChain$f([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isTrustWallet])) &&
|
|
246
275
|
// not crypto.com
|
|
247
|
-
!_optionalChain$
|
|
276
|
+
!_optionalChain$f([window, 'optionalAccess', _39 => _39.ethereum, 'optionalAccess', _40 => _40.isDeficonnectProvider]) &&
|
|
248
277
|
// not HyperPay
|
|
249
|
-
!_optionalChain$
|
|
278
|
+
!_optionalChain$f([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isHyperPay]) &&
|
|
250
279
|
// not Phantom
|
|
251
|
-
!(window.phantom && !window.glow && !_optionalChain$
|
|
280
|
+
!(window.phantom && !window.glow && !_optionalChain$f([window, 'optionalAccess', _43 => _43.solana, 'optionalAccess', _44 => _44.isGlow]) && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
252
281
|
// not Rabby
|
|
253
|
-
!_optionalChain$
|
|
282
|
+
!_optionalChain$f([window, 'optionalAccess', _45 => _45.ethereum, 'optionalAccess', _46 => _46.isRabby]) &&
|
|
254
283
|
// not Backpack
|
|
255
|
-
!_optionalChain$
|
|
284
|
+
!_optionalChain$f([window, 'optionalAccess', _47 => _47.backpack, 'optionalAccess', _48 => _48.isBackpack]) &&
|
|
256
285
|
// not TokenPocket
|
|
257
|
-
!_optionalChain$
|
|
286
|
+
!_optionalChain$f([window, 'optionalAccess', _49 => _49.ethereum, 'optionalAccess', _50 => _50.isTokenPocket]) &&
|
|
258
287
|
// not BitKeep
|
|
259
|
-
!_optionalChain$
|
|
288
|
+
!_optionalChain$f([window, 'optionalAccess', _51 => _51.ethereum, 'optionalAccess', _52 => _52.isBitKeep]) &&
|
|
260
289
|
// not Coinbase
|
|
261
|
-
!(_optionalChain$
|
|
290
|
+
!(_optionalChain$f([window, 'optionalAccess', _53 => _53.ethereum, 'optionalAccess', _54 => _54.isCoinbaseWallet]) || _optionalChain$f([window, 'optionalAccess', _55 => _55.ethereum, 'optionalAccess', _56 => _56.isWalletLink])) &&
|
|
262
291
|
// MetaMask through ProviderMap
|
|
263
|
-
!_optionalChain$
|
|
292
|
+
!_optionalChain$f([window, 'optionalAccess', _57 => _57.ethereum, 'optionalAccess', _58 => _58.providerMap, 'optionalAccess', _59 => _59.has, 'call', _60 => _60('MetaMask')])
|
|
264
293
|
)
|
|
265
294
|
};}
|
|
266
295
|
|
|
@@ -386,7 +415,7 @@ class WindowEthereum {
|
|
|
386
415
|
}
|
|
387
416
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
388
417
|
|
|
389
|
-
function _optionalChain$
|
|
418
|
+
function _optionalChain$e(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
390
419
|
class Binance extends WindowEthereum {
|
|
391
420
|
|
|
392
421
|
static __initStatic() {this.info = {
|
|
@@ -396,7 +425,7 @@ class Binance extends WindowEthereum {
|
|
|
396
425
|
};}
|
|
397
426
|
|
|
398
427
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
399
|
-
return _optionalChain$
|
|
428
|
+
return _optionalChain$e([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
400
429
|
!window.coin98
|
|
401
430
|
};}
|
|
402
431
|
|
|
@@ -404,7 +433,7 @@ class Binance extends WindowEthereum {
|
|
|
404
433
|
|
|
405
434
|
} Binance.__initStatic(); Binance.__initStatic2();
|
|
406
435
|
|
|
407
|
-
function _optionalChain$
|
|
436
|
+
function _optionalChain$d(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
408
437
|
class Brave extends WindowEthereum {
|
|
409
438
|
|
|
410
439
|
static __initStatic() {this.info = {
|
|
@@ -413,10 +442,10 @@ class Brave extends WindowEthereum {
|
|
|
413
442
|
blockchains: supported$1.evm
|
|
414
443
|
};}
|
|
415
444
|
|
|
416
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
445
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
417
446
|
} Brave.__initStatic(); Brave.__initStatic2();
|
|
418
447
|
|
|
419
|
-
function _optionalChain$
|
|
448
|
+
function _optionalChain$c(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
420
449
|
class Coin98 extends WindowEthereum {
|
|
421
450
|
|
|
422
451
|
static __initStatic() {this.info = {
|
|
@@ -425,10 +454,10 @@ class Coin98 extends WindowEthereum {
|
|
|
425
454
|
blockchains: supported$1.evm
|
|
426
455
|
};}
|
|
427
456
|
|
|
428
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
457
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
429
458
|
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
430
459
|
|
|
431
|
-
function _optionalChain$
|
|
460
|
+
function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
432
461
|
class Coinbase extends WindowEthereum {
|
|
433
462
|
|
|
434
463
|
static __initStatic() {this.info = {
|
|
@@ -438,8 +467,8 @@ class Coinbase extends WindowEthereum {
|
|
|
438
467
|
};}
|
|
439
468
|
|
|
440
469
|
getProvider() {
|
|
441
|
-
if(_optionalChain$
|
|
442
|
-
return _optionalChain$
|
|
470
|
+
if(_optionalChain$b([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
|
|
471
|
+
return _optionalChain$b([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
|
|
443
472
|
} else {
|
|
444
473
|
return window.ethereum
|
|
445
474
|
}
|
|
@@ -448,15 +477,15 @@ class Coinbase extends WindowEthereum {
|
|
|
448
477
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
449
478
|
return(
|
|
450
479
|
(
|
|
451
|
-
_optionalChain$
|
|
480
|
+
_optionalChain$b([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$b([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
|
|
452
481
|
) || (
|
|
453
|
-
_optionalChain$
|
|
482
|
+
_optionalChain$b([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
|
|
454
483
|
)
|
|
455
484
|
)
|
|
456
485
|
};}
|
|
457
486
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
458
487
|
|
|
459
|
-
function _optionalChain$
|
|
488
|
+
function _optionalChain$a(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
460
489
|
class CryptoCom extends WindowEthereum {
|
|
461
490
|
|
|
462
491
|
static __initStatic() {this.info = {
|
|
@@ -465,10 +494,10 @@ class CryptoCom extends WindowEthereum {
|
|
|
465
494
|
blockchains: supported$1.evm
|
|
466
495
|
};}
|
|
467
496
|
|
|
468
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
497
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
469
498
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
470
499
|
|
|
471
|
-
function _optionalChain$
|
|
500
|
+
function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
472
501
|
class HyperPay extends WindowEthereum {
|
|
473
502
|
|
|
474
503
|
static __initStatic() {this.info = {
|
|
@@ -477,10 +506,10 @@ class HyperPay extends WindowEthereum {
|
|
|
477
506
|
blockchains: supported$1.evm
|
|
478
507
|
};}
|
|
479
508
|
|
|
480
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
509
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
481
510
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
482
511
|
|
|
483
|
-
function _optionalChain$
|
|
512
|
+
function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
484
513
|
class MetaMask extends WindowEthereum {
|
|
485
514
|
|
|
486
515
|
static __initStatic() {this.info = {
|
|
@@ -490,8 +519,8 @@ class MetaMask extends WindowEthereum {
|
|
|
490
519
|
};}
|
|
491
520
|
|
|
492
521
|
getProvider() {
|
|
493
|
-
if(_optionalChain$
|
|
494
|
-
return _optionalChain$
|
|
522
|
+
if(_optionalChain$8([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.providerMap, 'optionalAccess', _9 => _9.has, 'call', _10 => _10('MetaMask')])) {
|
|
523
|
+
return _optionalChain$8([window, 'optionalAccess', _11 => _11.ethereum, 'optionalAccess', _12 => _12.providerMap, 'optionalAccess', _13 => _13.get, 'call', _14 => _14('MetaMask')])
|
|
495
524
|
} else {
|
|
496
525
|
return window.ethereum
|
|
497
526
|
}
|
|
@@ -500,16 +529,16 @@ class MetaMask extends WindowEthereum {
|
|
|
500
529
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
501
530
|
return(
|
|
502
531
|
(
|
|
503
|
-
_optionalChain$
|
|
532
|
+
_optionalChain$8([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isMetaMask]) &&
|
|
504
533
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
505
534
|
) || (
|
|
506
|
-
_optionalChain$
|
|
535
|
+
_optionalChain$8([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.providerMap, 'optionalAccess', _19 => _19.has, 'call', _20 => _20('MetaMask')])
|
|
507
536
|
)
|
|
508
537
|
)
|
|
509
538
|
};}
|
|
510
539
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
511
540
|
|
|
512
|
-
function _optionalChain$
|
|
541
|
+
function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
513
542
|
class Opera extends WindowEthereum {
|
|
514
543
|
|
|
515
544
|
static __initStatic() {this.info = {
|
|
@@ -518,10 +547,10 @@ class Opera extends WindowEthereum {
|
|
|
518
547
|
blockchains: supported$1.evm
|
|
519
548
|
};}
|
|
520
549
|
|
|
521
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
550
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
522
551
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
523
552
|
|
|
524
|
-
function _optionalChain$
|
|
553
|
+
function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
525
554
|
class Rabby extends WindowEthereum {
|
|
526
555
|
|
|
527
556
|
static __initStatic() {this.info = {
|
|
@@ -532,12 +561,12 @@ class Rabby extends WindowEthereum {
|
|
|
532
561
|
|
|
533
562
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
534
563
|
return(
|
|
535
|
-
_optionalChain$
|
|
564
|
+
_optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
536
565
|
)
|
|
537
566
|
};}
|
|
538
567
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
539
568
|
|
|
540
|
-
function _optionalChain$
|
|
569
|
+
function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
541
570
|
class TokenPocket extends WindowEthereum {
|
|
542
571
|
|
|
543
572
|
static __initStatic() {this.info = {
|
|
@@ -548,12 +577,12 @@ class TokenPocket extends WindowEthereum {
|
|
|
548
577
|
|
|
549
578
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
550
579
|
return (
|
|
551
|
-
_optionalChain$
|
|
580
|
+
_optionalChain$5([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
|
|
552
581
|
)
|
|
553
582
|
};}
|
|
554
583
|
} TokenPocket.__initStatic(); TokenPocket.__initStatic2();
|
|
555
584
|
|
|
556
|
-
function _optionalChain$
|
|
585
|
+
function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
557
586
|
class Trust extends WindowEthereum {
|
|
558
587
|
|
|
559
588
|
static __initStatic() {this.info = {
|
|
@@ -564,7 +593,7 @@ class Trust extends WindowEthereum {
|
|
|
564
593
|
|
|
565
594
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
566
595
|
return (
|
|
567
|
-
(_optionalChain$
|
|
596
|
+
(_optionalChain$4([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$4([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
|
|
568
597
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!Debug)(?!TrustWallet)(?!MetaMask)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
569
598
|
)
|
|
570
599
|
};}
|
|
@@ -659,7 +688,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
|
|
|
659
688
|
}
|
|
660
689
|
};
|
|
661
690
|
|
|
662
|
-
function _optionalChain$
|
|
691
|
+
function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
663
692
|
|
|
664
693
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
665
694
|
transaction = new Transaction(transaction);
|
|
@@ -671,7 +700,6 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
671
700
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
672
701
|
transaction.nonce = transactionCount;
|
|
673
702
|
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
674
|
-
console.log('tx', tx);
|
|
675
703
|
if (tx) {
|
|
676
704
|
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
677
705
|
transaction.id = tx;
|
|
@@ -710,9 +738,21 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
710
738
|
|
|
711
739
|
const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
712
740
|
return new Promise((resolve, reject)=>{
|
|
741
|
+
try {
|
|
713
742
|
|
|
714
|
-
|
|
715
|
-
|
|
743
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
744
|
+
if(error && error.toString().match('undefined')) {
|
|
745
|
+
setTimeout(()=>{
|
|
746
|
+
retrieveConfirmedTransaction$2(sentTransaction)
|
|
747
|
+
.then(resolve)
|
|
748
|
+
.catch(reject);
|
|
749
|
+
}, 500);
|
|
750
|
+
} else {
|
|
751
|
+
reject(error);
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
} catch (error) {
|
|
755
|
+
if(error && error.toString().match('undefined')) {
|
|
716
756
|
setTimeout(()=>{
|
|
717
757
|
retrieveConfirmedTransaction$2(sentTransaction)
|
|
718
758
|
.then(resolve)
|
|
@@ -721,7 +761,7 @@ const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
|
721
761
|
} else {
|
|
722
762
|
reject(error);
|
|
723
763
|
}
|
|
724
|
-
}
|
|
764
|
+
}
|
|
725
765
|
})
|
|
726
766
|
};
|
|
727
767
|
|
|
@@ -757,7 +797,7 @@ const submit$2 = ({ transaction, wallet }) => {
|
|
|
757
797
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
758
798
|
const provider = await getProvider(transaction.blockchain);
|
|
759
799
|
let gasPrice = await provider.getGasPrice();
|
|
760
|
-
if(_optionalChain$
|
|
800
|
+
if(_optionalChain$3([wallet, 'access', _ => _.session, 'optionalAccess', _2 => _2.peerMeta, 'optionalAccess', _3 => _3.name]) === 'Uniswap Wallet') {
|
|
761
801
|
gasPrice = undefined;
|
|
762
802
|
} else {
|
|
763
803
|
gasPrice = gasPrice.toHexString();
|
|
@@ -781,7 +821,7 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
781
821
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
782
822
|
const provider = await getProvider(transaction.blockchain);
|
|
783
823
|
let gasPrice = await provider.getGasPrice();
|
|
784
|
-
if(_optionalChain$
|
|
824
|
+
if(_optionalChain$3([wallet, 'access', _4 => _4.session, 'optionalAccess', _5 => _5.peerMeta, 'optionalAccess', _6 => _6.name]) === 'Uniswap Wallet') {
|
|
785
825
|
gasPrice = undefined;
|
|
786
826
|
} else {
|
|
787
827
|
gasPrice = gasPrice.toHexString();
|
|
@@ -800,7 +840,7 @@ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
|
800
840
|
})
|
|
801
841
|
};
|
|
802
842
|
|
|
803
|
-
function _optionalChain$
|
|
843
|
+
function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
804
844
|
|
|
805
845
|
const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
806
846
|
|
|
@@ -943,8 +983,8 @@ class WalletConnectV1 {
|
|
|
943
983
|
let session = await this.connector.connect();
|
|
944
984
|
this.session = session;
|
|
945
985
|
|
|
946
|
-
if(_optionalChain$
|
|
947
|
-
if(_optionalChain$
|
|
986
|
+
if(_optionalChain$2([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
987
|
+
if(_optionalChain$2([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
948
988
|
|
|
949
989
|
if(session.accounts instanceof Array && session.accounts.length) {
|
|
950
990
|
setConnectedInstance$1(this);
|
|
@@ -1088,8 +1128,6 @@ class WalletConnectV1 {
|
|
|
1088
1128
|
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
1089
1129
|
WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
|
|
1090
1130
|
|
|
1091
|
-
function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1092
|
-
|
|
1093
1131
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
1094
1132
|
transaction = new Transaction(transaction);
|
|
1095
1133
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -1108,7 +1146,6 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1108
1146
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1109
1147
|
if(!sentTransaction) {
|
|
1110
1148
|
transaction._failed = true;
|
|
1111
|
-
console.log('Error retrieving transaction');
|
|
1112
1149
|
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1113
1150
|
} else {
|
|
1114
1151
|
retrieveConfirmedTransaction$1(sentTransaction).then(() => {
|
|
@@ -1140,35 +1177,60 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1140
1177
|
|
|
1141
1178
|
const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
1142
1179
|
return new Promise((resolve, reject)=>{
|
|
1180
|
+
try {
|
|
1181
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1182
|
+
if(error && error.toString().match('undefined')) {
|
|
1183
|
+
setTimeout(()=>{
|
|
1184
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1185
|
+
.then(resolve)
|
|
1186
|
+
.catch(reject);
|
|
1187
|
+
}, 500);
|
|
1188
|
+
} else {
|
|
1189
|
+
reject(error);
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
} catch (error) {
|
|
1193
|
+
if(error && error.toString().match('undefined')) {
|
|
1194
|
+
setTimeout(()=>{
|
|
1195
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1196
|
+
.then(resolve)
|
|
1197
|
+
.catch(reject);
|
|
1198
|
+
}, 500);
|
|
1199
|
+
} else {
|
|
1200
|
+
reject(error);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
})
|
|
1204
|
+
};
|
|
1143
1205
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1206
|
+
const retrieveTransaction = (tx, blockchain)=>{
|
|
1207
|
+
return new Promise(async(resolve, reject)=>{
|
|
1208
|
+
try {
|
|
1209
|
+
let sentTransaction;
|
|
1210
|
+
const provider = await getProvider(blockchain);
|
|
1211
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1212
|
+
const maxRetries = 120;
|
|
1213
|
+
let attempt = 1;
|
|
1214
|
+
while (attempt <= maxRetries && !sentTransaction) {
|
|
1215
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1216
|
+
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1217
|
+
attempt++;
|
|
1218
|
+
}
|
|
1219
|
+
resolve(sentTransaction);
|
|
1220
|
+
} catch (error) {
|
|
1221
|
+
if(error && error.toString().match('undefined')) {
|
|
1146
1222
|
setTimeout(()=>{
|
|
1147
|
-
|
|
1223
|
+
retrieveTransaction(tx, blockchain)
|
|
1148
1224
|
.then(resolve)
|
|
1149
1225
|
.catch(reject);
|
|
1150
1226
|
}, 500);
|
|
1151
1227
|
} else {
|
|
1152
1228
|
reject(error);
|
|
1153
1229
|
}
|
|
1154
|
-
}
|
|
1230
|
+
}
|
|
1155
1231
|
})
|
|
1156
1232
|
};
|
|
1157
1233
|
|
|
1158
|
-
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1159
|
-
let sentTransaction;
|
|
1160
|
-
const provider = await getProvider(blockchain);
|
|
1161
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1162
|
-
const maxRetries = 120;
|
|
1163
|
-
let attempt = 1;
|
|
1164
|
-
while (attempt <= maxRetries && !sentTransaction) {
|
|
1165
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1166
|
-
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1167
|
-
attempt++;
|
|
1168
|
-
}
|
|
1169
|
-
return sentTransaction
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
1234
|
const submit$1 = ({ transaction, wallet }) => {
|
|
1173
1235
|
if(transaction.method) {
|
|
1174
1236
|
return submitContractInteraction$1({ transaction, wallet })
|
|
@@ -1222,7 +1284,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1222
1284
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
1223
1285
|
};
|
|
1224
1286
|
|
|
1225
|
-
function _optionalChain$
|
|
1287
|
+
function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1226
1288
|
|
|
1227
1289
|
const KEY = 'depay:wallets:wc2';
|
|
1228
1290
|
|
|
@@ -1341,11 +1403,11 @@ const getLastSession = async(walletName)=>{
|
|
|
1341
1403
|
};
|
|
1342
1404
|
|
|
1343
1405
|
const getWalletConnectV2Config = (walletName)=>{
|
|
1344
|
-
const methods = _optionalChain$
|
|
1345
|
-
const events = _optionalChain$
|
|
1406
|
+
const methods = _optionalChain$1([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
|
|
1407
|
+
const events = _optionalChain$1([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
|
|
1346
1408
|
|
|
1347
1409
|
let requiredNamespaces = {};
|
|
1348
|
-
if(_optionalChain$
|
|
1410
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
|
|
1349
1411
|
requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
|
|
1350
1412
|
} else {
|
|
1351
1413
|
requiredNamespaces['eip155'] = {
|
|
@@ -1358,14 +1420,14 @@ const getWalletConnectV2Config = (walletName)=>{
|
|
|
1358
1420
|
}
|
|
1359
1421
|
|
|
1360
1422
|
let optionalNamespaces = {};
|
|
1361
|
-
if(_optionalChain$
|
|
1423
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
|
|
1362
1424
|
optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
|
|
1363
1425
|
} else {
|
|
1364
1426
|
optionalNamespaces['eip155'] = {
|
|
1365
1427
|
chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
|
|
1366
1428
|
};
|
|
1367
1429
|
}
|
|
1368
|
-
if(_optionalChain$
|
|
1430
|
+
if(_optionalChain$1([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$1([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
|
|
1369
1431
|
optionalNamespaces['eip155'].methods = methods;
|
|
1370
1432
|
optionalNamespaces['eip155'].events = events;
|
|
1371
1433
|
}
|
|
@@ -1380,9 +1442,9 @@ const getSignClient = ()=>{
|
|
|
1380
1442
|
projectId: localStorage[KEY+":projectId"],
|
|
1381
1443
|
metadata: {
|
|
1382
1444
|
name: document.title || 'dApp',
|
|
1383
|
-
description: _optionalChain$
|
|
1445
|
+
description: _optionalChain$1([document, 'access', _13 => _13.querySelector, 'call', _14 => _14('meta[name="description"]'), 'optionalAccess', _15 => _15.getAttribute, 'call', _16 => _16('content')]) || document.title || 'dApp',
|
|
1384
1446
|
url: location.href,
|
|
1385
|
-
icons: [_optionalChain$
|
|
1447
|
+
icons: [_optionalChain$1([document, 'access', _17 => _17.querySelector, 'call', _18 => _18("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _19 => _19.href]) || `${location.origin}/favicon.ico`]
|
|
1386
1448
|
}
|
|
1387
1449
|
});
|
|
1388
1450
|
resolve(signClient);
|
|
@@ -1400,7 +1462,7 @@ class WalletConnectV2 {
|
|
|
1400
1462
|
};}
|
|
1401
1463
|
|
|
1402
1464
|
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
1403
|
-
return !! await getLastSession(_optionalChain$
|
|
1465
|
+
return !! await getLastSession(_optionalChain$1([options, 'optionalAccess', _21 => _21.walletName]))
|
|
1404
1466
|
};}
|
|
1405
1467
|
|
|
1406
1468
|
constructor() {
|
|
@@ -1415,19 +1477,19 @@ class WalletConnectV2 {
|
|
|
1415
1477
|
}
|
|
1416
1478
|
|
|
1417
1479
|
async account() {
|
|
1418
|
-
if(_optionalChain$
|
|
1480
|
+
if(_optionalChain$1([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
|
|
1419
1481
|
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
1420
1482
|
}
|
|
1421
1483
|
}
|
|
1422
1484
|
|
|
1423
1485
|
async setSessionBlockchains() {
|
|
1424
|
-
if(!this.session || !_optionalChain$
|
|
1425
|
-
if(_optionalChain$
|
|
1426
|
-
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$
|
|
1486
|
+
if(!this.session || !_optionalChain$1([this, 'access', _27 => _27.session, 'optionalAccess', _28 => _28.namespaces, 'optionalAccess', _29 => _29.eip155])) { return }
|
|
1487
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _30 => _30[this.walletName], 'optionalAccess', _31 => _31.methods, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33('wallet_switchEthereumChain')])) {
|
|
1488
|
+
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$1([Blockchains, 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(chainIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
|
|
1427
1489
|
} else if(this.session.namespaces.eip155.chains) {
|
|
1428
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$
|
|
1490
|
+
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$1([Blockchains, 'access', _37 => _37.findByNetworkId, 'call', _38 => _38(chainIdentifier.split(':')[1]), 'optionalAccess', _39 => _39.name])).filter(Boolean);
|
|
1429
1491
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1430
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$
|
|
1492
|
+
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$1([Blockchains, 'access', _40 => _40.findByNetworkId, 'call', _41 => _41(accountIdentifier.split(':')[1]), 'optionalAccess', _42 => _42.name])).filter(Boolean);
|
|
1431
1493
|
}
|
|
1432
1494
|
}
|
|
1433
1495
|
|
|
@@ -1437,13 +1499,13 @@ class WalletConnectV2 {
|
|
|
1437
1499
|
|
|
1438
1500
|
try {
|
|
1439
1501
|
|
|
1440
|
-
this.walletName = _optionalChain$
|
|
1502
|
+
this.walletName = _optionalChain$1([options, 'optionalAccess', _43 => _43.name]);
|
|
1441
1503
|
|
|
1442
1504
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1443
1505
|
this.signClient = await getSignClient();
|
|
1444
1506
|
|
|
1445
1507
|
this.signClient.on("session_delete", (session)=> {
|
|
1446
|
-
if(_optionalChain$
|
|
1508
|
+
if(_optionalChain$1([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$1([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
|
|
1447
1509
|
localStorage[KEY+':name'] = undefined;
|
|
1448
1510
|
localStorage[KEY+':logo'] = undefined;
|
|
1449
1511
|
this.signClient = undefined;
|
|
@@ -1452,14 +1514,14 @@ class WalletConnectV2 {
|
|
|
1452
1514
|
});
|
|
1453
1515
|
|
|
1454
1516
|
this.signClient.on("session_update", async(session)=> {
|
|
1455
|
-
if(_optionalChain$
|
|
1517
|
+
if(_optionalChain$1([session, 'optionalAccess', _47 => _47.topic]) === _optionalChain$1([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {
|
|
1456
1518
|
this.session = this.signClient.session.get(session.topic);
|
|
1457
1519
|
await this.setSessionBlockchains();
|
|
1458
1520
|
}
|
|
1459
1521
|
});
|
|
1460
1522
|
|
|
1461
1523
|
this.signClient.on("session_event", (event)=> {
|
|
1462
|
-
if(_optionalChain$
|
|
1524
|
+
if(_optionalChain$1([event, 'optionalAccess', _50 => _50.topic]) === _optionalChain$1([this, 'access', _51 => _51.session, 'optionalAccess', _52 => _52.topic])) {}
|
|
1463
1525
|
});
|
|
1464
1526
|
|
|
1465
1527
|
const connectWallet = async()=>{
|
|
@@ -1470,24 +1532,24 @@ class WalletConnectV2 {
|
|
|
1470
1532
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1471
1533
|
};
|
|
1472
1534
|
|
|
1473
|
-
const lastSession = _optionalChain$
|
|
1535
|
+
const lastSession = _optionalChain$1([this, 'optionalAccess', _53 => _53.walletName, 'optionalAccess', _54 => _54.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1474
1536
|
if(lastSession) {
|
|
1475
1537
|
this.session = lastSession;
|
|
1476
1538
|
} else {
|
|
1477
1539
|
await connectWallet();
|
|
1478
1540
|
}
|
|
1479
1541
|
|
|
1480
|
-
let meta = _optionalChain$
|
|
1542
|
+
let meta = _optionalChain$1([this, 'access', _55 => _55.session, 'optionalAccess', _56 => _56.peer, 'optionalAccess', _57 => _57.metadata]);
|
|
1481
1543
|
if(meta && meta.name) {
|
|
1482
1544
|
this.name = meta.name;
|
|
1483
1545
|
localStorage[KEY+':name'] = meta.name;
|
|
1484
|
-
if(_optionalChain$
|
|
1546
|
+
if(_optionalChain$1([meta, 'optionalAccess', _58 => _58.icons]) && meta.icons.length) {
|
|
1485
1547
|
this.logo = meta.icons[0];
|
|
1486
1548
|
localStorage[KEY+':logo'] = this.logo;
|
|
1487
1549
|
}
|
|
1488
1550
|
}
|
|
1489
|
-
if(_optionalChain$
|
|
1490
|
-
if(_optionalChain$
|
|
1551
|
+
if(_optionalChain$1([options, 'optionalAccess', _59 => _59.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1552
|
+
if(_optionalChain$1([options, 'optionalAccess', _60 => _60.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1491
1553
|
|
|
1492
1554
|
await this.setSessionBlockchains();
|
|
1493
1555
|
|
|
@@ -1544,7 +1606,7 @@ class WalletConnectV2 {
|
|
|
1544
1606
|
switch (event) {
|
|
1545
1607
|
case 'account':
|
|
1546
1608
|
internalCallback = async(event)=> {
|
|
1547
|
-
if(_optionalChain$
|
|
1609
|
+
if(_optionalChain$1([event, 'optionalAccess', _61 => _61.topic]) === _optionalChain$1([this, 'access', _62 => _62.session, 'optionalAccess', _63 => _63.topic]) && event.params.event.name === 'accountsChanged') {
|
|
1548
1610
|
callback(await this.account());
|
|
1549
1611
|
}
|
|
1550
1612
|
};
|
|
@@ -1604,7 +1666,6 @@ class WalletConnectV2 {
|
|
|
1604
1666
|
|
|
1605
1667
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
1606
1668
|
|
|
1607
|
-
function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1608
1669
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
1609
1670
|
transaction = new Transaction(transaction);
|
|
1610
1671
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -1652,9 +1713,21 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
1652
1713
|
|
|
1653
1714
|
const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
1654
1715
|
return new Promise((resolve, reject)=>{
|
|
1716
|
+
try {
|
|
1655
1717
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1718
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1719
|
+
if(error && error.toString().match('undefined')) {
|
|
1720
|
+
setTimeout(()=>{
|
|
1721
|
+
retrieveConfirmedTransaction(sentTransaction)
|
|
1722
|
+
.then(resolve)
|
|
1723
|
+
.catch(reject);
|
|
1724
|
+
}, 500);
|
|
1725
|
+
} else {
|
|
1726
|
+
reject(error);
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
} catch(error) {
|
|
1730
|
+
if(error && error.toString().match('undefined')) {
|
|
1658
1731
|
setTimeout(()=>{
|
|
1659
1732
|
retrieveConfirmedTransaction(sentTransaction)
|
|
1660
1733
|
.then(resolve)
|
|
@@ -1663,7 +1736,7 @@ const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
|
1663
1736
|
} else {
|
|
1664
1737
|
reject(error);
|
|
1665
1738
|
}
|
|
1666
|
-
}
|
|
1739
|
+
}
|
|
1667
1740
|
})
|
|
1668
1741
|
};
|
|
1669
1742
|
|