@depay/web3-wallets-evm 14.6.2 → 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 +22 -21
- package/dist/esm/index.js +22 -21
- package/dist/umd/index.evm.js +22 -21
- package/dist/umd/index.js +22 -21
- 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
|
@@ -60006,34 +60006,35 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
60006
60006
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
60007
60007
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
60008
60008
|
transaction.nonce = transactionCount;
|
|
60009
|
-
await submit$3({ transaction, wallet }).then(
|
|
60009
|
+
await submit$3({ transaction, wallet }).then((tx)=>{
|
|
60010
60010
|
if (tx) {
|
|
60011
60011
|
let blockchain = Blockchain.findByName(transaction.blockchain);
|
|
60012
60012
|
transaction.id = tx;
|
|
60013
60013
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60014
60014
|
if (transaction.sent) transaction.sent(transaction);
|
|
60015
|
-
|
|
60016
|
-
|
|
60017
|
-
|
|
60018
|
-
|
|
60019
|
-
|
|
60020
|
-
|
|
60021
|
-
|
|
60022
|
-
|
|
60023
|
-
|
|
60024
|
-
|
|
60025
|
-
|
|
60026
|
-
|
|
60027
|
-
|
|
60028
|
-
|
|
60029
|
-
|
|
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 {
|
|
60030
60034
|
transaction._failed = true;
|
|
60031
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60035
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
60032
60036
|
}
|
|
60033
|
-
}
|
|
60034
|
-
transaction._failed = true;
|
|
60035
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60036
|
-
}
|
|
60037
|
+
});
|
|
60037
60038
|
});
|
|
60038
60039
|
} else {
|
|
60039
60040
|
throw('Submitting transaction failed!')
|
package/dist/esm/index.js
CHANGED
|
@@ -1100,34 +1100,35 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
1100
1100
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
1101
1101
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
1102
1102
|
transaction.nonce = transactionCount;
|
|
1103
|
-
await submit$2({ transaction, wallet }).then(
|
|
1103
|
+
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
1104
1104
|
if (tx) {
|
|
1105
1105
|
let blockchain = Blockchain.findByName(transaction.blockchain);
|
|
1106
1106
|
transaction.id = tx;
|
|
1107
1107
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
1108
1108
|
if (transaction.sent) transaction.sent(transaction);
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
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 {
|
|
1124
1128
|
transaction._failed = true;
|
|
1125
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1129
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1126
1130
|
}
|
|
1127
|
-
}
|
|
1128
|
-
transaction._failed = true;
|
|
1129
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1130
|
-
}
|
|
1131
|
+
});
|
|
1131
1132
|
});
|
|
1132
1133
|
} else {
|
|
1133
1134
|
throw('Submitting transaction failed!')
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -60004,34 +60004,35 @@
|
|
|
60004
60004
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
60005
60005
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
60006
60006
|
transaction.nonce = transactionCount;
|
|
60007
|
-
await submit$3({ transaction, wallet }).then(
|
|
60007
|
+
await submit$3({ transaction, wallet }).then((tx)=>{
|
|
60008
60008
|
if (tx) {
|
|
60009
60009
|
let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
|
|
60010
60010
|
transaction.id = tx;
|
|
60011
60011
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
60012
60012
|
if (transaction.sent) transaction.sent(transaction);
|
|
60013
|
-
|
|
60014
|
-
|
|
60015
|
-
|
|
60016
|
-
|
|
60017
|
-
|
|
60018
|
-
|
|
60019
|
-
|
|
60020
|
-
|
|
60021
|
-
|
|
60022
|
-
|
|
60023
|
-
|
|
60024
|
-
|
|
60025
|
-
|
|
60026
|
-
|
|
60027
|
-
|
|
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 {
|
|
60028
60032
|
transaction._failed = true;
|
|
60029
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60033
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
60030
60034
|
}
|
|
60031
|
-
}
|
|
60032
|
-
transaction._failed = true;
|
|
60033
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
60034
|
-
}
|
|
60035
|
+
});
|
|
60035
60036
|
});
|
|
60036
60037
|
} else {
|
|
60037
60038
|
throw('Submitting transaction failed!')
|
package/dist/umd/index.js
CHANGED
|
@@ -1097,34 +1097,35 @@
|
|
|
1097
1097
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
1098
1098
|
const transactionCount = smartContractWallet ? await smartContractWallet.transactionCount() : await web3Client.request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
1099
1099
|
transaction.nonce = transactionCount;
|
|
1100
|
-
await submit$2({ transaction, wallet }).then(
|
|
1100
|
+
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
1101
1101
|
if (tx) {
|
|
1102
1102
|
let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
|
|
1103
1103
|
transaction.id = tx;
|
|
1104
1104
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
1105
1105
|
if (transaction.sent) transaction.sent(transaction);
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
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 {
|
|
1121
1125
|
transaction._failed = true;
|
|
1122
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1126
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1123
1127
|
}
|
|
1124
|
-
}
|
|
1125
|
-
transaction._failed = true;
|
|
1126
|
-
if(transaction.failed) transaction.failed(transaction, error);
|
|
1127
|
-
}
|
|
1128
|
+
});
|
|
1128
1129
|
});
|
|
1129
1130
|
} else {
|
|
1130
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",
|