@depay/web3-wallets-evm 14.6.1 → 14.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -8
- package/dist/esm/index.evm.js +37 -24
- package/dist/esm/index.js +37 -24
- package/dist/umd/index.evm.js +37 -24
- package/dist/umd/index.js +37 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -224,29 +224,60 @@ await wallet.switchTo('bsc')
|
|
|
224
224
|
|
|
225
225
|
### Transaction
|
|
226
226
|
|
|
227
|
+
### Data Structure
|
|
228
|
+
|
|
229
|
+
`api: Array`: Api of the contract (e.g. abi for Ethereum).
|
|
230
|
+
|
|
231
|
+
`blockchain: String`: Name of the blockchain e.g. 'ethereum'.
|
|
232
|
+
|
|
233
|
+
`failed: Function (transaction, error)=>{}`: Callback to be executed if transaction failed (e.g. reverted).
|
|
234
|
+
|
|
235
|
+
`from: String`: Address of the transaction sender.
|
|
236
|
+
|
|
237
|
+
`id: String`: Identifier of the transaction.
|
|
238
|
+
|
|
239
|
+
`instructions: Array`: List of instructions (e.g. Solana).
|
|
240
|
+
|
|
241
|
+
`method: String`: Name of the contract method to be called.
|
|
242
|
+
|
|
243
|
+
`nonce: Integer`: Nonce (number only used once) of the transaction.
|
|
244
|
+
|
|
245
|
+
`params: Object or Array`: Parameters passed to the method.
|
|
246
|
+
|
|
247
|
+
`sent: Function (transaction)=>{}`: Callback to be executed if transaction has been sent to the network.
|
|
248
|
+
|
|
249
|
+
`succeeded: Function (transaction)=>{}`: Callback to be executed if transaction was successful and has been confirmed once by the network.
|
|
250
|
+
|
|
251
|
+
`to String`: Address of the contract to be transacted with.
|
|
252
|
+
|
|
253
|
+
`url String`: Url to open the transaction (e.g. in an explorer).
|
|
254
|
+
|
|
255
|
+
`value: Number or BigNumber as String`: Value of the transaction (amount of the native blockchain currency sent along with the transaction).
|
|
256
|
+
|
|
227
257
|
### sendTransaction
|
|
228
258
|
|
|
229
259
|
#### EVM: sendTransaction
|
|
230
260
|
|
|
231
261
|
Available arguments for EVM blockchains:
|
|
232
262
|
|
|
233
|
-
`
|
|
263
|
+
`api: Array`: Api of the contract (e.g. abi for Ethereum).
|
|
234
264
|
|
|
235
|
-
`
|
|
265
|
+
`blockchain: String`: Name of the blockchain e.g. 'ethereum'.
|
|
236
266
|
|
|
237
|
-
`
|
|
267
|
+
`failed: Function (transaction, error)=>{}`: Callback to be executed if transaction failed (e.g. reverted).
|
|
238
268
|
|
|
239
269
|
`method: String`: Name of the contract method to be called.
|
|
240
270
|
|
|
241
271
|
`params: Object or Array`: Parameters passed to the method.
|
|
242
272
|
|
|
243
|
-
`value: Number or BigNumber as String`: Value of the transaction (amount of the native blockchain currency sent along with the transaction).
|
|
244
|
-
|
|
245
273
|
`sent: Function (transaction)=>{}`: Callback to be executed if transaction has been sent to the network.
|
|
246
274
|
|
|
247
275
|
`succeeded: Function (transaction)=>{}`: Callback to be executed if transaction was successful and has been confirmed once by the network.
|
|
248
276
|
|
|
249
|
-
`
|
|
277
|
+
`to String`: Address of the contract to be transacted with.
|
|
278
|
+
|
|
279
|
+
`value: Number or BigNumber as String`: Value of the transaction (amount of the native blockchain currency sent along with the transaction).
|
|
280
|
+
|
|
250
281
|
|
|
251
282
|
##### EVM: Simple value transfer
|
|
252
283
|
|
|
@@ -292,12 +323,12 @@ Available arguments for Solana blockchains:
|
|
|
292
323
|
|
|
293
324
|
`blockchain: String`: Name of the blockchain e.g. 'solana'.
|
|
294
325
|
|
|
326
|
+
`failed: Function (transaction, error)=>{}`: Callback to be executed if transaction failed (e.g. reverted).
|
|
327
|
+
|
|
295
328
|
`sent: Function (transaction)=>{}`: Callback to be executed if transaction has been sent to the network.
|
|
296
329
|
|
|
297
330
|
`succeeded: Function (transaction)=>{}`: Callback to be executed if transaction was successful and has been confirmed once by the network.
|
|
298
331
|
|
|
299
|
-
`failed: Function (transaction, error)=>{}`: Callback to be executed if transaction failed (e.g. reverted).
|
|
300
|
-
|
|
301
332
|
##### Solana: Simple value transfer
|
|
302
333
|
|
|
303
334
|
e.g. send 0.01 SOL on Solana:
|
package/dist/esm/index.evm.js
CHANGED
|
@@ -59903,12 +59903,18 @@ class Argent {
|
|
|
59903
59903
|
}
|
|
59904
59904
|
}
|
|
59905
59905
|
|
|
59906
|
-
const
|
|
59906
|
+
const transactionApiBlockchainNames = {
|
|
59907
59907
|
'ethereum': 'mainnet',
|
|
59908
59908
|
'bsc': 'bsc',
|
|
59909
59909
|
'polygon': 'polygon',
|
|
59910
59910
|
};
|
|
59911
59911
|
|
|
59912
|
+
const explorerBlockchainNames = {
|
|
59913
|
+
'ethereum': 'eth',
|
|
59914
|
+
'bsc': 'bnb',
|
|
59915
|
+
'polygon': 'matic',
|
|
59916
|
+
};
|
|
59917
|
+
|
|
59912
59918
|
class Safe {
|
|
59913
59919
|
|
|
59914
59920
|
constructor ({ address, blockchain }) {
|
|
@@ -59927,7 +59933,7 @@ class Safe {
|
|
|
59927
59933
|
|
|
59928
59934
|
async retrieveTransaction({ blockchain, tx }) {
|
|
59929
59935
|
const provider = await getProvider(blockchain);
|
|
59930
|
-
let jsonResult = await fetch(`https://safe-transaction-${
|
|
59936
|
+
let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
|
|
59931
59937
|
.then((response) => response.json())
|
|
59932
59938
|
.catch((error) => { console.error('Error:', error); });
|
|
59933
59939
|
if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
|
|
@@ -59936,6 +59942,12 @@ class Safe {
|
|
|
59936
59942
|
return undefined
|
|
59937
59943
|
}
|
|
59938
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
|
+
}
|
|
59939
59951
|
}
|
|
59940
59952
|
|
|
59941
59953
|
const isSmartContractWallet = async(blockchain, address)=>{
|
|
@@ -59994,34 +60006,35 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
59994
60006
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
59995
60007
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
59996
60008
|
transaction.nonce = transactionCount;
|
|
59997
|
-
await submit$3({ transaction, wallet }).then(
|
|
60009
|
+
await submit$3({ transaction, wallet }).then((tx)=>{
|
|
59998
60010
|
if (tx) {
|
|
59999
60011
|
let blockchain = Blockchain.findByName(transaction.blockchain);
|
|
60000
60012
|
transaction.id = tx;
|
|
60001
|
-
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
60013
|
+
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60002
60014
|
if (transaction.sent) transaction.sent(transaction);
|
|
60003
|
-
|
|
60004
|
-
|
|
60005
|
-
|
|
60006
|
-
|
|
60007
|
-
|
|
60008
|
-
|
|
60009
|
-
|
|
60010
|
-
|
|
60011
|
-
|
|
60012
|
-
|
|
60013
|
-
|
|
60014
|
-
|
|
60015
|
-
|
|
60016
|
-
|
|
60017
|
-
|
|
60015
|
+
retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
|
|
60016
|
+
transaction.id = sentTransaction.hash || transaction.id;
|
|
60017
|
+
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
60018
|
+
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
60019
|
+
sentTransaction.wait(1).then(() => {
|
|
60020
|
+
transaction._succeeded = true;
|
|
60021
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
60022
|
+
}).catch((error)=>{
|
|
60023
|
+
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
60024
|
+
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
60025
|
+
transaction.id = error.replacement.hash;
|
|
60026
|
+
transaction._succeeded = true;
|
|
60027
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
60028
|
+
} else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
|
|
60029
|
+
transaction.id = error.replacement.hash;
|
|
60030
|
+
transaction._failed = true;
|
|
60031
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
60032
|
+
}
|
|
60033
|
+
} else {
|
|
60018
60034
|
transaction._failed = true;
|
|
60019
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60035
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
60020
60036
|
}
|
|
60021
|
-
}
|
|
60022
|
-
transaction._failed = true;
|
|
60023
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60024
|
-
}
|
|
60037
|
+
});
|
|
60025
60038
|
});
|
|
60026
60039
|
} else {
|
|
60027
60040
|
throw('Submitting transaction failed!')
|
package/dist/esm/index.js
CHANGED
|
@@ -997,12 +997,18 @@ class Argent {
|
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
|
-
const
|
|
1000
|
+
const transactionApiBlockchainNames = {
|
|
1001
1001
|
'ethereum': 'mainnet',
|
|
1002
1002
|
'bsc': 'bsc',
|
|
1003
1003
|
'polygon': 'polygon',
|
|
1004
1004
|
};
|
|
1005
1005
|
|
|
1006
|
+
const explorerBlockchainNames = {
|
|
1007
|
+
'ethereum': 'eth',
|
|
1008
|
+
'bsc': 'bnb',
|
|
1009
|
+
'polygon': 'matic',
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1006
1012
|
class Safe {
|
|
1007
1013
|
|
|
1008
1014
|
constructor ({ address, blockchain }) {
|
|
@@ -1021,7 +1027,7 @@ class Safe {
|
|
|
1021
1027
|
|
|
1022
1028
|
async retrieveTransaction({ blockchain, tx }) {
|
|
1023
1029
|
const provider = await getProvider(blockchain);
|
|
1024
|
-
let jsonResult = await fetch(`https://safe-transaction-${
|
|
1030
|
+
let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
|
|
1025
1031
|
.then((response) => response.json())
|
|
1026
1032
|
.catch((error) => { console.error('Error:', error); });
|
|
1027
1033
|
if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
|
|
@@ -1030,6 +1036,12 @@ class Safe {
|
|
|
1030
1036
|
return undefined
|
|
1031
1037
|
}
|
|
1032
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
|
+
}
|
|
1033
1045
|
}
|
|
1034
1046
|
|
|
1035
1047
|
const isSmartContractWallet = async(blockchain, address)=>{
|
|
@@ -1088,34 +1100,35 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
1088
1100
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
1089
1101
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
1090
1102
|
transaction.nonce = transactionCount;
|
|
1091
|
-
await submit$2({ transaction, wallet }).then(
|
|
1103
|
+
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
1092
1104
|
if (tx) {
|
|
1093
1105
|
let blockchain = Blockchain.findByName(transaction.blockchain);
|
|
1094
1106
|
transaction.id = tx;
|
|
1095
|
-
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
1107
|
+
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
1096
1108
|
if (transaction.sent) transaction.sent(transaction);
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1109
|
+
retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
|
|
1110
|
+
transaction.id = sentTransaction.hash || transaction.id;
|
|
1111
|
+
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
1112
|
+
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1113
|
+
sentTransaction.wait(1).then(() => {
|
|
1114
|
+
transaction._succeeded = true;
|
|
1115
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1116
|
+
}).catch((error)=>{
|
|
1117
|
+
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
1118
|
+
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
1119
|
+
transaction.id = error.replacement.hash;
|
|
1120
|
+
transaction._succeeded = true;
|
|
1121
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1122
|
+
} else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
|
|
1123
|
+
transaction.id = error.replacement.hash;
|
|
1124
|
+
transaction._failed = true;
|
|
1125
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1126
|
+
}
|
|
1127
|
+
} else {
|
|
1112
1128
|
transaction._failed = true;
|
|
1113
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1129
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1114
1130
|
}
|
|
1115
|
-
}
|
|
1116
|
-
transaction._failed = true;
|
|
1117
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1118
|
-
}
|
|
1131
|
+
});
|
|
1119
1132
|
});
|
|
1120
1133
|
} else {
|
|
1121
1134
|
throw('Submitting transaction failed!')
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -59901,12 +59901,18 @@
|
|
|
59901
59901
|
}
|
|
59902
59902
|
}
|
|
59903
59903
|
|
|
59904
|
-
const
|
|
59904
|
+
const transactionApiBlockchainNames = {
|
|
59905
59905
|
'ethereum': 'mainnet',
|
|
59906
59906
|
'bsc': 'bsc',
|
|
59907
59907
|
'polygon': 'polygon',
|
|
59908
59908
|
};
|
|
59909
59909
|
|
|
59910
|
+
const explorerBlockchainNames = {
|
|
59911
|
+
'ethereum': 'eth',
|
|
59912
|
+
'bsc': 'bnb',
|
|
59913
|
+
'polygon': 'matic',
|
|
59914
|
+
};
|
|
59915
|
+
|
|
59910
59916
|
class Safe {
|
|
59911
59917
|
|
|
59912
59918
|
constructor ({ address, blockchain }) {
|
|
@@ -59925,7 +59931,7 @@
|
|
|
59925
59931
|
|
|
59926
59932
|
async retrieveTransaction({ blockchain, tx }) {
|
|
59927
59933
|
const provider = await getProvider(blockchain);
|
|
59928
|
-
let jsonResult = await fetch(`https://safe-transaction-${
|
|
59934
|
+
let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
|
|
59929
59935
|
.then((response) => response.json())
|
|
59930
59936
|
.catch((error) => { console.error('Error:', error); });
|
|
59931
59937
|
if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
|
|
@@ -59934,6 +59940,12 @@
|
|
|
59934
59940
|
return undefined
|
|
59935
59941
|
}
|
|
59936
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
|
+
}
|
|
59937
59949
|
}
|
|
59938
59950
|
|
|
59939
59951
|
const isSmartContractWallet = async(blockchain, address)=>{
|
|
@@ -59992,34 +60004,35 @@
|
|
|
59992
60004
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
59993
60005
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
59994
60006
|
transaction.nonce = transactionCount;
|
|
59995
|
-
await submit$3({ transaction, wallet }).then(
|
|
60007
|
+
await submit$3({ transaction, wallet }).then((tx)=>{
|
|
59996
60008
|
if (tx) {
|
|
59997
60009
|
let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
|
|
59998
60010
|
transaction.id = tx;
|
|
59999
|
-
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
60011
|
+
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60000
60012
|
if (transaction.sent) transaction.sent(transaction);
|
|
60001
|
-
|
|
60002
|
-
|
|
60003
|
-
|
|
60004
|
-
|
|
60005
|
-
|
|
60006
|
-
|
|
60007
|
-
|
|
60008
|
-
|
|
60009
|
-
|
|
60010
|
-
|
|
60011
|
-
|
|
60012
|
-
|
|
60013
|
-
|
|
60014
|
-
|
|
60015
|
-
|
|
60013
|
+
retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
|
|
60014
|
+
transaction.id = sentTransaction.hash || transaction.id;
|
|
60015
|
+
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
60016
|
+
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
60017
|
+
sentTransaction.wait(1).then(() => {
|
|
60018
|
+
transaction._succeeded = true;
|
|
60019
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
60020
|
+
}).catch((error)=>{
|
|
60021
|
+
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
60022
|
+
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
60023
|
+
transaction.id = error.replacement.hash;
|
|
60024
|
+
transaction._succeeded = true;
|
|
60025
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
60026
|
+
} else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
|
|
60027
|
+
transaction.id = error.replacement.hash;
|
|
60028
|
+
transaction._failed = true;
|
|
60029
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
60030
|
+
}
|
|
60031
|
+
} else {
|
|
60016
60032
|
transaction._failed = true;
|
|
60017
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60033
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
60018
60034
|
}
|
|
60019
|
-
}
|
|
60020
|
-
transaction._failed = true;
|
|
60021
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60022
|
-
}
|
|
60035
|
+
});
|
|
60023
60036
|
});
|
|
60024
60037
|
} else {
|
|
60025
60038
|
throw('Submitting transaction failed!')
|
package/dist/umd/index.js
CHANGED
|
@@ -994,12 +994,18 @@
|
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
|
|
997
|
-
const
|
|
997
|
+
const transactionApiBlockchainNames = {
|
|
998
998
|
'ethereum': 'mainnet',
|
|
999
999
|
'bsc': 'bsc',
|
|
1000
1000
|
'polygon': 'polygon',
|
|
1001
1001
|
};
|
|
1002
1002
|
|
|
1003
|
+
const explorerBlockchainNames = {
|
|
1004
|
+
'ethereum': 'eth',
|
|
1005
|
+
'bsc': 'bnb',
|
|
1006
|
+
'polygon': 'matic',
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1003
1009
|
class Safe {
|
|
1004
1010
|
|
|
1005
1011
|
constructor ({ address, blockchain }) {
|
|
@@ -1018,7 +1024,7 @@
|
|
|
1018
1024
|
|
|
1019
1025
|
async retrieveTransaction({ blockchain, tx }) {
|
|
1020
1026
|
const provider = await web3Client.getProvider(blockchain);
|
|
1021
|
-
let jsonResult = await fetch(`https://safe-transaction-${
|
|
1027
|
+
let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
|
|
1022
1028
|
.then((response) => response.json())
|
|
1023
1029
|
.catch((error) => { console.error('Error:', error); });
|
|
1024
1030
|
if(jsonResult && jsonResult.isExecuted && jsonResult.transactionHash) {
|
|
@@ -1027,6 +1033,12 @@
|
|
|
1027
1033
|
return undefined
|
|
1028
1034
|
}
|
|
1029
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
|
+
}
|
|
1030
1042
|
}
|
|
1031
1043
|
|
|
1032
1044
|
const isSmartContractWallet = async(blockchain, address)=>{
|
|
@@ -1085,34 +1097,35 @@
|
|
|
1085
1097
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
1086
1098
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await web3Client.request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
1087
1099
|
transaction.nonce = transactionCount;
|
|
1088
|
-
await submit$2({ transaction, wallet }).then(
|
|
1100
|
+
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
1089
1101
|
if (tx) {
|
|
1090
1102
|
let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
|
|
1091
1103
|
transaction.id = tx;
|
|
1092
|
-
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
1104
|
+
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
1093
1105
|
if (transaction.sent) transaction.sent(transaction);
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1106
|
+
retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
|
|
1107
|
+
transaction.id = sentTransaction.hash || transaction.id;
|
|
1108
|
+
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
1109
|
+
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1110
|
+
sentTransaction.wait(1).then(() => {
|
|
1111
|
+
transaction._succeeded = true;
|
|
1112
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1113
|
+
}).catch((error)=>{
|
|
1114
|
+
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
1115
|
+
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
1116
|
+
transaction.id = error.replacement.hash;
|
|
1117
|
+
transaction._succeeded = true;
|
|
1118
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1119
|
+
} else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
|
|
1120
|
+
transaction.id = error.replacement.hash;
|
|
1121
|
+
transaction._failed = true;
|
|
1122
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1123
|
+
}
|
|
1124
|
+
} else {
|
|
1109
1125
|
transaction._failed = true;
|
|
1110
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1126
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1111
1127
|
}
|
|
1112
|
-
}
|
|
1113
|
-
transaction._failed = true;
|
|
1114
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1115
|
-
}
|
|
1128
|
+
});
|
|
1116
1129
|
});
|
|
1117
1130
|
} else {
|
|
1118
1131
|
throw('Submitting transaction failed!')
|
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.
|
|
4
|
+
"version": "14.6.3",
|
|
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",
|