@audius/sdk 2.0.3-beta.52 → 2.0.3-beta.53
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/dist/api/Users.d.ts +3 -1
- package/dist/index.cjs.js +64 -42
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +64 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +64 -42
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +64 -42
- package/dist/native-libs.js.map +1 -1
- package/dist/web-libs.js +64 -42
- package/dist/web-libs.js.map +1 -1
- package/package.json +2 -2
- package/src/api/Account.ts +3 -8
- package/src/api/Users.ts +44 -20
package/dist/native-libs.js
CHANGED
|
@@ -600,9 +600,9 @@ if (typeof window !== 'undefined' && window && window.Web3) {
|
|
|
600
600
|
var LibsWeb3 = Web3;
|
|
601
601
|
|
|
602
602
|
var name = "@audius/sdk";
|
|
603
|
-
var version$1 = "2.0.3-beta.
|
|
603
|
+
var version$1 = "2.0.3-beta.53";
|
|
604
604
|
var audius = {
|
|
605
|
-
releaseSHA: "
|
|
605
|
+
releaseSHA: "1b19b6001940e0a9764d5b8e3fb52e93c4917f14"
|
|
606
606
|
};
|
|
607
607
|
var description = "Audius SDK";
|
|
608
608
|
var main = "dist/index.cjs.js";
|
|
@@ -43445,7 +43445,9 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
43445
43445
|
phase = phases.ADD_USER;
|
|
43446
43446
|
_context4.next = 34;
|
|
43447
43447
|
return this.User.createEntityManagerUserV2({
|
|
43448
|
-
metadata: metadata
|
|
43448
|
+
metadata: metadata,
|
|
43449
|
+
profilePictureFile: profilePictureFile,
|
|
43450
|
+
coverPhotoFile: coverPhotoFile
|
|
43449
43451
|
});
|
|
43450
43452
|
|
|
43451
43453
|
case 34:
|
|
@@ -43453,20 +43455,14 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
43453
43455
|
newMetadata = _yield$this$User$crea2.newMetadata;
|
|
43454
43456
|
blockHash = _yield$this$User$crea2.blockHash;
|
|
43455
43457
|
blockNumber = _yield$this$User$crea2.blockNumber;
|
|
43456
|
-
// Upload user's profile images, if any
|
|
43457
|
-
phase = phases.UPLOAD_PROFILE_IMAGES;
|
|
43458
|
-
_context4.next = 41;
|
|
43459
|
-
return this.User.uploadProfileImagesV2(profilePictureFile, coverPhotoFile, newMetadata);
|
|
43460
|
-
|
|
43461
|
-
case 41:
|
|
43462
43458
|
return _context4.abrupt("return", {
|
|
43463
43459
|
blockHash: blockHash,
|
|
43464
43460
|
blockNumber: blockNumber,
|
|
43465
43461
|
userId: newMetadata.user_id
|
|
43466
43462
|
});
|
|
43467
43463
|
|
|
43468
|
-
case
|
|
43469
|
-
_context4.prev =
|
|
43464
|
+
case 41:
|
|
43465
|
+
_context4.prev = 41;
|
|
43470
43466
|
_context4.t0 = _context4["catch"](7);
|
|
43471
43467
|
return _context4.abrupt("return", {
|
|
43472
43468
|
error: _context4.t0.message,
|
|
@@ -43474,12 +43470,12 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
43474
43470
|
errorStatus: _context4.t0.response ? _context4.t0.response.status : null
|
|
43475
43471
|
});
|
|
43476
43472
|
|
|
43477
|
-
case
|
|
43473
|
+
case 44:
|
|
43478
43474
|
case "end":
|
|
43479
43475
|
return _context4.stop();
|
|
43480
43476
|
}
|
|
43481
43477
|
}
|
|
43482
|
-
}, _callee4, this, [[7,
|
|
43478
|
+
}, _callee4, this, [[7, 41]]);
|
|
43483
43479
|
}));
|
|
43484
43480
|
|
|
43485
43481
|
function signUpV2(_x6, _x7, _x8) {
|
|
@@ -45751,13 +45747,13 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45751
45747
|
key: "createEntityManagerUserV2",
|
|
45752
45748
|
value: function () {
|
|
45753
45749
|
var _createEntityManagerUserV = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(_ref4) {
|
|
45754
|
-
var metadata,
|
|
45750
|
+
var metadata, profilePictureFile, coverPhotoFile, userId, newMetadata, resp, _resp3, cid, manageEntityResponse, errorMsg;
|
|
45755
45751
|
|
|
45756
45752
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
45757
45753
|
while (1) {
|
|
45758
45754
|
switch (_context17.prev = _context17.next) {
|
|
45759
45755
|
case 0:
|
|
45760
|
-
metadata = _ref4.metadata;
|
|
45756
|
+
metadata = _ref4.metadata, profilePictureFile = _ref4.profilePictureFile, coverPhotoFile = _ref4.coverPhotoFile;
|
|
45761
45757
|
this.REQUIRES(Services.DISCOVERY_PROVIDER);
|
|
45762
45758
|
_context17.prev = 2;
|
|
45763
45759
|
_context17.next = 5;
|
|
@@ -45765,15 +45761,6 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45765
45761
|
|
|
45766
45762
|
case 5:
|
|
45767
45763
|
userId = _context17.sent;
|
|
45768
|
-
_context17.next = 8;
|
|
45769
|
-
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.CREATE, 'v2');
|
|
45770
|
-
|
|
45771
|
-
case 8:
|
|
45772
|
-
manageEntityResponse = _context17.sent;
|
|
45773
|
-
_context17.next = 11;
|
|
45774
|
-
return this._waitForDiscoveryToIndexUser(userId, manageEntityResponse.txReceipt.blockNumber);
|
|
45775
|
-
|
|
45776
|
-
case 11:
|
|
45777
45764
|
// Ensure metadata has expected properties
|
|
45778
45765
|
newMetadata = this.cleanUserMetadata(_objectSpread2({}, metadata));
|
|
45779
45766
|
|
|
@@ -45789,46 +45776,81 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45789
45776
|
followee_count: 0,
|
|
45790
45777
|
follower_count: 0,
|
|
45791
45778
|
repost_count: 0
|
|
45792
|
-
})); //
|
|
45779
|
+
})); // Upload images
|
|
45793
45780
|
|
|
45794
|
-
|
|
45795
|
-
|
|
45796
|
-
|
|
45797
|
-
|
|
45798
|
-
});
|
|
45781
|
+
if (!profilePictureFile) {
|
|
45782
|
+
_context17.next = 17;
|
|
45783
|
+
break;
|
|
45784
|
+
}
|
|
45799
45785
|
|
|
45800
|
-
|
|
45801
|
-
|
|
45802
|
-
|
|
45803
|
-
|
|
45786
|
+
_context17.next = 15;
|
|
45787
|
+
return this.creatorNode.uploadProfilePictureV2(profilePictureFile);
|
|
45788
|
+
|
|
45789
|
+
case 15:
|
|
45790
|
+
resp = _context17.sent;
|
|
45791
|
+
newMetadata.profile_picture_sizes = resp.id;
|
|
45792
|
+
|
|
45793
|
+
case 17:
|
|
45794
|
+
if (!coverPhotoFile) {
|
|
45795
|
+
_context17.next = 22;
|
|
45796
|
+
break;
|
|
45797
|
+
}
|
|
45798
|
+
|
|
45799
|
+
_context17.next = 20;
|
|
45800
|
+
return this.creatorNode.uploadCoverPhotoV2(coverPhotoFile);
|
|
45801
|
+
|
|
45802
|
+
case 20:
|
|
45803
|
+
_resp3 = _context17.sent;
|
|
45804
|
+
newMetadata.cover_photo_sizes = _resp3.id;
|
|
45805
|
+
|
|
45806
|
+
case 22:
|
|
45807
|
+
_context17.next = 24;
|
|
45808
|
+
return Utils.fileHasher.generateMetadataCidV1(newMetadata);
|
|
45809
|
+
|
|
45810
|
+
case 24:
|
|
45811
|
+
cid = _context17.sent;
|
|
45812
|
+
_context17.next = 27;
|
|
45813
|
+
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.CREATE, JSON.stringify({
|
|
45814
|
+
cid: cid.toString(),
|
|
45815
|
+
data: newMetadata
|
|
45816
|
+
}));
|
|
45817
|
+
|
|
45818
|
+
case 27:
|
|
45819
|
+
manageEntityResponse = _context17.sent;
|
|
45820
|
+
_context17.next = 30;
|
|
45821
|
+
return this._waitForDiscoveryToIndexUser(userId, manageEntityResponse.txReceipt.blockNumber);
|
|
45822
|
+
|
|
45823
|
+
case 30:
|
|
45824
|
+
// Update libs instance with new user metadata object
|
|
45825
|
+
this.userStateManager.setCurrentUser(_objectSpread2({}, newMetadata));
|
|
45804
45826
|
return _context17.abrupt("return", {
|
|
45805
45827
|
newMetadata: newMetadata,
|
|
45806
|
-
blockHash: blockHash,
|
|
45807
|
-
blockNumber: blockNumber
|
|
45828
|
+
blockHash: manageEntityResponse.txReceipt.blockHash,
|
|
45829
|
+
blockNumber: manageEntityResponse.txReceipt.blockNumber
|
|
45808
45830
|
});
|
|
45809
45831
|
|
|
45810
|
-
case
|
|
45811
|
-
_context17.prev =
|
|
45832
|
+
case 34:
|
|
45833
|
+
_context17.prev = 34;
|
|
45812
45834
|
_context17.t0 = _context17["catch"](2);
|
|
45813
45835
|
errorMsg = "createEntityManagerUserV2() error: ".concat(_context17.t0);
|
|
45814
45836
|
|
|
45815
45837
|
if (!(_context17.t0 instanceof Error)) {
|
|
45816
|
-
_context17.next =
|
|
45838
|
+
_context17.next = 40;
|
|
45817
45839
|
break;
|
|
45818
45840
|
}
|
|
45819
45841
|
|
|
45820
45842
|
_context17.t0.message = errorMsg;
|
|
45821
45843
|
throw _context17.t0;
|
|
45822
45844
|
|
|
45823
|
-
case
|
|
45845
|
+
case 40:
|
|
45824
45846
|
throw new Error(errorMsg);
|
|
45825
45847
|
|
|
45826
|
-
case
|
|
45848
|
+
case 41:
|
|
45827
45849
|
case "end":
|
|
45828
45850
|
return _context17.stop();
|
|
45829
45851
|
}
|
|
45830
45852
|
}
|
|
45831
|
-
}, _callee17, this, [[2,
|
|
45853
|
+
}, _callee17, this, [[2, 34]]);
|
|
45832
45854
|
}));
|
|
45833
45855
|
|
|
45834
45856
|
function createEntityManagerUserV2(_x18) {
|