@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 +592 -406
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/cjs/package.json +3 -0
- package/dist/esm/index.js +595 -406
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/esm/package.json +4 -0
- package/dist/types/client.d.ts +4 -1
- package/dist/types/types/auth.d.ts +5 -0
- package/package.json +2 -2
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
|
|
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
|
|
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 =
|
|
191
|
-
const res =
|
|
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 =
|
|
195
|
-
const res =
|
|
196
|
-
params: {
|
|
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 =
|
|
201
|
-
return (
|
|
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 =
|
|
206
|
-
const res =
|
|
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 =
|
|
211
|
-
const res =
|
|
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 =
|
|
215
|
-
const res =
|
|
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 =
|
|
219
|
-
const res =
|
|
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 =
|
|
224
|
-
const res =
|
|
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 =
|
|
229
|
-
const res =
|
|
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 =
|
|
234
|
-
const res =
|
|
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 =
|
|
239
|
-
const res =
|
|
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 =
|
|
244
|
-
const res =
|
|
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 =
|
|
253
|
-
const res =
|
|
254
|
-
params: {
|
|
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 =
|
|
260
|
-
const res =
|
|
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 =
|
|
267
|
-
const res =
|
|
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 =
|
|
272
|
-
const res =
|
|
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 =
|
|
281
|
-
const res =
|
|
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 =
|
|
286
|
-
const res =
|
|
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 =
|
|
291
|
-
const res =
|
|
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 =
|
|
296
|
-
const res =
|
|
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 =
|
|
301
|
-
const res =
|
|
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 =
|
|
308
|
-
const res =
|
|
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 =
|
|
313
|
-
const res =
|
|
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 =
|
|
319
|
-
const res =
|
|
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 =
|
|
373
|
+
this.refreshKeys = (userId, walletId, oldPartnerId, newPartnerId, keyShareProtocolId) => __async(this, null, function* () {
|
|
324
374
|
const body = { oldPartnerId, newPartnerId, keyShareProtocolId };
|
|
325
|
-
const res =
|
|
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 =
|
|
330
|
-
const res =
|
|
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 =
|
|
335
|
-
const res =
|
|
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 =
|
|
342
|
-
const res =
|
|
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 =
|
|
347
|
-
const res =
|
|
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 =
|
|
406
|
+
this.login = (props) => __async(this, null, function* () {
|
|
357
407
|
const body = props;
|
|
358
|
-
const res =
|
|
408
|
+
const res = yield this.baseRequest.post("/login", body);
|
|
359
409
|
return res;
|
|
360
|
-
};
|
|
410
|
+
});
|
|
361
411
|
// POST /login
|
|
362
|
-
this.verifyLogin =
|
|
412
|
+
this.verifyLogin = (verificationCode) => __async(this, null, function* () {
|
|
363
413
|
const body = { verificationCode };
|
|
364
|
-
const res =
|
|
414
|
+
const res = yield this.baseRequest.post("/login/verify-email", body);
|
|
365
415
|
return res;
|
|
366
|
-
};
|
|
416
|
+
});
|
|
367
417
|
// GET /logout
|
|
368
|
-
this.logout =
|
|
369
|
-
const res =
|
|
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 =
|
|
423
|
+
this.recoveryVerification = (email, verificationCode) => __async(this, null, function* () {
|
|
374
424
|
const body = { email, verificationCode };
|
|
375
|
-
const res =
|
|
425
|
+
const res = yield this.baseRequest.post("/recovery/verification", body);
|
|
376
426
|
return res;
|
|
377
|
-
};
|
|
427
|
+
});
|
|
378
428
|
// POST /recovery
|
|
379
|
-
this.recoveryInit =
|
|
429
|
+
this.recoveryInit = (email) => __async(this, null, function* () {
|
|
380
430
|
const body = { email };
|
|
381
|
-
const res =
|
|
431
|
+
const res = yield this.baseRequest.post("/recovery", body);
|
|
382
432
|
return res;
|
|
383
|
-
};
|
|
384
|
-
this.preSignMessage =
|
|
433
|
+
});
|
|
434
|
+
this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
|
|
385
435
|
const body = { message, scheme, cosmosSignDoc };
|
|
386
|
-
const res =
|
|
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 =
|
|
391
|
-
const res =
|
|
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 =
|
|
396
|
-
const res =
|
|
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 =
|
|
401
|
-
const res =
|
|
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 =
|
|
406
|
-
const res =
|
|
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
|
|
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
|
|
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
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
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
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
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
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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
|
-
|
|
521
|
-
|
|
522
|
-
|
|
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
|
-
|
|
526
|
-
|
|
527
|
-
|
|
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
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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
|
-
|
|
536
|
-
|
|
537
|
-
|
|
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
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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
|
-
|
|
551
|
-
|
|
552
|
-
|
|
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
|
-
|
|
556
|
-
|
|
557
|
-
|
|
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
|
-
|
|
561
|
-
|
|
562
|
-
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
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
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
|
-
|
|
576
|
-
|
|
577
|
-
|
|
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
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
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
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
732
|
-
|
|
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
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
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
|
-
|
|
756
|
-
|
|
757
|
-
|
|
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
|
-
|
|
760
|
-
|
|
761
|
-
|
|
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
|
-
|
|
764
|
-
|
|
765
|
-
|
|
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
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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
|
-
|
|
773
|
-
|
|
774
|
-
|
|
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
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
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
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
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
|
-
|
|
787
|
-
|
|
788
|
-
|
|
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
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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
|
-
|
|
805
|
-
|
|
806
|
-
|
|
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
|
-
|
|
809
|
-
|
|
810
|
-
|
|
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
|
-
|
|
815
|
-
|
|
816
|
-
|
|
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
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
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
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
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
|
-
|
|
838
|
-
|
|
839
|
-
|
|
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;
|