@depay/web3-wallets-evm 14.2.0 → 14.5.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/dist/esm/index.evm.js +100 -43
- package/dist/esm/index.js +115 -58
- package/dist/umd/index.evm.js +99 -42
- package/dist/umd/index.js +114 -57
- package/package.json +2 -2
package/dist/umd/index.evm.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Constants, global.Web3Client, global.WalletConnect, global.WalletConnectV2, global.CoinbaseWalletSdk));
|
|
5
5
|
}(this, (function (exports, web3Blockchains, ethers, web3Constants, web3ClientEvm, walletconnectV1, walletconnectV2, coinbaseWalletSdk) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function _optionalChain$
|
|
7
|
+
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; }
|
|
8
8
|
class Transaction$1 {
|
|
9
9
|
|
|
10
10
|
constructor({ blockchain, from, to, value, api, method, params, instructions, sent, succeeded, failed }) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
|
|
16
16
|
|
|
17
17
|
// optional
|
|
18
|
-
this.value = _optionalChain$
|
|
18
|
+
this.value = _optionalChain$e([Transaction$1, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
19
19
|
this.api = api;
|
|
20
20
|
this.method = method;
|
|
21
21
|
this.params = params;
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
supported$3.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
|
|
184
184
|
supported$3.solana = [];
|
|
185
185
|
|
|
186
|
-
function _optionalChain$
|
|
186
|
+
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; }
|
|
187
187
|
class WindowEthereum {
|
|
188
188
|
|
|
189
189
|
static __initStatic() {this.info = {
|
|
@@ -194,12 +194,12 @@
|
|
|
194
194
|
|
|
195
195
|
static __initStatic2() {this.isAvailable = ()=>{
|
|
196
196
|
return (
|
|
197
|
-
_optionalChain$
|
|
197
|
+
_optionalChain$d([window, 'optionalAccess', _13 => _13.ethereum]) &&
|
|
198
198
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length != 1 && // MetaMask
|
|
199
|
-
!_optionalChain$
|
|
200
|
-
!(_optionalChain$
|
|
201
|
-
!_optionalChain$
|
|
202
|
-
!(_optionalChain$
|
|
199
|
+
!_optionalChain$d([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
|
|
200
|
+
!(_optionalChain$d([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$d([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
|
|
201
|
+
!_optionalChain$d([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
|
|
202
|
+
!(_optionalChain$d([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$d([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
|
|
203
203
|
)
|
|
204
204
|
};}
|
|
205
205
|
|
|
@@ -306,7 +306,7 @@
|
|
|
306
306
|
}
|
|
307
307
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
308
308
|
|
|
309
|
-
function _optionalChain$
|
|
309
|
+
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; }
|
|
310
310
|
class Binance extends WindowEthereum {
|
|
311
311
|
|
|
312
312
|
static __initStatic() {this.info = {
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
};}
|
|
317
317
|
|
|
318
318
|
static __initStatic2() {this.isAvailable = ()=>{
|
|
319
|
-
return _optionalChain$
|
|
319
|
+
return _optionalChain$c([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
320
320
|
!window.coin98
|
|
321
321
|
};}
|
|
322
322
|
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
|
|
325
325
|
} Binance.__initStatic(); Binance.__initStatic2();
|
|
326
326
|
|
|
327
|
-
function _optionalChain$
|
|
327
|
+
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; }
|
|
328
328
|
class Brave extends WindowEthereum {
|
|
329
329
|
|
|
330
330
|
static __initStatic() {this.info = {
|
|
@@ -333,10 +333,10 @@
|
|
|
333
333
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
334
334
|
};}
|
|
335
335
|
|
|
336
|
-
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$
|
|
336
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
337
337
|
} Brave.__initStatic(); Brave.__initStatic2();
|
|
338
338
|
|
|
339
|
-
function _optionalChain$
|
|
339
|
+
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; }
|
|
340
340
|
class Coin98 extends WindowEthereum {
|
|
341
341
|
|
|
342
342
|
static __initStatic() {this.info = {
|
|
@@ -345,10 +345,10 @@
|
|
|
345
345
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
346
346
|
};}
|
|
347
347
|
|
|
348
|
-
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$
|
|
348
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$a([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
349
349
|
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
350
350
|
|
|
351
|
-
function _optionalChain$
|
|
351
|
+
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; }
|
|
352
352
|
class Coinbase extends WindowEthereum {
|
|
353
353
|
|
|
354
354
|
static __initStatic() {this.info = {
|
|
@@ -357,10 +357,10 @@
|
|
|
357
357
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
358
358
|
};}
|
|
359
359
|
|
|
360
|
-
static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$
|
|
360
|
+
static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$9([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$9([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
|
|
361
361
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
362
362
|
|
|
363
|
-
function _optionalChain$
|
|
363
|
+
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; }
|
|
364
364
|
class CryptoCom extends WindowEthereum {
|
|
365
365
|
|
|
366
366
|
static __initStatic() {this.info = {
|
|
@@ -369,10 +369,10 @@
|
|
|
369
369
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
370
370
|
};}
|
|
371
371
|
|
|
372
|
-
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$
|
|
372
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
373
373
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
374
374
|
|
|
375
|
-
function _optionalChain$
|
|
375
|
+
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; }
|
|
376
376
|
class MetaMask extends WindowEthereum {
|
|
377
377
|
|
|
378
378
|
static __initStatic() {this.info = {
|
|
@@ -382,11 +382,11 @@
|
|
|
382
382
|
};}
|
|
383
383
|
|
|
384
384
|
static __initStatic2() {this.isAvailable = ()=>{
|
|
385
|
-
return _optionalChain$
|
|
385
|
+
return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
|
|
386
386
|
};}
|
|
387
387
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
388
388
|
|
|
389
|
-
function _optionalChain$
|
|
389
|
+
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; }
|
|
390
390
|
class Opera extends WindowEthereum {
|
|
391
391
|
|
|
392
392
|
static __initStatic() {this.info = {
|
|
@@ -395,10 +395,10 @@
|
|
|
395
395
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
396
396
|
};}
|
|
397
397
|
|
|
398
|
-
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$
|
|
398
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
399
399
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
400
400
|
|
|
401
|
-
function _optionalChain$
|
|
401
|
+
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; }
|
|
402
402
|
class Trust extends WindowEthereum {
|
|
403
403
|
|
|
404
404
|
static __initStatic() {this.info = {
|
|
@@ -407,7 +407,7 @@
|
|
|
407
407
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
408
408
|
};}
|
|
409
409
|
|
|
410
|
-
static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$
|
|
410
|
+
static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$5([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$5([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
|
|
411
411
|
} Trust.__initStatic(); Trust.__initStatic2();
|
|
412
412
|
|
|
413
413
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -59889,7 +59889,6 @@
|
|
|
59889
59889
|
}
|
|
59890
59890
|
};
|
|
59891
59891
|
|
|
59892
|
-
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; }
|
|
59893
59892
|
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
59894
59893
|
transaction = new Transaction$1(transaction);
|
|
59895
59894
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -59965,26 +59964,54 @@
|
|
|
59965
59964
|
|
|
59966
59965
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
59967
59966
|
const provider = await getProvider(transaction.blockchain);
|
|
59967
|
+
const gasPrice = await provider.getGasPrice();
|
|
59968
|
+
const gas = await estimate(transaction);
|
|
59969
|
+
const data = await transaction.getData();
|
|
59970
|
+
const value = transaction.value ? ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value)) : undefined;
|
|
59971
|
+
const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
|
|
59972
|
+
console.log({
|
|
59973
|
+
from: transaction.from,
|
|
59974
|
+
to: transaction.to,
|
|
59975
|
+
value,
|
|
59976
|
+
data,
|
|
59977
|
+
gas: gas.toHexString(),
|
|
59978
|
+
gasPrice: gasPrice.toHexString(),
|
|
59979
|
+
nonce,
|
|
59980
|
+
});
|
|
59968
59981
|
return wallet.connector.sendTransaction({
|
|
59969
59982
|
from: transaction.from,
|
|
59970
59983
|
to: transaction.to,
|
|
59971
|
-
value
|
|
59972
|
-
data
|
|
59973
|
-
gas:
|
|
59974
|
-
gasPrice:
|
|
59975
|
-
nonce
|
|
59984
|
+
value,
|
|
59985
|
+
data,
|
|
59986
|
+
gas: gas.toHexString(),
|
|
59987
|
+
gasPrice: gasPrice.toHexString(),
|
|
59988
|
+
nonce,
|
|
59976
59989
|
})
|
|
59977
59990
|
};
|
|
59978
59991
|
|
|
59979
59992
|
const submitSimpleTransfer$3 = async ({ transaction, wallet })=>{
|
|
59980
59993
|
const provider = await getProvider(transaction.blockchain);
|
|
59994
|
+
const gasPrice = await provider.getGasPrice();
|
|
59995
|
+
const gas = await estimate(transaction);
|
|
59996
|
+
const value = ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value));
|
|
59997
|
+
const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
|
|
59998
|
+
console.log({
|
|
59999
|
+
from: transaction.from,
|
|
60000
|
+
to: transaction.to,
|
|
60001
|
+
value,
|
|
60002
|
+
data: '0x',
|
|
60003
|
+
gas: gas.toHexString(),
|
|
60004
|
+
gasPrice: gasPrice.toHexString(),
|
|
60005
|
+
nonce,
|
|
60006
|
+
});
|
|
59981
60007
|
return wallet.connector.sendTransaction({
|
|
59982
60008
|
from: transaction.from,
|
|
59983
60009
|
to: transaction.to,
|
|
59984
|
-
value
|
|
59985
|
-
|
|
59986
|
-
|
|
59987
|
-
|
|
60010
|
+
value,
|
|
60011
|
+
data: '0x',
|
|
60012
|
+
gas: gas.toHexString(),
|
|
60013
|
+
gasPrice: gasPrice.toHexString(),
|
|
60014
|
+
nonce,
|
|
59988
60015
|
})
|
|
59989
60016
|
};
|
|
59990
60017
|
|
|
@@ -60015,7 +60042,6 @@
|
|
|
60015
60042
|
this.name = this.constructor.info.name;
|
|
60016
60043
|
this.logo = this.constructor.info.logo;
|
|
60017
60044
|
this.blockchains = this.constructor.info.blockchains;
|
|
60018
|
-
this.connector = WalletConnectV1.instance || this.newWalletConnectInstance();
|
|
60019
60045
|
this.sendTransaction = (transaction)=>{
|
|
60020
60046
|
return sendTransaction$3({
|
|
60021
60047
|
wallet: this,
|
|
@@ -60024,10 +60050,13 @@
|
|
|
60024
60050
|
};
|
|
60025
60051
|
}
|
|
60026
60052
|
|
|
60027
|
-
newWalletConnectInstance() {
|
|
60053
|
+
newWalletConnectInstance(connect) {
|
|
60028
60054
|
let instance = new walletconnectV1.WalletConnectClient({
|
|
60029
|
-
bridge: "https://
|
|
60030
|
-
qrcodeModal:
|
|
60055
|
+
bridge: "https://walletconnect.depay.com",
|
|
60056
|
+
qrcodeModal: {
|
|
60057
|
+
open: async(uri)=>connect({ uri }),
|
|
60058
|
+
close: ()=>{},
|
|
60059
|
+
}
|
|
60031
60060
|
});
|
|
60032
60061
|
|
|
60033
60062
|
instance.on("connect", (error, payload) => {
|
|
@@ -60063,20 +60092,25 @@
|
|
|
60063
60092
|
}
|
|
60064
60093
|
|
|
60065
60094
|
async connect(options) {
|
|
60095
|
+
let connect = (options && options.connect) ? options.connect : ({uri})=>{};
|
|
60096
|
+
if(_optionalChain$4([options, 'optionalAccess', _ => _.name])) { this.name = options.name; }
|
|
60097
|
+
if(_optionalChain$4([options, 'optionalAccess', _2 => _2.logo])) { this.logo = options.logo; }
|
|
60066
60098
|
try {
|
|
60067
60099
|
window.localStorage.removeItem('walletconnect'); // https://github.com/WalletConnect/walletconnect-monorepo/issues/315
|
|
60068
60100
|
|
|
60101
|
+
this.connector = WalletConnectV1.instance;
|
|
60102
|
+
|
|
60069
60103
|
if(this.connector == undefined){
|
|
60070
|
-
this.connector = this.newWalletConnectInstance();
|
|
60104
|
+
this.connector = this.newWalletConnectInstance(connect);
|
|
60071
60105
|
}
|
|
60072
60106
|
|
|
60073
60107
|
if(this.connector.connected) {
|
|
60074
60108
|
await this.connector.killSession();
|
|
60075
60109
|
setConnectedInstance$2(undefined);
|
|
60076
|
-
this.connector = this.newWalletConnectInstance();
|
|
60110
|
+
this.connector = this.newWalletConnectInstance(connect);
|
|
60077
60111
|
}
|
|
60078
60112
|
|
|
60079
|
-
let { accounts, chainId } = await this.connector.connect(
|
|
60113
|
+
let { accounts, chainId } = await this.connector.connect();
|
|
60080
60114
|
|
|
60081
60115
|
if(accounts instanceof Array && accounts.length) {
|
|
60082
60116
|
setConnectedInstance$2(this);
|
|
@@ -60382,6 +60416,8 @@
|
|
|
60382
60416
|
methods: [
|
|
60383
60417
|
"eth_sendTransaction",
|
|
60384
60418
|
"personal_sign",
|
|
60419
|
+
"eth_chainId",
|
|
60420
|
+
"wallet_switchEthereumChain",
|
|
60385
60421
|
],
|
|
60386
60422
|
chains: [`${blockchain.namespace}:${blockchain.networkId}`],
|
|
60387
60423
|
events: [],
|
|
@@ -60421,7 +60457,28 @@
|
|
|
60421
60457
|
|
|
60422
60458
|
switchTo(blockchainName) {
|
|
60423
60459
|
return new Promise((resolve, reject)=>{
|
|
60424
|
-
|
|
60460
|
+
let resolved, rejected;
|
|
60461
|
+
const blockchain = web3Blockchains.Blockchain.findByName(blockchainName);
|
|
60462
|
+
setTimeout(async()=>{
|
|
60463
|
+
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
60464
|
+
reject({ code: 'NOT_SUPPORTED' });
|
|
60465
|
+
} else {
|
|
60466
|
+
resolve();
|
|
60467
|
+
}
|
|
60468
|
+
}, 4000);
|
|
60469
|
+
this.connectedBlockchain = blockchain.name;
|
|
60470
|
+
this.signClient.request({
|
|
60471
|
+
topic: this.session.topic,
|
|
60472
|
+
chainId: this.session.chainId,
|
|
60473
|
+
request:{
|
|
60474
|
+
method: 'wallet_switchEthereumChain',
|
|
60475
|
+
params: [{ chainId: blockchain.id }],
|
|
60476
|
+
}
|
|
60477
|
+
}).then((result)=>{
|
|
60478
|
+
console.log('RESULT ', result);
|
|
60479
|
+
resolved = true;
|
|
60480
|
+
resolve();
|
|
60481
|
+
});
|
|
60425
60482
|
})
|
|
60426
60483
|
}
|
|
60427
60484
|
|