@depay/web3-wallets-evm 14.6.5 → 14.7.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.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Blockchain } from '@depay/web3-blockchains';
2
2
  import { ethers } from 'ethers';
3
+ import { request as request$2, getProvider, estimate } from '@depay/web3-client';
3
4
  import { CONSTANTS } from '@depay/web3-constants';
4
5
  import { PublicKey, Transaction as Transaction$1, SystemProgram } from '@depay/solana-web3.js';
5
- import { getProvider, request as request$1, estimate } from '@depay/web3-client';
6
6
  import { WalletConnectClient } from '@depay/walletconnect-v1';
7
7
  import { Core, SignClient } from '@depay/walletconnect-v2';
8
8
  import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
@@ -213,7 +213,7 @@ let getWindow = () => {
213
213
 
214
214
  // MAKE SURE PROVIDER SUPPORT BATCH SIZE OF 99 BATCH REQUESTS!
215
215
  const ENDPOINTS = {
216
- ethereum: ['https://rpc.ankr.com/eth', 'https://eth-mainnet-public.unifra.io', 'https://ethereum.publicnode.com'],
216
+ ethereum: ['https://rpc.ankr.com/eth', 'https://eth.llamarpc.com', 'https://ethereum.publicnode.com'],
217
217
  bsc: ['https://bsc-dataseed.binance.org', 'https://bsc-dataseed1.ninicoin.io', 'https://bsc-dataseed3.defibit.io'],
218
218
  polygon: ['https://polygon-rpc.com', 'https://poly-rpc.gateway.pokt.network', 'https://matic-mainnet.chainstacklabs.com'],
219
219
  velas: ['https://mainnet.velas.com/rpc', 'https://evmexplorer.velas.com/rpc', 'https://explorer.velas.com/rpc'],
@@ -469,7 +469,7 @@ var requestEVM = async ({ blockchain, address, api, method, params, block }) =>
469
469
  }
470
470
  };
471
471
 
472
- let request = async function (url, options) {
472
+ let request$1 = async function (url, options) {
473
473
  let { blockchain, address, method } = parseUrl(url);
474
474
  let { api, params, cache: cache$1, block } = (typeof(url) == 'object' ? url : options) || {};
475
475
 
@@ -495,7 +495,7 @@ const sendTransaction$4 = async ({ transaction, wallet })=> {
495
495
  throw({ code: 'WRONG_NETWORK' })
496
496
  }
497
497
  await transaction.prepare({ wallet });
498
- let transactionCount = await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
498
+ let transactionCount = await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
499
499
  transaction.nonce = transactionCount;
500
500
  let provider = new ethers.providers.Web3Provider(wallet.getProvider(), 'any');
501
501
  let signer = provider.getSigner(0);
@@ -681,6 +681,10 @@ class WindowEthereum {
681
681
  })
682
682
  }
683
683
 
684
+ transactionCount({ blockchain, address }) {
685
+ return request$2({ blockchain, method: 'transactionCount', address })
686
+ }
687
+
684
688
  async sign(message) {
685
689
  await this.account();
686
690
  let provider = new ethers.providers.Web3Provider(this.getProvider(), 'any');
@@ -1024,7 +1028,7 @@ class Safe {
1024
1028
  if(jsonResult && jsonResult.nonce) {
1025
1029
  transactionCount = jsonResult.nonce;
1026
1030
  } else {
1027
- transactionCount = parseInt((await request$1({
1031
+ transactionCount = parseInt((await request$2({
1028
1032
  blockchain: this.blockchain,
1029
1033
  address: this.address,
1030
1034
  api: [{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],
@@ -1062,7 +1066,7 @@ const isSmartContractWallet = async(blockchain, address)=>{
1062
1066
  const identifySmartContractWallet = async (blockchain, address)=>{
1063
1067
  let name;
1064
1068
  try {
1065
- name = await request$1({
1069
+ name = await request$2({
1066
1070
  blockchain,
1067
1071
  address,
1068
1072
  api: [{ "constant": true, "inputs": [], "name": "NAME", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function"}],
@@ -1073,7 +1077,7 @@ const identifySmartContractWallet = async (blockchain, address)=>{
1073
1077
 
1074
1078
  let executor;
1075
1079
  try {
1076
- executor = await request$1({
1080
+ executor = await request$2({
1077
1081
  blockchain,
1078
1082
  address,
1079
1083
  api: [{ "constant": true, "inputs": [], "name": "staticCallExecutor", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "payable": false, "stateMutability": "view", "type": "function"}],
@@ -1107,7 +1111,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
1107
1111
  }
1108
1112
  await transaction.prepare({ wallet });
1109
1113
  const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
1110
- const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
1114
+ let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
1111
1115
  transaction.nonce = transactionCount;
1112
1116
  await submit$2({ transaction, wallet }).then((tx)=>{
1113
1117
  if (tx) {
@@ -1414,6 +1418,15 @@ class WalletConnectV1 {
1414
1418
  }
1415
1419
  }
1416
1420
 
1421
+ async transactionCount({ blockchain, address }) {
1422
+ const smartContractWallet = await getSmartContractWallet(blockchain, address);
1423
+ if(smartContractWallet) {
1424
+ return await smartContractWallet.transactionCount()
1425
+ } else {
1426
+ return await request$2({ blockchain, method: 'transactionCount', address })
1427
+ }
1428
+ }
1429
+
1417
1430
  async sign(message) {
1418
1431
  let address = await this.account();
1419
1432
  var params = [ethers.utils.toUtf8Bytes(message), address];
@@ -1435,7 +1448,7 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
1435
1448
  throw({ code: 'WRONG_NETWORK' })
1436
1449
  }
1437
1450
  await transaction.prepare({ wallet });
1438
- let transactionCount = await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
1451
+ let transactionCount = await request$2({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
1439
1452
  transaction.nonce = transactionCount;
1440
1453
  await submit$1({ transaction, wallet }).then(async (response)=>{
1441
1454
  if(typeof response == 'string') {
@@ -1913,6 +1926,10 @@ class WalletLink {
1913
1926
  return internalCallback
1914
1927
  }
1915
1928
 
1929
+ transactionCount({ blockchain, address }) {
1930
+ return request({ blockchain, method: 'transactionCount', address })
1931
+ }
1932
+
1916
1933
  async sign(message) {
1917
1934
  await this.account();
1918
1935
  let provider = new ethers.providers.Web3Provider(this.connector, 'any');