@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/api/Users.d.ts
CHANGED
|
@@ -175,8 +175,10 @@ export declare class Users extends Base {
|
|
|
175
175
|
blockHash: string;
|
|
176
176
|
blockNumber: number;
|
|
177
177
|
}>;
|
|
178
|
-
createEntityManagerUserV2({ metadata }: {
|
|
178
|
+
createEntityManagerUserV2({ metadata, profilePictureFile, coverPhotoFile }: {
|
|
179
179
|
metadata: UserMetadata;
|
|
180
|
+
profilePictureFile: Nullable<File>;
|
|
181
|
+
coverPhotoFile: Nullable<File>;
|
|
180
182
|
}): Promise<{
|
|
181
183
|
newMetadata: Pick<UserMetadata, keyof UserMetadata>;
|
|
182
184
|
blockHash: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -30251,9 +30251,9 @@ var EthWeb3Manager = /*#__PURE__*/function () {
|
|
|
30251
30251
|
}();
|
|
30252
30252
|
|
|
30253
30253
|
var name = "@audius/sdk";
|
|
30254
|
-
var version = "2.0.3-beta.
|
|
30254
|
+
var version = "2.0.3-beta.53";
|
|
30255
30255
|
var audius = {
|
|
30256
|
-
releaseSHA: "
|
|
30256
|
+
releaseSHA: "1b19b6001940e0a9764d5b8e3fb52e93c4917f14"
|
|
30257
30257
|
};
|
|
30258
30258
|
var description = "Audius SDK";
|
|
30259
30259
|
var main = "dist/index.cjs.js";
|
|
@@ -65042,7 +65042,9 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
65042
65042
|
phase = phases.ADD_USER;
|
|
65043
65043
|
_context4.next = 34;
|
|
65044
65044
|
return this.User.createEntityManagerUserV2({
|
|
65045
|
-
metadata: metadata
|
|
65045
|
+
metadata: metadata,
|
|
65046
|
+
profilePictureFile: profilePictureFile,
|
|
65047
|
+
coverPhotoFile: coverPhotoFile
|
|
65046
65048
|
});
|
|
65047
65049
|
|
|
65048
65050
|
case 34:
|
|
@@ -65050,20 +65052,14 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
65050
65052
|
newMetadata = _yield$this$User$crea2.newMetadata;
|
|
65051
65053
|
blockHash = _yield$this$User$crea2.blockHash;
|
|
65052
65054
|
blockNumber = _yield$this$User$crea2.blockNumber;
|
|
65053
|
-
// Upload user's profile images, if any
|
|
65054
|
-
phase = phases.UPLOAD_PROFILE_IMAGES;
|
|
65055
|
-
_context4.next = 41;
|
|
65056
|
-
return this.User.uploadProfileImagesV2(profilePictureFile, coverPhotoFile, newMetadata);
|
|
65057
|
-
|
|
65058
|
-
case 41:
|
|
65059
65055
|
return _context4.abrupt("return", {
|
|
65060
65056
|
blockHash: blockHash,
|
|
65061
65057
|
blockNumber: blockNumber,
|
|
65062
65058
|
userId: newMetadata.user_id
|
|
65063
65059
|
});
|
|
65064
65060
|
|
|
65065
|
-
case
|
|
65066
|
-
_context4.prev =
|
|
65061
|
+
case 41:
|
|
65062
|
+
_context4.prev = 41;
|
|
65067
65063
|
_context4.t0 = _context4["catch"](7);
|
|
65068
65064
|
return _context4.abrupt("return", {
|
|
65069
65065
|
error: _context4.t0.message,
|
|
@@ -65071,12 +65067,12 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
65071
65067
|
errorStatus: _context4.t0.response ? _context4.t0.response.status : null
|
|
65072
65068
|
});
|
|
65073
65069
|
|
|
65074
|
-
case
|
|
65070
|
+
case 44:
|
|
65075
65071
|
case "end":
|
|
65076
65072
|
return _context4.stop();
|
|
65077
65073
|
}
|
|
65078
65074
|
}
|
|
65079
|
-
}, _callee4, this, [[7,
|
|
65075
|
+
}, _callee4, this, [[7, 41]]);
|
|
65080
65076
|
}));
|
|
65081
65077
|
|
|
65082
65078
|
function signUpV2(_x6, _x7, _x8) {
|
|
@@ -67348,13 +67344,13 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
67348
67344
|
key: "createEntityManagerUserV2",
|
|
67349
67345
|
value: function () {
|
|
67350
67346
|
var _createEntityManagerUserV = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(_ref4) {
|
|
67351
|
-
var metadata,
|
|
67347
|
+
var metadata, profilePictureFile, coverPhotoFile, userId, newMetadata, resp, _resp3, cid, manageEntityResponse, errorMsg;
|
|
67352
67348
|
|
|
67353
67349
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
67354
67350
|
while (1) {
|
|
67355
67351
|
switch (_context17.prev = _context17.next) {
|
|
67356
67352
|
case 0:
|
|
67357
|
-
metadata = _ref4.metadata;
|
|
67353
|
+
metadata = _ref4.metadata, profilePictureFile = _ref4.profilePictureFile, coverPhotoFile = _ref4.coverPhotoFile;
|
|
67358
67354
|
this.REQUIRES(Services.DISCOVERY_PROVIDER);
|
|
67359
67355
|
_context17.prev = 2;
|
|
67360
67356
|
_context17.next = 5;
|
|
@@ -67362,15 +67358,6 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
67362
67358
|
|
|
67363
67359
|
case 5:
|
|
67364
67360
|
userId = _context17.sent;
|
|
67365
|
-
_context17.next = 8;
|
|
67366
|
-
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.CREATE, 'v2');
|
|
67367
|
-
|
|
67368
|
-
case 8:
|
|
67369
|
-
manageEntityResponse = _context17.sent;
|
|
67370
|
-
_context17.next = 11;
|
|
67371
|
-
return this._waitForDiscoveryToIndexUser(userId, manageEntityResponse.txReceipt.blockNumber);
|
|
67372
|
-
|
|
67373
|
-
case 11:
|
|
67374
67361
|
// Ensure metadata has expected properties
|
|
67375
67362
|
newMetadata = this.cleanUserMetadata(_objectSpread2({}, metadata));
|
|
67376
67363
|
|
|
@@ -67386,46 +67373,81 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
67386
67373
|
followee_count: 0,
|
|
67387
67374
|
follower_count: 0,
|
|
67388
67375
|
repost_count: 0
|
|
67389
|
-
})); //
|
|
67376
|
+
})); // Upload images
|
|
67390
67377
|
|
|
67391
|
-
|
|
67392
|
-
|
|
67393
|
-
|
|
67394
|
-
|
|
67395
|
-
});
|
|
67378
|
+
if (!profilePictureFile) {
|
|
67379
|
+
_context17.next = 17;
|
|
67380
|
+
break;
|
|
67381
|
+
}
|
|
67396
67382
|
|
|
67397
|
-
|
|
67398
|
-
|
|
67399
|
-
|
|
67400
|
-
|
|
67383
|
+
_context17.next = 15;
|
|
67384
|
+
return this.creatorNode.uploadProfilePictureV2(profilePictureFile);
|
|
67385
|
+
|
|
67386
|
+
case 15:
|
|
67387
|
+
resp = _context17.sent;
|
|
67388
|
+
newMetadata.profile_picture_sizes = resp.id;
|
|
67389
|
+
|
|
67390
|
+
case 17:
|
|
67391
|
+
if (!coverPhotoFile) {
|
|
67392
|
+
_context17.next = 22;
|
|
67393
|
+
break;
|
|
67394
|
+
}
|
|
67395
|
+
|
|
67396
|
+
_context17.next = 20;
|
|
67397
|
+
return this.creatorNode.uploadCoverPhotoV2(coverPhotoFile);
|
|
67398
|
+
|
|
67399
|
+
case 20:
|
|
67400
|
+
_resp3 = _context17.sent;
|
|
67401
|
+
newMetadata.cover_photo_sizes = _resp3.id;
|
|
67402
|
+
|
|
67403
|
+
case 22:
|
|
67404
|
+
_context17.next = 24;
|
|
67405
|
+
return Utils.fileHasher.generateMetadataCidV1(newMetadata);
|
|
67406
|
+
|
|
67407
|
+
case 24:
|
|
67408
|
+
cid = _context17.sent;
|
|
67409
|
+
_context17.next = 27;
|
|
67410
|
+
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.CREATE, JSON.stringify({
|
|
67411
|
+
cid: cid.toString(),
|
|
67412
|
+
data: newMetadata
|
|
67413
|
+
}));
|
|
67414
|
+
|
|
67415
|
+
case 27:
|
|
67416
|
+
manageEntityResponse = _context17.sent;
|
|
67417
|
+
_context17.next = 30;
|
|
67418
|
+
return this._waitForDiscoveryToIndexUser(userId, manageEntityResponse.txReceipt.blockNumber);
|
|
67419
|
+
|
|
67420
|
+
case 30:
|
|
67421
|
+
// Update libs instance with new user metadata object
|
|
67422
|
+
this.userStateManager.setCurrentUser(_objectSpread2({}, newMetadata));
|
|
67401
67423
|
return _context17.abrupt("return", {
|
|
67402
67424
|
newMetadata: newMetadata,
|
|
67403
|
-
blockHash: blockHash,
|
|
67404
|
-
blockNumber: blockNumber
|
|
67425
|
+
blockHash: manageEntityResponse.txReceipt.blockHash,
|
|
67426
|
+
blockNumber: manageEntityResponse.txReceipt.blockNumber
|
|
67405
67427
|
});
|
|
67406
67428
|
|
|
67407
|
-
case
|
|
67408
|
-
_context17.prev =
|
|
67429
|
+
case 34:
|
|
67430
|
+
_context17.prev = 34;
|
|
67409
67431
|
_context17.t0 = _context17["catch"](2);
|
|
67410
67432
|
errorMsg = "createEntityManagerUserV2() error: ".concat(_context17.t0);
|
|
67411
67433
|
|
|
67412
67434
|
if (!(_context17.t0 instanceof Error)) {
|
|
67413
|
-
_context17.next =
|
|
67435
|
+
_context17.next = 40;
|
|
67414
67436
|
break;
|
|
67415
67437
|
}
|
|
67416
67438
|
|
|
67417
67439
|
_context17.t0.message = errorMsg;
|
|
67418
67440
|
throw _context17.t0;
|
|
67419
67441
|
|
|
67420
|
-
case
|
|
67442
|
+
case 40:
|
|
67421
67443
|
throw new Error(errorMsg);
|
|
67422
67444
|
|
|
67423
|
-
case
|
|
67445
|
+
case 41:
|
|
67424
67446
|
case "end":
|
|
67425
67447
|
return _context17.stop();
|
|
67426
67448
|
}
|
|
67427
67449
|
}
|
|
67428
|
-
}, _callee17, this, [[2,
|
|
67450
|
+
}, _callee17, this, [[2, 34]]);
|
|
67429
67451
|
}));
|
|
67430
67452
|
|
|
67431
67453
|
function createEntityManagerUserV2(_x18) {
|