@depay/web3-wallets-evm 15.3.1 → 15.4.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/dist/esm/index.evm.js +35 -26
- package/dist/esm/index.js +32 -23
- package/dist/esm/index.solana.js +35 -26
- package/dist/umd/index.evm.js +42 -28
- package/dist/umd/index.js +39 -25
- package/dist/umd/index.solana.js +42 -28
- package/package.json +3 -4
package/dist/esm/index.evm.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Blockchains from '@depay/web3-blockchains';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { request as request$3, getProvider, estimate } from '@depay/web3-client-evm';
|
|
4
|
-
import { CONSTANTS } from '@depay/web3-constants';
|
|
5
4
|
import { WalletConnectClient } from '@depay/walletconnect-v1';
|
|
6
5
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
7
6
|
|
|
@@ -58933,7 +58932,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
|
|
|
58933
58932
|
}
|
|
58934
58933
|
|
|
58935
58934
|
detectNetwork() {
|
|
58936
|
-
return Promise.resolve(
|
|
58935
|
+
return Promise.resolve(Blockchains.findByName(this._network).id)
|
|
58937
58936
|
}
|
|
58938
58937
|
|
|
58939
58938
|
requestChunk(chunk, endpoint) {
|
|
@@ -59210,7 +59209,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'velas'];
|
|
|
59210
59209
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'velas'];
|
|
59211
59210
|
supported$1.solana = ['solana'];
|
|
59212
59211
|
|
|
59213
|
-
function _optionalChain$
|
|
59212
|
+
function _optionalChain$1$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; }
|
|
59214
59213
|
let getCacheStore = () => {
|
|
59215
59214
|
if (getWindow()._cacheStore == undefined) {
|
|
59216
59215
|
resetCache();
|
|
@@ -59240,7 +59239,7 @@ let set = function ({ key, value, expires }) {
|
|
|
59240
59239
|
|
|
59241
59240
|
let get = function ({ key, expires }) {
|
|
59242
59241
|
let cachedEntry = getCacheStore()[key];
|
|
59243
|
-
if (_optionalChain$
|
|
59242
|
+
if (_optionalChain$1$1([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
|
|
59244
59243
|
return cachedEntry.value
|
|
59245
59244
|
}
|
|
59246
59245
|
};
|
|
@@ -59478,7 +59477,7 @@ class Transaction {
|
|
|
59478
59477
|
|
|
59479
59478
|
static bigNumberify(value, blockchain) {
|
|
59480
59479
|
if (typeof value === 'number') {
|
|
59481
|
-
return ethers.utils.parseUnits(value.toString(),
|
|
59480
|
+
return ethers.utils.parseUnits(value.toString(), Blockchains[blockchain].currency.decimals)
|
|
59482
59481
|
} else if (value && value.toString) {
|
|
59483
59482
|
return ethers.BigNumber.from(value.toString())
|
|
59484
59483
|
} else {
|
|
@@ -59562,7 +59561,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
59562
59561
|
if (sentTransaction) {
|
|
59563
59562
|
transaction.id = sentTransaction.hash;
|
|
59564
59563
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
59565
|
-
transaction.url =
|
|
59564
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59566
59565
|
if (transaction.sent) transaction.sent(transaction);
|
|
59567
59566
|
sentTransaction.wait(1).then(() => {
|
|
59568
59567
|
transaction._succeeded = true;
|
|
@@ -59571,7 +59570,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
59571
59570
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
59572
59571
|
if(error.replacement && error.replacement.hash) {
|
|
59573
59572
|
transaction.id = error.replacement.hash;
|
|
59574
|
-
transaction.url =
|
|
59573
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59575
59574
|
}
|
|
59576
59575
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
59577
59576
|
transaction._succeeded = true;
|
|
@@ -59691,7 +59690,7 @@ class WindowEthereum {
|
|
|
59691
59690
|
}
|
|
59692
59691
|
|
|
59693
59692
|
async connectedTo(input) {
|
|
59694
|
-
const blockchain =
|
|
59693
|
+
const blockchain = Blockchains.findById(await this.getProvider().request({ method: 'eth_chainId' }));
|
|
59695
59694
|
if(input) {
|
|
59696
59695
|
return input === blockchain.name
|
|
59697
59696
|
} else {
|
|
@@ -59701,7 +59700,7 @@ class WindowEthereum {
|
|
|
59701
59700
|
|
|
59702
59701
|
addNetwork(blockchainName) {
|
|
59703
59702
|
return new Promise((resolve, reject)=>{
|
|
59704
|
-
const blockchain =
|
|
59703
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
59705
59704
|
this.getProvider().request({
|
|
59706
59705
|
method: 'wallet_addEthereumChain',
|
|
59707
59706
|
params: [{
|
|
@@ -59722,7 +59721,7 @@ class WindowEthereum {
|
|
|
59722
59721
|
|
|
59723
59722
|
switchTo(blockchainName) {
|
|
59724
59723
|
return new Promise((resolve, reject)=>{
|
|
59725
|
-
const blockchain =
|
|
59724
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
59726
59725
|
this.getProvider().request({
|
|
59727
59726
|
method: 'wallet_switchEthereumChain',
|
|
59728
59727
|
params: [{ chainId: blockchain.id }],
|
|
@@ -59869,7 +59868,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
59869
59868
|
await submit$2({ transaction, wallet }).then(({ signature })=>{
|
|
59870
59869
|
if(signature) {
|
|
59871
59870
|
transaction.id = signature;
|
|
59872
|
-
transaction.url =
|
|
59871
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59873
59872
|
if (transaction.sent) transaction.sent(transaction);
|
|
59874
59873
|
|
|
59875
59874
|
let count = 0;
|
|
@@ -60158,7 +60157,7 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
60158
60157
|
transaction.nonce = transactionCount;
|
|
60159
60158
|
await submit$1({ transaction, wallet }).then((tx)=>{
|
|
60160
60159
|
if (tx) {
|
|
60161
|
-
let blockchain =
|
|
60160
|
+
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
60162
60161
|
transaction.id = tx;
|
|
60163
60162
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60164
60163
|
if (transaction.sent) transaction.sent(transaction);
|
|
@@ -60269,11 +60268,21 @@ const getPlainInstance = ()=>{
|
|
|
60269
60268
|
return currentPlainInstance
|
|
60270
60269
|
};
|
|
60271
60270
|
|
|
60272
|
-
const isConnected =
|
|
60273
|
-
|
|
60274
|
-
|
|
60275
|
-
|
|
60276
|
-
|
|
60271
|
+
const isConnected = ()=>{
|
|
60272
|
+
return new Promise(async(resolve, reject)=>{
|
|
60273
|
+
let connector = getPlainInstance();
|
|
60274
|
+
let accounts;
|
|
60275
|
+
|
|
60276
|
+
try {
|
|
60277
|
+
setTimeout(()=>{ resolve(false); }, 2000);
|
|
60278
|
+
let blockNumber = await connector.sendCustomRequest({ method: 'eth_blockNumber' });
|
|
60279
|
+
if(blockNumber) {
|
|
60280
|
+
accounts = await connector.sendCustomRequest({ method: 'eth_accounts' });
|
|
60281
|
+
}
|
|
60282
|
+
} catch (error) { resolve(false); }
|
|
60283
|
+
|
|
60284
|
+
return resolve(accounts && accounts.length)
|
|
60285
|
+
})
|
|
60277
60286
|
};
|
|
60278
60287
|
|
|
60279
60288
|
const getConnectedInstance$1 = async()=>{
|
|
@@ -60393,7 +60402,7 @@ class WalletConnectV1 {
|
|
|
60393
60402
|
|
|
60394
60403
|
async connectedTo(input) {
|
|
60395
60404
|
let chainId = await this.connector.sendCustomRequest({ method: 'eth_chainId' });
|
|
60396
|
-
const blockchain =
|
|
60405
|
+
const blockchain = Blockchains.findById(chainId);
|
|
60397
60406
|
if(input) {
|
|
60398
60407
|
return input === blockchain.name
|
|
60399
60408
|
} else {
|
|
@@ -60404,7 +60413,7 @@ class WalletConnectV1 {
|
|
|
60404
60413
|
switchTo(blockchainName) {
|
|
60405
60414
|
return new Promise((resolve, reject)=>{
|
|
60406
60415
|
let resolved, rejected;
|
|
60407
|
-
const blockchain =
|
|
60416
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60408
60417
|
setTimeout(async()=>{
|
|
60409
60418
|
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
60410
60419
|
reject({ code: 'NOT_SUPPORTED' });
|
|
@@ -60439,7 +60448,7 @@ class WalletConnectV1 {
|
|
|
60439
60448
|
|
|
60440
60449
|
addNetwork(blockchainName) {
|
|
60441
60450
|
return new Promise((resolve, reject)=>{
|
|
60442
|
-
const blockchain =
|
|
60451
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60443
60452
|
this.connector.sendCustomRequest({
|
|
60444
60453
|
method: 'wallet_addEthereumChain',
|
|
60445
60454
|
params: [{
|
|
@@ -60520,7 +60529,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
60520
60529
|
if (sentTransaction) {
|
|
60521
60530
|
transaction.id = sentTransaction.hash;
|
|
60522
60531
|
transaction.nonce = sentTransaction.nonce;
|
|
60523
|
-
transaction.url =
|
|
60532
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60524
60533
|
if (transaction.sent) transaction.sent(transaction);
|
|
60525
60534
|
sentTransaction.wait(1).then(() => {
|
|
60526
60535
|
transaction._succeeded = true;
|
|
@@ -60529,7 +60538,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
60529
60538
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
60530
60539
|
if(error.replacement && error.replacement.hash) {
|
|
60531
60540
|
transaction.id = error.replacement.hash;
|
|
60532
|
-
transaction.url =
|
|
60541
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60533
60542
|
}
|
|
60534
60543
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
60535
60544
|
transaction._succeeded = true;
|
|
@@ -60636,7 +60645,7 @@ class WalletLink {
|
|
|
60636
60645
|
|
|
60637
60646
|
async connectedTo(input) {
|
|
60638
60647
|
let chainId = await this.connector.getChainId();
|
|
60639
|
-
const blockchain =
|
|
60648
|
+
const blockchain = Blockchains.findByNetworkId(chainId);
|
|
60640
60649
|
if(input) {
|
|
60641
60650
|
return input === blockchain.name
|
|
60642
60651
|
} else {
|
|
@@ -60646,7 +60655,7 @@ class WalletLink {
|
|
|
60646
60655
|
|
|
60647
60656
|
switchTo(blockchainName) {
|
|
60648
60657
|
return new Promise((resolve, reject)=>{
|
|
60649
|
-
const blockchain =
|
|
60658
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60650
60659
|
this.connector.request({
|
|
60651
60660
|
method: 'wallet_switchEthereumChain',
|
|
60652
60661
|
params: [{ chainId: blockchain.id }],
|
|
@@ -60664,7 +60673,7 @@ class WalletLink {
|
|
|
60664
60673
|
|
|
60665
60674
|
addNetwork(blockchainName) {
|
|
60666
60675
|
return new Promise((resolve, reject)=>{
|
|
60667
|
-
const blockchain =
|
|
60676
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60668
60677
|
this.connector.request({
|
|
60669
60678
|
method: 'wallet_addEthereumChain',
|
|
60670
60679
|
params: [{
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Blockchains from '@depay/web3-blockchains';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { request, getProvider, estimate } from '@depay/web3-client';
|
|
4
|
-
import { CONSTANTS } from '@depay/web3-constants';
|
|
5
4
|
import { PublicKey, Transaction as Transaction$1, SystemProgram } from '@depay/solana-web3.js';
|
|
6
5
|
import { WalletConnectClient } from '@depay/walletconnect-v1';
|
|
7
6
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
@@ -41,7 +40,7 @@ class Transaction {
|
|
|
41
40
|
|
|
42
41
|
static bigNumberify(value, blockchain) {
|
|
43
42
|
if (typeof value === 'number') {
|
|
44
|
-
return ethers.utils.parseUnits(value.toString(),
|
|
43
|
+
return ethers.utils.parseUnits(value.toString(), Blockchains[blockchain].currency.decimals)
|
|
45
44
|
} else if (value && value.toString) {
|
|
46
45
|
return ethers.BigNumber.from(value.toString())
|
|
47
46
|
} else {
|
|
@@ -125,7 +124,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
125
124
|
if (sentTransaction) {
|
|
126
125
|
transaction.id = sentTransaction.hash;
|
|
127
126
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
128
|
-
transaction.url =
|
|
127
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
129
128
|
if (transaction.sent) transaction.sent(transaction);
|
|
130
129
|
sentTransaction.wait(1).then(() => {
|
|
131
130
|
transaction._succeeded = true;
|
|
@@ -134,7 +133,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
134
133
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
135
134
|
if(error.replacement && error.replacement.hash) {
|
|
136
135
|
transaction.id = error.replacement.hash;
|
|
137
|
-
transaction.url =
|
|
136
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
138
137
|
}
|
|
139
138
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
140
139
|
transaction._succeeded = true;
|
|
@@ -254,7 +253,7 @@ class WindowEthereum {
|
|
|
254
253
|
}
|
|
255
254
|
|
|
256
255
|
async connectedTo(input) {
|
|
257
|
-
const blockchain =
|
|
256
|
+
const blockchain = Blockchains.findById(await this.getProvider().request({ method: 'eth_chainId' }));
|
|
258
257
|
if(input) {
|
|
259
258
|
return input === blockchain.name
|
|
260
259
|
} else {
|
|
@@ -264,7 +263,7 @@ class WindowEthereum {
|
|
|
264
263
|
|
|
265
264
|
addNetwork(blockchainName) {
|
|
266
265
|
return new Promise((resolve, reject)=>{
|
|
267
|
-
const blockchain =
|
|
266
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
268
267
|
this.getProvider().request({
|
|
269
268
|
method: 'wallet_addEthereumChain',
|
|
270
269
|
params: [{
|
|
@@ -285,7 +284,7 @@ class WindowEthereum {
|
|
|
285
284
|
|
|
286
285
|
switchTo(blockchainName) {
|
|
287
286
|
return new Promise((resolve, reject)=>{
|
|
288
|
-
const blockchain =
|
|
287
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
289
288
|
this.getProvider().request({
|
|
290
289
|
method: 'wallet_switchEthereumChain',
|
|
291
290
|
params: [{ chainId: blockchain.id }],
|
|
@@ -432,7 +431,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
432
431
|
await submit$2({ transaction, wallet }).then(({ signature })=>{
|
|
433
432
|
if(signature) {
|
|
434
433
|
transaction.id = signature;
|
|
435
|
-
transaction.url =
|
|
434
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
436
435
|
if (transaction.sent) transaction.sent(transaction);
|
|
437
436
|
|
|
438
437
|
let count = 0;
|
|
@@ -721,7 +720,7 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
721
720
|
transaction.nonce = transactionCount;
|
|
722
721
|
await submit$1({ transaction, wallet }).then((tx)=>{
|
|
723
722
|
if (tx) {
|
|
724
|
-
let blockchain =
|
|
723
|
+
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
725
724
|
transaction.id = tx;
|
|
726
725
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
727
726
|
if (transaction.sent) transaction.sent(transaction);
|
|
@@ -832,11 +831,21 @@ const getPlainInstance = ()=>{
|
|
|
832
831
|
return currentPlainInstance
|
|
833
832
|
};
|
|
834
833
|
|
|
835
|
-
const isConnected =
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
834
|
+
const isConnected = ()=>{
|
|
835
|
+
return new Promise(async(resolve, reject)=>{
|
|
836
|
+
let connector = getPlainInstance();
|
|
837
|
+
let accounts;
|
|
838
|
+
|
|
839
|
+
try {
|
|
840
|
+
setTimeout(()=>{ resolve(false); }, 2000);
|
|
841
|
+
let blockNumber = await connector.sendCustomRequest({ method: 'eth_blockNumber' });
|
|
842
|
+
if(blockNumber) {
|
|
843
|
+
accounts = await connector.sendCustomRequest({ method: 'eth_accounts' });
|
|
844
|
+
}
|
|
845
|
+
} catch (error) { resolve(false); }
|
|
846
|
+
|
|
847
|
+
return resolve(accounts && accounts.length)
|
|
848
|
+
})
|
|
840
849
|
};
|
|
841
850
|
|
|
842
851
|
const getConnectedInstance$1 = async()=>{
|
|
@@ -956,7 +965,7 @@ class WalletConnectV1 {
|
|
|
956
965
|
|
|
957
966
|
async connectedTo(input) {
|
|
958
967
|
let chainId = await this.connector.sendCustomRequest({ method: 'eth_chainId' });
|
|
959
|
-
const blockchain =
|
|
968
|
+
const blockchain = Blockchains.findById(chainId);
|
|
960
969
|
if(input) {
|
|
961
970
|
return input === blockchain.name
|
|
962
971
|
} else {
|
|
@@ -967,7 +976,7 @@ class WalletConnectV1 {
|
|
|
967
976
|
switchTo(blockchainName) {
|
|
968
977
|
return new Promise((resolve, reject)=>{
|
|
969
978
|
let resolved, rejected;
|
|
970
|
-
const blockchain =
|
|
979
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
971
980
|
setTimeout(async()=>{
|
|
972
981
|
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
973
982
|
reject({ code: 'NOT_SUPPORTED' });
|
|
@@ -1002,7 +1011,7 @@ class WalletConnectV1 {
|
|
|
1002
1011
|
|
|
1003
1012
|
addNetwork(blockchainName) {
|
|
1004
1013
|
return new Promise((resolve, reject)=>{
|
|
1005
|
-
const blockchain =
|
|
1014
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
1006
1015
|
this.connector.sendCustomRequest({
|
|
1007
1016
|
method: 'wallet_addEthereumChain',
|
|
1008
1017
|
params: [{
|
|
@@ -1083,7 +1092,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
1083
1092
|
if (sentTransaction) {
|
|
1084
1093
|
transaction.id = sentTransaction.hash;
|
|
1085
1094
|
transaction.nonce = sentTransaction.nonce;
|
|
1086
|
-
transaction.url =
|
|
1095
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
1087
1096
|
if (transaction.sent) transaction.sent(transaction);
|
|
1088
1097
|
sentTransaction.wait(1).then(() => {
|
|
1089
1098
|
transaction._succeeded = true;
|
|
@@ -1092,7 +1101,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
1092
1101
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
1093
1102
|
if(error.replacement && error.replacement.hash) {
|
|
1094
1103
|
transaction.id = error.replacement.hash;
|
|
1095
|
-
transaction.url =
|
|
1104
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
1096
1105
|
}
|
|
1097
1106
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
1098
1107
|
transaction._succeeded = true;
|
|
@@ -1199,7 +1208,7 @@ class WalletLink {
|
|
|
1199
1208
|
|
|
1200
1209
|
async connectedTo(input) {
|
|
1201
1210
|
let chainId = await this.connector.getChainId();
|
|
1202
|
-
const blockchain =
|
|
1211
|
+
const blockchain = Blockchains.findByNetworkId(chainId);
|
|
1203
1212
|
if(input) {
|
|
1204
1213
|
return input === blockchain.name
|
|
1205
1214
|
} else {
|
|
@@ -1209,7 +1218,7 @@ class WalletLink {
|
|
|
1209
1218
|
|
|
1210
1219
|
switchTo(blockchainName) {
|
|
1211
1220
|
return new Promise((resolve, reject)=>{
|
|
1212
|
-
const blockchain =
|
|
1221
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
1213
1222
|
this.connector.request({
|
|
1214
1223
|
method: 'wallet_switchEthereumChain',
|
|
1215
1224
|
params: [{ chainId: blockchain.id }],
|
|
@@ -1227,7 +1236,7 @@ class WalletLink {
|
|
|
1227
1236
|
|
|
1228
1237
|
addNetwork(blockchainName) {
|
|
1229
1238
|
return new Promise((resolve, reject)=>{
|
|
1230
|
-
const blockchain =
|
|
1239
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
1231
1240
|
this.connector.request({
|
|
1232
1241
|
method: 'wallet_addEthereumChain',
|
|
1233
1242
|
params: [{
|
package/dist/esm/index.solana.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Blockchains from '@depay/web3-blockchains';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { request as request$3, getProvider, estimate } from '@depay/web3-client-solana';
|
|
4
|
-
import { CONSTANTS } from '@depay/web3-constants';
|
|
5
4
|
import { WalletConnectClient } from '@depay/walletconnect-v1';
|
|
6
5
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
7
6
|
|
|
@@ -58933,7 +58932,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
|
|
|
58933
58932
|
}
|
|
58934
58933
|
|
|
58935
58934
|
detectNetwork() {
|
|
58936
|
-
return Promise.resolve(
|
|
58935
|
+
return Promise.resolve(Blockchains.findByName(this._network).id)
|
|
58937
58936
|
}
|
|
58938
58937
|
|
|
58939
58938
|
requestChunk(chunk, endpoint) {
|
|
@@ -59210,7 +59209,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'velas'];
|
|
|
59210
59209
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'velas'];
|
|
59211
59210
|
supported$1.solana = ['solana'];
|
|
59212
59211
|
|
|
59213
|
-
function _optionalChain$
|
|
59212
|
+
function _optionalChain$1$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; }
|
|
59214
59213
|
let getCacheStore = () => {
|
|
59215
59214
|
if (getWindow()._cacheStore == undefined) {
|
|
59216
59215
|
resetCache();
|
|
@@ -59240,7 +59239,7 @@ let set = function ({ key, value, expires }) {
|
|
|
59240
59239
|
|
|
59241
59240
|
let get = function ({ key, expires }) {
|
|
59242
59241
|
let cachedEntry = getCacheStore()[key];
|
|
59243
|
-
if (_optionalChain$
|
|
59242
|
+
if (_optionalChain$1$1([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
|
|
59244
59243
|
return cachedEntry.value
|
|
59245
59244
|
}
|
|
59246
59245
|
};
|
|
@@ -59478,7 +59477,7 @@ class Transaction {
|
|
|
59478
59477
|
|
|
59479
59478
|
static bigNumberify(value, blockchain) {
|
|
59480
59479
|
if (typeof value === 'number') {
|
|
59481
|
-
return ethers.utils.parseUnits(value.toString(),
|
|
59480
|
+
return ethers.utils.parseUnits(value.toString(), Blockchains[blockchain].currency.decimals)
|
|
59482
59481
|
} else if (value && value.toString) {
|
|
59483
59482
|
return ethers.BigNumber.from(value.toString())
|
|
59484
59483
|
} else {
|
|
@@ -59562,7 +59561,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
59562
59561
|
if (sentTransaction) {
|
|
59563
59562
|
transaction.id = sentTransaction.hash;
|
|
59564
59563
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
59565
|
-
transaction.url =
|
|
59564
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59566
59565
|
if (transaction.sent) transaction.sent(transaction);
|
|
59567
59566
|
sentTransaction.wait(1).then(() => {
|
|
59568
59567
|
transaction._succeeded = true;
|
|
@@ -59571,7 +59570,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
59571
59570
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
59572
59571
|
if(error.replacement && error.replacement.hash) {
|
|
59573
59572
|
transaction.id = error.replacement.hash;
|
|
59574
|
-
transaction.url =
|
|
59573
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59575
59574
|
}
|
|
59576
59575
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
59577
59576
|
transaction._succeeded = true;
|
|
@@ -59691,7 +59690,7 @@ class WindowEthereum {
|
|
|
59691
59690
|
}
|
|
59692
59691
|
|
|
59693
59692
|
async connectedTo(input) {
|
|
59694
|
-
const blockchain =
|
|
59693
|
+
const blockchain = Blockchains.findById(await this.getProvider().request({ method: 'eth_chainId' }));
|
|
59695
59694
|
if(input) {
|
|
59696
59695
|
return input === blockchain.name
|
|
59697
59696
|
} else {
|
|
@@ -59701,7 +59700,7 @@ class WindowEthereum {
|
|
|
59701
59700
|
|
|
59702
59701
|
addNetwork(blockchainName) {
|
|
59703
59702
|
return new Promise((resolve, reject)=>{
|
|
59704
|
-
const blockchain =
|
|
59703
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
59705
59704
|
this.getProvider().request({
|
|
59706
59705
|
method: 'wallet_addEthereumChain',
|
|
59707
59706
|
params: [{
|
|
@@ -59722,7 +59721,7 @@ class WindowEthereum {
|
|
|
59722
59721
|
|
|
59723
59722
|
switchTo(blockchainName) {
|
|
59724
59723
|
return new Promise((resolve, reject)=>{
|
|
59725
|
-
const blockchain =
|
|
59724
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
59726
59725
|
this.getProvider().request({
|
|
59727
59726
|
method: 'wallet_switchEthereumChain',
|
|
59728
59727
|
params: [{ chainId: blockchain.id }],
|
|
@@ -59869,7 +59868,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
59869
59868
|
await submit$2({ transaction, wallet }).then(({ signature })=>{
|
|
59870
59869
|
if(signature) {
|
|
59871
59870
|
transaction.id = signature;
|
|
59872
|
-
transaction.url =
|
|
59871
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59873
59872
|
if (transaction.sent) transaction.sent(transaction);
|
|
59874
59873
|
|
|
59875
59874
|
let count = 0;
|
|
@@ -60158,7 +60157,7 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
60158
60157
|
transaction.nonce = transactionCount;
|
|
60159
60158
|
await submit$1({ transaction, wallet }).then((tx)=>{
|
|
60160
60159
|
if (tx) {
|
|
60161
|
-
let blockchain =
|
|
60160
|
+
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
60162
60161
|
transaction.id = tx;
|
|
60163
60162
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60164
60163
|
if (transaction.sent) transaction.sent(transaction);
|
|
@@ -60269,11 +60268,21 @@ const getPlainInstance = ()=>{
|
|
|
60269
60268
|
return currentPlainInstance
|
|
60270
60269
|
};
|
|
60271
60270
|
|
|
60272
|
-
const isConnected =
|
|
60273
|
-
|
|
60274
|
-
|
|
60275
|
-
|
|
60276
|
-
|
|
60271
|
+
const isConnected = ()=>{
|
|
60272
|
+
return new Promise(async(resolve, reject)=>{
|
|
60273
|
+
let connector = getPlainInstance();
|
|
60274
|
+
let accounts;
|
|
60275
|
+
|
|
60276
|
+
try {
|
|
60277
|
+
setTimeout(()=>{ resolve(false); }, 2000);
|
|
60278
|
+
let blockNumber = await connector.sendCustomRequest({ method: 'eth_blockNumber' });
|
|
60279
|
+
if(blockNumber) {
|
|
60280
|
+
accounts = await connector.sendCustomRequest({ method: 'eth_accounts' });
|
|
60281
|
+
}
|
|
60282
|
+
} catch (error) { resolve(false); }
|
|
60283
|
+
|
|
60284
|
+
return resolve(accounts && accounts.length)
|
|
60285
|
+
})
|
|
60277
60286
|
};
|
|
60278
60287
|
|
|
60279
60288
|
const getConnectedInstance$1 = async()=>{
|
|
@@ -60393,7 +60402,7 @@ class WalletConnectV1 {
|
|
|
60393
60402
|
|
|
60394
60403
|
async connectedTo(input) {
|
|
60395
60404
|
let chainId = await this.connector.sendCustomRequest({ method: 'eth_chainId' });
|
|
60396
|
-
const blockchain =
|
|
60405
|
+
const blockchain = Blockchains.findById(chainId);
|
|
60397
60406
|
if(input) {
|
|
60398
60407
|
return input === blockchain.name
|
|
60399
60408
|
} else {
|
|
@@ -60404,7 +60413,7 @@ class WalletConnectV1 {
|
|
|
60404
60413
|
switchTo(blockchainName) {
|
|
60405
60414
|
return new Promise((resolve, reject)=>{
|
|
60406
60415
|
let resolved, rejected;
|
|
60407
|
-
const blockchain =
|
|
60416
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60408
60417
|
setTimeout(async()=>{
|
|
60409
60418
|
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
60410
60419
|
reject({ code: 'NOT_SUPPORTED' });
|
|
@@ -60439,7 +60448,7 @@ class WalletConnectV1 {
|
|
|
60439
60448
|
|
|
60440
60449
|
addNetwork(blockchainName) {
|
|
60441
60450
|
return new Promise((resolve, reject)=>{
|
|
60442
|
-
const blockchain =
|
|
60451
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60443
60452
|
this.connector.sendCustomRequest({
|
|
60444
60453
|
method: 'wallet_addEthereumChain',
|
|
60445
60454
|
params: [{
|
|
@@ -60520,7 +60529,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
60520
60529
|
if (sentTransaction) {
|
|
60521
60530
|
transaction.id = sentTransaction.hash;
|
|
60522
60531
|
transaction.nonce = sentTransaction.nonce;
|
|
60523
|
-
transaction.url =
|
|
60532
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60524
60533
|
if (transaction.sent) transaction.sent(transaction);
|
|
60525
60534
|
sentTransaction.wait(1).then(() => {
|
|
60526
60535
|
transaction._succeeded = true;
|
|
@@ -60529,7 +60538,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
60529
60538
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
60530
60539
|
if(error.replacement && error.replacement.hash) {
|
|
60531
60540
|
transaction.id = error.replacement.hash;
|
|
60532
|
-
transaction.url =
|
|
60541
|
+
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60533
60542
|
}
|
|
60534
60543
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
60535
60544
|
transaction._succeeded = true;
|
|
@@ -60636,7 +60645,7 @@ class WalletLink {
|
|
|
60636
60645
|
|
|
60637
60646
|
async connectedTo(input) {
|
|
60638
60647
|
let chainId = await this.connector.getChainId();
|
|
60639
|
-
const blockchain =
|
|
60648
|
+
const blockchain = Blockchains.findByNetworkId(chainId);
|
|
60640
60649
|
if(input) {
|
|
60641
60650
|
return input === blockchain.name
|
|
60642
60651
|
} else {
|
|
@@ -60646,7 +60655,7 @@ class WalletLink {
|
|
|
60646
60655
|
|
|
60647
60656
|
switchTo(blockchainName) {
|
|
60648
60657
|
return new Promise((resolve, reject)=>{
|
|
60649
|
-
const blockchain =
|
|
60658
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60650
60659
|
this.connector.request({
|
|
60651
60660
|
method: 'wallet_switchEthereumChain',
|
|
60652
60661
|
params: [{ chainId: blockchain.id }],
|
|
@@ -60664,7 +60673,7 @@ class WalletLink {
|
|
|
60664
60673
|
|
|
60665
60674
|
addNetwork(blockchainName) {
|
|
60666
60675
|
return new Promise((resolve, reject)=>{
|
|
60667
|
-
const blockchain =
|
|
60676
|
+
const blockchain = Blockchains.findByName(blockchainName);
|
|
60668
60677
|
this.connector.request({
|
|
60669
60678
|
method: 'wallet_addEthereumChain',
|
|
60670
60679
|
params: [{
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-client-evm'), require('@depay/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-client-evm', '@depay/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Client, global.
|
|
5
|
-
}(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-client-evm'), require('@depay/walletconnect-v1'), require('@depay/coinbase-wallet-sdk')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-client-evm', '@depay/walletconnect-v1', '@depay/coinbase-wallet-sdk'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Client, global.WalletConnect, global.CoinbaseWalletSdk));
|
|
5
|
+
}(this, (function (exports, Blockchains, ethers, web3ClientEvm, walletconnectV1, coinbaseWalletSdk) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var Blockchains__default = /*#__PURE__*/_interopDefaultLegacy(Blockchains);
|
|
6
10
|
|
|
7
11
|
let supported$2 = ['ethereum', 'bsc', 'polygon', 'fantom', 'velas'];
|
|
8
12
|
supported$2.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'velas'];
|
|
@@ -58932,7 +58936,7 @@
|
|
|
58932
58936
|
}
|
|
58933
58937
|
|
|
58934
58938
|
detectNetwork() {
|
|
58935
|
-
return Promise.resolve(
|
|
58939
|
+
return Promise.resolve(Blockchains__default['default'].findByName(this._network).id)
|
|
58936
58940
|
}
|
|
58937
58941
|
|
|
58938
58942
|
requestChunk(chunk, endpoint) {
|
|
@@ -59209,7 +59213,7 @@
|
|
|
59209
59213
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'velas'];
|
|
59210
59214
|
supported$1.solana = ['solana'];
|
|
59211
59215
|
|
|
59212
|
-
function _optionalChain$
|
|
59216
|
+
function _optionalChain$1$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; }
|
|
59213
59217
|
let getCacheStore = () => {
|
|
59214
59218
|
if (getWindow()._cacheStore == undefined) {
|
|
59215
59219
|
resetCache();
|
|
@@ -59239,7 +59243,7 @@
|
|
|
59239
59243
|
|
|
59240
59244
|
let get = function ({ key, expires }) {
|
|
59241
59245
|
let cachedEntry = getCacheStore()[key];
|
|
59242
|
-
if (_optionalChain$
|
|
59246
|
+
if (_optionalChain$1$1([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
|
|
59243
59247
|
return cachedEntry.value
|
|
59244
59248
|
}
|
|
59245
59249
|
};
|
|
@@ -59477,7 +59481,7 @@
|
|
|
59477
59481
|
|
|
59478
59482
|
static bigNumberify(value, blockchain) {
|
|
59479
59483
|
if (typeof value === 'number') {
|
|
59480
|
-
return ethers.ethers.utils.parseUnits(value.toString(),
|
|
59484
|
+
return ethers.ethers.utils.parseUnits(value.toString(), Blockchains__default['default'][blockchain].currency.decimals)
|
|
59481
59485
|
} else if (value && value.toString) {
|
|
59482
59486
|
return ethers.ethers.BigNumber.from(value.toString())
|
|
59483
59487
|
} else {
|
|
@@ -59561,7 +59565,7 @@
|
|
|
59561
59565
|
if (sentTransaction) {
|
|
59562
59566
|
transaction.id = sentTransaction.hash;
|
|
59563
59567
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
59564
|
-
transaction.url =
|
|
59568
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59565
59569
|
if (transaction.sent) transaction.sent(transaction);
|
|
59566
59570
|
sentTransaction.wait(1).then(() => {
|
|
59567
59571
|
transaction._succeeded = true;
|
|
@@ -59570,7 +59574,7 @@
|
|
|
59570
59574
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
59571
59575
|
if(error.replacement && error.replacement.hash) {
|
|
59572
59576
|
transaction.id = error.replacement.hash;
|
|
59573
|
-
transaction.url =
|
|
59577
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59574
59578
|
}
|
|
59575
59579
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
59576
59580
|
transaction._succeeded = true;
|
|
@@ -59690,7 +59694,7 @@
|
|
|
59690
59694
|
}
|
|
59691
59695
|
|
|
59692
59696
|
async connectedTo(input) {
|
|
59693
|
-
const blockchain =
|
|
59697
|
+
const blockchain = Blockchains__default['default'].findById(await this.getProvider().request({ method: 'eth_chainId' }));
|
|
59694
59698
|
if(input) {
|
|
59695
59699
|
return input === blockchain.name
|
|
59696
59700
|
} else {
|
|
@@ -59700,7 +59704,7 @@
|
|
|
59700
59704
|
|
|
59701
59705
|
addNetwork(blockchainName) {
|
|
59702
59706
|
return new Promise((resolve, reject)=>{
|
|
59703
|
-
const blockchain =
|
|
59707
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
59704
59708
|
this.getProvider().request({
|
|
59705
59709
|
method: 'wallet_addEthereumChain',
|
|
59706
59710
|
params: [{
|
|
@@ -59721,7 +59725,7 @@
|
|
|
59721
59725
|
|
|
59722
59726
|
switchTo(blockchainName) {
|
|
59723
59727
|
return new Promise((resolve, reject)=>{
|
|
59724
|
-
const blockchain =
|
|
59728
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
59725
59729
|
this.getProvider().request({
|
|
59726
59730
|
method: 'wallet_switchEthereumChain',
|
|
59727
59731
|
params: [{ chainId: blockchain.id }],
|
|
@@ -59868,7 +59872,7 @@
|
|
|
59868
59872
|
await submit$2({ transaction, wallet }).then(({ signature })=>{
|
|
59869
59873
|
if(signature) {
|
|
59870
59874
|
transaction.id = signature;
|
|
59871
|
-
transaction.url =
|
|
59875
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59872
59876
|
if (transaction.sent) transaction.sent(transaction);
|
|
59873
59877
|
|
|
59874
59878
|
let count = 0;
|
|
@@ -60157,7 +60161,7 @@
|
|
|
60157
60161
|
transaction.nonce = transactionCount;
|
|
60158
60162
|
await submit$1({ transaction, wallet }).then((tx)=>{
|
|
60159
60163
|
if (tx) {
|
|
60160
|
-
let blockchain =
|
|
60164
|
+
let blockchain = Blockchains__default['default'].findByName(transaction.blockchain);
|
|
60161
60165
|
transaction.id = tx;
|
|
60162
60166
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60163
60167
|
if (transaction.sent) transaction.sent(transaction);
|
|
@@ -60268,11 +60272,21 @@
|
|
|
60268
60272
|
return currentPlainInstance
|
|
60269
60273
|
};
|
|
60270
60274
|
|
|
60271
|
-
const isConnected =
|
|
60272
|
-
|
|
60273
|
-
|
|
60274
|
-
|
|
60275
|
-
|
|
60275
|
+
const isConnected = ()=>{
|
|
60276
|
+
return new Promise(async(resolve, reject)=>{
|
|
60277
|
+
let connector = getPlainInstance();
|
|
60278
|
+
let accounts;
|
|
60279
|
+
|
|
60280
|
+
try {
|
|
60281
|
+
setTimeout(()=>{ resolve(false); }, 2000);
|
|
60282
|
+
let blockNumber = await connector.sendCustomRequest({ method: 'eth_blockNumber' });
|
|
60283
|
+
if(blockNumber) {
|
|
60284
|
+
accounts = await connector.sendCustomRequest({ method: 'eth_accounts' });
|
|
60285
|
+
}
|
|
60286
|
+
} catch (error) { resolve(false); }
|
|
60287
|
+
|
|
60288
|
+
return resolve(accounts && accounts.length)
|
|
60289
|
+
})
|
|
60276
60290
|
};
|
|
60277
60291
|
|
|
60278
60292
|
const getConnectedInstance$1 = async()=>{
|
|
@@ -60392,7 +60406,7 @@
|
|
|
60392
60406
|
|
|
60393
60407
|
async connectedTo(input) {
|
|
60394
60408
|
let chainId = await this.connector.sendCustomRequest({ method: 'eth_chainId' });
|
|
60395
|
-
const blockchain =
|
|
60409
|
+
const blockchain = Blockchains__default['default'].findById(chainId);
|
|
60396
60410
|
if(input) {
|
|
60397
60411
|
return input === blockchain.name
|
|
60398
60412
|
} else {
|
|
@@ -60403,7 +60417,7 @@
|
|
|
60403
60417
|
switchTo(blockchainName) {
|
|
60404
60418
|
return new Promise((resolve, reject)=>{
|
|
60405
60419
|
let resolved, rejected;
|
|
60406
|
-
const blockchain =
|
|
60420
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60407
60421
|
setTimeout(async()=>{
|
|
60408
60422
|
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
60409
60423
|
reject({ code: 'NOT_SUPPORTED' });
|
|
@@ -60438,7 +60452,7 @@
|
|
|
60438
60452
|
|
|
60439
60453
|
addNetwork(blockchainName) {
|
|
60440
60454
|
return new Promise((resolve, reject)=>{
|
|
60441
|
-
const blockchain =
|
|
60455
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60442
60456
|
this.connector.sendCustomRequest({
|
|
60443
60457
|
method: 'wallet_addEthereumChain',
|
|
60444
60458
|
params: [{
|
|
@@ -60519,7 +60533,7 @@
|
|
|
60519
60533
|
if (sentTransaction) {
|
|
60520
60534
|
transaction.id = sentTransaction.hash;
|
|
60521
60535
|
transaction.nonce = sentTransaction.nonce;
|
|
60522
|
-
transaction.url =
|
|
60536
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60523
60537
|
if (transaction.sent) transaction.sent(transaction);
|
|
60524
60538
|
sentTransaction.wait(1).then(() => {
|
|
60525
60539
|
transaction._succeeded = true;
|
|
@@ -60528,7 +60542,7 @@
|
|
|
60528
60542
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
60529
60543
|
if(error.replacement && error.replacement.hash) {
|
|
60530
60544
|
transaction.id = error.replacement.hash;
|
|
60531
|
-
transaction.url =
|
|
60545
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60532
60546
|
}
|
|
60533
60547
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
60534
60548
|
transaction._succeeded = true;
|
|
@@ -60635,7 +60649,7 @@
|
|
|
60635
60649
|
|
|
60636
60650
|
async connectedTo(input) {
|
|
60637
60651
|
let chainId = await this.connector.getChainId();
|
|
60638
|
-
const blockchain =
|
|
60652
|
+
const blockchain = Blockchains__default['default'].findByNetworkId(chainId);
|
|
60639
60653
|
if(input) {
|
|
60640
60654
|
return input === blockchain.name
|
|
60641
60655
|
} else {
|
|
@@ -60645,7 +60659,7 @@
|
|
|
60645
60659
|
|
|
60646
60660
|
switchTo(blockchainName) {
|
|
60647
60661
|
return new Promise((resolve, reject)=>{
|
|
60648
|
-
const blockchain =
|
|
60662
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60649
60663
|
this.connector.request({
|
|
60650
60664
|
method: 'wallet_switchEthereumChain',
|
|
60651
60665
|
params: [{ chainId: blockchain.id }],
|
|
@@ -60663,7 +60677,7 @@
|
|
|
60663
60677
|
|
|
60664
60678
|
addNetwork(blockchainName) {
|
|
60665
60679
|
return new Promise((resolve, reject)=>{
|
|
60666
|
-
const blockchain =
|
|
60680
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60667
60681
|
this.connector.request({
|
|
60668
60682
|
method: 'wallet_addEthereumChain',
|
|
60669
60683
|
params: [{
|
package/dist/umd/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-client'), require('@depay/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-client', '@depay/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Client, global.
|
|
5
|
-
}(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-client'), require('@depay/solana-web3.js'), require('@depay/walletconnect-v1'), require('@depay/coinbase-wallet-sdk')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-client', '@depay/solana-web3.js', '@depay/walletconnect-v1', '@depay/coinbase-wallet-sdk'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Client, global.SolanaWeb3js, global.WalletConnect, global.CoinbaseWalletSdk));
|
|
5
|
+
}(this, (function (exports, Blockchains, ethers, web3Client, solanaWeb3_js, walletconnectV1, coinbaseWalletSdk) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var Blockchains__default = /*#__PURE__*/_interopDefaultLegacy(Blockchains);
|
|
6
10
|
|
|
7
11
|
let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'velas'];
|
|
8
12
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'velas'];
|
|
@@ -39,7 +43,7 @@
|
|
|
39
43
|
|
|
40
44
|
static bigNumberify(value, blockchain) {
|
|
41
45
|
if (typeof value === 'number') {
|
|
42
|
-
return ethers.ethers.utils.parseUnits(value.toString(),
|
|
46
|
+
return ethers.ethers.utils.parseUnits(value.toString(), Blockchains__default['default'][blockchain].currency.decimals)
|
|
43
47
|
} else if (value && value.toString) {
|
|
44
48
|
return ethers.ethers.BigNumber.from(value.toString())
|
|
45
49
|
} else {
|
|
@@ -123,7 +127,7 @@
|
|
|
123
127
|
if (sentTransaction) {
|
|
124
128
|
transaction.id = sentTransaction.hash;
|
|
125
129
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
126
|
-
transaction.url =
|
|
130
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
127
131
|
if (transaction.sent) transaction.sent(transaction);
|
|
128
132
|
sentTransaction.wait(1).then(() => {
|
|
129
133
|
transaction._succeeded = true;
|
|
@@ -132,7 +136,7 @@
|
|
|
132
136
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
133
137
|
if(error.replacement && error.replacement.hash) {
|
|
134
138
|
transaction.id = error.replacement.hash;
|
|
135
|
-
transaction.url =
|
|
139
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
136
140
|
}
|
|
137
141
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
138
142
|
transaction._succeeded = true;
|
|
@@ -252,7 +256,7 @@
|
|
|
252
256
|
}
|
|
253
257
|
|
|
254
258
|
async connectedTo(input) {
|
|
255
|
-
const blockchain =
|
|
259
|
+
const blockchain = Blockchains__default['default'].findById(await this.getProvider().request({ method: 'eth_chainId' }));
|
|
256
260
|
if(input) {
|
|
257
261
|
return input === blockchain.name
|
|
258
262
|
} else {
|
|
@@ -262,7 +266,7 @@
|
|
|
262
266
|
|
|
263
267
|
addNetwork(blockchainName) {
|
|
264
268
|
return new Promise((resolve, reject)=>{
|
|
265
|
-
const blockchain =
|
|
269
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
266
270
|
this.getProvider().request({
|
|
267
271
|
method: 'wallet_addEthereumChain',
|
|
268
272
|
params: [{
|
|
@@ -283,7 +287,7 @@
|
|
|
283
287
|
|
|
284
288
|
switchTo(blockchainName) {
|
|
285
289
|
return new Promise((resolve, reject)=>{
|
|
286
|
-
const blockchain =
|
|
290
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
287
291
|
this.getProvider().request({
|
|
288
292
|
method: 'wallet_switchEthereumChain',
|
|
289
293
|
params: [{ chainId: blockchain.id }],
|
|
@@ -430,7 +434,7 @@
|
|
|
430
434
|
await submit$2({ transaction, wallet }).then(({ signature })=>{
|
|
431
435
|
if(signature) {
|
|
432
436
|
transaction.id = signature;
|
|
433
|
-
transaction.url =
|
|
437
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
434
438
|
if (transaction.sent) transaction.sent(transaction);
|
|
435
439
|
|
|
436
440
|
let count = 0;
|
|
@@ -719,7 +723,7 @@
|
|
|
719
723
|
transaction.nonce = transactionCount;
|
|
720
724
|
await submit$1({ transaction, wallet }).then((tx)=>{
|
|
721
725
|
if (tx) {
|
|
722
|
-
let blockchain =
|
|
726
|
+
let blockchain = Blockchains__default['default'].findByName(transaction.blockchain);
|
|
723
727
|
transaction.id = tx;
|
|
724
728
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
725
729
|
if (transaction.sent) transaction.sent(transaction);
|
|
@@ -830,11 +834,21 @@
|
|
|
830
834
|
return currentPlainInstance
|
|
831
835
|
};
|
|
832
836
|
|
|
833
|
-
const isConnected =
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
837
|
+
const isConnected = ()=>{
|
|
838
|
+
return new Promise(async(resolve, reject)=>{
|
|
839
|
+
let connector = getPlainInstance();
|
|
840
|
+
let accounts;
|
|
841
|
+
|
|
842
|
+
try {
|
|
843
|
+
setTimeout(()=>{ resolve(false); }, 2000);
|
|
844
|
+
let blockNumber = await connector.sendCustomRequest({ method: 'eth_blockNumber' });
|
|
845
|
+
if(blockNumber) {
|
|
846
|
+
accounts = await connector.sendCustomRequest({ method: 'eth_accounts' });
|
|
847
|
+
}
|
|
848
|
+
} catch (error) { resolve(false); }
|
|
849
|
+
|
|
850
|
+
return resolve(accounts && accounts.length)
|
|
851
|
+
})
|
|
838
852
|
};
|
|
839
853
|
|
|
840
854
|
const getConnectedInstance$1 = async()=>{
|
|
@@ -954,7 +968,7 @@
|
|
|
954
968
|
|
|
955
969
|
async connectedTo(input) {
|
|
956
970
|
let chainId = await this.connector.sendCustomRequest({ method: 'eth_chainId' });
|
|
957
|
-
const blockchain =
|
|
971
|
+
const blockchain = Blockchains__default['default'].findById(chainId);
|
|
958
972
|
if(input) {
|
|
959
973
|
return input === blockchain.name
|
|
960
974
|
} else {
|
|
@@ -965,7 +979,7 @@
|
|
|
965
979
|
switchTo(blockchainName) {
|
|
966
980
|
return new Promise((resolve, reject)=>{
|
|
967
981
|
let resolved, rejected;
|
|
968
|
-
const blockchain =
|
|
982
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
969
983
|
setTimeout(async()=>{
|
|
970
984
|
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
971
985
|
reject({ code: 'NOT_SUPPORTED' });
|
|
@@ -1000,7 +1014,7 @@
|
|
|
1000
1014
|
|
|
1001
1015
|
addNetwork(blockchainName) {
|
|
1002
1016
|
return new Promise((resolve, reject)=>{
|
|
1003
|
-
const blockchain =
|
|
1017
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
1004
1018
|
this.connector.sendCustomRequest({
|
|
1005
1019
|
method: 'wallet_addEthereumChain',
|
|
1006
1020
|
params: [{
|
|
@@ -1081,7 +1095,7 @@
|
|
|
1081
1095
|
if (sentTransaction) {
|
|
1082
1096
|
transaction.id = sentTransaction.hash;
|
|
1083
1097
|
transaction.nonce = sentTransaction.nonce;
|
|
1084
|
-
transaction.url =
|
|
1098
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
1085
1099
|
if (transaction.sent) transaction.sent(transaction);
|
|
1086
1100
|
sentTransaction.wait(1).then(() => {
|
|
1087
1101
|
transaction._succeeded = true;
|
|
@@ -1090,7 +1104,7 @@
|
|
|
1090
1104
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
1091
1105
|
if(error.replacement && error.replacement.hash) {
|
|
1092
1106
|
transaction.id = error.replacement.hash;
|
|
1093
|
-
transaction.url =
|
|
1107
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
1094
1108
|
}
|
|
1095
1109
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
1096
1110
|
transaction._succeeded = true;
|
|
@@ -1197,7 +1211,7 @@
|
|
|
1197
1211
|
|
|
1198
1212
|
async connectedTo(input) {
|
|
1199
1213
|
let chainId = await this.connector.getChainId();
|
|
1200
|
-
const blockchain =
|
|
1214
|
+
const blockchain = Blockchains__default['default'].findByNetworkId(chainId);
|
|
1201
1215
|
if(input) {
|
|
1202
1216
|
return input === blockchain.name
|
|
1203
1217
|
} else {
|
|
@@ -1207,7 +1221,7 @@
|
|
|
1207
1221
|
|
|
1208
1222
|
switchTo(blockchainName) {
|
|
1209
1223
|
return new Promise((resolve, reject)=>{
|
|
1210
|
-
const blockchain =
|
|
1224
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
1211
1225
|
this.connector.request({
|
|
1212
1226
|
method: 'wallet_switchEthereumChain',
|
|
1213
1227
|
params: [{ chainId: blockchain.id }],
|
|
@@ -1225,7 +1239,7 @@
|
|
|
1225
1239
|
|
|
1226
1240
|
addNetwork(blockchainName) {
|
|
1227
1241
|
return new Promise((resolve, reject)=>{
|
|
1228
|
-
const blockchain =
|
|
1242
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
1229
1243
|
this.connector.request({
|
|
1230
1244
|
method: 'wallet_addEthereumChain',
|
|
1231
1245
|
params: [{
|
package/dist/umd/index.solana.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-client-solana'), require('@depay/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-client-solana', '@depay/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Client, global.
|
|
5
|
-
}(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-client-solana'), require('@depay/walletconnect-v1'), require('@depay/coinbase-wallet-sdk')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-client-solana', '@depay/walletconnect-v1', '@depay/coinbase-wallet-sdk'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Client, global.WalletConnect, global.CoinbaseWalletSdk));
|
|
5
|
+
}(this, (function (exports, Blockchains, ethers, web3ClientSolana, walletconnectV1, coinbaseWalletSdk) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var Blockchains__default = /*#__PURE__*/_interopDefaultLegacy(Blockchains);
|
|
6
10
|
|
|
7
11
|
let supported$2 = ['solana'];
|
|
8
12
|
supported$2.evm = [];
|
|
@@ -58932,7 +58936,7 @@
|
|
|
58932
58936
|
}
|
|
58933
58937
|
|
|
58934
58938
|
detectNetwork() {
|
|
58935
|
-
return Promise.resolve(
|
|
58939
|
+
return Promise.resolve(Blockchains__default['default'].findByName(this._network).id)
|
|
58936
58940
|
}
|
|
58937
58941
|
|
|
58938
58942
|
requestChunk(chunk, endpoint) {
|
|
@@ -59209,7 +59213,7 @@
|
|
|
59209
59213
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'velas'];
|
|
59210
59214
|
supported$1.solana = ['solana'];
|
|
59211
59215
|
|
|
59212
|
-
function _optionalChain$
|
|
59216
|
+
function _optionalChain$1$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; }
|
|
59213
59217
|
let getCacheStore = () => {
|
|
59214
59218
|
if (getWindow()._cacheStore == undefined) {
|
|
59215
59219
|
resetCache();
|
|
@@ -59239,7 +59243,7 @@
|
|
|
59239
59243
|
|
|
59240
59244
|
let get = function ({ key, expires }) {
|
|
59241
59245
|
let cachedEntry = getCacheStore()[key];
|
|
59242
|
-
if (_optionalChain$
|
|
59246
|
+
if (_optionalChain$1$1([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
|
|
59243
59247
|
return cachedEntry.value
|
|
59244
59248
|
}
|
|
59245
59249
|
};
|
|
@@ -59477,7 +59481,7 @@
|
|
|
59477
59481
|
|
|
59478
59482
|
static bigNumberify(value, blockchain) {
|
|
59479
59483
|
if (typeof value === 'number') {
|
|
59480
|
-
return ethers.ethers.utils.parseUnits(value.toString(),
|
|
59484
|
+
return ethers.ethers.utils.parseUnits(value.toString(), Blockchains__default['default'][blockchain].currency.decimals)
|
|
59481
59485
|
} else if (value && value.toString) {
|
|
59482
59486
|
return ethers.ethers.BigNumber.from(value.toString())
|
|
59483
59487
|
} else {
|
|
@@ -59561,7 +59565,7 @@
|
|
|
59561
59565
|
if (sentTransaction) {
|
|
59562
59566
|
transaction.id = sentTransaction.hash;
|
|
59563
59567
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
59564
|
-
transaction.url =
|
|
59568
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59565
59569
|
if (transaction.sent) transaction.sent(transaction);
|
|
59566
59570
|
sentTransaction.wait(1).then(() => {
|
|
59567
59571
|
transaction._succeeded = true;
|
|
@@ -59570,7 +59574,7 @@
|
|
|
59570
59574
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
59571
59575
|
if(error.replacement && error.replacement.hash) {
|
|
59572
59576
|
transaction.id = error.replacement.hash;
|
|
59573
|
-
transaction.url =
|
|
59577
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59574
59578
|
}
|
|
59575
59579
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
59576
59580
|
transaction._succeeded = true;
|
|
@@ -59690,7 +59694,7 @@
|
|
|
59690
59694
|
}
|
|
59691
59695
|
|
|
59692
59696
|
async connectedTo(input) {
|
|
59693
|
-
const blockchain =
|
|
59697
|
+
const blockchain = Blockchains__default['default'].findById(await this.getProvider().request({ method: 'eth_chainId' }));
|
|
59694
59698
|
if(input) {
|
|
59695
59699
|
return input === blockchain.name
|
|
59696
59700
|
} else {
|
|
@@ -59700,7 +59704,7 @@
|
|
|
59700
59704
|
|
|
59701
59705
|
addNetwork(blockchainName) {
|
|
59702
59706
|
return new Promise((resolve, reject)=>{
|
|
59703
|
-
const blockchain =
|
|
59707
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
59704
59708
|
this.getProvider().request({
|
|
59705
59709
|
method: 'wallet_addEthereumChain',
|
|
59706
59710
|
params: [{
|
|
@@ -59721,7 +59725,7 @@
|
|
|
59721
59725
|
|
|
59722
59726
|
switchTo(blockchainName) {
|
|
59723
59727
|
return new Promise((resolve, reject)=>{
|
|
59724
|
-
const blockchain =
|
|
59728
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
59725
59729
|
this.getProvider().request({
|
|
59726
59730
|
method: 'wallet_switchEthereumChain',
|
|
59727
59731
|
params: [{ chainId: blockchain.id }],
|
|
@@ -59868,7 +59872,7 @@
|
|
|
59868
59872
|
await submit$2({ transaction, wallet }).then(({ signature })=>{
|
|
59869
59873
|
if(signature) {
|
|
59870
59874
|
transaction.id = signature;
|
|
59871
|
-
transaction.url =
|
|
59875
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
59872
59876
|
if (transaction.sent) transaction.sent(transaction);
|
|
59873
59877
|
|
|
59874
59878
|
let count = 0;
|
|
@@ -60157,7 +60161,7 @@
|
|
|
60157
60161
|
transaction.nonce = transactionCount;
|
|
60158
60162
|
await submit$1({ transaction, wallet }).then((tx)=>{
|
|
60159
60163
|
if (tx) {
|
|
60160
|
-
let blockchain =
|
|
60164
|
+
let blockchain = Blockchains__default['default'].findByName(transaction.blockchain);
|
|
60161
60165
|
transaction.id = tx;
|
|
60162
60166
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60163
60167
|
if (transaction.sent) transaction.sent(transaction);
|
|
@@ -60268,11 +60272,21 @@
|
|
|
60268
60272
|
return currentPlainInstance
|
|
60269
60273
|
};
|
|
60270
60274
|
|
|
60271
|
-
const isConnected =
|
|
60272
|
-
|
|
60273
|
-
|
|
60274
|
-
|
|
60275
|
-
|
|
60275
|
+
const isConnected = ()=>{
|
|
60276
|
+
return new Promise(async(resolve, reject)=>{
|
|
60277
|
+
let connector = getPlainInstance();
|
|
60278
|
+
let accounts;
|
|
60279
|
+
|
|
60280
|
+
try {
|
|
60281
|
+
setTimeout(()=>{ resolve(false); }, 2000);
|
|
60282
|
+
let blockNumber = await connector.sendCustomRequest({ method: 'eth_blockNumber' });
|
|
60283
|
+
if(blockNumber) {
|
|
60284
|
+
accounts = await connector.sendCustomRequest({ method: 'eth_accounts' });
|
|
60285
|
+
}
|
|
60286
|
+
} catch (error) { resolve(false); }
|
|
60287
|
+
|
|
60288
|
+
return resolve(accounts && accounts.length)
|
|
60289
|
+
})
|
|
60276
60290
|
};
|
|
60277
60291
|
|
|
60278
60292
|
const getConnectedInstance$1 = async()=>{
|
|
@@ -60392,7 +60406,7 @@
|
|
|
60392
60406
|
|
|
60393
60407
|
async connectedTo(input) {
|
|
60394
60408
|
let chainId = await this.connector.sendCustomRequest({ method: 'eth_chainId' });
|
|
60395
|
-
const blockchain =
|
|
60409
|
+
const blockchain = Blockchains__default['default'].findById(chainId);
|
|
60396
60410
|
if(input) {
|
|
60397
60411
|
return input === blockchain.name
|
|
60398
60412
|
} else {
|
|
@@ -60403,7 +60417,7 @@
|
|
|
60403
60417
|
switchTo(blockchainName) {
|
|
60404
60418
|
return new Promise((resolve, reject)=>{
|
|
60405
60419
|
let resolved, rejected;
|
|
60406
|
-
const blockchain =
|
|
60420
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60407
60421
|
setTimeout(async()=>{
|
|
60408
60422
|
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
60409
60423
|
reject({ code: 'NOT_SUPPORTED' });
|
|
@@ -60438,7 +60452,7 @@
|
|
|
60438
60452
|
|
|
60439
60453
|
addNetwork(blockchainName) {
|
|
60440
60454
|
return new Promise((resolve, reject)=>{
|
|
60441
|
-
const blockchain =
|
|
60455
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60442
60456
|
this.connector.sendCustomRequest({
|
|
60443
60457
|
method: 'wallet_addEthereumChain',
|
|
60444
60458
|
params: [{
|
|
@@ -60519,7 +60533,7 @@
|
|
|
60519
60533
|
if (sentTransaction) {
|
|
60520
60534
|
transaction.id = sentTransaction.hash;
|
|
60521
60535
|
transaction.nonce = sentTransaction.nonce;
|
|
60522
|
-
transaction.url =
|
|
60536
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60523
60537
|
if (transaction.sent) transaction.sent(transaction);
|
|
60524
60538
|
sentTransaction.wait(1).then(() => {
|
|
60525
60539
|
transaction._succeeded = true;
|
|
@@ -60528,7 +60542,7 @@
|
|
|
60528
60542
|
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
60529
60543
|
if(error.replacement && error.replacement.hash) {
|
|
60530
60544
|
transaction.id = error.replacement.hash;
|
|
60531
|
-
transaction.url =
|
|
60545
|
+
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
60532
60546
|
}
|
|
60533
60547
|
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
60534
60548
|
transaction._succeeded = true;
|
|
@@ -60635,7 +60649,7 @@
|
|
|
60635
60649
|
|
|
60636
60650
|
async connectedTo(input) {
|
|
60637
60651
|
let chainId = await this.connector.getChainId();
|
|
60638
|
-
const blockchain =
|
|
60652
|
+
const blockchain = Blockchains__default['default'].findByNetworkId(chainId);
|
|
60639
60653
|
if(input) {
|
|
60640
60654
|
return input === blockchain.name
|
|
60641
60655
|
} else {
|
|
@@ -60645,7 +60659,7 @@
|
|
|
60645
60659
|
|
|
60646
60660
|
switchTo(blockchainName) {
|
|
60647
60661
|
return new Promise((resolve, reject)=>{
|
|
60648
|
-
const blockchain =
|
|
60662
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60649
60663
|
this.connector.request({
|
|
60650
60664
|
method: 'wallet_switchEthereumChain',
|
|
60651
60665
|
params: [{ chainId: blockchain.id }],
|
|
@@ -60663,7 +60677,7 @@
|
|
|
60663
60677
|
|
|
60664
60678
|
addNetwork(blockchainName) {
|
|
60665
60679
|
return new Promise((resolve, reject)=>{
|
|
60666
|
-
const blockchain =
|
|
60680
|
+
const blockchain = Blockchains__default['default'].findByName(blockchainName);
|
|
60667
60681
|
this.connector.request({
|
|
60668
60682
|
method: 'wallet_addEthereumChain',
|
|
60669
60683
|
params: [{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/web3-wallets-evm",
|
|
3
3
|
"moduleName": "Web3Wallets",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.4.1",
|
|
5
5
|
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
|
|
6
6
|
"main": "dist/umd/index.evm.js",
|
|
7
7
|
"module": "dist/esm/index.evm.js",
|
|
@@ -27,9 +27,8 @@
|
|
|
27
27
|
"@depay/coinbase-wallet-sdk": "^3.6.4",
|
|
28
28
|
"@depay/walletconnect-v1": "^1.8.0",
|
|
29
29
|
"@depay/walletconnect-v2": "^2.4.2",
|
|
30
|
-
"@depay/web3-blockchains": "^
|
|
31
|
-
"@depay/web3-client-evm": "^10.
|
|
32
|
-
"@depay/web3-constants": "^6.4.2",
|
|
30
|
+
"@depay/web3-blockchains": "^7.1.0",
|
|
31
|
+
"@depay/web3-client-evm": "^10.7.0",
|
|
33
32
|
"ethers": "^5.7.1"
|
|
34
33
|
},
|
|
35
34
|
"engines": {
|