@eluvio/elv-client-js 4.0.92 → 4.0.94

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.
@@ -1761,14 +1761,14 @@ exports.PublishContentVersion = /*#__PURE__*/function () {
1761
1761
  throw Error("Pending version hash mismatch on ".concat(objectId, ": expected ").concat(objectHash, ", currently ").concat(pendingHash));
1762
1762
  case 19:
1763
1763
  if (!awaitCommitConfirmation) {
1764
- _context21.next = 34;
1764
+ _context21.next = 48;
1765
1765
  break;
1766
1766
  }
1767
1767
  this.Log("Awaiting commit confirmation for ".concat(objectHash));
1768
1768
  pollingInterval = this.ethClient.Provider().pollingInterval || 500; // eslint-disable-next-line no-constant-condition
1769
1769
  case 22:
1770
1770
  if (!true) {
1771
- _context21.next = 34;
1771
+ _context21.next = 48;
1772
1772
  break;
1773
1773
  }
1774
1774
  _context21.next = 25;
@@ -1776,15 +1776,37 @@ exports.PublishContentVersion = /*#__PURE__*/function () {
1776
1776
  return setTimeout(resolve, pollingInterval);
1777
1777
  });
1778
1778
  case 25:
1779
- _context21.next = 27;
1780
- return this.ContractEvents({
1781
- contractAddress: this.utils.HashToAddress(objectId),
1782
- abi: abi,
1783
- fromBlock: fromBlock,
1784
- topics: [Ethers.utils.id("VersionConfirm(address,address,string)")],
1785
- count: 1000
1779
+ _context21.t0 = this;
1780
+ _context21.t1 = this.utils.HashToAddress(objectId);
1781
+ _context21.t2 = abi;
1782
+ _context21.t3 = fromBlock;
1783
+ _context21.next = 31;
1784
+ return this.authClient.IsV3({
1785
+ id: objectId
1786
1786
  });
1787
- case 27:
1787
+ case 31:
1788
+ if (!_context21.sent) {
1789
+ _context21.next = 35;
1790
+ break;
1791
+ }
1792
+ _context21.t4 = Ethers.utils.id("VersionConfirm(address,address,string)");
1793
+ _context21.next = 36;
1794
+ break;
1795
+ case 35:
1796
+ _context21.t4 = Ethers.utils.id("VersionConfirm(address,string)");
1797
+ case 36:
1798
+ _context21.t5 = _context21.t4;
1799
+ _context21.t6 = [_context21.t5];
1800
+ _context21.t7 = {
1801
+ contractAddress: _context21.t1,
1802
+ abi: _context21.t2,
1803
+ fromBlock: _context21.t3,
1804
+ topics: _context21.t6,
1805
+ count: 1000
1806
+ };
1807
+ _context21.next = 41;
1808
+ return _context21.t0.ContractEvents.call(_context21.t0, _context21.t7);
1809
+ case 41:
1788
1810
  events = _context21.sent;
1789
1811
  confirmEvent = events.find(function (blockEvents) {
1790
1812
  return blockEvents.find(function (event) {
@@ -1792,72 +1814,72 @@ exports.PublishContentVersion = /*#__PURE__*/function () {
1792
1814
  });
1793
1815
  });
1794
1816
  if (!confirmEvent) {
1795
- _context21.next = 32;
1817
+ _context21.next = 46;
1796
1818
  break;
1797
1819
  }
1798
1820
  // Found confirmation
1799
1821
  this.Log("Commit confirmed on chain: ".concat(objectHash));
1800
- return _context21.abrupt("break", 34);
1801
- case 32:
1822
+ return _context21.abrupt("break", 48);
1823
+ case 46:
1802
1824
  _context21.next = 22;
1803
1825
  break;
1804
- case 34:
1826
+ case 48:
1805
1827
  if (!awaitCommitConfirmation) {
1806
- _context21.next = 62;
1828
+ _context21.next = 76;
1807
1829
  break;
1808
1830
  }
1809
1831
  _pollingInterval = 500; // ms
1810
1832
  tries = 20;
1811
- case 37:
1833
+ case 51:
1812
1834
  if (!(tries > 0)) {
1813
- _context21.next = 62;
1835
+ _context21.next = 76;
1814
1836
  break;
1815
1837
  }
1816
1838
  h = void 0;
1817
- _context21.prev = 39;
1818
- _context21.next = 42;
1839
+ _context21.prev = 53;
1840
+ _context21.next = 56;
1819
1841
  return this.LatestVersionHashV2({
1820
1842
  objectId: objectId
1821
1843
  });
1822
- case 42:
1844
+ case 56:
1823
1845
  h = _context21.sent;
1824
1846
  if (!(h === versionHash)) {
1825
- _context21.next = 48;
1847
+ _context21.next = 62;
1826
1848
  break;
1827
1849
  }
1828
1850
  this.Log("Commit confirmed on fabric node: ".concat(versionHash));
1829
- return _context21.abrupt("break", 62);
1830
- case 48:
1851
+ return _context21.abrupt("break", 76);
1852
+ case 62:
1831
1853
  tries--;
1832
- _context21.next = 51;
1854
+ _context21.next = 65;
1833
1855
  return new Promise(function (resolve) {
1834
1856
  return setTimeout(resolve, _pollingInterval);
1835
1857
  });
1836
- case 51:
1837
- _context21.next = 60;
1858
+ case 65:
1859
+ _context21.next = 74;
1838
1860
  break;
1839
- case 53:
1840
- _context21.prev = 53;
1841
- _context21.t0 = _context21["catch"](39);
1842
- if (!(_context21.t0.status !== 404)) {
1843
- _context21.next = 57;
1861
+ case 67:
1862
+ _context21.prev = 67;
1863
+ _context21.t8 = _context21["catch"](53);
1864
+ if (!(_context21.t8.status !== 404)) {
1865
+ _context21.next = 71;
1844
1866
  break;
1845
1867
  }
1846
- throw _context21.t0;
1847
- case 57:
1868
+ throw _context21.t8;
1869
+ case 71:
1848
1870
  tries--;
1849
- _context21.next = 60;
1871
+ _context21.next = 74;
1850
1872
  return new Promise(function (resolve) {
1851
1873
  return setTimeout(resolve, _pollingInterval);
1852
1874
  });
1853
- case 60:
1854
- _context21.next = 37;
1875
+ case 74:
1876
+ _context21.next = 51;
1855
1877
  break;
1856
- case 62:
1878
+ case 76:
1857
1879
  case "end":
1858
1880
  return _context21.stop();
1859
1881
  }
1860
- }, _callee21, this, [[39, 53]]);
1882
+ }, _callee21, this, [[53, 67]]);
1861
1883
  }));
