@getpara/user-management-client 1.5.0 → 1.6.0

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/cjs/index.js CHANGED
@@ -1,9 +1,38 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __getProtoOf = Object.getPrototypeOf;
6
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
7
36
  var __export = (target, all) => {
8
37
  for (var name in all)
9
38
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -25,6 +54,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
54
  mod
26
55
  ));
27
56
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
+ var __async = (__this, __arguments, generator) => {
58
+ return new Promise((resolve, reject) => {
59
+ var fulfilled = (value) => {
60
+ try {
61
+ step(generator.next(value));
62
+ } catch (e) {
63
+ reject(e);
64
+ }
65
+ };
66
+ var rejected = (value) => {
67
+ try {
68
+ step(generator.throw(value));
69
+ } catch (e) {
70
+ reject(e);
71
+ }
72
+ };
73
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
74
+ step((generator = generator.apply(__this, __arguments)).next());
75
+ });
76
+ };
28
77
 
29
78
  // src/index.ts
30
79
  var src_exports = {};
@@ -165,15 +214,16 @@ var handleResponseSuccess = (response) => {
165
214
  throw new ParaApiError("Invalid status code");
166
215
  };
167
216
  var handleResponseError = (error) => {
217
+ var _a, _b, _c;
168
218
  if (error === null) throw new ParaApiError("Error is null");
169
219
  if (import_axios.default.isAxiosError(error)) {
170
- let message = error.response?.data ?? "Unknown error";
220
+ let message = (_b = (_a = error.response) == null ? void 0 : _a.data) != null ? _b : "Unknown error";
171
221
  if (error.code === "ERR_NETWORK") {
172
222
  message = "Connection error";
173
223
  } else if (error.code === "ERR_CANCELED") {
174
224
  message = "Connection canceled";
175
225
  }
176
- throw new ParaApiError(message, error.code, error.response.status, error.request?.responseURL);
226
+ throw new ParaApiError(message, error.code, error.response.status, (_c = error.request) == null ? void 0 : _c.responseURL);
177
227
  }
178
228
  throw new ParaApiError("Unknown error");
179
229
  };
