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