@depay/web3-wallets-evm 17.4.7 → 17.5.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/README.md CHANGED
@@ -222,11 +222,13 @@ await wallet.switchTo('bsc')
222
222
 
223
223
  ### Data Structure
224
224
 
225
+ `accepted: Function ()=>{}`: Callback that will be executed once the transaction has been accepted by the wallet but not sent to the network yet (e.g. relayer, World App). Has no transaction yet, as only sent can contain the transaction.
226
+
225
227
  `api: Array`: Api of the contract (e.g. abi for Ethereum, Layout/Struct for Solana).
226
228
 
227
229
  `blockchain: String`: Name of the blockchain e.g. 'ethereum'.
228
230
 
229
- `failed: Function (transaction, error)=>{}`: Callback to be executed if transaction failed (e.g. reverted).
231
+ `failed: Function (transaction, error)=>{}`: Callback that will be executed once the transaction failed onchain (reverted).
230
232
 
231
233
  `from: String`: Address of the transaction sender.
232
234
 
@@ -242,9 +244,9 @@ await wallet.switchTo('bsc')
242
244
 
243
245
  `params: Object or Array`: Parameters passed to the method (EVM).
244
246
 
245
- `sent: Function (transaction)=>{}`: Callback to be executed if transaction has been sent to the network.
247
+ `sent: Function (transaction)=>{}`: Callback that will be executed executed once the transaction has been sent to the network.
246
248
 
247
- `succeeded: Function (transaction)=>{}`: Callback to be executed if transaction was successful and has been confirmed once by the network.
249
+ `succeeded: Function (transaction)=>{}`: Callback that will be executed once the transaction was successful and has been confirmed at least once by the network.
248
250
 
249
251
  `to String`: Address of the contract to be transacted with (EVM).
250
252
 
