@depay/web3-wallets-evm 15.16.3 → 16.0.1
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 +6 -0
- package/dist/esm/index.evm.js +263 -199
- package/dist/esm/index.js +263 -199
- package/dist/esm/index.solana.js +263 -199
- package/dist/umd/index.evm.js +262 -198
- package/dist/umd/index.js +262 -198
- package/dist/umd/index.solana.js +262 -198
- package/package.json +2 -2
package/dist/esm/index.evm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getProvider as getProvider$3, request as request$1, estimate as estimat
|
|
|
2
2
|
import Blockchains from '@depay/web3-blockchains';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import { WalletConnectClient } from '@depay/walletconnect-v1';
|
|
5
|
-
import { SignClient
|
|
5
|
+
import { SignClient } from '@depay/walletconnect-v2';
|
|
6
6
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
7
7
|
|
|
8
8
|
var _global$1 = (typeof global !== "undefined" ? global :
|
|
@@ -42135,7 +42135,7 @@ lib.u8;
|
|
|
42135
42135
|
lib.vec;
|
|
42136
42136
|
lib.vecU8;
|
|
42137
42137
|
|
|
42138
|
-
function _optionalChain$
|
|
42138
|
+
function _optionalChain$l(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; }
|
|
42139
42139
|
class Transaction {
|
|
42140
42140
|
|
|
42141
42141
|
constructor({
|
|
@@ -42160,7 +42160,7 @@ class Transaction {
|
|
|
42160
42160
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
42161
42161
|
|
|
42162
42162
|
// optional
|
|
42163
|
-
this.value = _optionalChain$
|
|
42163
|
+
this.value = _optionalChain$l([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
42164
42164
|
this.api = api;
|
|
42165
42165
|
this.method = method;
|
|
42166
42166
|
this.params = params;
|
|
@@ -42265,7 +42265,7 @@ class Transaction {
|
|
|
42265
42265
|
}
|
|
42266
42266
|
}
|
|
42267
42267
|
|
|
42268
|
-
function _optionalChain$
|
|
42268
|
+
function _optionalChain$k(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; }
|
|
42269
42269
|
|
|
42270
42270
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
42271
42271
|
const MAX_POLLS = 240; // 120 seconds
|
|
@@ -42286,14 +42286,14 @@ const sendTransaction$5 = async ({ transaction, wallet })=> {
|
|
|
42286
42286
|
|
|
42287
42287
|
const provider = await getProvider$3(transaction.blockchain);
|
|
42288
42288
|
const { value } = await provider.getSignatureStatus(signature);
|
|
42289
|
-
const confirmationStatus = _optionalChain$
|
|
42289
|
+
const confirmationStatus = _optionalChain$k([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
42290
42290
|
if(confirmationStatus) {
|
|
42291
42291
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
42292
42292
|
if (hasReachedSufficientCommitment) {
|
|
42293
42293
|
if(value.err) {
|
|
42294
42294
|
transaction._failed = true;
|
|
42295
42295
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
42296
|
-
const failedReason = _optionalChain$
|
|
42296
|
+
const failedReason = _optionalChain$k([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
42297
42297
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
42298
42298
|
} else {
|
|
42299
42299
|
transaction._succeeded = true;
|
|
@@ -42384,7 +42384,7 @@ let supported$2 = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanch
|
|
|
42384
42384
|
supported$2.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
42385
42385
|
supported$2.solana = [];
|
|
42386
42386
|
|
|
42387
|
-
function _optionalChain$
|
|
42387
|
+
function _optionalChain$j(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; }
|
|
42388
42388
|
class WindowSolana {
|
|
42389
42389
|
|
|
42390
42390
|
static __initStatic() {this.info = {
|
|
@@ -42395,7 +42395,7 @@ class WindowSolana {
|
|
|
42395
42395
|
|
|
42396
42396
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
42397
42397
|
return (
|
|
42398
|
-
_optionalChain$
|
|
42398
|
+
_optionalChain$j([window, 'optionalAccess', _2 => _2.solana]) &&
|
|
42399
42399
|
!(window.phantom && !window.glow && !window.solana.isGlow) &&
|
|
42400
42400
|
!window.coin98 &&
|
|
42401
42401
|
!window.solana.isGlow
|
|
@@ -42445,7 +42445,7 @@ class WindowSolana {
|
|
|
42445
42445
|
let internalCallback;
|
|
42446
42446
|
switch (event) {
|
|
42447
42447
|
case 'account':
|
|
42448
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
42448
|
+
internalCallback = (publicKey) => callback(_optionalChain$j([publicKey, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]));
|
|
42449
42449
|
this.getProvider().on('accountChanged', internalCallback);
|
|
42450
42450
|
break
|
|
42451
42451
|
}
|
|
@@ -43334,7 +43334,7 @@ const request = async function (url, options) {
|
|
|
43334
43334
|
})
|
|
43335
43335
|
};
|
|
43336
43336
|
|
|
43337
|
-
function _optionalChain$
|
|
43337
|
+
function _optionalChain$i(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; }
|
|
43338
43338
|
class Backpack extends WindowSolana {
|
|
43339
43339
|
|
|
43340
43340
|
static __initStatic() {this.info = {
|
|
@@ -43345,7 +43345,7 @@ class Backpack extends WindowSolana {
|
|
|
43345
43345
|
|
|
43346
43346
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43347
43347
|
return (
|
|
43348
|
-
_optionalChain$
|
|
43348
|
+
_optionalChain$i([window, 'optionalAccess', _2 => _2.backpack]) &&
|
|
43349
43349
|
window.backpack.isBackpack
|
|
43350
43350
|
)
|
|
43351
43351
|
};}
|
|
@@ -43440,7 +43440,7 @@ const submitSimpleTransfer$3 = ({ transaction, signer })=>{
|
|
|
43440
43440
|
})
|
|
43441
43441
|
};
|
|
43442
43442
|
|
|
43443
|
-
function _optionalChain$
|
|
43443
|
+
function _optionalChain$h(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; }
|
|
43444
43444
|
class WindowEthereum {
|
|
43445
43445
|
|
|
43446
43446
|
static __initStatic() {this.info = {
|
|
@@ -43451,17 +43451,17 @@ class WindowEthereum {
|
|
|
43451
43451
|
|
|
43452
43452
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43453
43453
|
return (
|
|
43454
|
-
_optionalChain$
|
|
43454
|
+
_optionalChain$h([window, 'optionalAccess', _23 => _23.ethereum]) &&
|
|
43455
43455
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length != 1 && // MetaMask
|
|
43456
|
-
!_optionalChain$
|
|
43457
|
-
!(_optionalChain$
|
|
43458
|
-
!_optionalChain$
|
|
43459
|
-
!_optionalChain$
|
|
43460
|
-
!_optionalChain$
|
|
43461
|
-
!_optionalChain$
|
|
43462
|
-
!_optionalChain$
|
|
43463
|
-
!_optionalChain$
|
|
43464
|
-
!(_optionalChain$
|
|
43456
|
+
!_optionalChain$h([window, 'optionalAccess', _24 => _24.coin98]) && // Coin98
|
|
43457
|
+
!(_optionalChain$h([window, 'optionalAccess', _25 => _25.ethereum, 'optionalAccess', _26 => _26.isTrust]) || _optionalChain$h([window, 'optionalAccess', _27 => _27.ethereum, 'optionalAccess', _28 => _28.isTrustWallet])) && // Trust Wallet
|
|
43458
|
+
!_optionalChain$h([window, 'optionalAccess', _29 => _29.ethereum, 'optionalAccess', _30 => _30.isDeficonnectProvider]) && // crypto.com
|
|
43459
|
+
!_optionalChain$h([window, 'optionalAccess', _31 => _31.ethereum, 'optionalAccess', _32 => _32.isHyperPay]) && // isHyperPay
|
|
43460
|
+
!_optionalChain$h([window, 'optionalAccess', _33 => _33.ethereum, 'optionalAccess', _34 => _34.isPhantom]) && // Phantom
|
|
43461
|
+
!_optionalChain$h([window, 'optionalAccess', _35 => _35.solana, 'optionalAccess', _36 => _36.isPhantom]) && // Phantom
|
|
43462
|
+
!_optionalChain$h([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isRabby]) && // Rabby
|
|
43463
|
+
!_optionalChain$h([window, 'optionalAccess', _39 => _39.backpack, 'optionalAccess', _40 => _40.isBackpack]) && // Backpack
|
|
43464
|
+
!(_optionalChain$h([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isCoinbaseWallet]) || _optionalChain$h([window, 'optionalAccess', _43 => _43.ethereum, 'optionalAccess', _44 => _44.isWalletLink]))
|
|
43465
43465
|
)
|
|
43466
43466
|
};}
|
|
43467
43467
|
|
|
@@ -43587,7 +43587,7 @@ class WindowEthereum {
|
|
|
43587
43587
|
}
|
|
43588
43588
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
43589
43589
|
|
|
43590
|
-
function _optionalChain$
|
|
43590
|
+
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; }
|
|
43591
43591
|
class Binance extends WindowEthereum {
|
|
43592
43592
|
|
|
43593
43593
|
static __initStatic() {this.info = {
|
|
@@ -43597,7 +43597,7 @@ class Binance extends WindowEthereum {
|
|
|
43597
43597
|
};}
|
|
43598
43598
|
|
|
43599
43599
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43600
|
-
return _optionalChain$
|
|
43600
|
+
return _optionalChain$g([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
43601
43601
|
!window.coin98
|
|
43602
43602
|
};}
|
|
43603
43603
|
|
|
@@ -43605,7 +43605,7 @@ class Binance extends WindowEthereum {
|
|
|
43605
43605
|
|
|
43606
43606
|
} Binance.__initStatic(); Binance.__initStatic2();
|
|
43607
43607
|
|
|
43608
|
-
function _optionalChain$
|
|
43608
|
+
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; }
|
|
43609
43609
|
class Brave extends WindowEthereum {
|
|
43610
43610
|
|
|
43611
43611
|
static __initStatic() {this.info = {
|
|
@@ -43614,10 +43614,10 @@ class Brave extends WindowEthereum {
|
|
|
43614
43614
|
blockchains: supported$2.evm
|
|
43615
43615
|
};}
|
|
43616
43616
|
|
|
43617
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43617
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$f([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
43618
43618
|
} Brave.__initStatic(); Brave.__initStatic2();
|
|
43619
43619
|
|
|
43620
|
-
function _optionalChain$
|
|
43620
|
+
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; }
|
|
43621
43621
|
class Coin98 extends WindowEthereum {
|
|
43622
43622
|
|
|
43623
43623
|
static __initStatic() {this.info = {
|
|
@@ -43626,10 +43626,10 @@ class Coin98 extends WindowEthereum {
|
|
|
43626
43626
|
blockchains: supported$2.evm
|
|
43627
43627
|
};}
|
|
43628
43628
|
|
|
43629
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43629
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
43630
43630
|
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
43631
43631
|
|
|
43632
|
-
function _optionalChain$
|
|
43632
|
+
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; }
|
|
43633
43633
|
class Coinbase extends WindowEthereum {
|
|
43634
43634
|
|
|
43635
43635
|
static __initStatic() {this.info = {
|
|
@@ -43638,10 +43638,10 @@ class Coinbase extends WindowEthereum {
|
|
|
43638
43638
|
blockchains: supported$2.evm
|
|
43639
43639
|
};}
|
|
43640
43640
|
|
|
43641
|
-
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$
|
|
43641
|
+
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$d([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$d([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
|
|
43642
43642
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
43643
43643
|
|
|
43644
|
-
function _optionalChain$
|
|
43644
|
+
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; }
|
|
43645
43645
|
class CryptoCom extends WindowEthereum {
|
|
43646
43646
|
|
|
43647
43647
|
static __initStatic() {this.info = {
|
|
@@ -43650,7 +43650,7 @@ class CryptoCom extends WindowEthereum {
|
|
|
43650
43650
|
blockchains: supported$2.evm
|
|
43651
43651
|
};}
|
|
43652
43652
|
|
|
43653
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43653
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
43654
43654
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
43655
43655
|
|
|
43656
43656
|
class Glow extends WindowSolana {
|
|
@@ -43669,7 +43669,7 @@ class Glow extends WindowSolana {
|
|
|
43669
43669
|
};}
|
|
43670
43670
|
} Glow.__initStatic(); Glow.__initStatic2();
|
|
43671
43671
|
|
|
43672
|
-
function _optionalChain$
|
|
43672
|
+
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; }
|
|
43673
43673
|
class HyperPay extends WindowEthereum {
|
|
43674
43674
|
|
|
43675
43675
|
static __initStatic() {this.info = {
|
|
@@ -43678,10 +43678,10 @@ class HyperPay extends WindowEthereum {
|
|
|
43678
43678
|
blockchains: supported$2.evm
|
|
43679
43679
|
};}
|
|
43680
43680
|
|
|
43681
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43681
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
43682
43682
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
43683
43683
|
|
|
43684
|
-
function _optionalChain$
|
|
43684
|
+
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; }
|
|
43685
43685
|
class MetaMask extends WindowEthereum {
|
|
43686
43686
|
|
|
43687
43687
|
static __initStatic() {this.info = {
|
|
@@ -43692,13 +43692,13 @@ class MetaMask extends WindowEthereum {
|
|
|
43692
43692
|
|
|
43693
43693
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43694
43694
|
return(
|
|
43695
|
-
_optionalChain$
|
|
43695
|
+
_optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) &&
|
|
43696
43696
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
43697
43697
|
)
|
|
43698
43698
|
};}
|
|
43699
43699
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
43700
43700
|
|
|
43701
|
-
function _optionalChain$
|
|
43701
|
+
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; }
|
|
43702
43702
|
class Opera extends WindowEthereum {
|
|
43703
43703
|
|
|
43704
43704
|
static __initStatic() {this.info = {
|
|
@@ -43707,7 +43707,7 @@ class Opera extends WindowEthereum {
|
|
|
43707
43707
|
blockchains: supported$2.evm
|
|
43708
43708
|
};}
|
|
43709
43709
|
|
|
43710
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43710
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
43711
43711
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
43712
43712
|
|
|
43713
43713
|
class Phantom extends WindowSolana {
|
|
@@ -43725,7 +43725,7 @@ class Phantom extends WindowSolana {
|
|
|
43725
43725
|
};}
|
|
43726
43726
|
} Phantom.__initStatic(); Phantom.__initStatic2();
|
|
43727
43727
|
|
|
43728
|
-
function _optionalChain$
|
|
43728
|
+
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; }
|
|
43729
43729
|
class Rabby extends WindowEthereum {
|
|
43730
43730
|
|
|
43731
43731
|
static __initStatic() {this.info = {
|
|
@@ -43736,12 +43736,12 @@ class Rabby extends WindowEthereum {
|
|
|
43736
43736
|
|
|
43737
43737
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43738
43738
|
return(
|
|
43739
|
-
_optionalChain$
|
|
43739
|
+
_optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
43740
43740
|
)
|
|
43741
43741
|
};}
|
|
43742
43742
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
43743
43743
|
|
|
43744
|
-
function _optionalChain$
|
|
43744
|
+
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; }
|
|
43745
43745
|
const KEY$2 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
|
|
43746
43746
|
|
|
43747
43747
|
const base64StringToPublicKey = (base64String)=> {
|
|
@@ -43830,8 +43830,8 @@ class SolanaMobileWalletAdapter {
|
|
|
43830
43830
|
await transact(
|
|
43831
43831
|
async (wallet) => {
|
|
43832
43832
|
await this.authorize(wallet);
|
|
43833
|
-
if(_optionalChain$
|
|
43834
|
-
if(_optionalChain$
|
|
43833
|
+
if(_optionalChain$7([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
|
|
43834
|
+
if(_optionalChain$7([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
|
|
43835
43835
|
}
|
|
43836
43836
|
);
|
|
43837
43837
|
return this._account
|
|
@@ -43890,7 +43890,7 @@ class SolanaMobileWalletAdapter {
|
|
|
43890
43890
|
}
|
|
43891
43891
|
} SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
|
|
43892
43892
|
|
|
43893
|
-
function _optionalChain$
|
|
43893
|
+
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; }
|
|
43894
43894
|
class Solflare extends WindowSolana {
|
|
43895
43895
|
|
|
43896
43896
|
static __initStatic() {this.info = {
|
|
@@ -43901,7 +43901,7 @@ class Solflare extends WindowSolana {
|
|
|
43901
43901
|
|
|
43902
43902
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43903
43903
|
return (
|
|
43904
|
-
_optionalChain$
|
|
43904
|
+
_optionalChain$6([window, 'optionalAccess', _2 => _2.solflare]) &&
|
|
43905
43905
|
window.solflare.isSolflare
|
|
43906
43906
|
)
|
|
43907
43907
|
};}
|
|
@@ -43911,7 +43911,7 @@ class Solflare extends WindowSolana {
|
|
|
43911
43911
|
_sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
|
|
43912
43912
|
} Solflare.__initStatic(); Solflare.__initStatic2();
|
|
43913
43913
|
|
|
43914
|
-
function _optionalChain$
|
|
43914
|
+
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; }
|
|
43915
43915
|
class Trust extends WindowEthereum {
|
|
43916
43916
|
|
|
43917
43917
|
static __initStatic() {this.info = {
|
|
@@ -43920,7 +43920,7 @@ class Trust extends WindowEthereum {
|
|
|
43920
43920
|
blockchains: supported$2.evm
|
|
43921
43921
|
};}
|
|
43922
43922
|
|
|
43923
|
-
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$
|
|
43923
|
+
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$5([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$5([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
|
|
43924
43924
|
} Trust.__initStatic(); Trust.__initStatic2();
|
|
43925
43925
|
|
|
43926
43926
|
const transactionApiBlockchainNames = {
|
|
@@ -44012,7 +44012,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
|
|
|
44012
44012
|
}
|
|
44013
44013
|
};
|
|
44014
44014
|
|
|
44015
|
-
function _optionalChain$
|
|
44015
|
+
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; }
|
|
44016
44016
|
|
|
44017
44017
|
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
44018
44018
|
transaction = new Transaction(transaction);
|
|
@@ -44092,7 +44092,7 @@ const submit$2 = ({ transaction, wallet }) => {
|
|
|
44092
44092
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
44093
44093
|
const provider = await getProvider$3(transaction.blockchain);
|
|
44094
44094
|
let gasPrice = await provider.getGasPrice();
|
|
44095
|
-
if(_optionalChain$
|
|
44095
|
+
if(_optionalChain$4([wallet, 'access', _ => _.session, 'optionalAccess', _2 => _2.peerMeta, 'optionalAccess', _3 => _3.name]) === 'Uniswap Wallet') {
|
|
44096
44096
|
gasPrice = undefined;
|
|
44097
44097
|
} else {
|
|
44098
44098
|
gasPrice = gasPrice.toHexString();
|
|
@@ -44116,7 +44116,7 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
44116
44116
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
44117
44117
|
const provider = await getProvider$3(transaction.blockchain);
|
|
44118
44118
|
let gasPrice = await provider.getGasPrice();
|
|
44119
|
-
if(_optionalChain$
|
|
44119
|
+
if(_optionalChain$4([wallet, 'access', _4 => _4.session, 'optionalAccess', _5 => _5.peerMeta, 'optionalAccess', _6 => _6.name]) === 'Uniswap Wallet') {
|
|
44120
44120
|
gasPrice = undefined;
|
|
44121
44121
|
} else {
|
|
44122
44122
|
gasPrice = gasPrice.toHexString();
|
|
@@ -44135,7 +44135,7 @@ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
|
44135
44135
|
})
|
|
44136
44136
|
};
|
|
44137
44137
|
|
|
44138
|
-
function _optionalChain$
|
|
44138
|
+
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; }
|
|
44139
44139
|
|
|
44140
44140
|
const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
44141
44141
|
|
|
@@ -44184,7 +44184,7 @@ const getConnectedInstance$2 = async()=>{
|
|
|
44184
44184
|
if(await isConnected()) { return new WalletConnectV1() }
|
|
44185
44185
|
};
|
|
44186
44186
|
|
|
44187
|
-
const setConnectedInstance$
|
|
44187
|
+
const setConnectedInstance$1 = (value)=>{
|
|
44188
44188
|
window[KEY$1] = value;
|
|
44189
44189
|
};
|
|
44190
44190
|
|
|
@@ -44223,7 +44223,7 @@ class WalletConnectV1 {
|
|
|
44223
44223
|
}
|
|
44224
44224
|
|
|
44225
44225
|
disconnect() {
|
|
44226
|
-
setConnectedInstance$
|
|
44226
|
+
setConnectedInstance$1(undefined);
|
|
44227
44227
|
localStorage[KEY$1+'_name'] = undefined;
|
|
44228
44228
|
localStorage[KEY$1+'_logo'] = undefined;
|
|
44229
44229
|
currentPlainInstance = undefined;
|
|
@@ -44239,7 +44239,7 @@ class WalletConnectV1 {
|
|
|
44239
44239
|
});
|
|
44240
44240
|
|
|
44241
44241
|
instance.on("modal_closed", ()=>{
|
|
44242
|
-
setConnectedInstance$
|
|
44242
|
+
setConnectedInstance$1(undefined);
|
|
44243
44243
|
this.connector = undefined;
|
|
44244
44244
|
this.session = undefined;
|
|
44245
44245
|
});
|
|
@@ -44278,11 +44278,11 @@ class WalletConnectV1 {
|
|
|
44278
44278
|
let session = await this.connector.connect();
|
|
44279
44279
|
this.session = session;
|
|
44280
44280
|
|
|
44281
|
-
if(_optionalChain$
|
|
44282
|
-
if(_optionalChain$
|
|
44281
|
+
if(_optionalChain$3([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
44282
|
+
if(_optionalChain$3([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
44283
44283
|
|
|
44284
44284
|
if(session.accounts instanceof Array && session.accounts.length) {
|
|
44285
|
-
setConnectedInstance$
|
|
44285
|
+
setConnectedInstance$1(this);
|
|
44286
44286
|
return ethers.utils.getAddress(session.accounts[0])
|
|
44287
44287
|
} else {
|
|
44288
44288
|
return
|
|
@@ -44421,9 +44421,9 @@ class WalletConnectV1 {
|
|
|
44421
44421
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
44422
44422
|
|
|
44423
44423
|
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
44424
|
-
WalletConnectV1.setConnectedInstance = setConnectedInstance$
|
|
44424
|
+
WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
|
|
44425
44425
|
|
|
44426
|
-
function _optionalChain$
|
|
44426
|
+
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; }
|
|
44427
44427
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
44428
44428
|
transaction = new Transaction(transaction);
|
|
44429
44429
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -44507,14 +44507,14 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
44507
44507
|
params: [{
|
|
44508
44508
|
from: transaction.from,
|
|
44509
44509
|
to: transaction.to,
|
|
44510
|
-
value: _optionalChain$
|
|
44510
|
+
value: _optionalChain$2([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
|
|
44511
44511
|
data: await transaction.getData(),
|
|
44512
44512
|
gas: gas.toHexString(),
|
|
44513
44513
|
gasPrice: gasPrice.toHexString(),
|
|
44514
44514
|
nonce: transaction.nonce,
|
|
44515
44515
|
}]
|
|
44516
44516
|
}
|
|
44517
|
-
})
|
|
44517
|
+
}).catch((e)=>{console.log('ERROR', e);})
|
|
44518
44518
|
};
|
|
44519
44519
|
|
|
44520
44520
|
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
@@ -44530,7 +44530,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
44530
44530
|
params: [{
|
|
44531
44531
|
from: transaction.from,
|
|
44532
44532
|
to: transaction.to,
|
|
44533
|
-
value: _optionalChain$
|
|
44533
|
+
value: _optionalChain$2([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
|
|
44534
44534
|
gas: gas.toHexString(),
|
|
44535
44535
|
gasPrice: gasPrice.toHexString(),
|
|
44536
44536
|
nonce: transaction.nonce
|
|
@@ -44539,76 +44539,106 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
44539
44539
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
44540
44540
|
};
|
|
44541
44541
|
|
|
44542
|
-
function _optionalChain(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; }
|
|
44542
|
+
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; }
|
|
44543
44543
|
const KEY = 'depay:wallets:wc2';
|
|
44544
44544
|
|
|
44545
|
-
|
|
44546
|
-
|
|
44547
|
-
|
|
44548
|
-
|
|
44549
|
-
|
|
44550
|
-
|
|
44551
|
-
|
|
44552
|
-
if
|
|
44553
|
-
|
|
44545
|
+
// configurations for wallets that require special handling
|
|
44546
|
+
const CONFIGURATIONS = {
|
|
44547
|
+
|
|
44548
|
+
"MetaMask": {
|
|
44549
|
+
methods: [
|
|
44550
|
+
"eth_sendTransaction",
|
|
44551
|
+
"personal_sign",
|
|
44552
|
+
"eth_chainId", // only add eth_chainId if you do not trust the wallet provided chainIds!
|
|
44553
|
+
"eth_signTypedData",
|
|
44554
|
+
"eth_signTypedData_v4",
|
|
44555
|
+
"wallet_switchEthereumChain"
|
|
44556
|
+
]
|
|
44557
|
+
},
|
|
44558
|
+
|
|
44559
|
+
"Uniswap Wallet": {
|
|
44560
|
+
methods: [
|
|
44561
|
+
"eth_sendTransaction",
|
|
44562
|
+
"personal_sign",
|
|
44563
|
+
"eth_signTypedData",
|
|
44564
|
+
"eth_signTypedData_v4",
|
|
44565
|
+
],
|
|
44566
|
+
requiredNamespaces: {
|
|
44567
|
+
eip155: {
|
|
44568
|
+
chains: ['ethereum', 'polygon', 'arbitrum', 'optimism'].map((blockchainName)=>`eip155:${Blockchains[blockchainName].networkId}`)
|
|
44554
44569
|
}
|
|
44555
|
-
}
|
|
44556
|
-
|
|
44570
|
+
},
|
|
44571
|
+
optionalNamespaces: {},
|
|
44572
|
+
},
|
|
44573
|
+
|
|
44574
|
+
"Enjin Wallet": {
|
|
44575
|
+
methods: [
|
|
44576
|
+
"eth_sendTransaction",
|
|
44577
|
+
"personal_sign",
|
|
44578
|
+
"eth_signTypedData",
|
|
44579
|
+
]
|
|
44580
|
+
},
|
|
44581
|
+
|
|
44557
44582
|
};
|
|
44558
44583
|
|
|
44559
|
-
const
|
|
44560
|
-
|
|
44561
|
-
|
|
44562
|
-
|
|
44563
|
-
|
|
44564
|
-
|
|
44565
|
-
|
|
44566
|
-
|
|
44567
|
-
method: 'eth_chainId'
|
|
44568
|
-
}
|
|
44569
|
-
})
|
|
44570
|
-
])
|
|
44571
|
-
})));
|
|
44572
|
-
return results.filter(Boolean)[0]
|
|
44584
|
+
const DEFAULT_CONFIGURATION = {
|
|
44585
|
+
events: ['accountsChanged'],
|
|
44586
|
+
methods: [
|
|
44587
|
+
"eth_sendTransaction",
|
|
44588
|
+
"personal_sign",
|
|
44589
|
+
"eth_signTypedData",
|
|
44590
|
+
"eth_signTypedData_v4",
|
|
44591
|
+
]
|
|
44573
44592
|
};
|
|
44574
44593
|
|
|
44575
44594
|
const getConnectedInstance$1 = async()=>{
|
|
44576
|
-
if(
|
|
44577
|
-
const lastSession = await getLastSession();
|
|
44578
|
-
if(lastSession) {
|
|
44579
|
-
return new WalletConnectV2()
|
|
44580
|
-
}
|
|
44581
|
-
}
|
|
44595
|
+
if(await WalletConnectV2.isAvailable()) { return new WalletConnectV2() }
|
|
44582
44596
|
};
|
|
44583
44597
|
|
|
44584
|
-
const
|
|
44598
|
+
const getLastSession = async(walletName)=>{
|
|
44599
|
+
if(!localStorage[KEY+":projectId"]) { return }
|
|
44600
|
+
if(walletName !== localStorage[KEY+":lastSessionWalletName"]) { return }
|
|
44601
|
+
let signClient = await getSignClient();
|
|
44602
|
+
const existingSessions = signClient.find(getWalletConnectV2Config(walletName));
|
|
44603
|
+
const lastSession = existingSessions ? existingSessions[existingSessions.length-1] : undefined;
|
|
44604
|
+
if(lastSession && localStorage[KEY+":lastExpiredSessionTopic"] !== lastSession.topic && lastSession.expiry > Math.ceil(Date.now()/1000)) {
|
|
44605
|
+
const result = await Promise.race([signClient.ping({ topic: lastSession.topic }), new Promise((resolve)=>setTimeout(resolve, 1500))]);
|
|
44606
|
+
if(result) {
|
|
44607
|
+
return lastSession
|
|
44608
|
+
} else {
|
|
44609
|
+
localStorage[KEY+":lastExpiredSessionTopic"] = lastSession.topic;
|
|
44610
|
+
return
|
|
44611
|
+
}
|
|
44612
|
+
}
|
|
44585
44613
|
};
|
|
44586
44614
|
|
|
44587
|
-
const getWalletConnectV2Config = ()=>{
|
|
44588
|
-
const methods = [
|
|
44589
|
-
|
|
44590
|
-
"personal_sign",
|
|
44591
|
-
"eth_signTypedData_v4",
|
|
44592
|
-
"eth_chainId",
|
|
44593
|
-
"eth_accounts",
|
|
44594
|
-
"wallet_switchEthereumChain",
|
|
44595
|
-
];
|
|
44596
|
-
|
|
44597
|
-
const events = ['accountsChanged'];
|
|
44615
|
+
const getWalletConnectV2Config = (walletName)=>{
|
|
44616
|
+
const methods = _optionalChain$1([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
|
|
44617
|
+
const events = _optionalChain$1([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
|
|
44598
44618
|
|
|
44599
44619
|
let requiredNamespaces = {};
|
|
44600
|
-
|
|
44601
|
-
|
|
44602
|
-
|
|
44603
|
-
|
|
44604
|
-
|
|
44620
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
|
|
44621
|
+
requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
|
|
44622
|
+
} else {
|
|
44623
|
+
requiredNamespaces['eip155'] = {
|
|
44624
|
+
chains: [`eip155:1`],
|
|
44625
|
+
};
|
|
44626
|
+
}
|
|
44627
|
+
requiredNamespaces['eip155'].methods = methods;
|
|
44628
|
+
requiredNamespaces['eip155'].events = events;
|
|
44605
44629
|
|
|
44606
44630
|
let optionalNamespaces = {};
|
|
44607
|
-
|
|
44608
|
-
|
|
44609
|
-
|
|
44610
|
-
|
|
44611
|
-
|
|
44631
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
|
|
44632
|
+
optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
|
|
44633
|
+
} else {
|
|
44634
|
+
optionalNamespaces['eip155'] = {
|
|
44635
|
+
chains: supported$2.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
|
|
44636
|
+
};
|
|
44637
|
+
}
|
|
44638
|
+
if(_optionalChain$1([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$1([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
|
|
44639
|
+
optionalNamespaces['eip155'].methods = methods;
|
|
44640
|
+
optionalNamespaces['eip155'].events = events;
|
|
44641
|
+
}
|
|
44612
44642
|
|
|
44613
44643
|
return { requiredNamespaces, optionalNamespaces }
|
|
44614
44644
|
};
|
|
@@ -44617,18 +44647,18 @@ const getSignClient = ()=>{
|
|
|
44617
44647
|
if(window.getSignClientPromise) { return window.getSignClientPromise }
|
|
44618
44648
|
window.getSignClientPromise = new Promise(async(resolve)=>{
|
|
44619
44649
|
const signClient = await SignClient.init({
|
|
44620
|
-
|
|
44650
|
+
projectId: localStorage[KEY+":projectId"],
|
|
44621
44651
|
metadata: {
|
|
44622
44652
|
name: document.title || 'dApp',
|
|
44623
|
-
description: _optionalChain([document, 'access',
|
|
44653
|
+
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',
|
|
44624
44654
|
url: location.href,
|
|
44625
|
-
icons: [_optionalChain([document, 'access',
|
|
44655
|
+
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`]
|
|
44626
44656
|
}
|
|
44627
44657
|
});
|
|
44628
44658
|
resolve(signClient);
|
|
44629
44659
|
});
|
|
44630
44660
|
|
|
44631
|
-
return window.getSignClientPromise
|
|
44661
|
+
return window.getSignClientPromise
|
|
44632
44662
|
};
|
|
44633
44663
|
|
|
44634
44664
|
class WalletConnectV2 {
|
|
@@ -44639,14 +44669,13 @@ class WalletConnectV2 {
|
|
|
44639
44669
|
blockchains: supported$2.evm
|
|
44640
44670
|
};}
|
|
44641
44671
|
|
|
44642
|
-
static __initStatic2() {this.isAvailable = ()=>{
|
|
44643
|
-
return
|
|
44672
|
+
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
44673
|
+
return !! await getLastSession(_optionalChain$1([options, 'optionalAccess', _21 => _21.walletName]))
|
|
44644
44674
|
};}
|
|
44645
44675
|
|
|
44646
44676
|
constructor() {
|
|
44647
44677
|
this.name = (localStorage[KEY+':name'] && localStorage[KEY+':name'] != undefined) ? localStorage[KEY+':name'] : this.constructor.info.name;
|
|
44648
44678
|
this.logo = (localStorage[KEY+':logo'] && localStorage[KEY+':logo'] != undefined) ? localStorage[KEY+':logo'] : this.constructor.info.logo;
|
|
44649
|
-
this.blockchains = this.constructor.info.blockchains;
|
|
44650
44679
|
this.sendTransaction = (transaction)=>{
|
|
44651
44680
|
return sendTransaction$2({
|
|
44652
44681
|
wallet: this,
|
|
@@ -44656,17 +44685,57 @@ class WalletConnectV2 {
|
|
|
44656
44685
|
}
|
|
44657
44686
|
|
|
44658
44687
|
async account() {
|
|
44659
|
-
|
|
44660
|
-
|
|
44661
|
-
|
|
44662
|
-
|
|
44663
|
-
|
|
44664
|
-
|
|
44665
|
-
|
|
44666
|
-
|
|
44667
|
-
|
|
44668
|
-
|
|
44669
|
-
|
|
44688
|
+
if(_optionalChain$1([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
|
|
44689
|
+
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
44690
|
+
}
|
|
44691
|
+
}
|
|
44692
|
+
|
|
44693
|
+
async getAllAvailableBlockchains() {
|
|
44694
|
+
let timeTillResponse = new Date();
|
|
44695
|
+
await Promise.race([...
|
|
44696
|
+
this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
|
|
44697
|
+
return new Promise((resolve)=>{
|
|
44698
|
+
try {
|
|
44699
|
+
this.signClient.request({
|
|
44700
|
+
topic: this.session.topic,
|
|
44701
|
+
chainId: chainIdentifier,
|
|
44702
|
+
request:{
|
|
44703
|
+
method: 'eth_chainId',
|
|
44704
|
+
}
|
|
44705
|
+
}).then(resolve);
|
|
44706
|
+
} catch (e) {}
|
|
44707
|
+
})
|
|
44708
|
+
}),
|
|
44709
|
+
new Promise(resolve=>setTimeout(resolve, 6000))
|
|
44710
|
+
]);
|
|
44711
|
+
timeTillResponse = new Date() - timeTillResponse;
|
|
44712
|
+
|
|
44713
|
+
let blockchains = [];
|
|
44714
|
+
await Promise.race([
|
|
44715
|
+
Promise.all(this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
|
|
44716
|
+
try {
|
|
44717
|
+
return this.signClient.request({
|
|
44718
|
+
topic: this.session.topic,
|
|
44719
|
+
chainId: chainIdentifier,
|
|
44720
|
+
request:{
|
|
44721
|
+
method: 'eth_chainId',
|
|
44722
|
+
}
|
|
44723
|
+
}).then(()=> blockchains.push(Blockchains.findByNetworkId(chainIdentifier.split(':')[1]).name))
|
|
44724
|
+
} catch (e2) {}
|
|
44725
|
+
})),
|
|
44726
|
+
new Promise(resolve => setTimeout(resolve, timeTillResponse*2))
|
|
44727
|
+
]);
|
|
44728
|
+
return blockchains
|
|
44729
|
+
}
|
|
44730
|
+
|
|
44731
|
+
async setSessionBlockchains() {
|
|
44732
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _27 => _27[this.walletName], 'optionalAccess', _28 => _28.methods, 'optionalAccess', _29 => _29.includes, 'call', _30 => _30('eth_chainId')])) {
|
|
44733
|
+
this.blockchains = await this.getAllAvailableBlockchains();
|
|
44734
|
+
} else if(this.session.namespaces.eip155.chains) {
|
|
44735
|
+
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$1([Blockchains, 'access', _31 => _31.findByNetworkId, 'call', _32 => _32(chainIdentifier.split(':')[1]), 'optionalAccess', _33 => _33.name])).filter(Boolean);
|
|
44736
|
+
} else if(this.session.namespaces.eip155.accounts) {
|
|
44737
|
+
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$1([Blockchains, 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(accountIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
|
|
44738
|
+
}
|
|
44670
44739
|
}
|
|
44671
44740
|
|
|
44672
44741
|
async connect(options) {
|
|
@@ -44675,65 +44744,59 @@ class WalletConnectV2 {
|
|
|
44675
44744
|
|
|
44676
44745
|
try {
|
|
44677
44746
|
|
|
44678
|
-
|
|
44747
|
+
this.walletName = _optionalChain$1([options, 'optionalAccess', _37 => _37.name]);
|
|
44748
|
+
|
|
44749
|
+
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
44679
44750
|
this.signClient = await getSignClient();
|
|
44680
44751
|
|
|
44681
44752
|
this.signClient.on("session_delete", (session)=> {
|
|
44682
|
-
if(_optionalChain([session, 'optionalAccess',
|
|
44753
|
+
if(_optionalChain$1([session, 'optionalAccess', _38 => _38.topic]) === _optionalChain$1([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {
|
|
44683
44754
|
localStorage[KEY+':name'] = undefined;
|
|
44684
44755
|
localStorage[KEY+':logo'] = undefined;
|
|
44685
|
-
WalletConnect.instance = undefined;
|
|
44686
44756
|
this.signClient = undefined;
|
|
44687
44757
|
this.session = undefined;
|
|
44688
44758
|
}
|
|
44689
44759
|
});
|
|
44690
44760
|
|
|
44691
44761
|
this.signClient.on("session_update", async(session)=> {
|
|
44692
|
-
if(_optionalChain([session, 'optionalAccess',
|
|
44762
|
+
if(_optionalChain$1([session, 'optionalAccess', _41 => _41.topic]) === _optionalChain$1([this, 'access', _42 => _42.session, 'optionalAccess', _43 => _43.topic])) {
|
|
44693
44763
|
this.session = this.signClient.session.get(session.topic);
|
|
44764
|
+
await this.setSessionBlockchains();
|
|
44694
44765
|
}
|
|
44695
44766
|
});
|
|
44696
44767
|
|
|
44697
44768
|
this.signClient.on("session_event", (event)=> {
|
|
44698
|
-
if(_optionalChain([event, 'optionalAccess',
|
|
44699
|
-
}
|
|
44769
|
+
if(_optionalChain$1([event, 'optionalAccess', _44 => _44.topic]) === _optionalChain$1([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {}
|
|
44700
44770
|
});
|
|
44701
44771
|
|
|
44702
|
-
const lastSession = await getLastSession();
|
|
44703
|
-
if(lastSession) {
|
|
44704
|
-
this.session = lastSession;
|
|
44705
|
-
}
|
|
44706
|
-
|
|
44707
44772
|
const connectWallet = async()=>{
|
|
44708
|
-
const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config());
|
|
44773
|
+
const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config(this.walletName));
|
|
44709
44774
|
await connect({ uri });
|
|
44710
44775
|
this.session = await approval();
|
|
44776
|
+
localStorage[KEY+":lastSessionWalletName"] = this.walletName;
|
|
44777
|
+
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
44711
44778
|
};
|
|
44712
44779
|
|
|
44713
|
-
|
|
44780
|
+
const lastSession = _optionalChain$1([this, 'optionalAccess', _47 => _47.walletName, 'optionalAccess', _48 => _48.length]) ? await getLastSession(this.walletName) : undefined;
|
|
44781
|
+
if(lastSession) {
|
|
44782
|
+
this.session = lastSession;
|
|
44783
|
+
} else {
|
|
44784
|
+
await connectWallet();
|
|
44785
|
+
}
|
|
44714
44786
|
|
|
44715
|
-
let meta = _optionalChain([this, 'access',
|
|
44787
|
+
let meta = _optionalChain$1([this, 'access', _49 => _49.session, 'optionalAccess', _50 => _50.peer, 'optionalAccess', _51 => _51.metadata]);
|
|
44716
44788
|
if(meta && meta.name) {
|
|
44717
44789
|
this.name = meta.name;
|
|
44718
44790
|
localStorage[KEY+':name'] = meta.name;
|
|
44719
|
-
if(_optionalChain([meta, 'optionalAccess',
|
|
44791
|
+
if(_optionalChain$1([meta, 'optionalAccess', _52 => _52.icons]) && meta.icons.length) {
|
|
44720
44792
|
this.logo = meta.icons[0];
|
|
44721
44793
|
localStorage[KEY+':logo'] = this.logo;
|
|
44722
44794
|
}
|
|
44723
44795
|
}
|
|
44724
|
-
if(_optionalChain([options, 'optionalAccess',
|
|
44725
|
-
if(_optionalChain([options, 'optionalAccess',
|
|
44726
|
-
|
|
44727
|
-
let connectedChainId;
|
|
44728
|
-
for(var i = 0; i<3; i++) {
|
|
44729
|
-
await new Promise((resolve)=>{setTimeout(resolve, 500);});
|
|
44730
|
-
connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
44731
|
-
if(connectedChainId){ break }
|
|
44732
|
-
}
|
|
44733
|
-
|
|
44734
|
-
if(!connectedChainId) { await connectWallet(); }
|
|
44796
|
+
if(_optionalChain$1([options, 'optionalAccess', _53 => _53.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
44797
|
+
if(_optionalChain$1([options, 'optionalAccess', _54 => _54.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
44735
44798
|
|
|
44736
|
-
|
|
44799
|
+
await this.setSessionBlockchains();
|
|
44737
44800
|
|
|
44738
44801
|
return await this.account()
|
|
44739
44802
|
|
|
@@ -44743,42 +44806,37 @@ class WalletConnectV2 {
|
|
|
44743
44806
|
}
|
|
44744
44807
|
|
|
44745
44808
|
async connectedTo(input) {
|
|
44746
|
-
let chainId = await getConnectedChainId(this.signClient, this.session);
|
|
44747
|
-
if(!chainId) { return false }
|
|
44748
|
-
const blockchain = Blockchains.findById(chainId);
|
|
44749
|
-
if(!blockchain) { return false }
|
|
44750
44809
|
if(input) {
|
|
44751
|
-
return input
|
|
44810
|
+
return this.blockchains.indexOf(input) > -1
|
|
44752
44811
|
} else {
|
|
44753
|
-
return
|
|
44812
|
+
return this.blockchains
|
|
44754
44813
|
}
|
|
44755
44814
|
}
|
|
44756
44815
|
|
|
44816
|
+
getValidChainId() {
|
|
44817
|
+
return `eip155:${Blockchains[this.blockchains[0]].networkId}`
|
|
44818
|
+
}
|
|
44819
|
+
|
|
44757
44820
|
switchTo(blockchainName) {
|
|
44758
44821
|
return new Promise((resolve, reject)=>{
|
|
44759
|
-
|
|
44822
|
+
|
|
44760
44823
|
const blockchain = Blockchains[blockchainName];
|
|
44761
|
-
|
|
44762
|
-
|
|
44763
|
-
|
|
44764
|
-
|
|
44765
|
-
this.
|
|
44766
|
-
|
|
44767
|
-
|
|
44768
|
-
|
|
44769
|
-
|
|
44770
|
-
|
|
44771
|
-
|
|
44772
|
-
this.
|
|
44773
|
-
|
|
44774
|
-
|
|
44775
|
-
|
|
44776
|
-
|
|
44777
|
-
params: [{ chainId: blockchain.id }],
|
|
44778
|
-
}
|
|
44779
|
-
})
|
|
44780
|
-
])
|
|
44781
|
-
});
|
|
44824
|
+
|
|
44825
|
+
Promise.race([
|
|
44826
|
+
this.signClient.request({
|
|
44827
|
+
topic: this.session.topic,
|
|
44828
|
+
chainId: this.getValidChainId(),
|
|
44829
|
+
request:{
|
|
44830
|
+
method: 'wallet_switchEthereumChain',
|
|
44831
|
+
params: [{ chainId: blockchain.id }],
|
|
44832
|
+
}
|
|
44833
|
+
}),
|
|
44834
|
+
new Promise((resolve, reject)=>setTimeout(()=>{
|
|
44835
|
+
if(this.blockchains.indexOf(blockchainName) === -1) {
|
|
44836
|
+
reject({ code: 'NOT_SUPPORTED' });
|
|
44837
|
+
}
|
|
44838
|
+
} , 8000))
|
|
44839
|
+
]).catch(reject);
|
|
44782
44840
|
})
|
|
44783
44841
|
}
|
|
44784
44842
|
|
|
@@ -44793,7 +44851,7 @@ class WalletConnectV2 {
|
|
|
44793
44851
|
switch (event) {
|
|
44794
44852
|
case 'account':
|
|
44795
44853
|
internalCallback = async(event)=> {
|
|
44796
|
-
if(_optionalChain([event, 'optionalAccess',
|
|
44854
|
+
if(_optionalChain$1([event, 'optionalAccess', _55 => _55.topic]) === _optionalChain$1([this, 'access', _56 => _56.session, 'optionalAccess', _57 => _57.topic]) && event.params.event.name === 'accountsChanged') {
|
|
44797
44855
|
callback(await this.account());
|
|
44798
44856
|
}
|
|
44799
44857
|
};
|
|
@@ -44814,13 +44872,9 @@ class WalletConnectV2 {
|
|
|
44814
44872
|
async sign(message) {
|
|
44815
44873
|
if(typeof message === 'object') {
|
|
44816
44874
|
let account = await this.account();
|
|
44817
|
-
const blockchain = Blockchains.findByNetworkId(message.domain.chainId);
|
|
44818
|
-
if((await this.connectedTo(blockchain.name)) === false) {
|
|
44819
|
-
throw({ code: 'WRONG_NETWORK' })
|
|
44820
|
-
}
|
|
44821
44875
|
let signature = await this.signClient.request({
|
|
44822
44876
|
topic: this.session.topic,
|
|
44823
|
-
chainId:
|
|
44877
|
+
chainId: this.getValidChainId(),
|
|
44824
44878
|
request:{
|
|
44825
44879
|
method: 'eth_signTypedData_v4',
|
|
44826
44880
|
params: [account, JSON.stringify(message)],
|
|
@@ -44830,11 +44884,9 @@ class WalletConnectV2 {
|
|
|
44830
44884
|
} else if (typeof message === 'string') {
|
|
44831
44885
|
const address = await this.account();
|
|
44832
44886
|
const params = [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), address];
|
|
44833
|
-
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
44834
|
-
const blockchain = Blockchains.findById(connectedChainId);
|
|
44835
44887
|
let signature = await this.signClient.request({
|
|
44836
44888
|
topic: this.session.topic,
|
|
44837
|
-
chainId:
|
|
44889
|
+
chainId: this.getValidChainId(),
|
|
44838
44890
|
request:{
|
|
44839
44891
|
method: 'personal_sign',
|
|
44840
44892
|
params
|
|
@@ -44849,7 +44901,6 @@ class WalletConnectV2 {
|
|
|
44849
44901
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
44850
44902
|
|
|
44851
44903
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
44852
|
-
WalletConnectV2.setConnectedInstance = setConnectedInstance$1;
|
|
44853
44904
|
|
|
44854
44905
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
44855
44906
|
transaction = new Transaction(transaction);
|
|
@@ -44926,6 +44977,7 @@ const submitSimpleTransfer = ({ transaction, signer })=>{
|
|
|
44926
44977
|
})
|
|
44927
44978
|
};
|
|
44928
44979
|
|
|
44980
|
+
function _optionalChain(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; }
|
|
44929
44981
|
const getConnectedInstance = ()=>{
|
|
44930
44982
|
return window._connectedWalletLinkInstance
|
|
44931
44983
|
};
|
|
@@ -44968,8 +45020,20 @@ class WalletLink {
|
|
|
44968
45020
|
}
|
|
44969
45021
|
|
|
44970
45022
|
async connect(options) {
|
|
45023
|
+
let connect = (options && options.connect) ? options.connect : ({uri})=>{};
|
|
45024
|
+
|
|
45025
|
+
await connect({ uri: this.connector.qrUrl });
|
|
45026
|
+
|
|
45027
|
+
_optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2('.-cbwsdk-extension-dialog-container'), 'optionalAccess', _3 => _3.setAttribute, 'call', _4 => _4('style', 'display: none;')]);
|
|
45028
|
+
setTimeout(()=>{
|
|
45029
|
+
if(_optionalChain([this, 'optionalAccess', _5 => _5.connector, 'optionalAccess', _6 => _6._relay, 'optionalAccess', _7 => _7.ui, 'optionalAccess', _8 => _8.linkFlow, 'optionalAccess', _9 => _9.isOpen])){
|
|
45030
|
+
this.connector._relay.ui.linkFlow.isOpen = false;
|
|
45031
|
+
}
|
|
45032
|
+
}, 10);
|
|
45033
|
+
|
|
44971
45034
|
let relay = await this.connector._relayProvider();
|
|
44972
45035
|
relay.setConnectDisabled(false);
|
|
45036
|
+
|
|
44973
45037
|
let accounts = await this.connector.enable();
|
|
44974
45038
|
if(accounts instanceof Array && accounts.length) {
|
|
44975
45039
|
setConnectedInstance(this);
|