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