@depay/web3-wallets-evm 14.6.0 → 14.6.2

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.
@@ -59903,6 +59903,18 @@ class Argent {
59903
59903
  }
59904
59904
  }
59905
59905
 
59906
+ const transactionApiBlockchainNames = {
59907
+ 'ethereum': 'mainnet',
59908
+ 'bsc': 'bsc',
59909
+ 'polygon': 'polygon',
59910
+ };
59911
+
59912
+ const explorerBlockchainNames = {
59913
+ 'ethereum': 'eth',
59914
+ 'bsc': 'bnb',
59915
+ 'polygon': 'matic',
59916
+ };
59917
+
59906
59918
  class Safe {
59907
59919
 
59908
59920
  constructor ({ address, blockchain }) {
@@ -59921,7 +59933,7 @@ class Safe {
59921
59933
 
59922
59934
  async retrieveTransaction({ blockchain, tx }) {
59923
59935
  const provider = await getProvider(blockchain);
59924
- let jsonResult = await fetch(`https://safe-transaction-${blockchain}.safe.global/api/v1/multisig-transactions/${tx}/`)
59936
+ let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
59925
59937
  .then((response) => response.json())
59926
59938
  .catch((error) => { console.error('Error:', error); });
59927
59939
  if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
@@ -59930,6 +59942,12 @@ class Safe {
59930
59942
  return undefined
59931
59943
  }
59932
59944
  }
59945
+
59946
+ explorerUrlFor({ transaction }) {
59947
+ if(transaction) {
59948
+ return `https://app.safe.global/${explorerBlockchainNames[transaction.blockchain]}:${transaction.from}/transactions/tx?id=multisig_${transaction.from}_${transaction.id}`
59949
+ }
59950
+ }
59933
59951
  }
59934
59952
 
59935
59953
  const isSmartContractWallet = async(blockchain, address)=>{
@@ -59992,7 +60010,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
59992
60010
  if (tx) {
59993
60011
  let blockchain = Blockchain.findByName(transaction.blockchain);
59994
60012
  transaction.id = tx;
59995
- transaction.url = blockchain.explorerUrlFor({ transaction });
60013
+ transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
59996
60014
  if (transaction.sent) transaction.sent(transaction);
59997
60015
  let sentTransaction = await retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet });
59998
60016
  transaction.id = sentTransaction.hash || transaction.id;
package/dist/esm/index.js CHANGED
@@ -997,6 +997,18 @@ class Argent {
997
997
  }
998
998
  }
999
999
 
1000
+ const transactionApiBlockchainNames = {
1001
+ 'ethereum': 'mainnet',
1002
+ 'bsc': 'bsc',
1003
+ 'polygon': 'polygon',
1004
+ };
1005
+
1006
+ const explorerBlockchainNames = {
1007
+ 'ethereum': 'eth',
1008
+ 'bsc': 'bnb',
1009
+ 'polygon': 'matic',
1010
+ };
1011
+
1000
1012
  class Safe {
1001
1013
 
1002
1014
  constructor ({ address, blockchain }) {
@@ -1015,7 +1027,7 @@ class Safe {
1015
1027
 
1016
1028
  async retrieveTransaction({ blockchain, tx }) {
1017
1029
  const provider = await getProvider(blockchain);
1018
- let jsonResult = await fetch(`https://safe-transaction-${blockchain}.safe.global/api/v1/multisig-transactions/${tx}/`)
1030
+ let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
1019
1031
  .then((response) => response.json())
1020
1032
  .catch((error) => { console.error('Error:', error); });
1021
1033
  if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
@@ -1024,6 +1036,12 @@ class Safe {
1024
1036
  return undefined
1025
1037
  }
1026
1038
  }
1039
+
1040
+ explorerUrlFor({ transaction }) {
1041
+ if(transaction) {
1042
+ return `https://app.safe.global/${explorerBlockchainNames[transaction.blockchain]}:${transaction.from}/transactions/tx?id=multisig_${transaction.from}_${transaction.id}`
1043
+ }
1044
+ }
1027
1045
  }
1028
1046
 
1029
1047
  const isSmartContractWallet = async(blockchain, address)=>{
@@ -1086,7 +1104,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
1086
1104
  if (tx) {
1087
1105
  let blockchain = Blockchain.findByName(transaction.blockchain);
1088
1106
  transaction.id = tx;
1089
- transaction.url = blockchain.explorerUrlFor({ transaction });
1107
+ transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
1090
1108
  if (transaction.sent) transaction.sent(transaction);
1091
1109
  let sentTransaction = await retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet });
1092
1110
  transaction.id = sentTransaction.hash || transaction.id;
@@ -59901,6 +59901,18 @@
59901
59901
  }
59902
59902
  }
59903
59903
 
59904
+ const transactionApiBlockchainNames = {
59905
+ 'ethereum': 'mainnet',
59906
+ 'bsc': 'bsc',
59907
+ 'polygon': 'polygon',
59908
+ };
59909
+
59910
+ const explorerBlockchainNames = {
59911
+ 'ethereum': 'eth',
59912
+ 'bsc': 'bnb',
59913
+ 'polygon': 'matic',
59914
+ };
59915
+
59904
59916
  class Safe {
59905
59917
 
59906
59918
  constructor ({ address, blockchain }) {
@@ -59919,7 +59931,7 @@
59919
59931
 
59920
59932
  async retrieveTransaction({ blockchain, tx }) {
59921
59933
  const provider = await getProvider(blockchain);
59922
- let jsonResult = await fetch(`https://safe-transaction-${blockchain}.safe.global/api/v1/multisig-transactions/${tx}/`)
59934
+ let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
59923
59935
  .then((response) => response.json())
59924
59936
  .catch((error) => { console.error('Error:', error); });
59925
59937
  if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
@@ -59928,6 +59940,12 @@
59928
59940
  return undefined
59929
59941
  }
59930
59942
  }
59943
+
59944
+ explorerUrlFor({ transaction }) {
59945
+ if(transaction) {
59946
+ return `https://app.safe.global/${explorerBlockchainNames[transaction.blockchain]}:${transaction.from}/transactions/tx?id=multisig_${transaction.from}_${transaction.id}`
59947
+ }
59948
+ }
59931
59949
  }
59932
59950
 
59933
59951
  const isSmartContractWallet = async(blockchain, address)=>{
@@ -59990,7 +60008,7 @@
59990
60008
  if (tx) {
59991
60009
  let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
59992
60010
  transaction.id = tx;
59993
- transaction.url = blockchain.explorerUrlFor({ transaction });
60011
+ transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
59994
60012
  if (transaction.sent) transaction.sent(transaction);
59995
60013
  let sentTransaction = await retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet });
59996
60014
  transaction.id = sentTransaction.hash || transaction.id;
package/dist/umd/index.js CHANGED
@@ -994,6 +994,18 @@
994
994
  }
