@audius/sdk 2.0.3-beta.3 → 2.0.3-beta.4

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/index.cjs.js CHANGED
@@ -9131,19 +9131,19 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9131
9131
  return block;
9132
9132
  }()
9133
9133
  }, {
9134
- key: "delete",
9134
+ key: "unblock",
9135
9135
  value: function () {
9136
- var _delete2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(requestParameters) {
9136
+ var _unblock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(requestParameters) {
9137
9137
  return regeneratorRuntime.wrap(function _callee17$(_context17) {
9138
9138
  while (1) {
9139
9139
  switch (_context17.prev = _context17.next) {
9140
9140
  case 0:
9141
- this.assertNotNullOrUndefined(requestParameters.chatId, 'requestParameters.chatId', 'delete');
9141
+ this.assertNotNullOrUndefined(requestParameters.userId, 'requestParameters.userId', 'unblock');
9142
9142
  _context17.next = 3;
9143
9143
  return this.sendRpc({
9144
- method: 'chat.delete',
9144
+ method: 'chat.unblock',
9145
9145
  params: {
9146
- chat_id: requestParameters.chatId
9146
+ user_id: requestParameters.userId
9147
9147
  }
9148
9148
  });
9149
9149
 
@@ -9158,26 +9158,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9158
9158
  }, _callee17, this);
9159
9159
  }));
9160
9160
 
9161
- function _delete(_x14) {
9162
- return _delete2.apply(this, arguments);
9161
+ function unblock(_x14) {
9162
+ return _unblock.apply(this, arguments);
9163
9163
  }
9164
9164
 
9165
- return _delete;
9165
+ return unblock;
9166
9166
  }()
9167
9167
  }, {
9168
- key: "permit",
9168
+ key: "delete",
9169
9169
  value: function () {
9170
- var _permit = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(requestParameters) {
9170
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(requestParameters) {
9171
9171
  return regeneratorRuntime.wrap(function _callee18$(_context18) {
9172
9172
  while (1) {
9173
9173
  switch (_context18.prev = _context18.next) {
9174
9174
  case 0:
9175
- this.assertNotNullOrUndefined(requestParameters.permit, 'requestParameters.permit', 'permit');
9175
+ this.assertNotNullOrUndefined(requestParameters.chatId, 'requestParameters.chatId', 'delete');
9176
9176
  _context18.next = 3;
9177
9177
  return this.sendRpc({
9178
- method: 'chat.permit',
9178
+ method: 'chat.delete',
9179
9179
  params: {
9180
- permit: requestParameters.permit
9180
+ chat_id: requestParameters.chatId
9181
9181
  }
9182
9182
  });
9183
9183
 
@@ -9192,7 +9192,41 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9192
9192
  }, _callee18, this);
9193
9193
  }));
9194
9194
 
9195
- function permit(_x15) {
9195
+ function _delete(_x15) {
9196
+ return _delete2.apply(this, arguments);
9197
+ }
9198
+
9199
+ return _delete;
9200
+ }()
9201
+ }, {
9202
+ key: "permit",
9203
+ value: function () {
9204
+ var _permit = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(requestParameters) {
9205
+ return regeneratorRuntime.wrap(function _callee19$(_context19) {
9206
+ while (1) {
9207
+ switch (_context19.prev = _context19.next) {
9208
+ case 0:
9209
+ this.assertNotNullOrUndefined(requestParameters.permit, 'requestParameters.permit', 'permit');
9210
+ _context19.next = 3;
9211
+ return this.sendRpc({
9212
+ method: 'chat.permit',
9213
+ params: {
9214
+ permit: requestParameters.permit
9215
+ }
9216
+ });
9217
+
9218
+ case 3:
9219
+ return _context19.abrupt("return", _context19.sent);
9220
+
9221
+ case 4:
9222
+ case "end":
9223
+ return _context19.stop();
9224
+ }
9225
+ }
9226
+ }, _callee19, this);
9227
+ }));
9228
+
9229
+ function permit(_x16) {
9196
9230
  return _permit.apply(this, arguments);
9197
9231
  }
9198
9232
 
@@ -9226,67 +9260,67 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9226
9260
  }, {
9227
9261
  key: "createInvites",
9228
9262
  value: function () {
9229
- var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId, invitedUserIds, chatSecret) {
9263
+ var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(userId, invitedUserIds, chatSecret) {
9230
9264
  var _this4 = this;
9231
9265
 
9232
9266
  var userPublicKey;
9233
- return regeneratorRuntime.wrap(function _callee20$(_context20) {
9267
+ return regeneratorRuntime.wrap(function _callee21$(_context21) {
9234
9268
  while (1) {
9235
- switch (_context20.prev = _context20.next) {
9269
+ switch (_context21.prev = _context21.next) {
9236
9270
  case 0:
9237
- _context20.next = 2;
9271
+ _context21.next = 2;
9238
9272
  return this.getPublicKey(userId);
9239
9273
 
9240
9274
  case 2:
9241
- userPublicKey = _context20.sent;
9242
- _context20.next = 5;
9275
+ userPublicKey = _context21.sent;
9276
+ _context21.next = 5;
9243
9277
  return Promise.all([userId].concat(_toConsumableArray(invitedUserIds)).map( /*#__PURE__*/function () {
9244
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId) {
9278
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId) {
9245
9279
  var inviteePublicKey, inviteCode;
9246
- return regeneratorRuntime.wrap(function _callee19$(_context19) {
9280
+ return regeneratorRuntime.wrap(function _callee20$(_context20) {
9247
9281
  while (1) {
9248
- switch (_context19.prev = _context19.next) {
9282
+ switch (_context20.prev = _context20.next) {
9249
9283
  case 0:
9250
- _context19.next = 2;
9284
+ _context20.next = 2;
9251
9285
  return _this4.getPublicKey(userId);
9252
9286
 
9253
9287
  case 2:
9254
- inviteePublicKey = _context19.sent;
9255
- _context19.next = 5;
9288
+ inviteePublicKey = _context20.sent;
9289
+ _context20.next = 5;
9256
9290
  return _this4.createInviteCode(userPublicKey, inviteePublicKey, chatSecret);
9257
9291
 
9258
9292
  case 5:
9259
- inviteCode = _context19.sent;
9260
- return _context19.abrupt("return", {
9293
+ inviteCode = _context20.sent;
9294
+ return _context20.abrupt("return", {
9261
9295
  user_id: userId,
9262
9296
  invite_code: base.base64.encode(inviteCode)
9263
9297
  });
9264
9298
 
9265
9299
  case 7:
9266
9300
  case "end":
9267
- return _context19.stop();
9301
+ return _context20.stop();
9268
9302
  }
9269
9303
  }
9270
- }, _callee19);
9304
+ }, _callee20);
9271
9305
  }));
9272
9306
 
9273
- return function (_x19) {
9307
+ return function (_x20) {
9274
9308
  return _ref3.apply(this, arguments);
9275
9309
  };
9276
9310
  }()));
9277
9311
 
9278
9312
  case 5:
9279
- return _context20.abrupt("return", _context20.sent);
9313
+ return _context21.abrupt("return", _context21.sent);
9280
9314
 
9281
9315
  case 6:
9282
9316
  case "end":
9283
- return _context20.stop();
9317
+ return _context21.stop();
9284
9318
  }
9285
9319
  }
9286
- }, _callee20, this);
9320
+ }, _callee21, this);
9287
9321
  }));
9288
9322
 
9289
- function createInvites(_x16, _x17, _x18) {
9323
+ function createInvites(_x17, _x18, _x19) {
9290
9324
  return _createInvites.apply(this, arguments);
9291
9325
  }
9292
9326
 
@@ -9295,36 +9329,36 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9295
9329
  }, {
9296
9330
  key: "createInviteCode",
9297
9331
  value: function () {
9298
- var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(userPublicKey, inviteePublicKey, chatSecret) {
9332
+ var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(userPublicKey, inviteePublicKey, chatSecret) {
9299
9333
  var sharedSecret, encryptedChatSecret, inviteCode;
9300
- return regeneratorRuntime.wrap(function _callee21$(_context21) {
9334
+ return regeneratorRuntime.wrap(function _callee22$(_context22) {
9301
9335
  while (1) {
9302
- switch (_context21.prev = _context21.next) {
9336
+ switch (_context22.prev = _context22.next) {
9303
9337
  case 0:
9304
- _context21.next = 2;
9338
+ _context22.next = 2;
9305
9339
  return this.walletService.getSharedSecret(inviteePublicKey);
9306
9340
 
9307
9341
  case 2:
9308
- sharedSecret = _context21.sent;
9309
- _context21.next = 5;
9342
+ sharedSecret = _context22.sent;
9343
+ _context22.next = 5;
9310
9344
  return this.encrypt(sharedSecret, chatSecret);
9311
9345
 
9312
9346
  case 5:
9313
- encryptedChatSecret = _context21.sent;
9347
+ encryptedChatSecret = _context22.sent;
9314
9348
  inviteCode = new Uint8Array(65 + encryptedChatSecret.length);
9315
9349
  inviteCode.set(userPublicKey);
9316
9350
  inviteCode.set(encryptedChatSecret, 65);
9317
- return _context21.abrupt("return", inviteCode);
9351
+ return _context22.abrupt("return", inviteCode);
9318
9352
 
9319
9353
  case 10:
9320
9354
  case "end":
9321
- return _context21.stop();
9355
+ return _context22.stop();
9322
9356
  }
9323
9357
  }
9324
- }, _callee21, this);
9358
+ }, _callee22, this);
9325
9359
  }));
9326
9360
 
9327
- function createInviteCode(_x20, _x21, _x22) {
9361
+ function createInviteCode(_x21, _x22, _x23) {
9328
9362
  return _createInviteCode.apply(this, arguments);
9329
9363
  }
9330
9364
 
@@ -9333,34 +9367,34 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9333
9367
  }, {
9334
9368
  key: "readInviteCode",
9335
9369
  value: function () {
9336
- var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(inviteCode) {
9370
+ var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(inviteCode) {
9337
9371
  var friendPublicKey, chatSecretEncrypted, sharedSecret;
9338
- return regeneratorRuntime.wrap(function _callee22$(_context22) {
9372
+ return regeneratorRuntime.wrap(function _callee23$(_context23) {
9339
9373
  while (1) {
9340
- switch (_context22.prev = _context22.next) {
9374
+ switch (_context23.prev = _context23.next) {
9341
9375
  case 0:
9342
9376
  friendPublicKey = inviteCode.slice(0, 65);
9343
9377
  chatSecretEncrypted = inviteCode.slice(65);
9344
- _context22.next = 4;
9378
+ _context23.next = 4;
9345
9379
  return this.walletService.getSharedSecret(friendPublicKey);
9346
9380
 
9347
9381
  case 4:
9348
- sharedSecret = _context22.sent;
9349
- _context22.next = 7;
9382
+ sharedSecret = _context23.sent;
9383
+ _context23.next = 7;
9350
9384
  return this.decrypt(sharedSecret, chatSecretEncrypted);
9351
9385
 
9352
9386
  case 7:
9353
- return _context22.abrupt("return", _context22.sent);
9387
+ return _context23.abrupt("return", _context23.sent);
9354
9388
 
9355
9389
  case 8:
9356
9390
  case "end":
9357
- return _context22.stop();
9391
+ return _context23.stop();
9358
9392
  }
9359
9393
  }
9360
- }, _callee22, this);
9394
+ }, _callee23, this);
9361
9395
  }));
9362
9396
 
9363
- function readInviteCode(_x23) {
9397
+ function readInviteCode(_x24) {
9364
9398
  return _readInviteCode.apply(this, arguments);
9365
9399
  }
9366
9400
 
@@ -9369,26 +9403,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9369
9403
  }, {
9370
9404
  key: "encrypt",
9371
9405
  value: function () {
9372
- var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(secret, payload) {
9373
- return regeneratorRuntime.wrap(function _callee23$(_context23) {
9406
+ var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(secret, payload) {
9407
+ return regeneratorRuntime.wrap(function _callee24$(_context24) {
9374
9408
  while (1) {
9375
- switch (_context23.prev = _context23.next) {
9409
+ switch (_context24.prev = _context24.next) {
9376
9410
  case 0:
9377
- _context23.next = 2;
9411
+ _context24.next = 2;
9378
9412
  return encrypt(secret.slice(secret.length - 32), payload);
9379
9413
 
9380
9414
  case 2:
9381
- return _context23.abrupt("return", _context23.sent);
9415
+ return _context24.abrupt("return", _context24.sent);
9382
9416
 
9383
9417
  case 3:
9384
9418
  case "end":
9385
- return _context23.stop();
9419
+ return _context24.stop();
9386
9420
  }
9387
9421
  }
9388
- }, _callee23);
9422
+ }, _callee24);
9389
9423
  }));
9390
9424
 
9391
- function encrypt$1(_x24, _x25) {
9425
+ function encrypt$1(_x25, _x26) {
9392
9426
  return _encrypt.apply(this, arguments);
9393
9427
  }
9394
9428
 
@@ -9397,26 +9431,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9397
9431
  }, {
9398
9432
  key: "encryptString",
9399
9433
  value: function () {
9400
- var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(secret, payload) {
9401
- return regeneratorRuntime.wrap(function _callee24$(_context24) {
9434
+ var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(secret, payload) {
9435
+ return regeneratorRuntime.wrap(function _callee25$(_context25) {
9402
9436
  while (1) {
9403
- switch (_context24.prev = _context24.next) {
9437
+ switch (_context25.prev = _context25.next) {
9404
9438
  case 0:
9405
- _context24.next = 2;
9439
+ _context25.next = 2;
9406
9440
  return this.encrypt(secret, new TextEncoder().encode(payload));
9407
9441
 
9408
9442
  case 2:
9409
- return _context24.abrupt("return", _context24.sent);
9443
+ return _context25.abrupt("return", _context25.sent);
9410
9444
 
9411
9445
  case 3:
9412
9446
  case "end":
9413
- return _context24.stop();
9447
+ return _context25.stop();
9414
9448
  }
9415
9449
  }
9416
- }, _callee24, this);
9450
+ }, _callee25, this);
9417
9451
  }));
9418
9452
 
9419
- function encryptString(_x26, _x27) {
9453
+ function encryptString(_x27, _x28) {
9420
9454
  return _encryptString.apply(this, arguments);
9421
9455
  }
9422
9456
 
@@ -9425,26 +9459,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9425
9459
  }, {
9426
9460
  key: "decrypt",
9427
9461
  value: function () {
9428
- var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(secret, payload) {
9429
- return regeneratorRuntime.wrap(function _callee25$(_context25) {
9462
+ var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(secret, payload) {
9463
+ return regeneratorRuntime.wrap(function _callee26$(_context26) {
9430
9464
  while (1) {
9431
- switch (_context25.prev = _context25.next) {
9465
+ switch (_context26.prev = _context26.next) {
9432
9466
  case 0:
9433
- _context25.next = 2;
9467
+ _context26.next = 2;
9434
9468
  return decrypt(secret.slice(secret.length - 32), payload);
9435
9469
 
9436
9470
  case 2:
9437
- return _context25.abrupt("return", _context25.sent);
9471
+ return _context26.abrupt("return", _context26.sent);
9438
9472
 
9439
9473
  case 3:
9440
9474
  case "end":
9441
- return _context25.stop();
9475
+ return _context26.stop();
9442
9476
  }
9443
9477
  }
9444
- }, _callee25);
9478
+ }, _callee26);
9445
9479
  }));
9446
9480
 
9447
- function decrypt$1(_x28, _x29) {
9481
+ function decrypt$1(_x29, _x30) {
9448
9482
  return _decrypt.apply(this, arguments);
9449
9483
  }
9450
9484
 
@@ -9453,28 +9487,28 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9453
9487
  }, {
9454
9488
  key: "decryptString",
9455
9489
  value: function () {
9456
- var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(secret, payload) {
9457
- return regeneratorRuntime.wrap(function _callee26$(_context26) {
9490
+ var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(secret, payload) {
9491
+ return regeneratorRuntime.wrap(function _callee27$(_context27) {
9458
9492
  while (1) {
9459
- switch (_context26.prev = _context26.next) {
9493
+ switch (_context27.prev = _context27.next) {
9460
9494
  case 0:
9461
- _context26.t0 = new TextDecoder();
9462
- _context26.next = 3;
9495
+ _context27.t0 = new TextDecoder();
9496
+ _context27.next = 3;
9463
9497
  return this.decrypt(secret, payload);
9464
9498
 
9465
9499
  case 3:
9466
- _context26.t1 = _context26.sent;
9467
- return _context26.abrupt("return", _context26.t0.decode.call(_context26.t0, _context26.t1));
9500
+ _context27.t1 = _context27.sent;
9501
+ return _context27.abrupt("return", _context27.t0.decode.call(_context27.t0, _context27.t1));
9468
9502
 
9469
9503
  case 5:
9470
9504
  case "end":
9471
- return _context26.stop();
9505
+ return _context27.stop();
9472
9506
  }
9473
9507
  }
9474
- }, _callee26, this);
9508
+ }, _callee27, this);
9475
9509
  }));
9476
9510
 
9477
- function decryptString(_x30, _x31) {
9511
+ function decryptString(_x31, _x32) {
9478
9512
  return _decryptString.apply(this, arguments);
9479
9513
  }
9480
9514
 
@@ -9483,53 +9517,53 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9483
9517
  }, {
9484
9518
  key: "decryptLastChatMessage",
9485
9519
  value: function () {
9486
- var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(c) {
9520
+ var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(c) {
9487
9521
  var sharedSecret, lastMessage;
9488
- return regeneratorRuntime.wrap(function _callee27$(_context27) {
9522
+ return regeneratorRuntime.wrap(function _callee28$(_context28) {
9489
9523
  while (1) {
9490
- switch (_context27.prev = _context27.next) {
9524
+ switch (_context28.prev = _context28.next) {
9491
9525
  case 0:
9492
- _context27.next = 2;
9526
+ _context28.next = 2;
9493
9527
  return this.getChatSecret(c.chat_id);
9494
9528
 
9495
9529
  case 2:
9496
- sharedSecret = _context27.sent;
9530
+ sharedSecret = _context28.sent;
9497
9531
  lastMessage = '';
9498
9532
 
9499
9533
  if (!(c.last_message && c.last_message.length > 0)) {
9500
- _context27.next = 15;
9534
+ _context28.next = 15;
9501
9535
  break;
9502
9536
  }
9503
9537
 
9504
- _context27.prev = 5;
9505
- _context27.next = 8;
9538
+ _context28.prev = 5;
9539
+ _context28.next = 8;
9506
9540
  return this.decryptString(sharedSecret, base.base64.decode(c.last_message));
9507
9541
 
9508
9542
  case 8:
9509
- lastMessage = _context27.sent;
9510
- _context27.next = 15;
9543
+ lastMessage = _context28.sent;
9544
+ _context28.next = 15;
9511
9545
  break;
9512
9546
 
9513
9547
  case 11:
9514
- _context27.prev = 11;
9515
- _context27.t0 = _context27["catch"](5);
9516
- console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c, _context27.t0);
9548
+ _context28.prev = 11;
9549
+ _context28.t0 = _context28["catch"](5);
9550
+ console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c, _context28.t0);
9517
9551
  lastMessage = "Error: Couldn't decrypt message";
9518
9552
 
9519
9553
  case 15:
9520
- return _context27.abrupt("return", _objectSpread2(_objectSpread2({}, c), {}, {
9554
+ return _context28.abrupt("return", _objectSpread2(_objectSpread2({}, c), {}, {
9521
9555
  last_message: lastMessage
9522
9556
  }));
9523
9557
 
9524
9558
  case 16:
9525
9559
  case "end":
9526
- return _context27.stop();
9560
+ return _context28.stop();
9527
9561
  }
9528
9562
  }
9529
- }, _callee27, this, [[5, 11]]);
9563
+ }, _callee28, this, [[5, 11]]);
9530
9564
  }));
9531
9565
 
9532
- function decryptLastChatMessage(_x32) {
9566
+ function decryptLastChatMessage(_x33) {
9533
9567
  return _decryptLastChatMessage.apply(this, arguments);
9534
9568
  }
9535
9569
 
@@ -9538,17 +9572,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9538
9572
  }, {
9539
9573
  key: "getRaw",
9540
9574
  value: function () {
9541
- var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(chatId) {
9575
+ var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(chatId) {
9542
9576
  var path, queryParameters, response;
9543
- return regeneratorRuntime.wrap(function _callee28$(_context28) {
9577
+ return regeneratorRuntime.wrap(function _callee29$(_context29) {
9544
9578
  while (1) {
9545
- switch (_context28.prev = _context28.next) {
9579
+ switch (_context29.prev = _context29.next) {
9546
9580
  case 0:
9547
9581
  path = "/comms/chats/".concat(chatId);
9548
9582
  queryParameters = {
9549
9583
  timestamp: new Date().getTime()
9550
9584
  };
9551
- _context28.next = 4;
9585
+ _context29.next = 4;
9552
9586
  return this.signAndSendRequest({
9553
9587
  method: 'GET',
9554
9588
  headers: {},
@@ -9557,22 +9591,22 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9557
9591
  });
9558
9592
 
9559
9593
  case 4:
9560
- response = _context28.sent;
9561
- _context28.next = 7;
9594
+ response = _context29.sent;
9595
+ _context29.next = 7;
9562
9596
  return response.json();
9563
9597
 
9564
9598
  case 7:
9565
- return _context28.abrupt("return", _context28.sent);
9599
+ return _context29.abrupt("return", _context29.sent);
9566
9600
 
9567
9601
  case 8:
9568
9602
  case "end":
9569
- return _context28.stop();
9603
+ return _context29.stop();
9570
9604
  }
9571
9605
  }
9572
- }, _callee28, this);
9606
+ }, _callee29, this);
9573
9607
  }));
9574
9608
 
9575
- function getRaw(_x33) {
9609
+ function getRaw(_x34) {
9576
9610
  return _getRaw.apply(this, arguments);
9577
9611
  }
9578
9612
 
@@ -9581,44 +9615,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9581
9615
  }, {
9582
9616
  key: "getChatSecret",
9583
9617
  value: function () {
9584
- var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(chatId) {
9618
+ var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(chatId) {
9585
9619
  var existingChatSecret, response, chatSecret;
9586
- return regeneratorRuntime.wrap(function _callee29$(_context29) {
9620
+ return regeneratorRuntime.wrap(function _callee30$(_context30) {
9587
9621
  while (1) {
9588
- switch (_context29.prev = _context29.next) {
9622
+ switch (_context30.prev = _context30.next) {
9589
9623
  case 0:
9590
9624
  existingChatSecret = this.chatSecrets[chatId];
9591
9625
 
9592
9626
  if (existingChatSecret) {
9593
- _context29.next = 10;
9627
+ _context30.next = 10;
9594
9628
  break;
9595
9629
  }
9596
9630
 
9597
- _context29.next = 4;
9631
+ _context30.next = 4;
9598
9632
  return this.getRaw(chatId);
9599
9633
 
9600
9634
  case 4:
9601
- response = _context29.sent;
9602
- _context29.next = 7;
9635
+ response = _context30.sent;
9636
+ _context30.next = 7;
9603
9637
  return this.readInviteCode(base.base64.decode(response.data.invite_code));
9604
9638
 
9605
9639
  case 7:
9606
- chatSecret = _context29.sent;
9640
+ chatSecret = _context30.sent;
9607
9641
  this.chatSecrets[chatId] = chatSecret;
9608
- return _context29.abrupt("return", chatSecret);
9642
+ return _context30.abrupt("return", chatSecret);
9609
9643
 
9610
9644
  case 10:
9611
- return _context29.abrupt("return", existingChatSecret);
9645
+ return _context30.abrupt("return", existingChatSecret);
9612
9646
 
9613
9647
  case 11:
9614
9648
  case "end":
9615
- return _context29.stop();
9649
+ return _context30.stop();
9616
9650
  }
9617
9651
  }
9618
- }, _callee29, this);
9652
+ }, _callee30, this);
9619
9653
  }));
9620
9654
 
9621
- function getChatSecret(_x34) {
9655
+ function getChatSecret(_x35) {
9622
9656
  return _getChatSecret.apply(this, arguments);
9623
9657
  }
9624
9658
 
@@ -9627,13 +9661,13 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9627
9661
  }, {
9628
9662
  key: "getPublicKey",
9629
9663
  value: function () {
9630
- var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(userId) {
9664
+ var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(userId) {
9631
9665
  var response, json;
9632
- return regeneratorRuntime.wrap(function _callee30$(_context30) {
9666
+ return regeneratorRuntime.wrap(function _callee31$(_context31) {
9633
9667
  while (1) {
9634
- switch (_context30.prev = _context30.next) {
9668
+ switch (_context31.prev = _context31.next) {
9635
9669
  case 0:
9636
- _context30.next = 2;
9670
+ _context31.next = 2;
9637
9671
  return this.request({
9638
9672
  path: "/comms/pubkey/".concat(userId),
9639
9673
  method: 'GET',
@@ -9641,23 +9675,23 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9641
9675
  });
9642
9676
 
9643
9677
  case 2:
9644
- response = _context30.sent;
9645
- _context30.next = 5;
9678
+ response = _context31.sent;
9679
+ _context31.next = 5;
9646
9680
  return response.json();
9647
9681
 
9648
9682
  case 5:
9649
- json = _context30.sent;
9650
- return _context30.abrupt("return", base.base64.decode(json.data));
9683
+ json = _context31.sent;
9684
+ return _context31.abrupt("return", base.base64.decode(json.data));
9651
9685
 
9652
9686
  case 7:
9653
9687
  case "end":
9654
- return _context30.stop();
9688
+ return _context31.stop();
9655
9689
  }
9656
9690
  }
9657
- }, _callee30, this);
9691
+ }, _callee31, this);
9658
9692
  }));
9659
9693
 
9660
- function getPublicKey(_x35) {
9694
+ function getPublicKey(_x36) {
9661
9695
  return _getPublicKey.apply(this, arguments);
9662
9696
  }
9663
9697
 
@@ -9666,37 +9700,37 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9666
9700
  }, {
9667
9701
  key: "getSignatureHeader",
9668
9702
  value: function () {
9669
- var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(payload) {
9703
+ var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(payload) {
9670
9704
  var _yield$this$walletSer, _yield$this$walletSer2, allSignatureBytes, recoveryByte, signatureBytes;
9671
9705
 
9672
- return regeneratorRuntime.wrap(function _callee31$(_context31) {
9706
+ return regeneratorRuntime.wrap(function _callee32$(_context32) {
9673
9707
  while (1) {
9674
- switch (_context31.prev = _context31.next) {
9708
+ switch (_context32.prev = _context32.next) {
9675
9709
  case 0:
9676
- _context31.next = 2;
9710
+ _context32.next = 2;
9677
9711
  return this.walletService.sign(payload);
9678
9712
 
9679
9713
  case 2:
9680
- _yield$this$walletSer = _context31.sent;
9714
+ _yield$this$walletSer = _context32.sent;
9681
9715
  _yield$this$walletSer2 = _slicedToArray(_yield$this$walletSer, 2);
9682
9716
  allSignatureBytes = _yield$this$walletSer2[0];
9683
9717
  recoveryByte = _yield$this$walletSer2[1];
9684
9718
  signatureBytes = new Uint8Array(65);
9685
9719
  signatureBytes.set(allSignatureBytes, 0);
9686
9720
  signatureBytes[64] = recoveryByte;
9687
- return _context31.abrupt("return", {
9721
+ return _context32.abrupt("return", {
9688
9722
  'x-sig': base.base64.encode(signatureBytes)
9689
9723
  });
9690
9724
 
9691
9725
  case 10:
9692
9726
  case "end":
9693
- return _context31.stop();
9727
+ return _context32.stop();
9694
9728
  }
9695
9729
  }
9696
- }, _callee31, this);
9730
+ }, _callee32, this);
9697
9731
  }));
9698
9732
 
9699
- function getSignatureHeader(_x36) {
9733
+ function getSignatureHeader(_x37) {
9700
9734
  return _getSignatureHeader.apply(this, arguments);
9701
9735
  }
9702
9736
 
@@ -9705,44 +9739,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9705
9739
  }, {
9706
9740
  key: "signAndSendRequest",
9707
9741
  value: function () {
9708
- var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(request) {
9742
+ var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(request) {
9709
9743
  var payload;
9710
- return regeneratorRuntime.wrap(function _callee32$(_context32) {
9744
+ return regeneratorRuntime.wrap(function _callee33$(_context33) {
9711
9745
  while (1) {
9712
- switch (_context32.prev = _context32.next) {
9746
+ switch (_context33.prev = _context33.next) {
9713
9747
  case 0:
9714
9748
  payload = request.method === 'GET' ? request.query ? "".concat(request.path, "?").concat(this.configuration.queryParamsStringify(request.query)) : request.path : request.body;
9715
- _context32.t0 = this;
9716
- _context32.t1 = _objectSpread2;
9717
- _context32.t2 = _objectSpread2({}, request);
9718
- _context32.t3 = {};
9719
- _context32.t4 = _objectSpread2;
9720
- _context32.t5 = _objectSpread2({}, request.headers);
9721
- _context32.next = 9;
9749
+ _context33.t0 = this;
9750
+ _context33.t1 = _objectSpread2;
9751
+ _context33.t2 = _objectSpread2({}, request);
9752
+ _context33.t3 = {};
9753
+ _context33.t4 = _objectSpread2;
9754
+ _context33.t5 = _objectSpread2({}, request.headers);
9755
+ _context33.next = 9;
9722
9756
  return this.getSignatureHeader(payload);
9723
9757
 
9724
9758
  case 9:
9725
- _context32.t6 = _context32.sent;
9726
- _context32.t7 = (0, _context32.t4)(_context32.t5, _context32.t6);
9727
- _context32.t8 = {
9728
- headers: _context32.t7
9759
+ _context33.t6 = _context33.sent;
9760
+ _context33.t7 = (0, _context33.t4)(_context33.t5, _context33.t6);
9761
+ _context33.t8 = {
9762
+ headers: _context33.t7
9729
9763
  };
9730
- _context32.t9 = (0, _context32.t1)(_context32.t2, _context32.t3, _context32.t8);
9731
- _context32.next = 15;
9732
- return _context32.t0.request.call(_context32.t0, _context32.t9);
9764
+ _context33.t9 = (0, _context33.t1)(_context33.t2, _context33.t3, _context33.t8);
9765
+ _context33.next = 15;
9766
+ return _context33.t0.request.call(_context33.t0, _context33.t9);
9733
9767
 
9734
9768
  case 15:
9735
- return _context32.abrupt("return", _context32.sent);
9769
+ return _context33.abrupt("return", _context33.sent);
9736
9770
 
9737
9771
  case 16:
9738
9772
  case "end":
9739
- return _context32.stop();
9773
+ return _context33.stop();
9740
9774
  }
9741
9775
  }
9742
- }, _callee32, this);
9776
+ }, _callee33, this);
9743
9777
  }));
9744
9778
 
9745
- function signAndSendRequest(_x37) {
9779
+ function signAndSendRequest(_x38) {
9746
9780
  return _signAndSendRequest.apply(this, arguments);
9747
9781
  }
9748
9782
 
@@ -9751,16 +9785,16 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9751
9785
  }, {
9752
9786
  key: "sendRpc",
9753
9787
  value: function () {
9754
- var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(args) {
9788
+ var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(args) {
9755
9789
  var payload;
9756
- return regeneratorRuntime.wrap(function _callee33$(_context33) {
9790
+ return regeneratorRuntime.wrap(function _callee34$(_context34) {
9757
9791
  while (1) {
9758
- switch (_context33.prev = _context33.next) {
9792
+ switch (_context34.prev = _context34.next) {
9759
9793
  case 0:
9760
9794
  payload = JSON.stringify(_objectSpread2(_objectSpread2({}, args), {}, {
9761
9795
  timestamp: new Date().getTime()
9762
9796
  }));
9763
- _context33.next = 3;
9797
+ _context34.next = 3;
9764
9798
  return this.signAndSendRequest({
9765
9799
  method: 'POST',
9766
9800
  headers: {
@@ -9771,17 +9805,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9771
9805
  });
9772
9806
 
9773
9807
  case 3:
9774
- return _context33.abrupt("return", args);
9808
+ return _context34.abrupt("return", args);
9775
9809
 
9776
9810
  case 4:
9777
9811
  case "end":
9778
- return _context33.stop();
9812
+ return _context34.stop();
9779
9813
  }
9780
9814
  }
9781
- }, _callee33, this);
9815
+ }, _callee34, this);
9782
9816
  }));
9783
9817
 
9784
- function sendRpc(_x38) {
9818
+ function sendRpc(_x39) {
9785
9819
  return _sendRpc.apply(this, arguments);
9786
9820
  }
9787
9821
 
@@ -9790,73 +9824,73 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9790
9824
  }, {
9791
9825
  key: "createWebsocket",
9792
9826
  value: function () {
9793
- var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35(endpoint) {
9827
+ var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(endpoint) {
9794
9828
  var _this5 = this;
9795
9829
 
9796
9830
  var timestamp, originalUrl, signatureHeader, host, url, ws;
9797
- return regeneratorRuntime.wrap(function _callee35$(_context35) {
9831
+ return regeneratorRuntime.wrap(function _callee36$(_context36) {
9798
9832
  while (1) {
9799
- switch (_context35.prev = _context35.next) {
9833
+ switch (_context36.prev = _context36.next) {
9800
9834
  case 0:
9801
9835
  timestamp = new Date().getTime();
9802
9836
  originalUrl = "/comms/chats/ws?timestamp=".concat(timestamp);
9803
- _context35.next = 4;
9837
+ _context36.next = 4;
9804
9838
  return this.getSignatureHeader(originalUrl);
9805
9839
 
9806
9840
  case 4:
9807
- signatureHeader = _context35.sent;
9841
+ signatureHeader = _context36.sent;
9808
9842
  host = endpoint.replace(/http(s?)/g, 'ws$1');
9809
9843
  url = "".concat(host).concat(originalUrl, "&signature=").concat(encodeURIComponent(signatureHeader['x-sig']));
9810
9844
  ws = new WebSocket__default["default"](url);
9811
9845
  ws.addEventListener('message', function (messageEvent) {
9812
9846
  var handleAsync = /*#__PURE__*/function () {
9813
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34() {
9847
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35() {
9814
9848
  var data, sharedSecret;
9815
- return regeneratorRuntime.wrap(function _callee34$(_context34) {
9849
+ return regeneratorRuntime.wrap(function _callee35$(_context35) {
9816
9850
  while (1) {
9817
- switch (_context34.prev = _context34.next) {
9851
+ switch (_context35.prev = _context35.next) {
9818
9852
  case 0:
9819
9853
  data = JSON.parse(messageEvent.data);
9820
9854
 
9821
9855
  if (!(data.rpc.method === 'chat.message')) {
9822
- _context34.next = 19;
9856
+ _context35.next = 19;
9823
9857
  break;
9824
9858
  }
9825
9859
 
9826
- _context34.next = 4;
9860
+ _context35.next = 4;
9827
9861
  return _this5.getChatSecret(data.rpc.params.chat_id);
9828
9862
 
9829
9863
  case 4:
9830
- sharedSecret = _context34.sent;
9831
- _context34.t0 = _this5.eventEmitter;
9832
- _context34.t1 = data.rpc.params.chat_id;
9833
- _context34.t2 = data.rpc.params.message_id;
9834
- _context34.next = 10;
9864
+ sharedSecret = _context35.sent;
9865
+ _context35.t0 = _this5.eventEmitter;
9866
+ _context35.t1 = data.rpc.params.chat_id;
9867
+ _context35.t2 = data.rpc.params.message_id;
9868
+ _context35.next = 10;
9835
9869
  return _this5.decryptString(sharedSecret, base.base64.decode(data.rpc.params.message))["catch"](function (e) {
9836
9870
  console.error("[audius-sdk]: Error: Couldn't decrypt websocket chat message", data, e);
9837
9871
  return "Error: Couldn't decrypt message";
9838
9872
  });
9839
9873
 
9840
9874
  case 10:
9841
- _context34.t3 = _context34.sent;
9842
- _context34.t4 = data.metadata.userId;
9843
- _context34.t5 = data.metadata.timestamp;
9844
- _context34.t6 = [];
9845
- _context34.t7 = {
9846
- message_id: _context34.t2,
9847
- message: _context34.t3,
9848
- sender_user_id: _context34.t4,
9849
- created_at: _context34.t5,
9850
- reactions: _context34.t6
9875
+ _context35.t3 = _context35.sent;
9876
+ _context35.t4 = data.metadata.userId;
9877
+ _context35.t5 = data.metadata.timestamp;
9878
+ _context35.t6 = [];
9879
+ _context35.t7 = {
9880
+ message_id: _context35.t2,
9881
+ message: _context35.t3,
9882
+ sender_user_id: _context35.t4,
9883
+ created_at: _context35.t5,
9884
+ reactions: _context35.t6
9851
9885
  };
9852
- _context34.t8 = {
9853
- chatId: _context34.t1,
9854
- message: _context34.t7
9886
+ _context35.t8 = {
9887
+ chatId: _context35.t1,
9888
+ message: _context35.t7
9855
9889
  };
9856
9890
 
9857
- _context34.t0.emit.call(_context34.t0, 'message', _context34.t8);
9891
+ _context35.t0.emit.call(_context35.t0, 'message', _context35.t8);
9858
9892
 
9859
- _context34.next = 20;
9893
+ _context35.next = 20;
9860
9894
  break;
9861
9895
 
9862
9896
  case 19:
@@ -9874,10 +9908,10 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9874
9908
 
9875
9909
  case 20:
9876
9910
  case "end":
9877
- return _context34.stop();
9911
+ return _context35.stop();
9878
9912
  }
9879
9913
  }
9880
- }, _callee34);
9914
+ }, _callee35);
9881
9915
  }));
9882
9916
 
9883
9917
  return function handleAsync() {
@@ -9896,17 +9930,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9896
9930
  ws.addEventListener('error', function (e) {
9897
9931
  _this5.eventEmitter.emit('error', e);
9898
9932
  });
9899
- return _context35.abrupt("return", ws);
9933
+ return _context36.abrupt("return", ws);
9900
9934
 
9901
9935
  case 13:
9902
9936
  case "end":
9903
- return _context35.stop();
9937
+ return _context36.stop();
9904
9938
  }
9905
9939
  }
9906
- }, _callee35, this);
9940
+ }, _callee36, this);
9907
9941
  }));
9908
9942
 
9909
- function createWebsocket(_x39) {
9943
+ function createWebsocket(_x40) {
9910
9944
  return _createWebsocket.apply(this, arguments);
9911
9945
  }
9912
9946
 
@@ -27065,9 +27099,9 @@ var EthWeb3Manager = /*#__PURE__*/function () {
27065
27099
  }();
27066
27100
 
27067
27101
  var name = "@audius/sdk";
27068
- var version = "2.0.3-beta.3";
27102
+ var version = "2.0.3-beta.4";
27069
27103
  var audius = {
27070
- releaseSHA: "ac2f3f33f7f99e4d22588ffaf77a1e01bc4dbc15"
27104
+ releaseSHA: "42c56a1bf4cc52d52da7df738ace6822a91b0fce"
27071
27105
  };
27072
27106
  var description = "";
27073
27107
  var main = "dist/index.cjs.js";