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