995
995
  }
996
996
 
997
+ const transactionApiBlockchainNames = {
998
+ 'ethereum': 'mainnet',
999
+ 'bsc': 'bsc',
1000
+ 'polygon': 'polygon',
1001
+ };
1002
+
1003
+ const explorerBlockchainNames = {
1004
+ 'ethereum': 'eth',
1005
+ 'bsc': 'bnb',
1006
+ 'polygon': 'matic',
1007
+ };
1008
+
997
1009
  class Safe {
998
1010
 
999
1011
  constructor ({ address, blockchain }) {
@@ -1012,7 +1024,7 @@
1012
1024
 
1013
1025
  async retrieveTransaction({ blockchain, tx }) {
1014
1026
  const provider = await web3Client.getProvider(blockchain);
1015
- let jsonResult = await fetch(`https://safe-transaction-${blockchain}.safe.global/api/v1/multisig-transactions/${tx}/`)
1027
+ let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
1016
1028
  .then((response) => response.json())
1017
1029
  .catch((error) => { console.error('Error:', error); });
1018
1030
  if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
@@ -1021,6 +1033,12 @@
1021
1033
  return undefined
1022
1034
  }
1023
1035
  }
1036
+
1037
+ explorerUrlFor({ transaction }) {
1038
+ if(transaction) {
1039
+ return `https://app.safe.global/${explorerBlockchainNames[transaction.blockchain]}:${transaction.from}/transactions/tx?id=multisig_${transaction.from}_${transaction.id}`
1040
+ }
1041
+ }
1024
1042
  }
1025
1043
 
1026
1044
  const isSmartContractWallet = async(blockchain, address)=>{
@@ -1083,7 +1101,7 @@
1083
1101
  if (tx) {
1084
1102
  let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
1085
1103
  transaction.id = tx;
1086
- transaction.url = blockchain.explorerUrlFor({ transaction });
1104
+ transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
1087
1105
  if (transaction.sent) transaction.sent(transaction);
1088
1106
  let sentTransaction = await retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet });
1089
1107
  transaction.id = sentTransaction.hash || transaction.id;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/web3-wallets-evm",
3
3
  "moduleName": "Web3Wallets",
4
- "version": "14.6.0",
4
+ "version": "14.6.2",
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",