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