@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/legacy.js CHANGED
@@ -8938,19 +8938,19 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
8938
8938
  return block;
8939
8939
  }()
8940
8940
  }, {
8941
- key: "delete",
8941
+ key: "unblock",
8942
8942
  value: function () {
8943
- var _delete2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(requestParameters) {
8943
+ var _unblock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(requestParameters) {
8944
8944
  return regeneratorRuntime.wrap(function _callee17$(_context17) {
8945
8945
  while (1) {
8946
8946
  switch (_context17.prev = _context17.next) {
8947
8947
  case 0:
8948
- this.assertNotNullOrUndefined(requestParameters.chatId, 'requestParameters.chatId', 'delete');
8948
+ this.assertNotNullOrUndefined(requestParameters.userId, 'requestParameters.userId', 'unblock');
8949
8949
  _context17.next = 3;
8950
8950
  return this.sendRpc({
8951
- method: 'chat.delete',
8951
+ method: 'chat.unblock',
8952
8952
  params: {
8953
- chat_id: requestParameters.chatId
8953
+ user_id: requestParameters.userId
8954
8954
  }
8955
8955
  });
8956
8956
 
@@ -8965,26 +8965,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
8965
8965
  }, _callee17, this);
8966
8966
  }));
8967
8967
 
8968
- function _delete(_x14) {
8969
- return _delete2.apply(this, arguments);
8968
+ function unblock(_x14) {
8969
+ return _unblock.apply(this, arguments);
8970
8970
  }
8971
8971
 
8972
- return _delete;
8972
+ return unblock;
8973
8973
  }()
8974
8974
  }, {
8975
- key: "permit",
8975
+ key: "delete",
8976
8976
  value: function () {
8977
- var _permit = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(requestParameters) {
8977
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(requestParameters) {
8978
8978
  return regeneratorRuntime.wrap(function _callee18$(_context18) {
8979
8979
  while (1) {
8980
8980
  switch (_context18.prev = _context18.next) {
8981
8981
  case 0:
8982
- this.assertNotNullOrUndefined(requestParameters.permit, 'requestParameters.permit', 'permit');
8982
+ this.assertNotNullOrUndefined(requestParameters.chatId, 'requestParameters.chatId', 'delete');
8983
8983
  _context18.next = 3;
8984
8984
  return this.sendRpc({
8985
- method: 'chat.permit',
8985
+ method: 'chat.delete',
8986
8986
  params: {
8987
- permit: requestParameters.permit
8987
+ chat_id: requestParameters.chatId
8988
8988
  }
8989
8989
  });
8990
8990
 
@@ -8999,7 +8999,41 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
8999
8999
  }, _callee18, this);
9000
9000
  }));
9001
9001
 
9002
- function permit(_x15) {
9002
+ function _delete(_x15) {
9003
+ return _delete2.apply(this, arguments);
9004
+ }
9005
+
9006
+ return _delete;
9007
+ }()
9008
+ }, {
9009
+ key: "permit",
9010
+ value: function () {
9011
+ var _permit = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(requestParameters) {
9012
+ return regeneratorRuntime.wrap(function _callee19$(_context19) {
9013
+ while (1) {
9014
+ switch (_context19.prev = _context19.next) {
9015
+ case 0:
9016
+ this.assertNotNullOrUndefined(requestParameters.permit, 'requestParameters.permit', 'permit');
9017
+ _context19.next = 3;
9018
+ return this.sendRpc({
9019
+ method: 'chat.permit',
9020
+ params: {
9021
+ permit: requestParameters.permit
9022
+ }
9023
+ });
9024
+
9025
+ case 3:
9026
+ return _context19.abrupt("return", _context19.sent);
9027
+
9028
+ case 4:
9029
+ case "end":
9030
+ return _context19.stop();
9031
+ }
9032
+ }
9033
+ }, _callee19, this);
9034
+ }));
9035
+
9036
+ function permit(_x16) {
9003
9037
  return _permit.apply(this, arguments);
9004
9038
  }
9005
9039
 
@@ -9033,67 +9067,67 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9033
9067
  }, {
9034
9068
  key: "createInvites",
9035
9069
  value: function () {
9036
- var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId, invitedUserIds, chatSecret) {
9070
+ var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(userId, invitedUserIds, chatSecret) {
9037
9071
  var _this4 = this;
9038
9072
 
9039
9073
  var userPublicKey;
9040
- return regeneratorRuntime.wrap(function _callee20$(_context20) {
9074
+ return regeneratorRuntime.wrap(function _callee21$(_context21) {
9041
9075
  while (1) {
9042
- switch (_context20.prev = _context20.next) {
9076
+ switch (_context21.prev = _context21.next) {
9043
9077
  case 0:
9044
- _context20.next = 2;
9078
+ _context21.next = 2;
9045
9079
  return this.getPublicKey(userId);
9046
9080
 
9047
9081
  case 2:
9048
- userPublicKey = _context20.sent;
9049
- _context20.next = 5;
9082
+ userPublicKey = _context21.sent;
9083
+ _context21.next = 5;
9050
9084
  return Promise.all([userId].concat(_toConsumableArray(invitedUserIds)).map( /*#__PURE__*/function () {
9051
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId) {
9085
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId) {
9052
9086
  var inviteePublicKey, inviteCode;
9053
- return regeneratorRuntime.wrap(function _callee19$(_context19) {
9087
+ return regeneratorRuntime.wrap(function _callee20$(_context20) {
9054
9088
  while (1) {
9055
- switch (_context19.prev = _context19.next) {
9089
+ switch (_context20.prev = _context20.next) {
9056
9090
  case 0:
9057
- _context19.next = 2;
9091
+ _context20.next = 2;
9058
9092
  return _this4.getPublicKey(userId);
9059
9093
 
9060
9094
  case 2:
9061
- inviteePublicKey = _context19.sent;
9062
- _context19.next = 5;
9095
+ inviteePublicKey = _context20.sent;
9096
+ _context20.next = 5;
9063
9097
  return _this4.createInviteCode(userPublicKey, inviteePublicKey, chatSecret);
9064
9098
 
9065
9099
  case 5:
9066
- inviteCode = _context19.sent;
9067
- return _context19.abrupt("return", {
9100
+ inviteCode = _context20.sent;
9101
+ return _context20.abrupt("return", {
9068
9102
  user_id: userId,
9069
9103
  invite_code: base.base64.encode(inviteCode)
9070
9104
  });
9071
9105
 
9072
9106
  case 7:
9073
9107
  case "end":
9074
- return _context19.stop();
9108
+ return _context20.stop();
9075
9109
  }
9076
9110
  }
9077
- }, _callee19);
9111
+ }, _callee20);
9078
9112
  }));
9079
9113
 
9080
- return function (_x19) {
9114
+ return function (_x20) {
9081
9115
  return _ref3.apply(this, arguments);
9082
9116
  };
9083
9117
  }()));
9084
9118
 
9085
9119
  case 5:
9086
- return _context20.abrupt("return", _context20.sent);
9120
+ return _context21.abrupt("return", _context21.sent);
9087
9121
 
9088
9122
  case 6:
9089
9123
  case "end":
9090
- return _context20.stop();
9124
+ return _context21.stop();
9091
9125
  }
9092
9126
  }
9093
- }, _callee20, this);
9127
+ }, _callee21, this);
9094
9128
  }));
9095
9129
 
9096
- function createInvites(_x16, _x17, _x18) {
9130
+ function createInvites(_x17, _x18, _x19) {
9097
9131
  return _createInvites.apply(this, arguments);
9098
9132
  }
9099
9133
 
@@ -9102,36 +9136,36 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9102
9136
  }, {
9103
9137
  key: "createInviteCode",
9104
9138
  value: function () {
9105
- var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(userPublicKey, inviteePublicKey, chatSecret) {
9139
+ var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(userPublicKey, inviteePublicKey, chatSecret) {
9106
9140
  var sharedSecret, encryptedChatSecret, inviteCode;
9107
- return regeneratorRuntime.wrap(function _callee21$(_context21) {
9141
+ return regeneratorRuntime.wrap(function _callee22$(_context22) {
9108
9142
  while (1) {
9109
- switch (_context21.prev = _context21.next) {
9143
+ switch (_context22.prev = _context22.next) {
9110
9144
  case 0:
9111
- _context21.next = 2;
9145
+ _context22.next = 2;
9112
9146
  return this.walletService.getSharedSecret(inviteePublicKey);
9113
9147
 
9114
9148
  case 2:
9115
- sharedSecret = _context21.sent;
9116
- _context21.next = 5;
9149
+ sharedSecret = _context22.sent;
9150
+ _context22.next = 5;
9117
9151
  return this.encrypt(sharedSecret, chatSecret);
9118
9152
 
9119
9153
  case 5:
9120
- encryptedChatSecret = _context21.sent;
9154
+ encryptedChatSecret = _context22.sent;
9121
9155
  inviteCode = new Uint8Array(65 + encryptedChatSecret.length);
9122
9156
  inviteCode.set(userPublicKey);
9123
9157
  inviteCode.set(encryptedChatSecret, 65);
9124
- return _context21.abrupt("return", inviteCode);
9158
+ return _context22.abrupt("return", inviteCode);
9125
9159
 
9126
9160
  case 10:
9127
9161
  case "end":
9128
- return _context21.stop();
9162
+ return _context22.stop();
9129
9163
  }
9130
9164
  }
9131
- }, _callee21, this);
9165
+ }, _callee22, this);
9132
9166
  }));
9133
9167
 
9134
- function createInviteCode(_x20, _x21, _x22) {
9168
+ function createInviteCode(_x21, _x22, _x23) {
9135
9169
  return _createInviteCode.apply(this, arguments);
9136
9170
  }
9137
9171
 
@@ -9140,34 +9174,34 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9140
9174
  }, {
9141
9175
  key: "readInviteCode",
9142
9176
  value: function () {
9143
- var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(inviteCode) {
9177
+ var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(inviteCode) {
9144
9178
  var friendPublicKey, chatSecretEncrypted, sharedSecret;
9145
- return regeneratorRuntime.wrap(function _callee22$(_context22) {
9179
+ return regeneratorRuntime.wrap(function _callee23$(_context23) {
9146
9180
  while (1) {
9147
- switch (_context22.prev = _context22.next) {
9181
+ switch (_context23.prev = _context23.next) {
9148
9182
  case 0:
9149
9183
  friendPublicKey = inviteCode.slice(0, 65);
9150
9184
  chatSecretEncrypted = inviteCode.slice(65);
9151
- _context22.next = 4;
9185
+ _context23.next = 4;
9152
9186
  return this.walletService.getSharedSecret(friendPublicKey);
9153
9187
 
9154
9188
  case 4:
9155
- sharedSecret = _context22.sent;
9156
- _context22.next = 7;
9189
+ sharedSecret = _context23.sent;
9190
+ _context23.next = 7;
9157
9191
  return this.decrypt(sharedSecret, chatSecretEncrypted);
9158
9192
 
9159
9193
  case 7:
9160
- return _context22.abrupt("return", _context22.sent);
9194
+ return _context23.abrupt("return", _context23.sent);
9161
9195
 
9162
9196
  case 8:
9163
9197
  case "end":
9164
- return _context22.stop();
9198
+ return _context23.stop();
9165
9199
  }
9166
9200
  }
9167
- }, _callee22, this);
9201
+ }, _callee23, this);
9168
9202
  }));
9169
9203
 
9170
- function readInviteCode(_x23) {
9204
+ function readInviteCode(_x24) {
9171
9205
  return _readInviteCode.apply(this, arguments);
9172
9206
  }
9173
9207
 
@@ -9176,26 +9210,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9176
9210
  }, {
9177
9211
  key: "encrypt",
9178
9212
  value: function () {
9179
- var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(secret, payload) {
9180
- return regeneratorRuntime.wrap(function _callee23$(_context23) {
9213
+ var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(secret, payload) {
9214
+ return regeneratorRuntime.wrap(function _callee24$(_context24) {
9181
9215
  while (1) {
9182
- switch (_context23.prev = _context23.next) {
9216
+ switch (_context24.prev = _context24.next) {
9183
9217
  case 0:
9184
- _context23.next = 2;
9218
+ _context24.next = 2;
9185
9219
  return aes__namespace.encrypt(secret.slice(secret.length - 32), payload);
9186
9220
 
9187
9221
  case 2:
9188
- return _context23.abrupt("return", _context23.sent);
9222
+ return _context24.abrupt("return", _context24.sent);
9189
9223
 
9190
9224
  case 3:
9191
9225
  case "end":
9192
- return _context23.stop();
9226
+ return _context24.stop();
9193
9227
  }
9194
9228
  }
9195
- }, _callee23);
9229
+ }, _callee24);
9196
9230
  }));
9197
9231
 
9198
- function encrypt(_x24, _x25) {
9232
+ function encrypt(_x25, _x26) {
9199
9233
  return _encrypt.apply(this, arguments);
9200
9234
  }
9201
9235
 
@@ -9204,26 +9238,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9204
9238
  }, {
9205
9239
  key: "encryptString",
9206
9240
  value: function () {
9207
- var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(secret, payload) {
9208
- return regeneratorRuntime.wrap(function _callee24$(_context24) {
9241
+ var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(secret, payload) {
9242
+ return regeneratorRuntime.wrap(function _callee25$(_context25) {
9209
9243
  while (1) {
9210
- switch (_context24.prev = _context24.next) {
9244
+ switch (_context25.prev = _context25.next) {
9211
9245
  case 0:
9212
- _context24.next = 2;
9246
+ _context25.next = 2;
9213
9247
  return this.encrypt(secret, new TextEncoder().encode(payload));
9214
9248
 
9215
9249
  case 2:
9216
- return _context24.abrupt("return", _context24.sent);
9250
+ return _context25.abrupt("return", _context25.sent);
9217
9251
 
9218
9252
  case 3:
9219
9253
  case "end":
9220
- return _context24.stop();
9254
+ return _context25.stop();
9221
9255
  }
9222
9256
  }
9223
- }, _callee24, this);
9257
+ }, _callee25, this);
9224
9258
  }));
9225
9259
 
9226
- function encryptString(_x26, _x27) {
9260
+ function encryptString(_x27, _x28) {
9227
9261
  return _encryptString.apply(this, arguments);
9228
9262
  }
9229
9263
 
@@ -9232,26 +9266,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9232
9266
  }, {
9233
9267
  key: "decrypt",
9234
9268
  value: function () {
9235
- var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(secret, payload) {
9236
- return regeneratorRuntime.wrap(function _callee25$(_context25) {
9269
+ var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(secret, payload) {
9270
+ return regeneratorRuntime.wrap(function _callee26$(_context26) {
9237
9271
  while (1) {
9238
- switch (_context25.prev = _context25.next) {
9272
+ switch (_context26.prev = _context26.next) {
9239
9273
  case 0:
9240
- _context25.next = 2;
9274
+ _context26.next = 2;
9241
9275
  return aes__namespace.decrypt(secret.slice(secret.length - 32), payload);
9242
9276
 
9243
9277
  case 2:
9244
- return _context25.abrupt("return", _context25.sent);
9278
+ return _context26.abrupt("return", _context26.sent);
9245
9279
 
9246
9280
  case 3:
9247
9281
  case "end":
9248
- return _context25.stop();
9282
+ return _context26.stop();
9249
9283
  }
9250
9284
  }
9251
- }, _callee25);
9285
+ }, _callee26);
9252
9286
  }));
9253
9287
 
9254
- function decrypt(_x28, _x29) {
9288
+ function decrypt(_x29, _x30) {
9255
9289
  return _decrypt.apply(this, arguments);
9256
9290
  }
9257
9291
 
@@ -9260,28 +9294,28 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9260
9294
  }, {
9261
9295
  key: "decryptString",
9262
9296
  value: function () {
9263
- var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(secret, payload) {
9264
- return regeneratorRuntime.wrap(function _callee26$(_context26) {
9297
+ var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(secret, payload) {
9298
+ return regeneratorRuntime.wrap(function _callee27$(_context27) {
9265
9299
  while (1) {
9266
- switch (_context26.prev = _context26.next) {
9300
+ switch (_context27.prev = _context27.next) {
9267
9301
  case 0:
9268
- _context26.t0 = new TextDecoder();
9269
- _context26.next = 3;
9302
+ _context27.t0 = new TextDecoder();
9303
+ _context27.next = 3;
9270
9304
  return this.decrypt(secret, payload);
9271
9305
 
9272
9306
  case 3:
9273
- _context26.t1 = _context26.sent;
9274
- return _context26.abrupt("return", _context26.t0.decode.call(_context26.t0, _context26.t1));
9307
+ _context27.t1 = _context27.sent;
9308
+ return _context27.abrupt("return", _context27.t0.decode.call(_context27.t0, _context27.t1));
9275
9309
 
9276
9310
  case 5:
9277
9311
  case "end":
9278
- return _context26.stop();
9312
+ return _context27.stop();
9279
9313
  }
9280
9314
  }
9281
- }, _callee26, this);
9315
+ }, _callee27, this);
9282
9316
  }));
9283
9317
 
9284
- function decryptString(_x30, _x31) {
9318
+ function decryptString(_x31, _x32) {
9285
9319
  return _decryptString.apply(this, arguments);
9286
9320
  }
9287
9321
 
@@ -9290,53 +9324,53 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9290
9324
  }, {
9291
9325
  key: "decryptLastChatMessage",
9292
9326
  value: function () {
9293
- var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(c) {
9327
+ var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(c) {
9294
9328
  var sharedSecret, lastMessage;
9295
- return regeneratorRuntime.wrap(function _callee27$(_context27) {
9329
+ return regeneratorRuntime.wrap(function _callee28$(_context28) {
9296
9330
  while (1) {
9297
- switch (_context27.prev = _context27.next) {
9331
+ switch (_context28.prev = _context28.next) {
9298
9332
  case 0:
9299
- _context27.next = 2;
9333
+ _context28.next = 2;
9300
9334
  return this.getChatSecret(c.chat_id);
9301
9335
 
9302
9336
  case 2:
9303
- sharedSecret = _context27.sent;
9337
+ sharedSecret = _context28.sent;
9304
9338
  lastMessage = '';
9305
9339
 
9306
9340
  if (!(c.last_message && c.last_message.length > 0)) {
9307
- _context27.next = 15;
9341
+ _context28.next = 15;
9308
9342
  break;
9309
9343
  }
9310
9344
 
9311
- _context27.prev = 5;
9312
- _context27.next = 8;
9345
+ _context28.prev = 5;
9346
+ _context28.next = 8;
9313
9347
  return this.decryptString(sharedSecret, base.base64.decode(c.last_message));
9314
9348
 
9315
9349
  case 8:
9316
- lastMessage = _context27.sent;
9317
- _context27.next = 15;
9350
+ lastMessage = _context28.sent;
9351
+ _context28.next = 15;
9318
9352
  break;
9319
9353
 
9320
9354
  case 11:
9321
- _context27.prev = 11;
9322
- _context27.t0 = _context27["catch"](5);
9323
- console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c, _context27.t0);
9355
+ _context28.prev = 11;
9356
+ _context28.t0 = _context28["catch"](5);
9357
+ console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c, _context28.t0);
9324
9358
  lastMessage = "Error: Couldn't decrypt message";
9325
9359
 
9326
9360
  case 15:
9327
- return _context27.abrupt("return", _objectSpread2(_objectSpread2({}, c), {}, {
9361
+ return _context28.abrupt("return", _objectSpread2(_objectSpread2({}, c), {}, {
9328
9362
  last_message: lastMessage
9329
9363
  }));
9330
9364
 
9331
9365
  case 16:
9332
9366
  case "end":
9333
- return _context27.stop();
9367
+ return _context28.stop();
9334
9368
  }
9335
9369
  }
9336
- }, _callee27, this, [[5, 11]]);
9370
+ }, _callee28, this, [[5, 11]]);
9337
9371
  }));
9338
9372
 
9339
- function decryptLastChatMessage(_x32) {
9373
+ function decryptLastChatMessage(_x33) {
9340
9374
  return _decryptLastChatMessage.apply(this, arguments);
9341
9375
  }
9342
9376
 
@@ -9345,17 +9379,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9345
9379
  }, {
9346
9380
  key: "getRaw",
9347
9381
  value: function () {
9348
- var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(chatId) {
9382
+ var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(chatId) {
9349
9383
  var path, queryParameters, response;
9350
- return regeneratorRuntime.wrap(function _callee28$(_context28) {
9384
+ return regeneratorRuntime.wrap(function _callee29$(_context29) {
9351
9385
  while (1) {
9352
- switch (_context28.prev = _context28.next) {
9386
+ switch (_context29.prev = _context29.next) {
9353
9387
  case 0:
9354
9388
  path = "/comms/chats/".concat(chatId);
9355
9389
  queryParameters = {
9356
9390
  timestamp: new Date().getTime()
9357
9391
  };
9358
- _context28.next = 4;
9392
+ _context29.next = 4;
9359
9393
  return this.signAndSendRequest({
9360
9394
  method: 'GET',
9361
9395
  headers: {},
@@ -9364,22 +9398,22 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9364
9398
  });
9365
9399
 
9366
9400
  case 4:
9367
- response = _context28.sent;
9368
- _context28.next = 7;
9401
+ response = _context29.sent;
9402
+ _context29.next = 7;
9369
9403
  return response.json();
9370
9404
 
9371
9405
  case 7:
9372
- return _context28.abrupt("return", _context28.sent);
9406
+ return _context29.abrupt("return", _context29.sent);
9373
9407
 
9374
9408
  case 8:
9375
9409
  case "end":
9376
- return _context28.stop();
9410
+ return _context29.stop();
9377
9411
  }
9378
9412
  }
9379
- }, _callee28, this);
9413
+ }, _callee29, this);
9380
9414
  }));
9381
9415
 
9382
- function getRaw(_x33) {
9416
+ function getRaw(_x34) {
9383
9417
  return _getRaw.apply(this, arguments);
9384
9418
  }
9385
9419
 
@@ -9388,44 +9422,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9388
9422
  }, {
9389
9423
  key: "getChatSecret",
9390
9424
  value: function () {
9391
- var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(chatId) {
9425
+ var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(chatId) {
9392
9426
  var existingChatSecret, response, chatSecret;
9393
- return regeneratorRuntime.wrap(function _callee29$(_context29) {
9427
+ return regeneratorRuntime.wrap(function _callee30$(_context30) {
9394
9428
  while (1) {
9395
- switch (_context29.prev = _context29.next) {
9429
+ switch (_context30.prev = _context30.next) {
9396
9430
  case 0:
9397
9431
  existingChatSecret = this.chatSecrets[chatId];
9398
9432
 
9399
9433
  if (existingChatSecret) {
9400
- _context29.next = 10;
9434
+ _context30.next = 10;
9401
9435
  break;
9402
9436
  }
9403
9437
 
9404
- _context29.next = 4;
9438
+ _context30.next = 4;
9405
9439
  return this.getRaw(chatId);
9406
9440
 
9407
9441
  case 4:
9408
- response = _context29.sent;
9409
- _context29.next = 7;
9442
+ response = _context30.sent;
9443
+ _context30.next = 7;
9410
9444
  return this.readInviteCode(base.base64.decode(response.data.invite_code));
9411
9445
 
9412
9446
  case 7:
9413
- chatSecret = _context29.sent;
9447
+ chatSecret = _context30.sent;
9414
9448
  this.chatSecrets[chatId] = chatSecret;
9415
- return _context29.abrupt("return", chatSecret);
9449
+ return _context30.abrupt("return", chatSecret);
9416
9450
 
9417
9451
  case 10:
9418
- return _context29.abrupt("return", existingChatSecret);
9452
+ return _context30.abrupt("return", existingChatSecret);
9419
9453
 
9420
9454
  case 11:
9421
9455
  case "end":
9422
- return _context29.stop();
9456
+ return _context30.stop();
9423
9457
  }
9424
9458
  }
9425
- }, _callee29, this);
9459
+ }, _callee30, this);
9426
9460
  }));
9427
9461
 
9428
- function getChatSecret(_x34) {
9462
+ function getChatSecret(_x35) {
9429
9463
  return _getChatSecret.apply(this, arguments);
9430
9464
  }
9431
9465
 
@@ -9434,13 +9468,13 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9434
9468
  }, {
9435
9469
  key: "getPublicKey",
9436
9470
  value: function () {
9437
- var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(userId) {
9471
+ var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(userId) {
9438
9472
  var response, json;
9439
- return regeneratorRuntime.wrap(function _callee30$(_context30) {
9473
+ return regeneratorRuntime.wrap(function _callee31$(_context31) {
9440
9474
  while (1) {
9441
- switch (_context30.prev = _context30.next) {
9475
+ switch (_context31.prev = _context31.next) {
9442
9476
  case 0:
9443
- _context30.next = 2;
9477
+ _context31.next = 2;
9444
9478
  return this.request({
9445
9479
  path: "/comms/pubkey/".concat(userId),
9446
9480
  method: 'GET',
@@ -9448,23 +9482,23 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9448
9482
  });
9449
9483
 
9450
9484
  case 2:
9451
- response = _context30.sent;
9452
- _context30.next = 5;
9485
+ response = _context31.sent;
9486
+ _context31.next = 5;
9453
9487
  return response.json();
9454
9488
 
9455
9489
  case 5:
9456
- json = _context30.sent;
9457
- return _context30.abrupt("return", base.base64.decode(json.data));
9490
+ json = _context31.sent;
9491
+ return _context31.abrupt("return", base.base64.decode(json.data));
9458
9492
 
9459
9493
  case 7:
9460
9494
  case "end":
9461
- return _context30.stop();
9495
+ return _context31.stop();
9462
9496
  }
9463
9497
  }
9464
- }, _callee30, this);
9498
+ }, _callee31, this);
9465
9499
  }));
9466
9500
 
9467
- function getPublicKey(_x35) {
9501
+ function getPublicKey(_x36) {
9468
9502
  return _getPublicKey.apply(this, arguments);
9469
9503
  }
9470
9504
 
@@ -9473,37 +9507,37 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9473
9507
  }, {
9474
9508
  key: "getSignatureHeader",
9475
9509
  value: function () {
9476
- var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(payload) {
9510
+ var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(payload) {
9477
9511
  var _yield$this$walletSer, _yield$this$walletSer2, allSignatureBytes, recoveryByte, signatureBytes;
9478
9512
 
9479
- return regeneratorRuntime.wrap(function _callee31$(_context31) {
9513
+ return regeneratorRuntime.wrap(function _callee32$(_context32) {
9480
9514
  while (1) {
9481
- switch (_context31.prev = _context31.next) {
9515
+ switch (_context32.prev = _context32.next) {
9482
9516
  case 0:
9483
- _context31.next = 2;
9517
+ _context32.next = 2;
9484
9518
  return this.walletService.sign(payload);
9485
9519
 
9486
9520
  case 2:
9487
- _yield$this$walletSer = _context31.sent;
9521
+ _yield$this$walletSer = _context32.sent;
9488
9522
  _yield$this$walletSer2 = _slicedToArray(_yield$this$walletSer, 2);
9489
9523
  allSignatureBytes = _yield$this$walletSer2[0];
9490
9524
  recoveryByte = _yield$this$walletSer2[1];
9491
9525
  signatureBytes = new Uint8Array(65);
9492
9526
  signatureBytes.set(allSignatureBytes, 0);
9493
9527
  signatureBytes[64] = recoveryByte;
9494
- return _context31.abrupt("return", {
9528
+ return _context32.abrupt("return", {
9495
9529
  'x-sig': base.base64.encode(signatureBytes)
9496
9530
  });
9497
9531
 
9498
9532
  case 10:
9499
9533
  case "end":
9500
- return _context31.stop();
9534
+ return _context32.stop();
9501
9535
  }
9502
9536
  }
9503
- }, _callee31, this);
9537
+ }, _callee32, this);
9504
9538
  }));
9505
9539
 
9506
- function getSignatureHeader(_x36) {
9540
+ function getSignatureHeader(_x37) {
9507
9541
  return _getSignatureHeader.apply(this, arguments);
9508
9542
  }
9509
9543
 
@@ -9512,44 +9546,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9512
9546
  }, {
9513
9547
  key: "signAndSendRequest",
9514
9548
  value: function () {
9515
- var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(request) {
9549
+ var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(request) {
9516
9550
  var payload;
9517
- return regeneratorRuntime.wrap(function _callee32$(_context32) {
9551
+ return regeneratorRuntime.wrap(function _callee33$(_context33) {
9518
9552
  while (1) {
9519
- switch (_context32.prev = _context32.next) {
9553
+ switch (_context33.prev = _context33.next) {
9520
9554
  case 0:
9521
9555
  payload = request.method === 'GET' ? request.query ? "".concat(request.path, "?").concat(this.configuration.queryParamsStringify(request.query)) : request.path : request.body;
9522
- _context32.t0 = this;
9523
- _context32.t1 = _objectSpread2;
9524
- _context32.t2 = _objectSpread2({}, request);
9525
- _context32.t3 = {};
9526
- _context32.t4 = _objectSpread2;
9527
- _context32.t5 = _objectSpread2({}, request.headers);
9528
- _context32.next = 9;
9556
+ _context33.t0 = this;
9557
+ _context33.t1 = _objectSpread2;
9558
+ _context33.t2 = _objectSpread2({}, request);
9559
+ _context33.t3 = {};
9560
+ _context33.t4 = _objectSpread2;
9561
+ _context33.t5 = _objectSpread2({}, request.headers);
9562
+ _context33.next = 9;
9529
9563
  return this.getSignatureHeader(payload);
9530
9564
 
9531
9565
  case 9:
9532
- _context32.t6 = _context32.sent;
9533
- _context32.t7 = (0, _context32.t4)(_context32.t5, _context32.t6);
9534
- _context32.t8 = {
9535
- headers: _context32.t7
9566
+ _context33.t6 = _context33.sent;
9567
+ _context33.t7 = (0, _context33.t4)(_context33.t5, _context33.t6);
9568
+ _context33.t8 = {
9569
+ headers: _context33.t7
9536
9570
  };
9537
- _context32.t9 = (0, _context32.t1)(_context32.t2, _context32.t3, _context32.t8);
9538
- _context32.next = 15;
9539
- return _context32.t0.request.call(_context32.t0, _context32.t9);
9571
+ _context33.t9 = (0, _context33.t1)(_context33.t2, _context33.t3, _context33.t8);
9572
+ _context33.next = 15;
9573
+ return _context33.t0.request.call(_context33.t0, _context33.t9);
9540
9574
 
9541
9575
  case 15:
9542
- return _context32.abrupt("return", _context32.sent);
9576
+ return _context33.abrupt("return", _context33.sent);
9543
9577
 
9544
9578
  case 16:
9545
9579
  case "end":
9546
- return _context32.stop();
9580
+ return _context33.stop();
9547
9581
  }
9548
9582
  }
9549
- }, _callee32, this);
9583
+ }, _callee33, this);
9550
9584
  }));
9551
9585
 
9552
- function signAndSendRequest(_x37) {
9586
+ function signAndSendRequest(_x38) {
9553
9587
  return _signAndSendRequest.apply(this, arguments);
9554
9588
  }
9555
9589
 
@@ -9558,16 +9592,16 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9558
9592
  }, {
9559
9593
  key: "sendRpc",
9560
9594
  value: function () {
9561
- var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(args) {
9595
+ var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(args) {
9562
9596
  var payload;
9563
- return regeneratorRuntime.wrap(function _callee33$(_context33) {
9597
+ return regeneratorRuntime.wrap(function _callee34$(_context34) {
9564
9598
  while (1) {
9565
- switch (_context33.prev = _context33.next) {
9599
+ switch (_context34.prev = _context34.next) {
9566
9600
  case 0:
9567
9601
  payload = JSON.stringify(_objectSpread2(_objectSpread2({}, args), {}, {
9568
9602
  timestamp: new Date().getTime()
9569
9603
  }));
9570
- _context33.next = 3;
9604
+ _context34.next = 3;
9571
9605
  return this.signAndSendRequest({
9572
9606
  method: 'POST',
9573
9607
  headers: {
@@ -9578,17 +9612,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9578
9612
  });
9579
9613
 
9580
9614
  case 3:
9581
- return _context33.abrupt("return", args);
9615
+ return _context34.abrupt("return", args);
9582
9616
 
9583
9617
  case 4:
9584
9618
  case "end":
9585
- return _context33.stop();
9619
+ return _context34.stop();
9586
9620
  }
9587
9621
  }
9588
- }, _callee33, this);
9622
+ }, _callee34, this);
9589
9623
  }));
9590
9624
 
9591
- function sendRpc(_x38) {
9625
+ function sendRpc(_x39) {
9592
9626
  return _sendRpc.apply(this, arguments);
9593
9627
  }
9594
9628
 
@@ -9597,73 +9631,73 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9597
9631
  }, {
9598
9632
  key: "createWebsocket",
9599
9633
  value: function () {
9600
- var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35(endpoint) {
9634
+ var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(endpoint) {
9601
9635
  var _this5 = this;
9602
9636
 
9603
9637
  var timestamp, originalUrl, signatureHeader, host, url, ws;
9604
- return regeneratorRuntime.wrap(function _callee35$(_context35) {
9638
+ return regeneratorRuntime.wrap(function _callee36$(_context36) {
9605
9639
  while (1) {
9606
- switch (_context35.prev = _context35.next) {
9640
+ switch (_context36.prev = _context36.next) {
9607
9641
  case 0:
9608
9642
  timestamp = new Date().getTime();
9609
9643
  originalUrl = "/comms/chats/ws?timestamp=".concat(timestamp);
9610
- _context35.next = 4;
9644
+ _context36.next = 4;
9611
9645
  return this.getSignatureHeader(originalUrl);
9612
9646
 
9613
9647
  case 4:
9614
- signatureHeader = _context35.sent;
9648
+ signatureHeader = _context36.sent;
9615
9649
  host = endpoint.replace(/http(s?)/g, 'ws$1');
9616
9650
  url = "".concat(host).concat(originalUrl, "&signature=").concat(encodeURIComponent(signatureHeader['x-sig']));
9617
9651
  ws = new WebSocket__default["default"](url);
9618
9652
  ws.addEventListener('message', function (messageEvent) {
9619
9653
  var handleAsync = /*#__PURE__*/function () {
9620
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34() {
9654
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35() {
9621
9655
  var data, sharedSecret;
9622
- return regeneratorRuntime.wrap(function _callee34$(_context34) {
9656
+ return regeneratorRuntime.wrap(function _callee35$(_context35) {
9623
9657
  while (1) {
9624
- switch (_context34.prev = _context34.next) {
9658
+ switch (_context35.prev = _context35.next) {
9625
9659
  case 0:
9626
9660
  data = JSON.parse(messageEvent.data);
9627
9661
 
9628
9662
  if (!(data.rpc.method === 'chat.message')) {
9629
- _context34.next = 19;
9663
+ _context35.next = 19;
9630
9664
  break;
9631
9665
  }
9632
9666
 
9633
- _context34.next = 4;
9667
+ _context35.next = 4;
9634
9668
  return _this5.getChatSecret(data.rpc.params.chat_id);
9635
9669
 
9636
9670
  case 4:
9637
- sharedSecret = _context34.sent;
9638
- _context34.t0 = _this5.eventEmitter;
9639
- _context34.t1 = data.rpc.params.chat_id;
9640
- _context34.t2 = data.rpc.params.message_id;
9641
- _context34.next = 10;
9671
+ sharedSecret = _context35.sent;
9672
+ _context35.t0 = _this5.eventEmitter;
9673
+ _context35.t1 = data.rpc.params.chat_id;
9674
+ _context35.t2 = data.rpc.params.message_id;
9675
+ _context35.next = 10;
9642
9676
  return _this5.decryptString(sharedSecret, base.base64.decode(data.rpc.params.message))["catch"](function (e) {
9643
9677
  console.error("[audius-sdk]: Error: Couldn't decrypt websocket chat message", data, e);
9644
9678
  return "Error: Couldn't decrypt message";
9645
9679
  });
9646
9680
 
9647
9681
  case 10:
9648
- _context34.t3 = _context34.sent;
9649
- _context34.t4 = data.metadata.userId;
9650
- _context34.t5 = data.metadata.timestamp;
9651
- _context34.t6 = [];
9652
- _context34.t7 = {
9653
- message_id: _context34.t2,
9654
- message: _context34.t3,
9655
- sender_user_id: _context34.t4,
9656
- created_at: _context34.t5,
9657
- reactions: _context34.t6
9682
+ _context35.t3 = _context35.sent;
9683
+ _context35.t4 = data.metadata.userId;
9684
+ _context35.t5 = data.metadata.timestamp;
9685
+ _context35.t6 = [];
9686
+ _context35.t7 = {
9687
+ message_id: _context35.t2,
9688
+ message: _context35.t3,
9689
+ sender_user_id: _context35.t4,
9690
+ created_at: _context35.t5,
9691
+ reactions: _context35.t6
9658
9692
  };
9659
- _context34.t8 = {
9660
- chatId: _context34.t1,
9661
- message: _context34.t7
9693
+ _context35.t8 = {
9694
+ chatId: _context35.t1,
9695
+ message: _context35.t7
9662
9696
  };
9663
9697
 
9664
- _context34.t0.emit.call(_context34.t0, 'message', _context34.t8);
9698
+ _context35.t0.emit.call(_context35.t0, 'message', _context35.t8);
9665
9699
 
9666
- _context34.next = 20;
9700
+ _context35.next = 20;
9667
9701
  break;
9668
9702
 
9669
9703
  case 19:
@@ -9681,10 +9715,10 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9681
9715
 
9682
9716
  case 20:
9683
9717
  case "end":
9684
- return _context34.stop();
9718
+ return _context35.stop();
9685
9719
  }
9686
9720
  }
9687
- }, _callee34);
9721
+ }, _callee35);
9688
9722
  }));
9689
9723
 
9690
9724
  return function handleAsync() {
@@ -9703,17 +9737,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
9703
9737
  ws.addEventListener('error', function (e) {
9704
9738
  _this5.eventEmitter.emit('error', e);
9705
9739
  });
9706
- return _context35.abrupt("return", ws);
9740
+ return _context36.abrupt("return", ws);
9707
9741
 
9708
9742
  case 13:
9709
9743
  case "end":
9710
- return _context35.stop();
9744
+ return _context36.stop();
9711
9745
  }
9712
9746
  }
9713
- }, _callee35, this);
9747
+ }, _callee36, this);
9714
9748
  }));
9715
9749
 
9716
- function createWebsocket(_x39) {
9750
+ function createWebsocket(_x40) {
9717
9751
  return _createWebsocket.apply(this, arguments);
9718
9752
  }
9719
9753
 
@@ -26872,9 +26906,9 @@ var EthWeb3Manager = /*#__PURE__*/function () {
26872
26906
  }();
26873
26907
 
26874
26908
  var name = "@audius/sdk";
26875
- var version = "2.0.3-beta.3";
26909
+ var version = "2.0.3-beta.4";
26876
26910
  var audius = {
26877
- releaseSHA: "ac2f3f33f7f99e4d22588ffaf77a1e01bc4dbc15"
26911
+ releaseSHA: "42c56a1bf4cc52d52da7df738ace6822a91b0fce"
26878
26912
  };
26879
26913
  var description = "";
26880
26914
  var main = "dist/index.cjs.js";