@alephium/web3 0.41.0 → 0.42.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.
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /*
3
+ Copyright 2018 - 2022 The Alephium Authors
4
+ This file is part of the alephium project.
5
+
6
+ The library is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Lesser General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ The library is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Lesser General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Lesser General Public License
17
+ along with the library. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.waitForTxConfirmation = void 0;
21
+ const global_1 = require("../global");
22
+ function isConfirmed(txStatus) {
23
+ return txStatus.type === 'Confirmed';
24
+ }
25
+ async function waitForTxConfirmation(txId, confirmations, requestInterval) {
26
+ const provider = (0, global_1.getCurrentNodeProvider)();
27
+ const status = await provider.transactions.getTransactionsStatus({ txId: txId });
28
+ if (isConfirmed(status) && status.chainConfirmations >= confirmations) {
29
+ return status;
30
+ }
31
+ await new Promise((r) => setTimeout(r, requestInterval));
32
+ return waitForTxConfirmation(txId, confirmations, requestInterval);
33
+ }
34
+ exports.waitForTxConfirmation = waitForTxConfirmation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/web3",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "A JS/TS library to interact with the Alephium platform",
5
5
  "license": "GPL",
6
6
  "main": "dist/src/index.js",