@eluvio/elv-client-js 4.0.81 → 4.0.83

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.
@@ -1711,7 +1711,7 @@ exports.FinalizeContentObject = /*#__PURE__*/function () {
1711
1711
  */
1712
1712
  exports.PublishContentVersion = /*#__PURE__*/function () {
1713
1713
  var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref37) {
1714
- var objectId, versionHash, _ref37$awaitCommitCon, awaitCommitConfirmation, commit, abi, fromBlock, objectHash, pendingHash, pollingInterval, events, confirmEvent;
1714
+ var objectId, versionHash, _ref37$awaitCommitCon, awaitCommitConfirmation, commit, abi, fromBlock, objectHash, pendingHash, pollingInterval, events, confirmEvent, _pollingInterval, tries, h;
1715
1715
  return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1716
1716
  while (1) switch (_context21.prev = _context21.next) {
1717
1717
  case 0:
@@ -1793,12 +1793,44 @@ exports.PublishContentVersion = /*#__PURE__*/function () {
1793
1793
  break;
1794
1794
  }
1795
1795
  // Found confirmation
1796
- this.Log("Commit confirmed: ".concat(objectHash));
1796
+ this.Log("Commit confirmed on chain: ".concat(objectHash));
1797
1797
  return _context21.abrupt("break", 34);
1798
1798
  case 32:
1799
1799
  _context21.next = 22;
1800
1800
  break;
1801
1801
  case 34:
1802
+ if (!awaitCommitConfirmation) {
1803
+ _context21.next = 48;
1804
+ break;
1805
+ }
1806
+ _pollingInterval = 500; // ms
1807
+ tries = 20;
1808
+ case 37:
1809
+ if (!(tries > 0)) {
1810
+ _context21.next = 48;
1811
+ break;
1812
+ }
1813
+ _context21.next = 40;
1814
+ return this.LatestVersionHashV2({
1815
+ objectId: objectId
1816
+ });
1817
+ case 40:
1818
+ h = _context21.sent;
1819
+ if (!(h == versionHash)) {
1820
+ _context21.next = 44;
1821
+ break;
1822
+ }
1823
+ this.Log("Commit confirmed on fabric node: ".concat(versionHash));
1824
+ return _context21.abrupt("break", 48);
1825
+ case 44:
1826
+ _context21.next = 46;
1827
+ return new Promise(function (resolve) {
1828
+ return setTimeout(resolve, _pollingInterval);
1829
+ });
1830
+ case 46:
1831
+ _context21.next = 37;
1832
+ break;
1833
+ case 48:
1802
1834
  case "end":
1803
1835
  return _context21.stop();
1804
1836
  }