@@ -25,7 +25,8 @@ class Transaction {
25
25
  alts,
26
26
  sent,
27
27
  succeeded,
28
- failed
28
+ failed,
29
+ accepted,
29
30
  }) {
30
31
 
31
32
  // required
@@ -38,6 +39,7 @@ class Transaction {
38
39
  this.api = api;
39
40
  this.method = method;
40
41
  this.params = params;
42
+ this.accepted = accepted;
41
43
  this.sent = sent;
42
44
  this.succeeded = succeeded;
43
45
  this.failed = failed;
@@ -1651,6 +1653,9 @@ class WorldApp {
1651
1653
  MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, (payload)=> {
1652
1654
  console.log('payload', payload);
1653
1655
  if (payload.status == "success") {
1656
+ console.log('before transaction.accepted', transaction);
1657
+ if (transaction.accepted) { transaction.accepted(); }
1658
+ console.log('after transaction.accepted', transaction);
1654
1659
  this.fetchTransaction(transaction, payload).then((transactionHash)=>{
1655
1660
  if(transactionHash) {
1656
1661
  resolve(transaction);
@@ -1726,6 +1731,8 @@ class WorldApp {
1726
1731
  console.log('before transaction.succeeded', transaction.succeeded);
1727
1732
  if (transaction.succeeded) { transaction.succeeded(transaction); }
1728
1733
  resolve(transaction);
1734
+ } else {
1735
+ if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
1729
1736
  }
1730
1737
  }).catch(reject);
1731
1738
  }).catch(reject);
package/dist/esm/index.js CHANGED
@@ -22,7 +22,8 @@ class Transaction {
22
22
  alts,
23
23
  sent,
24
24
  succeeded,
25
- failed
25
+ failed,
26
+ accepted,
26
27
  }) {
27
28
 
28
29
  // required
@@ -35,6 +36,7 @@ class Transaction {
35
36
  this.api = api;
36
37
  this.method = method;
37
38
  this.params = params;
39
+ this.accepted = accepted;
38
40
  this.sent = sent;
39
41
  this.succeeded = succeeded;
40
42
  this.failed = failed;
@@ -2250,6 +2252,9 @@ class WorldApp {
2250
2252
  MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, (payload)=> {
2251
2253
  console.log('payload', payload);
2252
2254
  if (payload.status == "success") {
2255
+ console.log('before transaction.accepted', transaction);
2256
+ if (transaction.accepted) { transaction.accepted(); }
2257
+ console.log('after transaction.accepted', transaction);
2253
2258
  this.fetchTransaction(transaction, payload).then((transactionHash)=>{
2254
2259
  if(transactionHash) {
2255
2260
  resolve(transaction);
@@ -2325,6 +2330,8 @@ class WorldApp {
2325
2330
  console.log('before transaction.succeeded', transaction.succeeded);
2326
2331
  if (transaction.succeeded) { transaction.succeeded(transaction); }
2327
2332
  resolve(transaction);
2333
+ } else {
2334
+ if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
2328
2335
  }
2329
2336
  }).catch(reject);
2330
2337
  }).catch(reject);
@@ -19,7 +19,8 @@ class Transaction {
19
19
  alts,
20
20
  sent,
21
21
  succeeded,
22
- failed
22
+ failed,
23
+ accepted,
23
24
  }) {
24
25
 
25
26
  // required
@@ -32,6 +33,7 @@ class Transaction {
32
33
  this.api = api;
33
34
  this.method = method;
34
35
  this.params = params;
36
+ this.accepted = accepted;
35
37
  this.sent = sent;
36
38
  this.succeeded = succeeded;
37
39
  this.failed = failed;
@@ -28,7 +28,8 @@
28
28
  alts,
29
29
  sent,
30
30
  succeeded,
31
- failed
31
+ failed,
32
+ accepted,
32
33
  }) {
33
34
 
34
35
  // required
@@ -41,6 +42,7 @@
41
42
  this.api = api;
42
43
  this.method = method;
43
44
  this.params = params;
45
+ this.accepted = accepted;
44
46
  this.sent = sent;
45
47
  this.succeeded = succeeded;
46
48
  this.failed = failed;
@@ -1654,6 +1656,9 @@
1654
1656
  worldcoinPrecompiled.MiniKit.subscribe(worldcoinPrecompiled.ResponseEvent.MiniAppSendTransaction, (payload)=> {
1655
1657
  console.log('payload', payload);
1656
1658
  if (payload.status == "success") {
1659
+ console.log('before transaction.accepted', transaction);
1660
+ if (transaction.accepted) { transaction.accepted(); }
1661
+ console.log('after transaction.accepted', transaction);
1657
1662
  this.fetchTransaction(transaction, payload).then((transactionHash)=>{
1658
1663
  if(transactionHash) {
1659
1664
  resolve(transaction);
@@ -1729,6 +1734,8 @@
1729
1734
  console.log('before transaction.succeeded', transaction.succeeded);
1730
1735
  if (transaction.succeeded) { transaction.succeeded(transaction); }
1731
1736
  resolve(transaction);
1737
+ } else {
1738
+ if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
1732
1739
  }
1733
1740
  }).catch(reject);
1734
1741
  }).catch(reject);
package/dist/umd/index.js CHANGED
@@ -24,7 +24,8 @@
24
24
  alts,
25
25
  sent,
26
26
  succeeded,
27
- failed
27
+ failed,
28
+ accepted,
28
29
  }) {
29
30
 
30
31
  // required
@@ -37,6 +38,7 @@
37
38
  this.api = api;
38
39
  this.method = method;
39
40
  this.params = params;
41
+ this.accepted = accepted;
40
42
  this.sent = sent;
41
43
  this.succeeded = succeeded;
42
44
  this.failed = failed;
@@ -2252,6 +2254,9 @@
2252
2254
  worldcoinPrecompiled.MiniKit.subscribe(worldcoinPrecompiled.ResponseEvent.MiniAppSendTransaction, (payload)=> {
2253
2255
  console.log('payload', payload);
2254
2256
  if (payload.status == "success") {
2257
+ console.log('before transaction.accepted', transaction);
2258
+ if (transaction.accepted) { transaction.accepted(); }
2259
+ console.log('after transaction.accepted', transaction);
2255
2260
  this.fetchTransaction(transaction, payload).then((transactionHash)=>{
2256
2261
  if(transactionHash) {
2257
2262
  resolve(transaction);
@@ -2327,6 +2332,8 @@
2327
2332
  console.log('before transaction.succeeded', transaction.succeeded);
2328
2333
  if (transaction.succeeded) { transaction.succeeded(transaction); }
2329
2334
  resolve(transaction);
2335
+ } else {
2336
+ if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
2330
2337
  }
2331
2338
  }).catch(reject);
2332
2339
  }).catch(reject);
@@ -24,7 +24,8 @@
24
24
  alts,
25
25
  sent,
26
26
  succeeded,
27
- failed
27
+ failed,
28
+ accepted,
28
29
  }) {
29
30
 
30
31
  // required
@@ -37,6 +38,7 @@
37
38
  this.api = api;
38
39
  this.method = method;
39
40
  this.params = params;
41
+ this.accepted = accepted;
40
42
  this.sent = sent;
41
43
  this.succeeded = succeeded;
42
44
  this.failed = failed;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/web3-wallets-evm",
3
3
  "moduleName": "Web3Wallets",
4
- "version": "17.4.7",
4
+ "version": "17.5.0",
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",