@@ -187,233 +237,230 @@ var Client = class {
187
237
  retrieveSessionCookie,
188
238
  persistSessionCookie
189
239
  }) {
190
- this.createUser = async (body) => {
191
- const res = await this.baseRequest.post(`/users`, body);
240
+ this.createUser = (body) => __async(this, null, function* () {
241
+ const res = yield this.baseRequest.post(`/users`, body);
192
242
  return res.data;
193
- };
194
- this.checkUserExists = async (auth) => {
195
- const res = await this.baseRequest.get("/users/exists", {
196
- params: { ...auth }
243
+ });
244
+ this.checkUserExists = (auth) => __async(this, null, function* () {
245
+ const res = yield this.baseRequest.get("/users/exists", {
246
+ params: __spreadValues({}, auth)
197
247
  });
198
248
  return res;
199
- };
200
- this.verifyTelegram = async (authObject) => {
201
- return (await this.baseRequest.post("/users/telegram", {
249
+ });
250
+ this.verifyTelegram = (authObject) => __async(this, null, function* () {
251
+ return (yield this.baseRequest.post("/users/telegram", {
202
252
  authObject
203
253
  })).data;
204
- };
205
- this.externalWalletLogin = async (body) => {
206
- const res = await this.baseRequest.post(`/users/external-wallets/login`, body);
254
+ });
255
+ this.externalWalletLogin = (body) => __async(this, null, function* () {
256
+ const res = yield this.baseRequest.post(`/users/external-wallets/login`, body);
207
257
  return res.data;
208
- };
258
+ });
209
259
  // POST /users/:userId/verify-email
210
- this.verifyEmail = async (userId, body) => {
211
- const res = await this.baseRequest.post(`/users/${userId}/verify-email`, body);
260
+ this.verifyEmail = (userId, body) => __async(this, null, function* () {
261
+ const res = yield this.baseRequest.post(`/users/${userId}/verify-email`, body);
212
262
  return res;
213
- };
214
- this.verifyPhone = async (userId, body) => {
215
- const res = await this.baseRequest.post(`/users/${userId}/verify-identifier`, body);
263
+ });
264
+ this.verifyPhone = (userId, body) => __async(this, null, function* () {
265
+ const res = yield this.baseRequest.post(`/users/${userId}/verify-identifier`, body);
216
266
  return res;
217
- };
218
- this.verifyExternalWallet = async (userId, body) => {
219
- const res = await this.baseRequest.post(`/users/${userId}/external-wallets/verify`, body);
267
+ });
268
+ this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
269
+ const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify`, body);
220
270
  return res;
221
- };
271
+ });
222
272
  // POST /users/:userId/biometrics/key
223
- this.addSessionPublicKey = async (userId, body) => {
224
- const res = await this.baseRequest.post(`/users/${userId}/biometrics/key`, body);
273
+ this.addSessionPublicKey = (userId, body) => __async(this, null, function* () {
274
+ const res = yield this.baseRequest.post(`/users/${userId}/biometrics/key`, body);
225
275
  return res;
226
- };
276
+ });
227
277
  // GET /users/:userId/biometrics/keys
228
- this.getSessionPublicKeys = async (userId) => {
229
- const res = await this.baseRequest.get(`/users/${userId}/biometrics/keys`);
278
+ this.getSessionPublicKeys = (userId) => __async(this, null, function* () {
279
+ const res = yield this.baseRequest.get(`/users/${userId}/biometrics/keys`);
230
280
  return res;
231
- };
281
+ });
232
282
  // GET /biometrics/location-hints
233
- this.getBiometricLocationHints = async (params) => {
234
- const res = await this.baseRequest.get(`/biometrics/location-hints`, { params });
283
+ this.getBiometricLocationHints = (params) => __async(this, null, function* () {
284
+ const res = yield this.baseRequest.get(`/biometrics/location-hints`, { params });
235
285
  return res.data.hints;
236
- };
286
+ });
237
287
  // GET /users/:userId/biometrics/:biometricId
238
- this.getSessionPublicKey = async (userId, biometricId) => {
239
- const res = await this.baseRequest.get(`/users/${userId}/biometrics/${biometricId}`);
288
+ this.getSessionPublicKey = (userId, biometricId) => __async(this, null, function* () {
289
+ const res = yield this.baseRequest.get(`/users/${userId}/biometrics/${biometricId}`);
240
290
  return res;
241
- };
291
+ });
242
292
  // PATCH /users/:userId/biometrics/:biometricId
243
- this.patchSessionPublicKey = async (partnerId, userId, biometricId, body) => {
244
- const res = await this.baseRequest.patch(`/users/${userId}/biometrics/${biometricId}`, body, {
293
+ this.patchSessionPublicKey = (partnerId, userId, biometricId, body) => __async(this, null, function* () {
294
+ const res = yield this.baseRequest.patch(`/users/${userId}/biometrics/${biometricId}`, body, {
245
295
  headers: {
246
296
  [PARTNER_ID_HEADER_NAME]: partnerId
247
297
  }
248
298
  });
249
299
  return res;
250
- };
300
+ });
251
301
  // GET /biometrics/challenge?email&publicKey
252
- this.getWebChallenge = async (auth) => {
253
- const res = await this.baseRequest.get("/biometrics/challenge", {
254
- params: { ...auth || {} }
302
+ this.getWebChallenge = (auth) => __async(this, null, function* () {
303
+ const res = yield this.baseRequest.get("/biometrics/challenge", {
304
+ params: __spreadValues({}, auth || {})
255
305
  });
256
306
  return res.data;
257
- };
307
+ });
258
308
  // POST /touch
259
- this.touchSession = async (regenerate) => {
260
- const res = await this.baseRequest.post(
309
+ this.touchSession = (regenerate) => __async(this, null, function* () {
310
+ const res = yield this.baseRequest.post(
261
311
  `/touch?regenerate=${!!regenerate}`
262
312
  );
263
313
  return res;
264
- };
314
+ });
265
315
  // GET /session/origin
266
- this.sessionOrigin = async (sessionLookupId) => {
267
- const res = await this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
316
+ this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
317
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
268
318
  return res.data;
269
- };
319
+ });
270
320
  // POST /biometrics/verify
271
- this.verifyWebChallenge = async (partnerId, body) => {
272
- const res = await this.baseRequest.post(`/biometrics/verify`, body, {
321
+ this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
322
+ const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
273
323
  headers: {
274
324
  [PARTNER_ID_HEADER_NAME]: partnerId
275
325
  }
276
326
  });
277
327
  return res;
278
- };
328
+ });
279
329
  // GET /users/:userId/biometrics/challenge
280
- this.getSessionChallenge = async (userId) => {
281
- const res = await this.baseRequest.get(`/users/${userId}/biometrics/challenge`);
330
+ this.getSessionChallenge = (userId) => __async(this, null, function* () {
331
+ const res = yield this.baseRequest.get(`/users/${userId}/biometrics/challenge`);
282
332
  return res;
283
- };
333
+ });
284
334
  // POST /users/:userId/biometrics/verify
285
- this.verifySessionChallenge = async (userId, body) => {
286
- const res = await this.baseRequest.post(`/users/${userId}/biometrics/verify`, body);
335
+ this.verifySessionChallenge = (userId, body) => __async(this, null, function* () {
336
+ const res = yield this.baseRequest.post(`/users/${userId}/biometrics/verify`, body);
287
337
  return res;
288
- };
338
+ });
289
339
  // POST /users/:userId/wallets
290
- this.createWallet = async (userId, body) => {
291
- const res = await this.baseRequest.post(`/users/${userId}/wallets`, body);
340
+ this.createWallet = (userId, body) => __async(this, null, function* () {
341
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets`, body);
292
342
  return res.data;
293
- };
343
+ });
294
344
  // POST /wallets/pregen
295
- this.createPregenWallet = async (body) => {
296
- const res = await this.baseRequest.post(`/wallets/pregen`, body);
345
+ this.createPregenWallet = (body) => __async(this, null, function* () {
346
+ const res = yield this.baseRequest.post(`/wallets/pregen`, body);
297
347
  return res.data;
298
- };
348
+ });
299
349
  // GET /wallets/pregen?pregenIdentifier={pregenIdentifier}&pregenIdentifierType={pregenIdentifierType}
300
- this.getPregenWallets = async (pregenIds, isPortal = false, userId) => {
301
- const res = await this.baseRequest.get("/wallets/pregen", {
350
+ this.getPregenWallets = (pregenIds, isPortal = false, userId) => __async(this, null, function* () {
351
+ const res = yield this.baseRequest.get("/wallets/pregen", {
302
352
  params: { ids: pregenIds, expand: isPortal, userId }
303
353
  });
304
354
  return res.data;
305
- };
355
+ });
306
356
  // POST /wallets/pregen/claim
307
- this.claimPregenWallets = async (body) => {
308
- const res = await this.baseRequest.post(`/wallets/pregen/claim`, body);
357
+ this.claimPregenWallets = (body) => __async(this, null, function* () {
358
+ const res = yield this.baseRequest.post(`/wallets/pregen/claim`, body);
309
359
  return res.data;
310
- };
360
+ });
311
361
  // POST /users/:userId/wallets/:walletId/transactions/send
312
- this.sendTransaction = async (userId, walletId, body) => {
313
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/send`, body);
362
+ this.sendTransaction = (userId, walletId, body) => __async(this, null, function* () {
363
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/send`, body);
314
364
  return res;
315
- };
365
+ });
316
366
  // functionality changed to only sign transactions and not send them
317
367
  // POST /users/:userId/wallets/:walletId/transactions/sign
318
- this.signTransaction = async (userId, walletId, body) => {
319
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/sign`, body);
368
+ this.signTransaction = (userId, walletId, body) => __async(this, null, function* () {
369
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/sign`, body);
320
370
  return res;
321
- };
371
+ });
322
372
  // POST /users/:userId/wallets/:walletId/refresh
323
- this.refreshKeys = async (userId, walletId, oldPartnerId, newPartnerId, keyShareProtocolId) => {
373
+ this.refreshKeys = (userId, walletId, oldPartnerId, newPartnerId, keyShareProtocolId) => __async(this, null, function* () {
324
374
  const body = { oldPartnerId, newPartnerId, keyShareProtocolId };
325
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/refresh`, body);
375
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/refresh`, body);
326
376
  return res;
327
- };
377
+ });
328
378
  // PATCH /wallets/pregen/:walletId