1862
1884
  return function (_x20) {
1863
1885
  return _ref38.apply(this, arguments);
@@ -1,10 +1,12 @@
1
1
  var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
2
+ var _objectWithoutProperties = require("@babel/runtime/helpers/objectWithoutProperties");
2
3
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
3
4
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
5
  var _typeof = require("@babel/runtime/helpers/typeof");
5
6
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
6
7
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
7
8
  var _createClass = require("@babel/runtime/helpers/createClass");
9
+ var _excluded = ["code", "address", "type", "authToken", "expiresAt"];
8
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
12
  var _require = require("../ElvClient"),
@@ -1002,11 +1004,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
1002
1004
  key: "SetCodeAuth",
1003
1005
  value: function () {
1004
1006
  var _SetCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref15) {
1005
- var code, address, type, authToken;
1007
+ var code, address, type, authToken, expiresAt, additionalPayload;
1006
1008
  return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1007
1009
  while (1) switch (_context16.prev = _context16.next) {
1008
1010
  case 0:
1009
- code = _ref15.code, address = _ref15.address, type = _ref15.type, authToken = _ref15.authToken;
1011
+ code = _ref15.code, address = _ref15.address, type = _ref15.type, authToken = _ref15.authToken, expiresAt = _ref15.expiresAt, additionalPayload = _objectWithoutProperties(_ref15, _excluded);
1010
1012
  _context16.next = 3;
1011
1013
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
1012
1014
  path: UrlJoin("as", "wlt", "login", "session", code),
@@ -1018,12 +1020,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
1018
1020
  op: "set",
1019
1021
  id: code,
1020
1022
  format: "auth_token",
1021
- payload: JSON.stringify({
1023
+ payload: JSON.stringify(_objectSpread({
1022
1024
  addr: Utils.FormatAddress(address),
1023
1025
  eth: address ? "ikms".concat(Utils.AddressToHash(address)) : "",
1024
1026
  type: type,
1025
- token: authToken
1026
- })
1027
+ token: authToken,
1028
+ expiresAt: expiresAt
1029
+ }, additionalPayload))
1027
1030
  }
1028
1031
  }));
1029
1032
  case 3:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.92",
3
+ "version": "4.0.94",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -1050,7 +1050,11 @@ exports.PublishContentVersion = async function({objectId, versionHash, awaitComm
1050
1050
  contractAddress: this.utils.HashToAddress(objectId),
1051
1051
  abi,
1052
1052
  fromBlock,
1053
- topics: [ Ethers.utils.id("VersionConfirm(address,address,string)") ],
1053
+ topics: [
1054
+ await this.authClient.IsV3({id: objectId}) ?
1055
+ Ethers.utils.id("VersionConfirm(address,address,string)") :
1056
+ Ethers.utils.id("VersionConfirm(address,string)")
1057
+ ],
1054
1058
  count: 1000
1055
1059
  });
1056
1060
 
@@ -702,7 +702,7 @@ class ElvWalletClient {
702
702
  return response;
703
703
  }
704
704
 
705
- async SetCodeAuth({code, address, type, authToken}) {
705
+ async SetCodeAuth({code, address, type, authToken, expiresAt, ...additionalPayload}) {
706
706
  await Utils.ResponseToJson(
707
707
  this.client.authClient.MakeAuthServiceRequest({
708
708
  path: UrlJoin("as", "wlt", "login", "session", code),
@@ -718,7 +718,9 @@ class ElvWalletClient {
718
718
  addr: Utils.FormatAddress(address),
719
719
  eth: address ? `ikms${Utils.AddressToHash(address)}` : "",
720
720
  type,
721
- token: authToken
721
+ token: authToken,
722
+ expiresAt,
723
+ ...additionalPayload
722
724
  })
723
725
  }
724
726
  })