@depay/web3-wallets-evm 15.16.3 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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/umd/index.solana.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
var Blockchains__default = /*#__PURE__*/_interopDefaultLegacy(Blockchains);
|
|
10
10
|
|
|
11
|
-
function _optionalChain$
|
|
11
|
+
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; }
|
|
12
12
|
class Transaction {
|
|
13
13
|
|
|
14
14
|
constructor({
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
|
|
34
34
|
|
|
35
35
|
// optional
|
|
36
|
-
this.value = _optionalChain$
|
|
36
|
+
this.value = _optionalChain$l([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
37
37
|
this.api = api;
|
|
38
38
|
this.method = method;
|
|
39
39
|
this.params = params;
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
function _optionalChain$
|
|
141
|
+
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; }
|
|
142
142
|
|
|
143
143
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
144
144
|
const MAX_POLLS = 240; // 120 seconds
|
|
@@ -159,14 +159,14 @@
|
|
|
159
159
|
|
|
160
160
|
const provider = await web3ClientSolana.getProvider(transaction.blockchain);
|
|
161
161
|
const { value } = await provider.getSignatureStatus(signature);
|
|
162
|
-
const confirmationStatus = _optionalChain$
|
|
162
|
+
const confirmationStatus = _optionalChain$k([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
163
163
|
if(confirmationStatus) {
|
|
164
164
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
165
165
|
if (hasReachedSufficientCommitment) {
|
|
166
166
|
if(value.err) {
|
|
167
167
|
transaction._failed = true;
|
|
168
168
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
169
|
-
const failedReason = _optionalChain$
|
|
169
|
+
const failedReason = _optionalChain$k([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
170
170
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
171
171
|
} else {
|
|
172
172
|
transaction._succeeded = true;
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
supported$2.evm = [];
|
|
258
258
|
supported$2.solana = ['solana'];
|
|
259
259
|
|
|
260
|
-
function _optionalChain$
|
|
260
|
+
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; }
|
|
261
261
|
class WindowSolana {
|
|
262
262
|
|
|
263
263
|
static __initStatic() {this.info = {
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
|
|
269
269
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
270
270
|
return (
|
|
271
|
-
_optionalChain$
|
|
271
|
+
_optionalChain$j([window, 'optionalAccess', _2 => _2.solana]) &&
|
|
272
272
|
!(window.phantom && !window.glow && !window.solana.isGlow) &&
|
|
273
273
|
!window.coin98 &&
|
|
274
274
|
!window.solana.isGlow
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
let internalCallback;
|
|
319
319
|
switch (event) {
|
|
320
320
|
case 'account':
|
|
321
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
321
|
+
internalCallback = (publicKey) => callback(_optionalChain$j([publicKey, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]));
|
|
322
322
|
this.getProvider().on('accountChanged', internalCallback);
|
|
323
323
|
break
|
|
324
324
|
}
|
|
@@ -1207,7 +1207,7 @@
|
|
|
1207
1207
|
})
|
|
1208
1208
|
};
|
|
1209
1209
|
|
|
1210
|
-
function _optionalChain$
|
|
1210
|
+
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; }
|
|
1211
1211
|
class Backpack extends WindowSolana {
|
|
1212
1212
|
|
|
1213
1213
|
static __initStatic() {this.info = {
|
|
@@ -1218,7 +1218,7 @@
|
|
|
1218
1218
|
|
|
1219
1219
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1220
1220
|
return (
|
|
1221
|
-
_optionalChain$
|
|
1221
|
+
_optionalChain$i([window, 'optionalAccess', _2 => _2.backpack]) &&
|
|
1222
1222
|
window.backpack.isBackpack
|
|
1223
1223
|
)
|
|
1224
1224
|
};}
|
|
@@ -1313,7 +1313,7 @@
|
|
|
1313
1313
|
})
|
|
1314
1314
|
};
|
|
1315
1315
|
|
|
1316
|
-
function _optionalChain$
|
|
1316
|
+
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; }
|
|
1317
1317
|
class WindowEthereum {
|
|
1318
1318
|
|
|
1319
1319
|
static __initStatic() {this.info = {
|
|
@@ -1324,17 +1324,17 @@
|
|
|
1324
1324
|
|
|
1325
1325
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1326
1326
|
return (
|
|
1327
|
-
_optionalChain$
|
|
1327
|
+
_optionalChain$h([window, 'optionalAccess', _23 => _23.ethereum]) &&
|
|
1328
1328
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length != 1 && // MetaMask
|
|
1329
|
-
!_optionalChain$
|
|
1330
|
-
!(_optionalChain$
|
|
1331
|
-
!_optionalChain$
|
|
1332
|
-
!_optionalChain$
|
|
1333
|
-
!_optionalChain$
|
|
1334
|
-
!_optionalChain$
|
|
1335
|
-
!_optionalChain$
|
|
1336
|
-
!_optionalChain$
|
|
1337
|
-
!(_optionalChain$
|
|
1329
|
+
!_optionalChain$h([window, 'optionalAccess', _24 => _24.coin98]) && // Coin98
|
|
1330
|
+
!(_optionalChain$h([window, 'optionalAccess', _25 => _25.ethereum, 'optionalAccess', _26 => _26.isTrust]) || _optionalChain$h([window, 'optionalAccess', _27 => _27.ethereum, 'optionalAccess', _28 => _28.isTrustWallet])) && // Trust Wallet
|
|
1331
|
+
!_optionalChain$h([window, 'optionalAccess', _29 => _29.ethereum, 'optionalAccess', _30 => _30.isDeficonnectProvider]) && // crypto.com
|
|
1332
|
+
!_optionalChain$h([window, 'optionalAccess', _31 => _31.ethereum, 'optionalAccess', _32 => _32.isHyperPay]) && // isHyperPay
|
|
1333
|
+
!_optionalChain$h([window, 'optionalAccess', _33 => _33.ethereum, 'optionalAccess', _34 => _34.isPhantom]) && // Phantom
|
|
1334
|
+
!_optionalChain$h([window, 'optionalAccess', _35 => _35.solana, 'optionalAccess', _36 => _36.isPhantom]) && // Phantom
|
|
1335
|
+
!_optionalChain$h([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isRabby]) && // Rabby
|
|
1336
|
+
!_optionalChain$h([window, 'optionalAccess', _39 => _39.backpack, 'optionalAccess', _40 => _40.isBackpack]) && // Backpack
|
|
1337
|
+
!(_optionalChain$h([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isCoinbaseWallet]) || _optionalChain$h([window, 'optionalAccess', _43 => _43.ethereum, 'optionalAccess', _44 => _44.isWalletLink]))
|
|
1338
1338
|
)
|
|
1339
1339
|
};}
|
|
1340
1340
|
|
|
@@ -1460,7 +1460,7 @@
|
|
|
1460
1460
|
}
|
|
1461
1461
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
1462
1462
|
|
|
1463
|
-
function _optionalChain$
|
|
1463
|
+
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; }
|
|
1464
1464
|
class Binance extends WindowEthereum {
|
|
1465
1465
|
|
|
1466
1466
|
static __initStatic() {this.info = {
|
|
@@ -1470,7 +1470,7 @@
|
|
|
1470
1470
|
};}
|
|
1471
1471
|
|
|
1472
1472
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1473
|
-
return _optionalChain$
|
|
1473
|
+
return _optionalChain$g([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
1474
1474
|
!window.coin98
|
|
1475
1475
|
};}
|
|
1476
1476
|
|
|
@@ -1478,7 +1478,7 @@
|
|
|
1478
1478
|
|
|
1479
1479
|
} Binance.__initStatic(); Binance.__initStatic2();
|
|
1480
1480
|
|
|
1481
|
-
function _optionalChain$
|
|
1481
|
+
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; }
|
|
1482
1482
|
class Brave extends WindowEthereum {
|
|
1483
1483
|
|
|
1484
1484
|
static __initStatic() {this.info = {
|
|
@@ -1487,10 +1487,10 @@
|
|
|
1487
1487
|
blockchains: supported$2.evm
|
|
1488
1488
|
};}
|
|
1489
1489
|
|
|
1490
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
1490
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$f([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
1491
1491
|
} Brave.__initStatic(); Brave.__initStatic2();
|
|
1492
1492
|
|
|
1493
|
-
function _optionalChain$
|
|
1493
|
+
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; }
|
|
1494
1494
|
class Coin98 extends WindowEthereum {
|
|
1495
1495
|
|
|
1496
1496
|
static __initStatic() {this.info = {
|
|
@@ -1499,10 +1499,10 @@
|
|
|
1499
1499
|
blockchains: supported$2.evm
|
|
1500
1500
|
};}
|
|
1501
1501
|
|
|
1502
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
1502
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
1503
1503
|
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
1504
1504
|
|
|
1505
|
-
function _optionalChain$
|
|
1505
|
+
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; }
|
|
1506
1506
|
class Coinbase extends WindowEthereum {
|
|
1507
1507
|
|
|
1508
1508
|
static __initStatic() {this.info = {
|
|
@@ -1511,10 +1511,10 @@
|
|
|
1511
1511
|
blockchains: supported$2.evm
|
|
1512
1512
|
};}
|
|
1513
1513
|
|
|
1514
|
-
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$
|
|
1514
|
+
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])) };}
|
|
1515
1515
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
1516
1516
|
|
|
1517
|
-
function _optionalChain$
|
|
1517
|
+
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; }
|
|
1518
1518
|
class CryptoCom extends WindowEthereum {
|
|
1519
1519
|
|
|
1520
1520
|
static __initStatic() {this.info = {
|
|
@@ -1523,7 +1523,7 @@
|
|
|
1523
1523
|
blockchains: supported$2.evm
|
|
1524
1524
|
};}
|
|
1525
1525
|
|
|
1526
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
1526
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
1527
1527
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
1528
1528
|
|
|
1529
1529
|
class Glow extends WindowSolana {
|
|
@@ -1542,7 +1542,7 @@
|
|
|
1542
1542
|
};}
|
|
1543
1543
|
} Glow.__initStatic(); Glow.__initStatic2();
|
|
1544
1544
|
|
|
1545
|
-
function _optionalChain$
|
|
1545
|
+
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; }
|
|
1546
1546
|
class HyperPay extends WindowEthereum {
|
|
1547
1547
|
|
|
1548
1548
|
static __initStatic() {this.info = {
|
|
@@ -1551,10 +1551,10 @@
|
|
|
1551
1551
|
blockchains: supported$2.evm
|
|
1552
1552
|
};}
|
|
1553
1553
|
|
|
1554
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
1554
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
1555
1555
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
1556
1556
|
|
|
1557
|
-
function _optionalChain$
|
|
1557
|
+
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; }
|
|
1558
1558
|
class MetaMask extends WindowEthereum {
|
|
1559
1559
|
|
|
1560
1560
|
static __initStatic() {this.info = {
|
|
@@ -1565,13 +1565,13 @@
|
|
|
1565
1565
|
|
|
1566
1566
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1567
1567
|
return(
|
|
1568
|
-
_optionalChain$
|
|
1568
|
+
_optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) &&
|
|
1569
1569
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
1570
1570
|
)
|
|
1571
1571
|
};}
|
|
1572
1572
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
1573
1573
|
|
|
1574
|
-
function _optionalChain$
|
|
1574
|
+
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; }
|
|
1575
1575
|
class Opera extends WindowEthereum {
|
|
1576
1576
|
|
|
1577
1577
|
static __initStatic() {this.info = {
|
|
@@ -1580,7 +1580,7 @@
|
|
|
1580
1580
|
blockchains: supported$2.evm
|
|
1581
1581
|
};}
|
|
1582
1582
|
|
|
1583
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
1583
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
1584
1584
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
1585
1585
|
|
|
1586
1586
|
class Phantom extends WindowSolana {
|
|
@@ -1598,7 +1598,7 @@
|
|
|
1598
1598
|
};}
|
|
1599
1599
|
} Phantom.__initStatic(); Phantom.__initStatic2();
|
|
1600
1600
|
|
|
1601
|
-
function _optionalChain$
|
|
1601
|
+
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; }
|
|
1602
1602
|
class Rabby extends WindowEthereum {
|
|
1603
1603
|
|
|
1604
1604
|
static __initStatic() {this.info = {
|
|
@@ -1609,12 +1609,12 @@
|
|
|
1609
1609
|
|
|
1610
1610
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1611
1611
|
return(
|
|
1612
|
-
_optionalChain$
|
|
1612
|
+
_optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
1613
1613
|
)
|
|
1614
1614
|
};}
|
|
1615
1615
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
1616
1616
|
|
|
1617
|
-
function _optionalChain$
|
|
1617
|
+
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; }
|
|
1618
1618
|
|
|
1619
1619
|
|
|
1620
1620
|
const KEY$2 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
|
|
@@ -1705,8 +1705,8 @@
|
|
|
1705
1705
|
await solanaWeb3_js.transact(
|
|
1706
1706
|
async (wallet) => {
|
|
1707
1707
|
await this.authorize(wallet);
|
|
1708
|
-
if(_optionalChain$
|
|
1709
|
-
if(_optionalChain$
|
|
1708
|
+
if(_optionalChain$7([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
|
|
1709
|
+
if(_optionalChain$7([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
|
|
1710
1710
|
}
|
|
1711
1711
|
);
|
|
1712
1712
|
return this._account
|
|
@@ -1765,7 +1765,7 @@
|
|
|
1765
1765
|
}
|
|
1766
1766
|
} SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
|
|
1767
1767
|
|
|
1768
|
-
function _optionalChain$
|
|
1768
|
+
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; }
|
|
1769
1769
|
class Solflare extends WindowSolana {
|
|
1770
1770
|
|
|
1771
1771
|
static __initStatic() {this.info = {
|
|
@@ -1776,7 +1776,7 @@
|
|
|
1776
1776
|
|
|
1777
1777
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1778
1778
|
return (
|
|
1779
|
-
_optionalChain$
|
|
1779
|
+
_optionalChain$6([window, 'optionalAccess', _2 => _2.solflare]) &&
|
|
1780
1780
|
window.solflare.isSolflare
|
|
1781
1781
|
)
|
|
1782
1782
|
};}
|
|
@@ -1786,7 +1786,7 @@
|
|
|
1786
1786
|
_sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
|
|
1787
1787
|
} Solflare.__initStatic(); Solflare.__initStatic2();
|
|
1788
1788
|
|
|
1789
|
-
function _optionalChain$
|
|
1789
|
+
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; }
|
|
1790
1790
|
class Trust extends WindowEthereum {
|
|
1791
1791
|
|
|
1792
1792
|
static __initStatic() {this.info = {
|
|
@@ -1795,7 +1795,7 @@
|
|
|
1795
1795
|
blockchains: supported$2.evm
|
|
1796
1796
|
};}
|
|
1797
1797
|
|
|
1798
|
-
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$
|
|
1798
|
+
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])) };}
|
|
1799
1799
|
} Trust.__initStatic(); Trust.__initStatic2();
|
|
1800
1800
|
|
|
1801
1801
|
const transactionApiBlockchainNames = {
|
|
@@ -1887,7 +1887,7 @@
|
|
|
1887
1887
|
}
|
|
1888
1888
|
};
|
|
1889
1889
|
|
|
1890
|
-
function _optionalChain$
|
|
1890
|
+
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; }
|
|
1891
1891
|
|
|
1892
1892
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
1893
1893
|
transaction = new Transaction(transaction);
|
|
@@ -1967,7 +1967,7 @@
|
|
|
1967
1967
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
1968
1968
|
const provider = await web3ClientSolana.getProvider(transaction.blockchain);
|
|
1969
1969
|
let gasPrice = await provider.getGasPrice();
|
|
1970
|
-
if(_optionalChain$
|
|
1970
|
+
if(_optionalChain$4([wallet, 'access', _ => _.session, 'optionalAccess', _2 => _2.peerMeta, 'optionalAccess', _3 => _3.name]) === 'Uniswap Wallet') {
|
|
1971
1971
|
gasPrice = undefined;
|
|
1972
1972
|
} else {
|
|
1973
1973
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1991,7 +1991,7 @@
|
|
|
1991
1991
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
1992
1992
|
const provider = await web3ClientSolana.getProvider(transaction.blockchain);
|
|
1993
1993
|
let gasPrice = await provider.getGasPrice();
|
|
1994
|
-
if(_optionalChain$
|
|
1994
|
+
if(_optionalChain$4([wallet, 'access', _4 => _4.session, 'optionalAccess', _5 => _5.peerMeta, 'optionalAccess', _6 => _6.name]) === 'Uniswap Wallet') {
|
|
1995
1995
|
gasPrice = undefined;
|
|
1996
1996
|
} else {
|
|
1997
1997
|
gasPrice = gasPrice.toHexString();
|
|
@@ -2010,7 +2010,7 @@
|
|
|
2010
2010
|
})
|
|
2011
2011
|
};
|
|
2012
2012
|
|
|
2013
|
-
function _optionalChain$
|
|
2013
|
+
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; }
|
|
2014
2014
|
|
|
2015
2015
|
const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
2016
2016
|
|
|
@@ -2059,7 +2059,7 @@
|
|
|
2059
2059
|
if(await isConnected()) { return new WalletConnectV1() }
|
|
2060
2060
|
};
|
|
2061
2061
|
|
|
2062
|
-
const setConnectedInstance$
|
|
2062
|
+
const setConnectedInstance$1 = (value)=>{
|
|
2063
2063
|
window[KEY$1] = value;
|
|
2064
2064
|
};
|
|
2065
2065
|
|
|
@@ -2098,7 +2098,7 @@
|
|
|
2098
2098
|
}
|
|
2099
2099
|
|
|
2100
2100
|
disconnect() {
|
|
2101
|
-
setConnectedInstance$
|
|
2101
|
+
setConnectedInstance$1(undefined);
|
|
2102
2102
|
localStorage[KEY$1+'_name'] = undefined;
|
|
2103
2103
|
localStorage[KEY$1+'_logo'] = undefined;
|
|
2104
2104
|
currentPlainInstance = undefined;
|
|
@@ -2114,7 +2114,7 @@
|
|
|
2114
2114
|
});
|
|
2115
2115
|
|
|
2116
2116
|
instance.on("modal_closed", ()=>{
|
|
2117
|
-
setConnectedInstance$
|
|
2117
|
+
setConnectedInstance$1(undefined);
|
|
2118
2118
|
this.connector = undefined;
|
|
2119
2119
|
this.session = undefined;
|
|
2120
2120
|
});
|
|
@@ -2153,11 +2153,11 @@
|
|
|
2153
2153
|
let session = await this.connector.connect();
|
|
2154
2154
|
this.session = session;
|
|
2155
2155
|
|
|
2156
|
-
if(_optionalChain$
|
|
2157
|
-
if(_optionalChain$
|
|
2156
|
+
if(_optionalChain$3([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
2157
|
+
if(_optionalChain$3([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
2158
2158
|
|
|
2159
2159
|
if(session.accounts instanceof Array && session.accounts.length) {
|
|
2160
|
-
setConnectedInstance$
|
|
2160
|
+
setConnectedInstance$1(this);
|
|
2161
2161
|
return ethers.ethers.utils.getAddress(session.accounts[0])
|
|
2162
2162
|
} else {
|
|
2163
2163
|
return
|
|
@@ -2296,9 +2296,9 @@
|
|
|
2296
2296
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
2297
2297
|
|
|
2298
2298
|
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
2299
|
-
WalletConnectV1.setConnectedInstance = setConnectedInstance$
|
|
2299
|
+
WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
|
|
2300
2300
|
|
|
2301
|
-
function _optionalChain$
|
|
2301
|
+
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; }
|
|
2302
2302
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
2303
2303
|
transaction = new Transaction(transaction);
|
|
2304
2304
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -2382,14 +2382,14 @@
|
|
|
2382
2382
|
params: [{
|
|
2383
2383
|
from: transaction.from,
|
|
2384
2384
|
to: transaction.to,
|
|
2385
|
-
value: _optionalChain$
|
|
2385
|
+
value: _optionalChain$2([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
|
|
2386
2386
|
data: await transaction.getData(),
|
|
2387
2387
|
gas: gas.toHexString(),
|
|
2388
2388
|
gasPrice: gasPrice.toHexString(),
|
|
2389
2389
|
nonce: transaction.nonce,
|
|
2390
2390
|
}]
|
|
2391
2391
|
}
|
|
2392
|
-
})
|
|
2392
|
+
}).catch((e)=>{console.log('ERROR', e);})
|
|
2393
2393
|
};
|
|
2394
2394
|
|
|
2395
2395
|
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
@@ -2405,7 +2405,7 @@
|
|
|
2405
2405
|
params: [{
|
|
2406
2406
|
from: transaction.from,
|
|
2407
2407
|
to: transaction.to,
|
|
2408
|
-
value: _optionalChain$
|
|
2408
|
+
value: _optionalChain$2([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
|
|
2409
2409
|
gas: gas.toHexString(),
|
|
2410
2410
|
gasPrice: gasPrice.toHexString(),
|
|
2411
2411
|
nonce: transaction.nonce
|
|
@@ -2414,76 +2414,106 @@
|
|
|
2414
2414
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
2415
2415
|
};
|
|
2416
2416
|
|
|
2417
|
-
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; }
|
|
2417
|
+
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; }
|
|
2418
2418
|
const KEY = 'depay:wallets:wc2';
|
|
2419
2419
|
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
if
|
|
2428
|
-
|
|
2420
|
+
// configurations for wallets that require special handling
|
|
2421
|
+
const CONFIGURATIONS = {
|
|
2422
|
+
|
|
2423
|
+
"MetaMask": {
|
|
2424
|
+
methods: [
|
|
2425
|
+
"eth_sendTransaction",
|
|
2426
|
+
"personal_sign",
|
|
2427
|
+
"eth_chainId", // only add eth_chainId if you do not trust the wallet provided chainIds!
|
|
2428
|
+
"eth_signTypedData",
|
|
2429
|
+
"eth_signTypedData_v4",
|
|
2430
|
+
"wallet_switchEthereumChain"
|
|
2431
|
+
]
|
|
2432
|
+
},
|
|
2433
|
+
|
|
2434
|
+
"Uniswap Wallet": {
|
|
2435
|
+
methods: [
|
|
2436
|
+
"eth_sendTransaction",
|
|
2437
|
+
"personal_sign",
|
|
2438
|
+
"eth_signTypedData",
|
|
2439
|
+
"eth_signTypedData_v4",
|
|
2440
|
+
],
|
|
2441
|
+
requiredNamespaces: {
|
|
2442
|
+
eip155: {
|
|
2443
|
+
chains: ['ethereum', 'polygon', 'arbitrum', 'optimism'].map((blockchainName)=>`eip155:${Blockchains__default['default'][blockchainName].networkId}`)
|
|
2429
2444
|
}
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2445
|
+
},
|
|
2446
|
+
optionalNamespaces: {},
|
|
2447
|
+
},
|
|
2448
|
+
|
|
2449
|
+
"Enjin Wallet": {
|
|
2450
|
+
methods: [
|
|
2451
|
+
"eth_sendTransaction",
|
|
2452
|
+
"personal_sign",
|
|
2453
|
+
"eth_signTypedData",
|
|
2454
|
+
]
|
|
2455
|
+
},
|
|
2456
|
+
|
|
2432
2457
|
};
|
|
2433
2458
|
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
method: 'eth_chainId'
|
|
2443
|
-
}
|
|
2444
|
-
})
|
|
2445
|
-
])
|
|
2446
|
-
})));
|
|
2447
|
-
return results.filter(Boolean)[0]
|
|
2459
|
+
const DEFAULT_CONFIGURATION = {
|
|
2460
|
+
events: ['accountsChanged'],
|
|
2461
|
+
methods: [
|
|
2462
|
+
"eth_sendTransaction",
|
|
2463
|
+
"personal_sign",
|
|
2464
|
+
"eth_signTypedData",
|
|
2465
|
+
"eth_signTypedData_v4",
|
|
2466
|
+
]
|
|
2448
2467
|
};
|
|
2449
2468
|
|
|
2450
2469
|
const getConnectedInstance$1 = async()=>{
|
|
2451
|
-
if(
|
|
2452
|
-
const lastSession = await getLastSession();
|
|
2453
|
-
if(lastSession) {
|
|
2454
|
-
return new WalletConnectV2()
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2470
|
+
if(await WalletConnectV2.isAvailable()) { return new WalletConnectV2() }
|
|
2457
2471
|
};
|
|
2458
2472
|
|
|
2459
|
-
const
|
|
2473
|
+
const getLastSession = async(walletName)=>{
|
|
2474
|
+
if(!localStorage[KEY+":projectId"]) { return }
|
|
2475
|
+
if(walletName !== localStorage[KEY+":lastSessionWalletName"]) { return }
|
|
2476
|
+
let signClient = await getSignClient();
|
|
2477
|
+
const existingSessions = signClient.find(getWalletConnectV2Config(walletName));
|
|
2478
|
+
const lastSession = existingSessions ? existingSessions[existingSessions.length-1] : undefined;
|
|
2479
|
+
if(lastSession && localStorage[KEY+":lastExpiredSessionTopic"] !== lastSession.topic && lastSession.expiry > Math.ceil(Date.now()/1000)) {
|
|
2480
|
+
const result = await Promise.race([signClient.ping({ topic: lastSession.topic }), new Promise((resolve)=>setTimeout(resolve, 1500))]);
|
|
2481
|
+
if(result) {
|
|
2482
|
+
return lastSession
|
|
2483
|
+
} else {
|
|
2484
|
+
localStorage[KEY+":lastExpiredSessionTopic"] = lastSession.topic;
|
|
2485
|
+
return
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2460
2488
|
};
|
|
2461
2489
|
|
|
2462
|
-
const getWalletConnectV2Config = ()=>{
|
|
2463
|
-
const methods = [
|
|
2464
|
-
|
|
2465
|
-
"personal_sign",
|
|
2466
|
-
"eth_signTypedData_v4",
|
|
2467
|
-
"eth_chainId",
|
|
2468
|
-
"eth_accounts",
|
|
2469
|
-
"wallet_switchEthereumChain",
|
|
2470
|
-
];
|
|
2471
|
-
|
|
2472
|
-
const events = ['accountsChanged'];
|
|
2490
|
+
const getWalletConnectV2Config = (walletName)=>{
|
|
2491
|
+
const methods = _optionalChain$1([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
|
|
2492
|
+
const events = _optionalChain$1([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
|
|
2473
2493
|
|
|
2474
2494
|
let requiredNamespaces = {};
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2495
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
|
|
2496
|
+
requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
|
|
2497
|
+
} else {
|
|
2498
|
+
requiredNamespaces['eip155'] = {
|
|
2499
|
+
chains: [`eip155:1`],
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2502
|
+
requiredNamespaces['eip155'].methods = methods;
|
|
2503
|
+
requiredNamespaces['eip155'].events = events;
|
|
2480
2504
|
|
|
2481
2505
|
let optionalNamespaces = {};
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2506
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
|
|
2507
|
+
optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
|
|
2508
|
+
} else {
|
|
2509
|
+
optionalNamespaces['eip155'] = {
|
|
2510
|
+
chains: supported$2.evm.map((blockchain)=>`${Blockchains__default['default'][blockchain].namespace}:${Blockchains__default['default'][blockchain].networkId}`),
|
|
2511
|
+
};
|
|
2512
|
+
}
|
|
2513
|
+
if(_optionalChain$1([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$1([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
|
|
2514
|
+
optionalNamespaces['eip155'].methods = methods;
|
|
2515
|
+
optionalNamespaces['eip155'].events = events;
|
|
2516
|
+
}
|
|
2487
2517
|
|
|
2488
2518
|
return { requiredNamespaces, optionalNamespaces }
|
|
2489
2519
|
};
|
|
@@ -2492,18 +2522,18 @@
|
|
|
2492
2522
|
if(window.getSignClientPromise) { return window.getSignClientPromise }
|
|
2493
2523
|
window.getSignClientPromise = new Promise(async(resolve)=>{
|
|
2494
2524
|
const signClient = await walletconnectV2.SignClient.init({
|
|
2495
|
-
|
|
2525
|
+
projectId: localStorage[KEY+":projectId"],
|
|
2496
2526
|
metadata: {
|
|
2497
2527
|
name: document.title || 'dApp',
|
|
2498
|
-
description: _optionalChain([document, 'access',
|
|
2528
|
+
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',
|
|
2499
2529
|
url: location.href,
|
|
2500
|
-
icons: [_optionalChain([document, 'access',
|
|
2530
|
+
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`]
|
|
2501
2531
|
}
|
|
2502
2532
|
});
|
|
2503
2533
|
resolve(signClient);
|
|
2504
2534
|
});
|
|
2505
2535
|
|
|
2506
|
-
return window.getSignClientPromise
|
|
2536
|
+
return window.getSignClientPromise
|
|
2507
2537
|
};
|
|
2508
2538
|
|
|
2509
2539
|
class WalletConnectV2 {
|
|
@@ -2514,14 +2544,13 @@
|
|
|
2514
2544
|
blockchains: supported$2.evm
|
|
2515
2545
|
};}
|
|
2516
2546
|
|
|
2517
|
-
static __initStatic2() {this.isAvailable = ()=>{
|
|
2518
|
-
return
|
|
2547
|
+
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
2548
|
+
return !! await getLastSession(_optionalChain$1([options, 'optionalAccess', _21 => _21.walletName]))
|
|
2519
2549
|
};}
|
|
2520
2550
|
|
|
2521
2551
|
constructor() {
|
|
2522
2552
|
this.name = (localStorage[KEY+':name'] && localStorage[KEY+':name'] != undefined) ? localStorage[KEY+':name'] : this.constructor.info.name;
|
|
2523
2553
|
this.logo = (localStorage[KEY+':logo'] && localStorage[KEY+':logo'] != undefined) ? localStorage[KEY+':logo'] : this.constructor.info.logo;
|
|
2524
|
-
this.blockchains = this.constructor.info.blockchains;
|
|
2525
2554
|
this.sendTransaction = (transaction)=>{
|
|
2526
2555
|
return sendTransaction$1({
|
|
2527
2556
|
wallet: this,
|
|
@@ -2531,17 +2560,57 @@
|
|
|
2531
2560
|
}
|
|
2532
2561
|
|
|
2533
2562
|
async account() {
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2563
|
+
if(_optionalChain$1([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
|
|
2564
|
+
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
async getAllAvailableBlockchains() {
|
|
2569
|
+
let timeTillResponse = new Date();
|
|
2570
|
+
await Promise.race([...
|
|
2571
|
+
this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
|
|
2572
|
+
return new Promise((resolve)=>{
|
|
2573
|
+
try {
|
|
2574
|
+
this.signClient.request({
|
|
2575
|
+
topic: this.session.topic,
|
|
2576
|
+
chainId: chainIdentifier,
|
|
2577
|
+
request:{
|
|
2578
|
+
method: 'eth_chainId',
|
|
2579
|
+
}
|
|
2580
|
+
}).then(resolve);
|
|
2581
|
+
} catch (e) {}
|
|
2582
|
+
})
|
|
2583
|
+
}),
|
|
2584
|
+
new Promise(resolve=>setTimeout(resolve, 6000))
|
|
2585
|
+
]);
|
|
2586
|
+
timeTillResponse = new Date() - timeTillResponse;
|
|
2587
|
+
|
|
2588
|
+
let blockchains = [];
|
|
2589
|
+
await Promise.race([
|
|
2590
|
+
Promise.all(this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
|
|
2591
|
+
try {
|
|
2592
|
+
return this.signClient.request({
|
|
2593
|
+
topic: this.session.topic,
|
|
2594
|
+
chainId: chainIdentifier,
|
|
2595
|
+
request:{
|
|
2596
|
+
method: 'eth_chainId',
|
|
2597
|
+
}
|
|
2598
|
+
}).then(()=> blockchains.push(Blockchains__default['default'].findByNetworkId(chainIdentifier.split(':')[1]).name))
|
|
2599
|
+
} catch (e2) {}
|
|
2600
|
+
})),
|
|
2601
|
+
new Promise(resolve => setTimeout(resolve, timeTillResponse*2))
|
|
2602
|
+
]);
|
|
2603
|
+
return blockchains
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
async setSessionBlockchains() {
|
|
2607
|
+
if(_optionalChain$1([CONFIGURATIONS, 'access', _27 => _27[this.walletName], 'optionalAccess', _28 => _28.methods, 'optionalAccess', _29 => _29.includes, 'call', _30 => _30('eth_chainId')])) {
|
|
2608
|
+
this.blockchains = await this.getAllAvailableBlockchains();
|
|
2609
|
+
} else if(this.session.namespaces.eip155.chains) {
|
|
2610
|
+
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$1([Blockchains__default['default'], 'access', _31 => _31.findByNetworkId, 'call', _32 => _32(chainIdentifier.split(':')[1]), 'optionalAccess', _33 => _33.name])).filter(Boolean);
|
|
2611
|
+
} else if(this.session.namespaces.eip155.accounts) {
|
|
2612
|
+
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$1([Blockchains__default['default'], 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(accountIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
|
|
2613
|
+
}
|
|
2545
2614
|
}
|
|
2546
2615
|
|
|
2547
2616
|
async connect(options) {
|
|
@@ -2550,65 +2619,59 @@
|
|
|
2550
2619
|
|
|
2551
2620
|
try {
|
|
2552
2621
|
|
|
2553
|
-
|
|
2622
|
+
this.walletName = _optionalChain$1([options, 'optionalAccess', _37 => _37.walletName]);
|
|
2623
|
+
|
|
2624
|
+
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
2554
2625
|
this.signClient = await getSignClient();
|
|
2555
2626
|
|
|
2556
2627
|
this.signClient.on("session_delete", (session)=> {
|
|
2557
|
-
if(_optionalChain([session, 'optionalAccess',
|
|
2628
|
+
if(_optionalChain$1([session, 'optionalAccess', _38 => _38.topic]) === _optionalChain$1([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {
|
|
2558
2629
|
localStorage[KEY+':name'] = undefined;
|
|
2559
2630
|
localStorage[KEY+':logo'] = undefined;
|
|
2560
|
-
WalletConnect.instance = undefined;
|
|
2561
2631
|
this.signClient = undefined;
|
|
2562
2632
|
this.session = undefined;
|
|
2563
2633
|
}
|
|
2564
2634
|
});
|
|
2565
2635
|
|
|
2566
2636
|
this.signClient.on("session_update", async(session)=> {
|
|
2567
|
-
if(_optionalChain([session, 'optionalAccess',
|
|
2637
|
+
if(_optionalChain$1([session, 'optionalAccess', _41 => _41.topic]) === _optionalChain$1([this, 'access', _42 => _42.session, 'optionalAccess', _43 => _43.topic])) {
|
|
2568
2638
|
this.session = this.signClient.session.get(session.topic);
|
|
2639
|
+
await this.setSessionBlockchains();
|
|
2569
2640
|
}
|
|
2570
2641
|
});
|
|
2571
2642
|
|
|
2572
2643
|
this.signClient.on("session_event", (event)=> {
|
|
2573
|
-
if(_optionalChain([event, 'optionalAccess',
|
|
2574
|
-
}
|
|
2644
|
+
if(_optionalChain$1([event, 'optionalAccess', _44 => _44.topic]) === _optionalChain$1([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {}
|
|
2575
2645
|
});
|
|
2576
2646
|
|
|
2577
|
-
const lastSession = await getLastSession();
|
|
2578
|
-
if(lastSession) {
|
|
2579
|
-
this.session = lastSession;
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
2647
|
const connectWallet = async()=>{
|
|
2583
|
-
const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config());
|
|
2648
|
+
const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config(this.walletName));
|
|
2584
2649
|
await connect({ uri });
|
|
2585
2650
|
this.session = await approval();
|
|
2651
|
+
localStorage[KEY+":lastSessionWalletName"] = this.walletName;
|
|
2652
|
+
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
2586
2653
|
};
|
|
2587
2654
|
|
|
2588
|
-
|
|
2655
|
+
const lastSession = _optionalChain$1([this, 'optionalAccess', _47 => _47.walletName, 'optionalAccess', _48 => _48.length]) ? await getLastSession(this.walletName) : undefined;
|
|
2656
|
+
if(lastSession) {
|
|
2657
|
+
this.session = lastSession;
|
|
2658
|
+
} else {
|
|
2659
|
+
await connectWallet();
|
|
2660
|
+
}
|
|
2589
2661
|
|
|
2590
|
-
let meta = _optionalChain([this, 'access',
|
|
2662
|
+
let meta = _optionalChain$1([this, 'access', _49 => _49.session, 'optionalAccess', _50 => _50.peer, 'optionalAccess', _51 => _51.metadata]);
|
|
2591
2663
|
if(meta && meta.name) {
|
|
2592
2664
|
this.name = meta.name;
|
|
2593
2665
|
localStorage[KEY+':name'] = meta.name;
|
|
2594
|
-
if(_optionalChain([meta, 'optionalAccess',
|
|
2666
|
+
if(_optionalChain$1([meta, 'optionalAccess', _52 => _52.icons]) && meta.icons.length) {
|
|
2595
2667
|
this.logo = meta.icons[0];
|
|
2596
2668
|
localStorage[KEY+':logo'] = this.logo;
|
|
2597
2669
|
}
|
|
2598
2670
|
}
|
|
2599
|
-
if(_optionalChain([options, 'optionalAccess',
|
|
2600
|
-
if(_optionalChain([options, 'optionalAccess',
|
|
2601
|
-
|
|
2602
|
-
let connectedChainId;
|
|
2603
|
-
for(var i = 0; i<3; i++) {
|
|
2604
|
-
await new Promise((resolve)=>{setTimeout(resolve, 500);});
|
|
2605
|
-
connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
2606
|
-
if(connectedChainId){ break }
|
|
2607
|
-
}
|
|
2608
|
-
|
|
2609
|
-
if(!connectedChainId) { await connectWallet(); }
|
|
2671
|
+
if(_optionalChain$1([options, 'optionalAccess', _53 => _53.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
2672
|
+
if(_optionalChain$1([options, 'optionalAccess', _54 => _54.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
2610
2673
|
|
|
2611
|
-
|
|
2674
|
+
await this.setSessionBlockchains();
|
|
2612
2675
|
|
|
2613
2676
|
return await this.account()
|
|
2614
2677
|
|
|
@@ -2618,42 +2681,37 @@
|
|
|
2618
2681
|
}
|
|
2619
2682
|
|
|
2620
2683
|
async connectedTo(input) {
|
|
2621
|
-
let chainId = await getConnectedChainId(this.signClient, this.session);
|
|
2622
|
-
if(!chainId) { return false }
|
|
2623
|
-
const blockchain = Blockchains__default['default'].findById(chainId);
|
|
2624
|
-
if(!blockchain) { return false }
|
|
2625
2684
|
if(input) {
|
|
2626
|
-
return input
|
|
2685
|
+
return this.blockchains.indexOf(input) > -1
|
|
2627
2686
|
} else {
|
|
2628
|
-
return
|
|
2687
|
+
return this.blockchains
|
|
2629
2688
|
}
|
|
2630
2689
|
}
|
|
2631
2690
|
|
|
2691
|
+
getValidChainId() {
|
|
2692
|
+
return `eip155:${Blockchains__default['default'][this.blockchains[0]].networkId}`
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2632
2695
|
switchTo(blockchainName) {
|
|
2633
2696
|
return new Promise((resolve, reject)=>{
|
|
2634
|
-
|
|
2697
|
+
|
|
2635
2698
|
const blockchain = Blockchains__default['default'][blockchainName];
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
this.
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
this.
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
params: [{ chainId: blockchain.id }],
|
|
2653
|
-
}
|
|
2654
|
-
})
|
|
2655
|
-
])
|
|
2656
|
-
});
|
|
2699
|
+
|
|
2700
|
+
Promise.race([
|
|
2701
|
+
this.signClient.request({
|
|
2702
|
+
topic: this.session.topic,
|
|
2703
|
+
chainId: this.getValidChainId(),
|
|
2704
|
+
request:{
|
|
2705
|
+
method: 'wallet_switchEthereumChain',
|
|
2706
|
+
params: [{ chainId: blockchain.id }],
|
|
2707
|
+
}
|
|
2708
|
+
}),
|
|
2709
|
+
new Promise((resolve, reject)=>setTimeout(()=>{
|
|
2710
|
+
if(this.blockchains.indexOf(blockchainName) === -1) {
|
|
2711
|
+
reject({ code: 'NOT_SUPPORTED' });
|
|
2712
|
+
}
|
|
2713
|
+
} , 8000))
|
|
2714
|
+
]).catch(reject);
|
|
2657
2715
|
})
|
|
2658
2716
|
}
|
|
2659
2717
|
|
|
@@ -2668,7 +2726,7 @@
|
|
|
2668
2726
|
switch (event) {
|
|
2669
2727
|
case 'account':
|
|
2670
2728
|
internalCallback = async(event)=> {
|
|
2671
|
-
if(_optionalChain([event, 'optionalAccess',
|
|
2729
|
+
if(_optionalChain$1([event, 'optionalAccess', _55 => _55.topic]) === _optionalChain$1([this, 'access', _56 => _56.session, 'optionalAccess', _57 => _57.topic]) && event.params.event.name === 'accountsChanged') {
|
|
2672
2730
|
callback(await this.account());
|
|
2673
2731
|
}
|
|
2674
2732
|
};
|
|
@@ -2689,13 +2747,9 @@
|
|
|
2689
2747
|
async sign(message) {
|
|
2690
2748
|
if(typeof message === 'object') {
|
|
2691
2749
|
let account = await this.account();
|
|
2692
|
-
const blockchain = Blockchains__default['default'].findByNetworkId(message.domain.chainId);
|
|
2693
|
-
if((await this.connectedTo(blockchain.name)) === false) {
|
|
2694
|
-
throw({ code: 'WRONG_NETWORK' })
|
|
2695
|
-
}
|
|
2696
2750
|
let signature = await this.signClient.request({
|
|
2697
2751
|
topic: this.session.topic,
|
|
2698
|
-
chainId:
|
|
2752
|
+
chainId: this.getValidChainId(),
|
|
2699
2753
|
request:{
|
|
2700
2754
|
method: 'eth_signTypedData_v4',
|
|
2701
2755
|
params: [account, JSON.stringify(message)],
|
|
@@ -2705,11 +2759,9 @@
|
|
|
2705
2759
|
} else if (typeof message === 'string') {
|
|
2706
2760
|
const address = await this.account();
|
|
2707
2761
|
const params = [ethers.ethers.utils.hexlify(ethers.ethers.utils.toUtf8Bytes(message)), address];
|
|
2708
|
-
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
2709
|
-
const blockchain = Blockchains__default['default'].findById(connectedChainId);
|
|
2710
2762
|
let signature = await this.signClient.request({
|
|
2711
2763
|
topic: this.session.topic,
|
|
2712
|
-
chainId:
|
|
2764
|
+
chainId: this.getValidChainId(),
|
|
2713
2765
|
request:{
|
|
2714
2766
|
method: 'personal_sign',
|
|
2715
2767
|
params
|
|
@@ -2724,7 +2776,6 @@
|
|
|
2724
2776
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
2725
2777
|
|
|
2726
2778
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
2727
|
-
WalletConnectV2.setConnectedInstance = setConnectedInstance$1;
|
|
2728
2779
|
|
|
2729
2780
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
2730
2781
|
transaction = new Transaction(transaction);
|
|
@@ -2801,6 +2852,7 @@
|
|
|
2801
2852
|
})
|
|
2802
2853
|
};
|
|
2803
2854
|
|
|
2855
|
+
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; }
|
|
2804
2856
|
const getConnectedInstance = ()=>{
|
|
2805
2857
|
return window._connectedWalletLinkInstance
|
|
2806
2858
|
};
|
|
@@ -2843,8 +2895,20 @@
|
|
|
2843
2895
|
}
|
|
2844
2896
|
|
|
2845
2897
|
async connect(options) {
|
|
2898
|
+
let connect = (options && options.connect) ? options.connect : ({uri})=>{};
|
|
2899
|
+
|
|
2900
|
+
await connect({ uri: this.connector.qrUrl });
|
|
2901
|
+
|
|
2902
|
+
_optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2('.-cbwsdk-extension-dialog-container'), 'optionalAccess', _3 => _3.setAttribute, 'call', _4 => _4('style', 'display: none;')]);
|
|
2903
|
+
setTimeout(()=>{
|
|
2904
|
+
if(_optionalChain([this, 'optionalAccess', _5 => _5.connector, 'optionalAccess', _6 => _6._relay, 'optionalAccess', _7 => _7.ui, 'optionalAccess', _8 => _8.linkFlow, 'optionalAccess', _9 => _9.isOpen])){
|
|
2905
|
+
this.connector._relay.ui.linkFlow.isOpen = false;
|
|
2906
|
+
}
|
|
2907
|
+
}, 10);
|
|
2908
|
+
|
|
2846
2909
|
let relay = await this.connector._relayProvider();
|
|
2847
2910
|
relay.setConnectDisabled(false);
|
|
2911
|
+
|
|
2848
2912
|
let accounts = await this.connector.enable();
|
|
2849
2913
|
if(accounts instanceof Array && accounts.length) {
|
|
2850
2914
|
setConnectedInstance(this);
|