329
- this.updatePregenWallet = async (walletId, body) => {
330
- const res = await this.baseRequest.patch(`/wallets/pregen/${walletId}`, body);
379
+ this.updatePregenWallet = (walletId, body) => __async(this, null, function* () {
380
+ const res = yield this.baseRequest.patch(`/wallets/pregen/${walletId}`, body);
331
381
  return res.data;
332
- };
382
+ });
333
383
  // GET /users/:userId/wallets
334
- this.getWallets = async (userId, includePartnerData) => {
335
- const res = await this.baseRequest.get(
384
+ this.getWallets = (userId, includePartnerData) => __async(this, null, function* () {
385
+ const res = yield this.baseRequest.get(
336
386
  `/users/${userId}/wallets${includePartnerData ? `?includePartnerData=${encodeURIComponent(includePartnerData)}` : ""}`
337
387
  );
338
388
  return res;
339
- };
389
+ });
340
390
  // GET /users/:userId/all-wallets
341
- this.getAllWallets = async (userId) => {
342
- const res = await this.baseRequest.get(`/users/${userId}/all-wallets`);
391
+ this.getAllWallets = (userId) => __async(this, null, function* () {
392
+ const res = yield this.baseRequest.get(`/users/${userId}/all-wallets`);
343
393
  return res;
344
- };
394
+ });
345
395
  // POST /users/:userId/wallets/set
346
- this.setCurrentWalletIds = async (userId, walletIds, needsWallet = false, sessionLookupId, newDeviceSessionLookupId) => {
347
- const res = await this.baseRequest.post(`/users/${userId}/wallets/set`, {
396
+ this.setCurrentWalletIds = (userId, walletIds, needsWallet = false, sessionLookupId, newDeviceSessionLookupId) => __async(this, null, function* () {
397
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/set`, {
348
398
  walletIds,
349
399
  needsWallet,
350
400
  sessionLookupId,
351
401
  newDeviceSessionLookupId
352
402
  });
353
403
  return res;
354
- };
404
+ });
355
405
  // POST /login
356
- this.login = async (props) => {
406
+ this.login = (props) => __async(this, null, function* () {
357
407
  const body = props;
358
- const res = await this.baseRequest.post("/login", body);
408
+ const res = yield this.baseRequest.post("/login", body);
359
409
  return res;
360
- };
410
+ });
361
411
  // POST /login
362
- this.verifyLogin = async (verificationCode) => {
412
+ this.verifyLogin = (verificationCode) => __async(this, null, function* () {
363
413
  const body = { verificationCode };
364
- const res = await this.baseRequest.post("/login/verify-email", body);
414
+ const res = yield this.baseRequest.post("/login/verify-email", body);
365
415
  return res;
366
- };
416
+ });
367
417
  // GET /logout
368
- this.logout = async () => {
369
- const res = await this.baseRequest.get("/logout");
418
+ this.logout = () => __async(this, null, function* () {
419
+ const res = yield this.baseRequest.get("/logout");
370
420
  return res;
371
- };
421
+ });
372
422
  // POST /recovery/verification
373
- this.recoveryVerification = async (email, verificationCode) => {
423
+ this.recoveryVerification = (email, verificationCode) => __async(this, null, function* () {
374
424
  const body = { email, verificationCode };
375
- const res = await this.baseRequest.post("/recovery/verification", body);
425
+ const res = yield this.baseRequest.post("/recovery/verification", body);
376
426
  return res;
377
- };
427
+ });
378
428
  // POST /recovery
379
- this.recoveryInit = async (email) => {
429
+ this.recoveryInit = (email) => __async(this, null, function* () {
380
430
  const body = { email };
381
- const res = await this.baseRequest.post("/recovery", body);
431
+ const res = yield this.baseRequest.post("/recovery", body);
382
432
  return res;
383
- };
384
- this.preSignMessage = async (userId, walletId, message, scheme, cosmosSignDoc) => {
433
+ });
434
+ this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
385
435
  const body = { message, scheme, cosmosSignDoc };
386
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
436
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
387
437
  return res.data;
388
- };
438
+ });
389
439
  //DELETE /users/:userId
390
- this.deleteSelf = async (userId) => {
391
- const res = await this.baseRequest.delete(`/users/${userId}`);
440
+ this.deleteSelf = (userId) => __async(this, null, function* () {
441
+ const res = yield this.baseRequest.delete(`/users/${userId}`);
392
442
  return res;
393
- };
443
+ });
394
444
  // GET /users/:userId/wallets/:walletId/capsule-share
395
- this.getParaShare = async (userId, walletId) => {
396
- const res = await this.baseRequest.get(`/users/${userId}/wallets/${walletId}/capsule-share`);
445
+ this.getParaShare = (userId, walletId) => __async(this, null, function* () {
446
+ const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/capsule-share`);
397
447
  return res.data.share;
398
- };
448
+ });
399
449
  // GET /download-backup-kit/:userId
400
- this.getBackupKit = async (userId) => {
401
- const res = await this.baseRequest.get(`/download-backup-kit/${userId}`, { responseType: "blob" });
450
+ this.getBackupKit = (userId) => __async(this, null, function* () {
451
+ const res = yield this.baseRequest.get(`/download-backup-kit/${userId}`, { responseType: "blob" });
402
452
  return res;
403
- };
453
+ });
404
454
  // PATCH /users/:userId/biometrics/:biometricId
405
- this.patchSessionPassword = async (partnerId, userId, passwordId, body) => {
406
- const res = await this.baseRequest.patch(`/users/${userId}/passwords/${passwordId}`, body, {
455
+ this.patchSessionPassword = (partnerId, userId, passwordId, body) => __async(this, null, function* () {
456
+ const res = yield this.baseRequest.patch(`/users/${userId}/passwords/${passwordId}`, body, {
407
457
  headers: {
408
458
  [PARTNER_ID_HEADER_NAME]: partnerId
409
459
  }
410
460
  });
411
461
  return res;
412
- };
413
- const headers = {
414
- ...apiKey && { [API_KEY_HEADER_NAME]: apiKey },
415
- ...partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId }
416
- };
462
+ });
463
+ const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
417
464
  const axiosConfig = {
418
465
  baseURL: userManagementHost,
419
466
  withCredentials: true,
@@ -440,7 +487,7 @@ var Client = class {
440
487
  axiosConfig.transformResponse = [
441
488
  ...defaultTransformResponse,
442
489
  function(data, headers2, _status) {
443
- if (headers2?.[SESSION_COOKIE_HEADER_NAME]) {
490
+ if (headers2 == null ? void 0 : headers2[SESSION_COOKIE_HEADER_NAME]) {
444
491
  persistSessionCookie(headers2[SESSION_COOKIE_HEADER_NAME]);
445
492
  }
446
493
  return data;
@@ -448,7 +495,7 @@ var Client = class {
448
495
  ];
449
496
  }
450
497
  this.baseRequest = import_axios.default.create(axiosConfig);
451
- if (opts?.useFetchAdapter) {
498
+ if (opts == null ? void 0 : opts.useFetchAdapter) {
452
499
  import_axios.default.defaults.adapter = function(config) {
453
500
  return fetch(config.baseURL + config.url.substring(1), {
454
501
  method: config.method,
@@ -473,370 +520,509 @@ var Client = class {
473
520
  }
474
521
  // DEPRECATED: use uploadUserKeyShares instead
475
522
  // POST /users/:userId/wallets/:walletId/key-shares
476
- async uploadKeyshares(userId, walletId, encryptedKeyshares) {
477
- const body = { keyShares: encryptedKeyshares };
478
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/key-shares`, body);
479
- return res;
523
+ uploadKeyshares(userId, walletId, encryptedKeyshares) {
524
+ return __async(this, null, function* () {
525
+ const body = { keyShares: encryptedKeyshares };
526
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/key-shares`, body);
527
+ return res;
528
+ });
480
529
  }
481
530
  // POST /users/:userId/key-shares
482
- async uploadUserKeyShares(userId, encryptedKeyshares) {
483
- const body = { keyShares: encryptedKeyshares };
484
- const res = await this.baseRequest.post(`/users/${userId}/key-shares`, body);
485
- return res;
531
+ uploadUserKeyShares(userId, encryptedKeyshares) {
532
+ return __async(this, null, function* () {
533
+ const body = { keyShares: encryptedKeyshares };
534
+ const res = yield this.baseRequest.post(`/users/${userId}/key-shares`, body);
535
+ return res;
536
+ });
486
537
  }
487
538
  // GET /users/:userId/wallets/:walletId/key-shares
488
- async getKeyshare(userId, walletId, type, encryptor) {
489
- const res = await this.baseRequest.get(
490
- `/users/${userId}/wallets/${walletId}/key-shares?type=${type}${encryptor ? `&encryptor=${encryptor}` : ""}`
491
- );
492
- return res;
539
+ getKeyshare(userId, walletId, type, encryptor) {
540
+ return __async(this, null, function* () {
541
+ const res = yield this.baseRequest.get(
542
+ `/users/${userId}/wallets/${walletId}/key-shares?type=${type}${encryptor ? `&encryptor=${encryptor}` : ""}`
543
+ );
544
+ return res;
545
+ });
493
546
  }
494
547
  // GET /users/:userId/biometrics/key-shares
495
- async getBiometricKeyshares(userId, biometricPublicKey, getAll) {
496
- const res = await this.baseRequest.get(
497
- `/users/${userId}/biometrics/key-shares?publicKey=${biometricPublicKey}&all=${!!getAll}`
498
- );
499
- return res;
548
+ getBiometricKeyshares(userId, biometricPublicKey, getAll) {
549
+ return __async(this, null, function* () {
550
+ const res = yield this.baseRequest.get(
551
+ `/users/${userId}/biometrics/key-shares?publicKey=${biometricPublicKey}&all=${!!getAll}`
552
+ );
553
+ return res;
554
+ });
500
555
  }
501
556
  // GET /users/:userId/key-shares
502
- async getPasswordKeyshares(userId, passwordId, getAll) {
503
- const res = await this.baseRequest.get(
504
- `/users/${userId}/passwords/key-shares?passwordId=${passwordId}&all=${!!getAll}`
505
- );
506
- return res;
557
+ getPasswordKeyshares(userId, passwordId, getAll) {
558
+ return __async(this, null, function* () {
559
+ const res = yield this.baseRequest.get(
560
+ `/users/${userId}/passwords/key-shares?passwordId=${passwordId}&all=${!!getAll}`
561
+ );
562
+ return res;
563
+ });
507
564
  }
508
565
  // POST '/users/:userId/temporary-shares',
509
- async uploadTransmissionKeyshares(userId, shares) {
510
- const body = { shares };
511
- const res = await this.baseRequest.post(`/users/${userId}/temporary-shares`, body);
512
- return res;
566
+ uploadTransmissionKeyshares(userId, shares) {
567
+ return __async(this, null, function* () {
568
+ const body = { shares };
569
+ const res = yield this.baseRequest.post(`/users/${userId}/temporary-shares`, body);
570
+ return res;
571
+ });
513
572
  }
514
573
  // GET /users/:userId/temporary-shares returns { temporaryShares: { userId: string, walletId: string, encryptedShare: string, encryptedKey?: string }[] }
515
- async getTransmissionKeyshares(userId, sessionLookupId) {
516
- const res = await this.baseRequest.get(`/users/${userId}/temporary-shares?sessionLookupId=${sessionLookupId}`);
517
- return res;
574
+ getTransmissionKeyshares(userId, sessionLookupId) {
575
+ return __async(this, null, function* () {
576
+ const res = yield this.baseRequest.get(`/users/${userId}/temporary-shares?sessionLookupId=${sessionLookupId}`);
577
+ return res;
578
+ });
518
579
  }
519
580
  // POST '/users/:userId/resend-verification-code
520
- async resendVerificationCode({ userId, ...rest }) {
521
- const res = await this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
522
- return res;
581
+ resendVerificationCode(_a) {
582
+ return __async(this, null, function* () {
583
+ var _b = _a, { userId } = _b, rest = __objRest(_b, ["userId"]);
584
+ const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
585
+ return res;
586
+ });
523
587
  }
524
588
  // POST '/users/:userId/resend-verification-code-by-phone
525
- async resendVerificationCodeByPhone({ userId, ...rest }) {
526
- const res = await this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
527
- return res;
589
+ resendVerificationCodeByPhone(_c) {
590
+ return __async(this, null, function* () {
591
+ var _d = _c, { userId } = _d, rest = __objRest(_d, ["userId"]);
592
+ const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
593
+ return res;
594
+ });
528
595
  }
529
596
  // POST recovery/cancel
530
- async cancelRecoveryAttempt(email) {
531
- const res = await this.baseRequest.post(`/recovery/cancel`, { email });
532
- return res;
597
+ cancelRecoveryAttempt(email) {
598
+ return __async(this, null, function* () {
599
+ const res = yield this.baseRequest.post(`/recovery/cancel`, { email });
600
+ return res;
601
+ });
533
602
  }
534
603
  // GET '/2fa/users/:userId/check-status'
535
- async check2FAStatus(userId) {
536
- const res = await this.baseRequest.get(`/2fa/users/${userId}/check-status`);
537
- return res;
604
+ check2FAStatus(userId) {
605
+ return __async(this, null, function* () {
606
+ const res = yield this.baseRequest.get(`/2fa/users/${userId}/check-status`);
607
+ return res;
608
+ });
538
609
  }
539
610
  // POST '/2fa/users/:userId/enable'
540
- async enable2FA(userId, verificationCode) {
541
- const res = await this.baseRequest.post(`/2fa/users/${userId}/enable`, { verificationCode });
542
- return res;
611
+ enable2FA(userId, verificationCode) {
612
+ return __async(this, null, function* () {
613
+ const res = yield this.baseRequest.post(`/2fa/users/${userId}/enable`, { verificationCode });
614
+ return res;
615
+ });
543
616
  }
544
617
  // POST '/2fa/users/:userId/setup'
545
- async setup2FA(userId) {
546
- const res = await this.baseRequest.post(`/2fa/users/${userId}/setup`);
547
- return res;
618
+ setup2FA(userId) {
619
+ return __async(this, null, function* () {
620
+ const res = yield this.baseRequest.post(`/2fa/users/${userId}/setup`);
621
+ return res;
622
+ });
548
623
  }
549
624
  // POST /recovery/init
550
- async initializeRecovery(email) {
551
- const res = await this.baseRequest.post(`/recovery/init`, { email });
552
- return res;
625
+ initializeRecovery(email) {
626
+ return __async(this, null, function* () {
627
+ const res = yield this.baseRequest.post(`/recovery/init`, { email });
628
+ return res;
629
+ });
553
630
  }
554
631
  // POST /auth/farcaster/init
555
- async initializeFarcasterLogin() {
556
- const res = await this.baseRequest.post(`/auth/farcaster/init`);
557
- return res;
632
+ initializeFarcasterLogin() {
633
+ return __async(this, null, function* () {
634
+ const res = yield this.baseRequest.post(`/auth/farcaster/init`);
635
+ return res;
636
+ });
558
637
  }
559
638
  // POST /auth/farcaster/status
560
- async getFarcasterAuthStatus() {
561
- const res = await this.baseRequest.post(`/auth/farcaster/status`);
562
- return res;
639
+ getFarcasterAuthStatus() {
640
+ return __async(this, null, function* () {
641
+ const res = yield this.baseRequest.post(`/auth/farcaster/status`);
642
+ return res;
643
+ });
563
644
  }
564
645
  // POST /recovery/init
565
- async initializeRecoveryForPhone(phone, countryCode) {
566
- const res = await this.baseRequest.post(`/recovery/init`, { phone, countryCode });
567
- return res;
646
+ initializeRecoveryForPhone(phone, countryCode) {
647
+ return __async(this, null, function* () {
648
+ const res = yield this.baseRequest.post(`/recovery/init`, { phone, countryCode });
649
+ return res;
650
+ });
568
651
  }
569
652
  // POST /recovery/users/:userId/wallets/:walletId/finish
570
- async finalizeRecovery(userId, walletId) {
571
- const res = await this.baseRequest.post(`/recovery/users/${userId}/wallets/${walletId}/finish`);
572
- return res;
653
+ finalizeRecovery(userId, walletId) {
654
+ return __async(this, null, function* () {
655
+ const res = yield this.baseRequest.post(`/recovery/users/${userId}/wallets/${walletId}/finish`);
656
+ return res;
657
+ });
573
658
  }
574
659
  // GET /recovery/users/:userId/wallets/:walletId/key-shares
575
- async recoverUserShares(userId, walletId) {
576
- const res = await this.baseRequest.get(`/recovery/users/${userId}/wallets/${walletId}/key-shares?type=USER&encryptor=RECOVERY`);
577
- return res;
660
+ recoverUserShares(userId, walletId) {
661
+ return __async(this, null, function* () {
662
+ const res = yield this.baseRequest.get(`/recovery/users/${userId}/wallets/${walletId}/key-shares?type=USER&encryptor=RECOVERY`);
663
+ return res;
664
+ });
578
665
  }
579
666
  // POST /recovery/verify-email
580
- async verifyEmailForRecovery(email, verificationCode) {
581
- const body = { email, verificationCode };
582
- const res = await this.baseRequest.post(`/recovery/verify-email`, body);
583
- return res;
667
+ verifyEmailForRecovery(email, verificationCode) {
668
+ return __async(this, null, function* () {
669
+ const body = { email, verificationCode };
670
+ const res = yield this.baseRequest.post(`/recovery/verify-email`, body);
671
+ return res;
672
+ });
584
673
  }
585
674
  // POST /recovery/verify-identifier
586
- async verifyPhoneForRecovery(phone, countryCode, verificationCode) {
587
- const body = { phone, countryCode, verificationCode };
588
- const res = await this.baseRequest.post(`/recovery/verify-identifier`, body);
589
- return res;
675
+ verifyPhoneForRecovery(phone, countryCode, verificationCode) {
676
+ return __async(this, null, function* () {
677
+ const body = { phone, countryCode, verificationCode };
678
+ const res = yield this.baseRequest.post(`/recovery/verify-identifier`, body);
679
+ return res;
680
+ });
590
681
  }
591
682
  // POST /2fa/verify
592
- async verify2FA(email, verificationCode) {
593
- const body = { email, verificationCode };
594
- const res = await this.baseRequest.post("/2fa/verify", body);
595
- return res;
683
+ verify2FA(email, verificationCode) {
684
+ return __async(this, null, function* () {
685
+ const body = { email, verificationCode };
686
+ const res = yield this.baseRequest.post("/2fa/verify", body);
687
+ return res;
688
+ });
596
689
  }
597
690
  // POST /2fa/phone/verify
598
- async verify2FAForPhone(phone, countryCode, verificationCode) {
599
- const body = { phone, countryCode, verificationCode };
600
- const res = await this.baseRequest.post("/2fa/verify", body);
601
- return res;
602
- }
603
- async tempTrasmissionInit(message, userId) {
604
- const body = { message, userId };
605
- const res = await this.baseRequest.post("/temporary-transmissions", body);
606
- return res;
607
- }
608
- async tempTrasmission(id) {
609
- const res = await this.baseRequest.get(`/temporary-transmissions/${id}`);
610
- return res;
611
- }
612
- async getPartner(partnerId) {
613
- const res = await this.baseRequest.get(`/partners/${partnerId}`);
614
- return res;
615
- }
616
- async acceptScopes(userId, walletId, body) {
617
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/scopes/accept`, body);
618
- return res;
619
- }
620
- async getPendingTransaction(userId, pendingTransactionId) {
621
- const res = await this.baseRequest.get(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
622
- return res;
623
- }
624
- async acceptPendingTransaction(userId, pendingTransactionId) {
625
- const res = await this.baseRequest.post(`/users/${userId}/pending-transactions/${pendingTransactionId}/accept`);
626
- return res;
627
- }
628
- async getOnRampConfig() {
629
- const res = await this.baseRequest.get(`/on-ramp-config`);
630
- return res.data;
631
- }
632
- async createOnRampPurchase({
633
- userId,
634
- params: {
635
- type,
636
- walletType,
637
- address,
638
- provider,
639
- networks,
640
- assets,
641
- defaultNetwork,
642
- defaultAsset,
643
- fiat,
644
- fiatQuantity,
645
- testMode = false
646
- },
647
- ...params
648
- }) {
649
- const [key, identifier] = extractWalletRef(params);
650
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
651
- const res = await this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, {
652
- type,
653
- provider,
654
- walletType,
655
- address,
656
- networks,
657
- assets,
658
- defaultAsset,
659
- defaultNetwork,
660
- fiat,
661
- fiatQuantity,
662
- testMode
663
- });
664
- return res.data;
665
- }
666
- async updateOnRampPurchase({
667
- userId,
668
- purchaseId,
669
- updates,
670
- ...params
671
- }) {
672
- const [key, identifier] = extractWalletRef(params);
673
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
674
- const res = await this.baseRequest.patch(
675
- `/users/${userId}/${walletString}/purchases/${purchaseId}`,
676
- updates
677
- );
678
- return res.data;
679
- }
680
- async getOnRampPurchase({
681
- userId,
682
- purchaseId,
683
- ...params
684
- }) {
685
- const [key, identifier] = extractWalletRef(params);
686
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
687
- const res = await this.baseRequest.get(`/users/${userId}/${walletString}/purchases/${purchaseId}`);
688
- return res;
689
- }
690
- async signMoonPayUrl(userId, {
691
- url,
692
- type,
693
- cosmosPrefix,
694
- testMode,
695
- walletId,
696
- externalWalletAddress
697
- }) {
698
- const walletString = walletId ? `wallets/${walletId}` : `external-wallets/${externalWalletAddress}`;
699
- const res = await this.baseRequest.post(`/users/${userId}/${walletString}/moonpay-sign`, {
691
+ verify2FAForPhone(phone, countryCode, verificationCode) {
692
+ return __async(this, null, function* () {
693
+ const body = { phone, countryCode, verificationCode };
694
+ const res = yield this.baseRequest.post("/2fa/verify", body);
695
+ return res;
696
+ });
697
+ }
698
+ tempTrasmissionInit(message, userId) {
699
+ return __async(this, null, function* () {
700
+ const body = { message, userId };
701
+ const res = yield this.baseRequest.post("/temporary-transmissions", body);
702
+ return res;
703
+ });
704
+ }
705
+ tempTrasmission(id) {
706
+ return __async(this, null, function* () {
707
+ const res = yield this.baseRequest.get(`/temporary-transmissions/${id}`);
708
+ return res;
709
+ });
710
+ }
711
+ getPartner(partnerId) {
712
+ return __async(this, null, function* () {
713
+ const res = yield this.baseRequest.get(`/partners/${partnerId}`);
714
+ return res;
715
+ });
716
+ }
717
+ acceptScopes(userId, walletId, body) {
718
+ return __async(this, null, function* () {
719
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/scopes/accept`, body);
720
+ return res;
721
+ });
722
+ }
723
+ getPendingTransaction(userId, pendingTransactionId) {
724
+ return __async(this, null, function* () {
725
+ const res = yield this.baseRequest.get(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
726
+ return res;
727
+ });
728
+ }
729
+ acceptPendingTransaction(userId, pendingTransactionId) {
730
+ return __async(this, null, function* () {
731
+ const res = yield this.baseRequest.post(`/users/${userId}/pending-transactions/${pendingTransactionId}/accept`);
732
+ return res;
733
+ });
734
+ }
735
+ getOnRampConfig() {
736
+ return __async(this, null, function* () {
737
+ const res = yield this.baseRequest.get(`/on-ramp-config`);
738
+ return res.data;
739
+ });
740
+ }
741
+ createOnRampPurchase(_e) {
742
+ return __async(this, null, function* () {
743
+ var _f = _e, {
744
+ userId,
745
+ params: {
746
+ type,
747
+ walletType,
748
+ address,
749
+ provider,
750
+ networks,
751
+ assets,
752
+ defaultNetwork,
753
+ defaultAsset,
754
+ fiat,
755
+ fiatQuantity,
756
+ testMode = false
757
+ }
758
+ } = _f, params = __objRest(_f, [
759
+ "userId",
760
+ "params"
761
+ ]);
762
+ const [key, identifier] = extractWalletRef(params);
763
+ const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
764
+ const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, {
765
+ type,
766
+ provider,
767
+ walletType,
768
+ address,
769
+ networks,
770
+ assets,
771
+ defaultAsset,
772
+ defaultNetwork,
773
+ fiat,
774
+ fiatQuantity,
775
+ testMode
776
+ });
777
+ return res.data;
778
+ });
779
+ }
780
+ updateOnRampPurchase(_g) {
781
+ return __async(this, null, function* () {
782
+ var _h = _g, {
783
+ userId,
784
+ purchaseId,
785
+ updates
786
+ } = _h, params = __objRest(_h, [
787
+ "userId",
788
+ "purchaseId",
789
+ "updates"
790
+ ]);
791
+ const [key, identifier] = extractWalletRef(params);
792
+ const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
793
+ const res = yield this.baseRequest.patch(
794
+ `/users/${userId}/${walletString}/purchases/${purchaseId}`,
795
+ updates
796
+ );
797
+ return res.data;
798
+ });
799
+ }
800
+ getOnRampPurchase(_i) {
801
+ return __async(this, null, function* () {
802
+ var _j = _i, {
803
+ userId,
804
+ purchaseId
805
+ } = _j, params = __objRest(_j, [
806
+ "userId",
807
+ "purchaseId"
808
+ ]);
809
+ const [key, identifier] = extractWalletRef(params);
810
+ const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
811
+ const res = yield this.baseRequest.get(`/users/${userId}/${walletString}/purchases/${purchaseId}`);
812
+ return res;
813
+ });
814
+ }
815
+ signMoonPayUrl(_0, _1) {
816
+ return __async(this, arguments, function* (userId, {
700
817
  url,
701
818
  type,
702
819
  cosmosPrefix,
703
- testMode
704
- });
705
- return res;
706
- }
707
- async generateOffRampTx(userId, {
708
- provider,
709
- chainId,
710
- contractAddress,
711
- testMode,
712
- walletId,
713
- walletType,
714
- destinationAddress,
715
- sourceAddress,
716
- assetQuantity
717
- }) {
718
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-generate`, {
719
- provider,
720
820
  testMode,
821
+ walletId,
822
+ externalWalletAddress
823
+ }) {
824
+ const walletString = walletId ? `wallets/${walletId}` : `external-wallets/${externalWalletAddress}`;
825
+ const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/moonpay-sign`, {
826
+ url,
827
+ type,
828
+ cosmosPrefix,
829
+ testMode
830
+ });
831
+ return res;
832
+ });
833
+ }
834
+ generateOffRampTx(_0, _1) {
835
+ return __async(this, arguments, function* (userId, {
836
+ provider,
721
837
  chainId,
722
838
  contractAddress,
839
+ testMode,
723
840
  walletId,
724
841
  walletType,
725
842
  destinationAddress,
726
843
  sourceAddress,
727
844
  assetQuantity
845
+ }) {
846
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-generate`, {
847
+ provider,
848
+ testMode,
849
+ chainId,
850
+ contractAddress,
851
+ walletId,
852
+ walletType,
853
+ destinationAddress,
854
+ sourceAddress,
855
+ assetQuantity
856
+ });
857
+ return res.data;
728
858
  });
729
- return res.data;
730
859
  }
731
- async sendOffRampTx(userId, {
732
- tx,
733
- signature,
734
- network,
735
- walletId,
736
- walletType
737
- }) {
738
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-send`, {
860
+ sendOffRampTx(_0, _1) {
861
+ return __async(this, arguments, function* (userId, {
739
862
  tx,
740
863
  signature,
741
864
  network,
865
+ walletId,
742
866
  walletType
867
+ }) {
868
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-send`, {
869
+ tx,
870
+ signature,
871
+ network,
872
+ walletType
873
+ });
874
+ return res.data;
743
875
  });
744
- return res.data;
745
876
  }
746
- async distributeParaShare({
747
- userId,
748
- walletId,
749
- ...rest
750
- }) {
751
- const body = rest;
752
- const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body);
753
- return res;
877
+ distributeParaShare(_k) {
878
+ return __async(this, null, function* () {
879
+ var _l = _k, {
880
+ userId,
881
+ walletId
882
+ } = _l, rest = __objRest(_l, [
883
+ "userId",
884
+ "walletId"
885
+ ]);
886
+ const body = rest;
887
+ const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body);
888
+ return res;
889
+ });
754
890
  }
755
- async keepSessionAlive(userId) {
756
- const res = await this.baseRequest.post(`/users/${userId}/session/keep-alive`);
757
- return res.data;
891
+ keepSessionAlive(userId) {
892
+ return __async(this, null, function* () {
893
+ const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`);
894
+ return res.data;
895
+ });
758
896
  }
759
- async persistRecoveryPublicKeys(userId, publicKeys) {
760
- const res = await this.baseRequest.post(`/users/${userId}/recovery-public-keys`, { publicKeys });
761
- return res.data;
897
+ persistRecoveryPublicKeys(userId, publicKeys) {
898
+ return __async(this, null, function* () {
899
+ const res = yield this.baseRequest.post(`/users/${userId}/recovery-public-keys`, { publicKeys });
900
+ return res.data;
901
+ });
762
902
  }
763
- async getRecoveryPublicKeys(userId) {
764
- const res = await this.baseRequest.get(`/users/${userId}/recovery-public-keys`);
765
- return res.data;
903
+ getRecoveryPublicKeys(userId) {
904
+ return __async(this, null, function* () {
905
+ const res = yield this.baseRequest.get(`/users/${userId}/recovery-public-keys`);
906
+ return res.data;
907
+ });
766
908
  }
767
- async uploadEncryptedWalletPrivateKey(userId, encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId) {
768
- const body = { encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId };
769
- const res = await this.baseRequest.post(`/users/${userId}/encrypted-wallet-private-keys`, body);
770
- return res.data;
909
+ uploadEncryptedWalletPrivateKey(userId, encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId) {
910
+ return __async(this, null, function* () {
911
+ const body = { encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId };
912
+ const res = yield this.baseRequest.post(`/users/${userId}/encrypted-wallet-private-keys`, body);
913
+ return res.data;
914
+ });
771
915
  }
772
- async getEncryptedWalletPrivateKeys(userId, encryptionKeyHash) {
773
- const res = await this.baseRequest.get(`/users/${userId}/encrypted-wallet-private-keys/${encryptionKeyHash}`);
774
- return res.data;
916
+ getEncryptedWalletPrivateKeys(userId, encryptionKeyHash) {
917
+ return __async(this, null, function* () {
918
+ const res = yield this.baseRequest.get(`/users/${userId}/encrypted-wallet-private-keys/${encryptionKeyHash}`);
919
+ return res.data;
920
+ });
775
921
  }
776
- async getConversionRate(chainId, symbol, currency) {
777
- const params = { symbol, currency };
778
- const res = await this.baseRequest.get(`/chains/${chainId}/conversion-rate`, { params });
779
- return res.data;
922
+ getConversionRate(chainId, symbol, currency) {
923
+ return __async(this, null, function* () {
924
+ const params = { symbol, currency };
925
+ const res = yield this.baseRequest.get(`/chains/${chainId}/conversion-rate`, { params });
926
+ return res.data;
927
+ });
780
928
  }
781
- async getGasEstimate(chainId, totalGasPrice) {
782
- const params = { totalGasPrice };
783
- const res = await this.baseRequest.get(`/chains/${chainId}/gas-estimate`, { params });
784
- return res.data;
929
+ getGasEstimate(chainId, totalGasPrice) {
930
+ return __async(this, null, function* () {
931
+ const params = { totalGasPrice };
932
+ const res = yield this.baseRequest.get(`/chains/${chainId}/gas-estimate`, { params });
933
+ return res.data;
934
+ });
785
935
  }
786
- async getGasOracle(chainId) {
787
- const res = await this.baseRequest.get(`/chains/${chainId}/gas-oracle`);
788
- return res.data;
936
+ getGasOracle(chainId) {
937
+ return __async(this, null, function* () {
938
+ const res = yield this.baseRequest.get(`/chains/${chainId}/gas-oracle`);
939
+ return res.data;
940
+ });
789
941
  }
790
942
  // GET /users/:userId/wallets/:walletId/refresh-done
791
- async isRefreshDone(userId, walletId, partnerId, protocolId) {
792
- const queryParams = {};
793
- if (partnerId) queryParams["partnerId"] = partnerId;
794
- if (protocolId) queryParams["protocolId"] = protocolId;
795
- const query = import_qs.default.stringify(queryParams);
796
- const res = await this.baseRequest.get(`/users/${userId}/wallets/${walletId}/refresh-done?${query}`);
797
- return res.data;
798
- }
799
- async deletePendingTransaction(userId, pendingTransactionId) {
800
- const res = await this.baseRequest.delete(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
801
- return res.data;
943
+ isRefreshDone(userId, walletId, partnerId, protocolId) {
944
+ return __async(this, null, function* () {
945
+ const queryParams = {};
946
+ if (partnerId) queryParams["partnerId"] = partnerId;
947
+ if (protocolId) queryParams["protocolId"] = protocolId;
948
+ const query = import_qs.default.stringify(queryParams);
949
+ const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/refresh-done?${query}`);
950
+ return res.data;
951
+ });
952
+ }
953
+ deletePendingTransaction(userId, pendingTransactionId) {
954
+ return __async(this, null, function* () {
955
+ const res = yield this.baseRequest.delete(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
956
+ return res.data;
957
+ });
802
958
  }
803
959
  // POST /users/:userId/passwords/key
804
- async addSessionPasswordPublicKey(userId, body) {
805
- const res = await this.baseRequest.post(`/users/${userId}/passwords/key`, body);
806
- return res;
960
+ addSessionPasswordPublicKey(userId, body) {
961
+ return __async(this, null, function* () {
962
+ const res = yield this.baseRequest.post(`/users/${userId}/passwords/key`, body);
963
+ return res;
964
+ });
807
965
  }
808
- async getSupportedAuthMethods(auth) {
809
- const res = await this.baseRequest.get("/users/supported-auth-methods", {
810
- params: { ...auth }
966
+ getSupportedAuthMethods(auth) {
967
+ return __async(this, null, function* () {
968
+ const res = yield this.baseRequest.get("/users/supported-auth-methods", {
969
+ params: __spreadValues({}, auth)
970
+ });
971
+ return res.data;
811
972
  });
812
- return res.data;
813
973
  }
814
- async getPasswords(auth) {
815
- const res = await this.baseRequest.get("/users/passwords", {
816
- params: { ...auth }
974
+ getPasswords(auth) {
975
+ return __async(this, null, function* () {
976
+ const res = yield this.baseRequest.get("/users/passwords", {
977
+ params: __spreadValues({}, auth)
978
+ });
979
+ return res.data.passwords;
817
980
  });
818
- return res.data.passwords;
819
981
  }
820
982
  // POST /passwords/verify
821
- async verifyPasswordChallenge(partnerId, body) {
822
- const res = await this.baseRequest.post(`/passwords/verify`, body, {
823
- headers: {
824
- [PARTNER_ID_HEADER_NAME]: partnerId
825
- }
983
+ verifyPasswordChallenge(partnerId, body) {
984
+ return __async(this, null, function* () {
985
+ const res = yield this.baseRequest.post(`/passwords/verify`, body, {
986
+ headers: {
987
+ [PARTNER_ID_HEADER_NAME]: partnerId
988
+ }
989
+ });
990
+ return res;
826
991
  });
827
- return res;
828
992
  }
829
- async getEncryptedWalletPrivateKey(passwordId) {
830
- const queryParams = {};
831
- queryParams["passwordId"] = passwordId;
832
- const query = import_qs.default.stringify(queryParams);
833
- const res = await this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
834
- return res;
993
+ getEncryptedWalletPrivateKey(passwordId) {
994
+ return __async(this, null, function* () {
995
+ const queryParams = {};
996
+ queryParams["passwordId"] = passwordId;
997
+ const query = import_qs.default.stringify(queryParams);
998
+ const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
999
+ return res;
1000
+ });
835
1001
  }
836
1002
  // GET /users/:userId
837
- async getUser(userId) {
838
- const res = await this.baseRequest.get(`/users/${userId}`);
839
- return res.data;
1003
+ getUser(userId) {
1004
+ return __async(this, null, function* () {
1005
+ const res = yield this.baseRequest.get(`/users/${userId}`);
1006
+ return res.data;
1007
+ });
1008
+ }
1009
+ // GET /users/:userId/accounts
1010
+ getAccountMetadata(userId, partnerId) {
1011
+ return __async(this, null, function* () {
1012
+ const res = yield this.baseRequest.get(`/users/${userId}/oauth/accounts`, {
1013
+ params: { partnerId }
1014
+ });
1015
+ return {
1016
+ accountMetadata: Object.entries(res.data.accountMetadata || {}).reduce(
1017
+ (acc, [method, obj]) => __spreadProps(__spreadValues({}, acc), {
1018
+ [method]: __spreadProps(__spreadValues({}, obj), {
1019
+ date: new Date(obj.date)
1020
+ })
1021
+ }),
1022
+ {}
1023
+ )
1024
+ };
1025
+ });
840
1026
  }
841
1027
  };
842
1028
  var client_default = Client;