@getpara/user-management-client 2.0.0-dev.1 → 2.0.0-dev.3

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/esm/index.js CHANGED
@@ -1,1303 +1,10 @@
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
-
53
- // src/client.ts
54
- import axios from "axios";
55
- import qs from "qs";
56
-
57
- // src/utils.ts
58
- import parsePhoneNumberFromString from "libphonenumber-js";
59
- function isWalletId(params) {
60
- return !!params.walletId && !params.externalWalletAddress;
61
- }
62
- function isExternalWalletAddress(params) {
63
- return !!params.externalWalletAddress && !params.walletId;
64
- }
65
- function extractWalletRef(params) {
66
- if (isWalletId(params)) {
67
- return ["walletId", params.walletId];
68
- } else if (isExternalWalletAddress(params)) {
69
- return ["externalWalletAddress", params.externalWalletAddress];
70
- }
71
- throw new Error("invalid wallet params");
72
- }
73
- function isValid(s) {
74
- return !!s && s !== "null" && s !== "undefined" && s !== "";
75
- }
76
- function isEmail(params) {
77
- return !!params && isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
78
- }
79
- function isPhone(params) {
80
- return !!params && isValid(params.phone) && /^\+\d+$/.test(params.phone) && !isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.userId) && !isValid(params.externalWalletAddress);
81
- }
82
- function isPhoneLegacy(params) {
83
- return !!params && isValid(params.phone) && isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
84
- }
85
- function isFarcaster(params) {
86
- return !!params && isValid(params.farcasterUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
87
- }
88
- function isTelegram(params) {
89
- return !!params && isValid(params.telegramUserId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
90
- }
91
- function isExternalWallet(params) {
92
- return !!params && isValid(params.externalWalletAddress) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId);
93
- }
94
- function isX(params) {
95
- return !!params && isValid(params.xUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
96
- }
97
- function isDiscord(params) {
98
- return !!params && isValid(params.discordUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
99
- }
100
- function isCustomId(params) {
101
- return !!params && isValid(params.customId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.externalWalletAddress);
102
- }
103
- function isUserId(params) {
104
- return !!params && isValid(params.userId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.telegramUserId) && !isValid(params.externalWalletAddress);
105
- }
106
- function isPrimary(params) {
107
- return isEmail(params) || isPhone(params) || isFarcaster(params) || isTelegram(params) || isExternalWallet(params);
108
- }
109
- function isVerifiedAuth(params) {
110
- return isEmail(params) || isPhone(params);
111
- }
112
- function isPregenAuth(params) {
113
- return isPrimary(params) && !isExternalWallet(params) || isX(params) || isDiscord(params) || isCustomId(params);
114
- }
115
- function extractAuthInfo(obj, { allowUserId = false, allowPregen = false, isRequired = false } = {}) {
116
- obj = Object.entries(obj || {}).reduce((acc, [k, v]) => {
117
- return __spreadValues(__spreadValues({}, acc), !!v && v !== "null" && v !== "undefined" && v !== "" ? { [k]: v } : {});
118
- }, {});
119
- let error;
120
- switch (true) {
121
- case isEmail(obj):
122
- return {
123
- auth: { email: obj.email },
124
- authType: "email",
125
- identifier: obj.email
126
- };
127
- case isPhone(obj):
128
- if (!parsePhoneNumberFromString(obj.phone)) {
129
- error = "invalid phone number";
130
- break;
131
- }
132
- return {
133
- auth: { phone: obj.phone },
134
- authType: "phone",
135
- identifier: obj.phone
136
- };
137
- case isPhoneLegacy(obj):
138
- const identifier = `${obj.countryCode.startsWith("+") ? "" : "+"}${obj.countryCode}${obj.phone}`;
139
- if (!parsePhoneNumberFromString(identifier)) {
140
- error = "invalid phone number";
141
- break;
142
- }
143
- return {
144
- auth: { phone: identifier },
145
- authType: "phone",
146
- identifier
147
- };
148
- case isFarcaster(obj):
149
- return {
150
- auth: { farcasterUsername: obj.farcasterUsername },
151
- authType: "farcaster",
152
- identifier: obj.farcasterUsername
153
- };
154
- case isTelegram(obj):
155
- return {
156
- auth: { telegramUserId: obj.telegramUserId },
157
- authType: "telegram",
158
- identifier: obj.telegramUserId
159
- };
160
- case isExternalWallet(obj):
161
- return {
162
- auth: { externalWalletAddress: obj.externalWalletAddress },
163
- authType: "externalWallet",
164
- identifier: obj.externalWalletAddress
165
- };
166
- case (allowPregen && isX(obj)):
167
- return {
168
- auth: { xUsername: obj.xUsername },
169
- authType: "x",
170
- identifier: obj.xUsername
171
- };
172
- case (allowPregen && isDiscord(obj)):
173
- return {
174
- auth: { discordUsername: obj.discordUsername },
175
- authType: "discord",
176
- identifier: obj.discordUsername
177
- };
178
- case (allowPregen && isCustomId(obj)):
179
- return {
180
- auth: { customId: obj.customId },
181
- authType: "customId",
182
- identifier: obj.customId
183
- };
184
- case (isUserId(obj) && allowUserId):
185
- return {
186
- auth: { userId: obj.userId },
187
- authType: "userId",
188
- identifier: obj.userId
189
- };
190
- default:
191
- break;
192
- }
193
- if (isRequired) {
194
- throw new Error(error != null ? error : "invalid auth object");
195
- }
196
- return void 0;
197
- }
198
- function toPregenTypeAndId(auth) {
199
- const { authType, identifier: pregenIdentifier } = extractAuthInfo(auth, { isRequired: true, allowPregen: true });
200
- const pregenIdentifierType = {
201
- email: "EMAIL",
202
- phone: "PHONE",
203
- farcaster: "FARCASTER",
204
- telegram: "TELEGRAM",
205
- discord: "DISCORD",
206
- x: "TWITTER",
207
- customId: "CUSTOM_ID"
208
- }[authType];
209
- return [pregenIdentifierType, pregenIdentifier];
210
- }
211
- function toPregenIds(auth) {
212
- const [pregenIdentifierType, pregenIdentifier] = toPregenTypeAndId(auth);
213
- return { [pregenIdentifierType]: [pregenIdentifier] };
214
- }
215
-
216
- // src/consts.ts
217
- var SESSION_COOKIE_HEADER_NAME = "x-capsule-sid";
218
- var VERSION_HEADER_NAME = "x-para-version";
219
- var PARTNER_ID_HEADER_NAME = "x-partner-id";
220
- var API_KEY_HEADER_NAME = "X-External-API-Key";
221
-
222
- // src/error.ts
223
- function ParaApiError(message, code, status, responseURL) {
224
- Error.call(this);
225
- if (Error.captureStackTrace) {
226
- Error.captureStackTrace(this, this.constructor);
227
- } else {
228
- this.stack = new Error().stack;
229
- }
230
- this.message = message;
231
- this.name = "ParaApiError";
232
- code && (this.code = code);
233
- status && (this.status = status);
234
- responseURL && (this.responseURL = responseURL);
235
- }
236
- var prototype = ParaApiError.prototype;
237
- Object.defineProperty(prototype, "isParaApiError", { value: true });
238
-
239
- // src/client.ts
240
- var handleResponseSuccess = (response) => {
241
- if (response.status === 200) {
242
- return response;
243
- }
244
- throw new ParaApiError("Invalid status code");
245
- };
246
- var handleResponseError = (error) => {
247
- var _a, _b, _c;
248
- if (error === null) throw new ParaApiError("Error is null");
249
- if (axios.isAxiosError(error)) {
250
- let message = (_b = (_a = error.response) == null ? void 0 : _a.data) != null ? _b : "Unknown error";
251
- if (error.code === "ERR_NETWORK") {
252
- message = "Connection error";
253
- } else if (error.code === "ERR_CANCELED") {
254
- message = "Connection canceled";
255
- }
256
- throw new ParaApiError(message, error.code, error.response.status, (_c = error.request) == null ? void 0 : _c.responseURL);
257
- }
258
- throw new ParaApiError("Unknown error");
259
- };
260
- var Client = class {
261
- constructor({
262
- userManagementHost,
263
- apiKey,
264
- partnerId,
265
- version,
266
- opts,
267
- retrieveSessionCookie,
268
- persistSessionCookie
269
- }) {
270
- this.signUpOrLogIn = (body) => __async(this, null, function* () {
271
- const res = yield this.baseRequest.post(`/users/init`, body);
272
- return res.data;
273
- });
274
- /**
275
- * @deprecated
276
- */
277
- this.createUser = (body) => __async(this, null, function* () {
278
- const res = yield this.baseRequest.post(`/users`, body);
279
- return res.data;
280
- });
281
- this.checkUserExists = (auth) => __async(this, null, function* () {
282
- const res = yield this.baseRequest.get("/users/exists", {
283
- params: __spreadValues({}, auth)
284
- });
285
- return res;
286
- });
287
- this.checkUserExistsV2 = (auth) => __async(this, null, function* () {
288
- const res = yield this.baseRequest.get("/users/exists", {
289
- params: __spreadValues({}, auth)
290
- });
291
- return res.data;
292
- });
293
- this.verifyTelegram = (authObject) => __async(this, null, function* () {
294
- return (yield this.baseRequest.post("/users/telegram", {
295
- authObject
296
- })).data;
297
- });
298
- this.verifyTelegramV2 = (authObject) => __async(this, null, function* () {
299
- return (yield this.baseRequest.post("/users/telegram/v2", {
300
- authObject
301
- })).data;
302
- });
303
- this.verifyOAuth = () => __async(this, null, function* () {
304
- const res = yield this.baseRequest.post("/users/verify-oauth");
305
- return res.data;
306
- });
307
- this.externalWalletLogin = (body) => __async(this, null, function* () {
308
- const res = yield this.baseRequest.post(`/users/external-wallets/login`, body);
309
- return res.data;
310
- });
311
- this.loginExternalWalletV2 = (_0) => __async(this, [_0], function* ({
312
- externalWallet,
313
- shouldTrackUser
314
- }) {
315
- const res = yield this.baseRequest.post(`/users/external-wallets/login/v2`, {
316
- externalWallet,
317
- shouldTrackUser
318
- });
319
- return res.data;
320
- });
321
- this.verifyNewAccount = (userId, body) => __async(this, null, function* () {
322
- const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
323
- return res.data;
324
- });
325
- // POST /users/:userId/verify-email
326
- /**
327
- * @deprecated
328
- */
329
- this.verifyEmail = (userId, body) => __async(this, null, function* () {
330
- const res = yield this.baseRequest.post(`/users/${userId}/verify-email`, body);
331
- return res;
332
- });
333
- /**
334
- * @deprecated
335
- */
336
- this.verifyPhone = (userId, body) => __async(this, null, function* () {
337
- const res = yield this.baseRequest.post(`/users/${userId}/verify-identifier`, body);
338
- return res;
339
- });
340
- this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
341
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify`, body);
342
- return res;
343
- });
344
- this.verifyExternalWalletV2 = (userId, body) => __async(this, null, function* () {
345
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
346
- return res.data;
347
- });
348
- // POST /users/:userId/biometrics/key
349
- this.addSessionPublicKey = (userId, body) => __async(this, null, function* () {
350
- const res = yield this.baseRequest.post(`/users/${userId}/biometrics/key`, body);
351
- return res;
352
- });
353
- // GET /users/:userId/biometrics/keys
354
- this.getSessionPublicKeys = (userId) => __async(this, null, function* () {
355
- const res = yield this.baseRequest.get(`/users/${userId}/biometrics/keys`);
356
- return res;
357
- });
358
- // GET /biometrics/location-hints
359
- this.getBiometricLocationHints = (auth) => __async(this, null, function* () {
360
- const res = yield this.baseRequest.get(`/biometrics/location-hints`, {
361
- params: auth
362
- });
363
- return res.data.hints;
364
- });
365
- // GET /users/:userId/biometrics/:biometricId
366
- this.getSessionPublicKey = (userId, biometricId) => __async(this, null, function* () {
367
- const res = yield this.baseRequest.get(`/users/${userId}/biometrics/${biometricId}`);
368
- return res;
369
- });
370
- // PATCH /users/:userId/biometrics/:biometricId
371
- this.patchSessionPublicKey = (partnerId, userId, biometricId, body) => __async(this, null, function* () {
372
- const res = yield this.baseRequest.patch(`/users/${userId}/biometrics/${biometricId}`, body, {
373
- headers: {
374
- [PARTNER_ID_HEADER_NAME]: partnerId
375
- }
376
- });
377
- return res;
378
- });
379
- // GET /biometrics/challenge?email&publicKey
380
- this.getWebChallenge = (auth) => __async(this, null, function* () {
381
- const res = yield this.baseRequest.get("/biometrics/challenge", {
382
- params: __spreadValues({}, auth || {})
383
- });
384
- return res.data;
385
- });
386
- // POST /touch
387
- this.touchSession = (regenerate) => __async(this, null, function* () {
388
- const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
389
- return res.data;
390
- });
391
- // GET /session/origin
392
- this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
393
- const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
394
- return res.data;
395
- });
396
- // POST /biometrics/verify
397
- this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
398
- const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
399
- headers: {
400
- [PARTNER_ID_HEADER_NAME]: partnerId
401
- }
402
- });
403
- return res;
404
- });
405
- // GET /users/:userId/biometrics/challenge
406
- this.getSessionChallenge = (userId) => __async(this, null, function* () {
407
- const res = yield this.baseRequest.get(`/users/${userId}/biometrics/challenge`);
408
- return res;
409
- });
410
- // POST /users/:userId/biometrics/verify
411
- this.verifySessionChallenge = (userId, body) => __async(this, null, function* () {
412
- const res = yield this.baseRequest.post(`/users/${userId}/biometrics/verify`, body);
413
- return res;
414
- });
415
- // POST /users/:userId/wallets
416
- this.createWallet = (userId, body) => __async(this, null, function* () {
417
- const res = yield this.baseRequest.post(`/users/${userId}/wallets`, body);
418
- return res.data;
419
- });
420
- // POST /wallets/pregen
421
- this.createPregenWallet = (body) => __async(this, null, function* () {
422
- const res = yield this.baseRequest.post(`/wallets/pregen`, body);
423
- return res.data;
424
- });
425
- // GET /wallets/pregen?pregenIdentifier={pregenIdentifier}&pregenIdentifierType={pregenIdentifierType}
426
- this.getPregenWallets = (pregenIds, isPortal = false, userId) => __async(this, null, function* () {
427
- const res = yield this.baseRequest.get("/wallets/pregen", {
428
- params: { ids: pregenIds, expand: isPortal, userId }
429
- });
430
- return res.data;
431
- });
432
- this.getPregenWalletsV2 = (pregenIds, isPortal = false, userId) => __async(this, null, function* () {
433
- const res = yield this.baseRequest.get("/wallets/pregen", {
434
- params: { ids: pregenIds, expand: isPortal, userId }
435
- });
436
- return res.data;
437
- });
438
- // POST /wallets/pregen/claim
439
- this.claimPregenWallets = (body) => __async(this, null, function* () {
440
- const res = yield this.baseRequest.post(`/wallets/pregen/claim`, body);
441
- return res.data;
442
- });
443
- this.claimPregenWalletsV2 = (body) => __async(this, null, function* () {
444
- const res = yield this.baseRequest.post(`/wallets/pregen/claim`, body);
445
- return res.data;
446
- });
447
- // POST /users/:userId/wallets/:walletId/transactions/send
448
- this.sendTransaction = (userId, walletId, body) => __async(this, null, function* () {
449
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/send`, body);
450
- return res;
451
- });
452
- // functionality changed to only sign transactions and not send them
453
- // POST /users/:userId/wallets/:walletId/transactions/sign
454
- this.signTransaction = (userId, walletId, body) => __async(this, null, function* () {
455
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/sign`, body);
456
- return res;
457
- });
458
- // POST /users/:userId/wallets/:walletId/refresh
459
- this.refreshKeys = (userId, walletId, oldPartnerId, newPartnerId, keyShareProtocolId) => __async(this, null, function* () {
460
- const body = { oldPartnerId, newPartnerId, keyShareProtocolId };
461
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/refresh`, body);
462
- return res;
463
- });
464
- // PATCH /wallets/pregen/:walletId
465
- this.updatePregenWallet = (walletId, body) => __async(this, null, function* () {
466
- const res = yield this.baseRequest.patch(`/wallets/pregen/${walletId}`, body);
467
- return res.data;
468
- });
469
- // GET /users/:userId/wallets
470
- this.getWallets = (userId, includePartnerData) => __async(this, null, function* () {
471
- const res = yield this.baseRequest.get(
472
- `/users/${userId}/wallets${includePartnerData ? `?includePartnerData=${encodeURIComponent(includePartnerData)}` : ""}`
473
- );
474
- return res;
475
- });
476
- // GET /users/:userId/all-wallets
477
- this.getAllWallets = (userId) => __async(this, null, function* () {
478
- const res = yield this.baseRequest.get(`/users/${userId}/all-wallets`);
479
- return res;
480
- });
481
- // POST /users/:userId/wallets/set
482
- this.setCurrentWalletIds = (userId, walletIds, needsWallet = false, sessionLookupId, newDeviceSessionLookupId) => __async(this, null, function* () {
483
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/set`, {
484
- walletIds,
485
- needsWallet,
486
- sessionLookupId,
487
- newDeviceSessionLookupId
488
- });
489
- return res;
490
- });
491
- // POST /login
492
- this.login = (props) => __async(this, null, function* () {
493
- const body = props;
494
- const res = yield this.baseRequest.post("/login", body);
495
- return res;
496
- });
497
- // POST /login
498
- this.verifyLogin = (verificationCode) => __async(this, null, function* () {
499
- const body = { verificationCode };
500
- const res = yield this.baseRequest.post("/login/verify-email", body);
501
- return res;
502
- });
503
- // GET /logout
504
- this.logout = () => __async(this, null, function* () {
505
- const res = yield this.baseRequest.get("/logout");
506
- return res;
507
- });
508
- // POST /recovery/verification
509
- this.recoveryVerification = (email, verificationCode) => __async(this, null, function* () {
510
- const body = { email, verificationCode };
511
- const res = yield this.baseRequest.post("/recovery/verification", body);
512
- return res;
513
- });
514
- // POST /recovery
515
- this.recoveryInit = (email) => __async(this, null, function* () {
516
- const body = { email };
517
- const res = yield this.baseRequest.post("/recovery", body);
518
- return res;
519
- });
520
- this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
521
- const body = { message, scheme, cosmosSignDoc };
522
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
523
- return res.data;
524
- });
525
- //DELETE /users/:userId
526
- this.deleteSelf = (userId) => __async(this, null, function* () {
527
- const res = yield this.baseRequest.delete(`/users/${userId}`);
528
- return res;
529
- });
530
- // GET /users/:userId/wallets/:walletId/capsule-share
531
- this.getParaShare = (userId, walletId) => __async(this, null, function* () {
532
- const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/capsule-share`);
533
- return res.data.share;
534
- });
535
- // GET /download-backup-kit/:userId
536
- this.getBackupKit = (userId) => __async(this, null, function* () {
537
- const res = yield this.baseRequest.get(`/download-backup-kit/${userId}`, { responseType: "blob" });
538
- return res;
539
- });
540
- // PATCH /users/:userId/biometrics/:biometricId
541
- this.patchSessionPassword = (partnerId, userId, passwordId, body) => __async(this, null, function* () {
542
- const res = yield this.baseRequest.patch(`/users/${userId}/passwords/${passwordId}`, body, {
543
- headers: {
544
- [PARTNER_ID_HEADER_NAME]: partnerId
545
- }
546
- });
547
- return res;
548
- });
549
- const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
550
- const axiosConfig = {
551
- baseURL: userManagementHost,
552
- withCredentials: true,
553
- headers
554
- };
555
- if (retrieveSessionCookie) {
556
- const defaultTransformRequest = Array.isArray(axios.defaults.transformRequest) ? axios.defaults.transformRequest : [axios.defaults.transformRequest];
557
- axiosConfig.transformRequest = [
558
- function(data, headers2) {
559
- const currentSessionCookie = retrieveSessionCookie();
560
- if (currentSessionCookie) {
561
- headers2[SESSION_COOKIE_HEADER_NAME] = currentSessionCookie;
562
- }
563
- if (version) {
564
- headers2[VERSION_HEADER_NAME] = version;
565
- }
566
- return data;
567
- },
568
- ...defaultTransformRequest
569
- ];
570
- }
571
- if (persistSessionCookie) {
572
- const defaultTransformResponse = Array.isArray(axios.defaults.transformResponse) ? axios.defaults.transformResponse : [axios.defaults.transformResponse];
573
- axiosConfig.transformResponse = [
574
- ...defaultTransformResponse,
575
- function(data, headers2, _status) {
576
- if (headers2 == null ? void 0 : headers2[SESSION_COOKIE_HEADER_NAME]) {
577
- persistSessionCookie(headers2[SESSION_COOKIE_HEADER_NAME]);
578
- }
579
- return data;
580
- }
581
- ];
582
- }
583
- this.baseRequest = axios.create(axiosConfig);
584
- if (opts == null ? void 0 : opts.useFetchAdapter) {
585
- axios.defaults.adapter = function(config) {
586
- return fetch(config.baseURL + config.url.substring(1), {
587
- method: config.method,
588
- headers: config.headers,
589
- body: config.data,
590
- credentials: config.withCredentials ? "include" : void 0
591
- }).then(
592
- (response) => response.text().then((text) => ({
593
- data: text,
594
- status: response.status,
595
- statusText: response.statusText,
596
- headers: response.headers,
597
- config,
598
- request: fetch
599
- }))
600
- ).catch(function(reason) {
601
- throw reason;
602
- });
603
- };
604
- }
605
- this.baseRequest.interceptors.response.use(handleResponseSuccess, handleResponseError);
606
- }
607
- // DEPRECATED: use uploadUserKeyShares instead
608
- // POST /users/:userId/wallets/:walletId/key-shares
609
- uploadKeyshares(userId, walletId, encryptedKeyshares) {
610
- return __async(this, null, function* () {
611
- const body = { keyShares: encryptedKeyshares };
612
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/key-shares`, body);
613
- return res;
614
- });
615
- }
616
- // POST /users/:userId/key-shares
617
- uploadUserKeyShares(userId, encryptedKeyshares) {
618
- return __async(this, null, function* () {
619
- const body = { keyShares: encryptedKeyshares };
620
- const res = yield this.baseRequest.post(`/users/${userId}/key-shares`, body);
621
- return res;
622
- });
623
- }
624
- // GET /users/:userId/wallets/:walletId/key-shares
625
- getKeyshare(userId, walletId, type, encryptor) {
626
- return __async(this, null, function* () {
627
- const res = yield this.baseRequest.get(
628
- `/users/${userId}/wallets/${walletId}/key-shares?type=${type}${encryptor ? `&encryptor=${encryptor}` : ""}`
629
- );
630
- return res;
631
- });
632
- }
633
- // GET /users/:userId/biometrics/key-shares
634
- getBiometricKeyshares(userId, biometricPublicKey, getAll) {
635
- return __async(this, null, function* () {
636
- const res = yield this.baseRequest.get(
637
- `/users/${userId}/biometrics/key-shares?publicKey=${biometricPublicKey}&all=${!!getAll}`
638
- );
639
- return res;
640
- });
641
- }
642
- // GET /users/:userId/key-shares
643
- getPasswordKeyshares(userId, passwordId, getAll) {
644
- return __async(this, null, function* () {
645
- const res = yield this.baseRequest.get(
646
- `/users/${userId}/passwords/key-shares?passwordId=${passwordId}&all=${!!getAll}`
647
- );
648
- return res;
649
- });
650
- }
651
- // POST '/users/:userId/temporary-shares',
652
- uploadTransmissionKeyshares(userId, shares) {
653
- return __async(this, null, function* () {
654
- const body = { shares };
655
- const res = yield this.baseRequest.post(`/users/${userId}/temporary-shares`, body);
656
- return res;
657
- });
658
- }
659
- // GET /users/:userId/temporary-shares returns { temporaryShares: { userId: string, walletId: string, encryptedShare: string, encryptedKey?: string }[] }
660
- getTransmissionKeyshares(userId, sessionLookupId) {
661
- return __async(this, null, function* () {
662
- const res = yield this.baseRequest.get(`/users/${userId}/temporary-shares?sessionLookupId=${sessionLookupId}`);
663
- return res;
664
- });
665
- }
666
- // POST '/users/:userId/resend-verification-code
667
- resendVerificationCode(_a) {
668
- return __async(this, null, function* () {
669
- var _b = _a, { userId } = _b, rest = __objRest(_b, ["userId"]);
670
- const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
671
- return res;
672
- });
673
- }
674
- // POST '/users/:userId/resend-verification-code-by-phone
675
- resendVerificationCodeByPhone(_c) {
676
- return __async(this, null, function* () {
677
- var _d = _c, { userId } = _d, rest = __objRest(_d, ["userId"]);
678
- const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
679
- return res;
680
- });
681
- }
682
- // POST recovery/cancel
683
- cancelRecoveryAttempt(email) {
684
- return __async(this, null, function* () {
685
- const res = yield this.baseRequest.post(`/recovery/cancel`, { email });
686
- return res;
687
- });
688
- }
689
- // GET '/2fa/users/:userId/check-status'
690
- check2FAStatus(userId) {
691
- return __async(this, null, function* () {
692
- const res = yield this.baseRequest.get(`/2fa/users/${userId}/check-status`);
693
- return res;
694
- });
695
- }
696
- // POST '/2fa/users/:userId/enable'
697
- enable2FA(userId, verificationCode) {
698
- return __async(this, null, function* () {
699
- const res = yield this.baseRequest.post(`/2fa/users/${userId}/enable`, { verificationCode });
700
- return res;
701
- });
702
- }
703
- // POST '/2fa/users/:userId/setup'
704
- setup2FA(userId) {
705
- return __async(this, null, function* () {
706
- const res = yield this.baseRequest.post(`/2fa/users/${userId}/setup`);
707
- return res;
708
- });
709
- }
710
- setup2FAV2(userId) {
711
- return __async(this, null, function* () {
712
- const res = yield this.baseRequest.post(`/2fa/users/${userId}/setup`);
713
- return res.data;
714
- });
715
- }
716
- // POST /recovery/init
717
- initializeRecovery(email) {
718
- return __async(this, null, function* () {
719
- const res = yield this.baseRequest.post(`/recovery/init`, { email });
720
- return res;
721
- });
722
- }
723
- // POST /auth/farcaster/init
724
- initializeFarcasterLogin() {
725
- return __async(this, null, function* () {
726
- const res = yield this.baseRequest.post(`/auth/farcaster/init`);
727
- return res;
728
- });
729
- }
730
- // POST /auth/farcaster/status
731
- getFarcasterAuthStatus() {
732
- return __async(this, null, function* () {
733
- const res = yield this.baseRequest.post(`/auth/farcaster/status`);
734
- return res;
735
- });
736
- }
737
- getFarcasterAuthStatusV2() {
738
- return __async(this, null, function* () {
739
- const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
740
- return res.data;
741
- });
742
- }
743
- // POST /recovery/init
744
- initializeRecoveryForPhone(phone, countryCode) {
745
- return __async(this, null, function* () {
746
- const res = yield this.baseRequest.post(`/recovery/init`, { phone, countryCode });
747
- return res;
748
- });
749
- }
750
- // POST /recovery/users/:userId/wallets/:walletId/finish
751
- finalizeRecovery(userId, walletId) {
752
- return __async(this, null, function* () {
753
- const res = yield this.baseRequest.post(`/recovery/users/${userId}/wallets/${walletId}/finish`);
754
- return res;
755
- });
756
- }
757
- // GET /recovery/users/:userId/wallets/:walletId/key-shares
758
- recoverUserShares(userId, walletId) {
759
- return __async(this, null, function* () {
760
- const res = yield this.baseRequest.get(`/recovery/users/${userId}/wallets/${walletId}/key-shares?type=USER&encryptor=RECOVERY`);
761
- return res;
762
- });
763
- }
764
- // POST /recovery/verify-email
765
- verifyEmailForRecovery(email, verificationCode) {
766
- return __async(this, null, function* () {
767
- const body = { email, verificationCode };
768
- const res = yield this.baseRequest.post(`/recovery/verify-email`, body);
769
- return res;
770
- });
771
- }
772
- // POST /recovery/verify-identifier
773
- verifyPhoneForRecovery(phone, countryCode, verificationCode) {
774
- return __async(this, null, function* () {
775
- const body = { phone, countryCode, verificationCode };
776
- const res = yield this.baseRequest.post(`/recovery/verify-identifier`, body);
777
- return res;
778
- });
779
- }
780
- // POST /2fa/verify
781
- verify2FA(email, verificationCode) {
782
- return __async(this, null, function* () {
783
- const body = { email, verificationCode };
784
- const res = yield this.baseRequest.post("/2fa/verify", body);
785
- return res;
786
- });
787
- }
788
- verify2FAV2(auth, verificationCode) {
789
- return __async(this, null, function* () {
790
- const body = __spreadProps(__spreadValues({}, auth), { verificationCode });
791
- const res = yield this.baseRequest.post("/2fa/verify", body);
792
- return res.data;
793
- });
794
- }
795
- // POST /2fa/phone/verify
796
- /**
797
- * @deprecated
798
- */
799
- verify2FAForPhone(phone, verificationCode) {
800
- return __async(this, null, function* () {
801
- const body = { phone, verificationCode };
802
- const res = yield this.baseRequest.post("/2fa/verify", body);
803
- return res;
804
- });
805
- }
806
- tempTrasmissionInit(message, userId) {
807
- return __async(this, null, function* () {
808
- const body = { message, userId };
809
- const res = yield this.baseRequest.post("/temporary-transmissions", body);
810
- return res;
811
- });
812
- }
813
- tempTrasmission(id) {
814
- return __async(this, null, function* () {
815
- const res = yield this.baseRequest.get(`/temporary-transmissions/${id}`);
816
- return res;
817
- });
818
- }
819
- getPartner(partnerId) {
820
- return __async(this, null, function* () {
821
- const res = yield this.baseRequest.get(`/partners/${partnerId}`);
822
- return res;
823
- });
824
- }
825
- acceptScopes(userId, walletId, body) {
826
- return __async(this, null, function* () {
827
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/scopes/accept`, body);
828
- return res;
829
- });
830
- }
831
- getPendingTransaction(userId, pendingTransactionId) {
832
- return __async(this, null, function* () {
833
- const res = yield this.baseRequest.get(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
834
- return res;
835
- });
836
- }
837
- acceptPendingTransaction(userId, pendingTransactionId) {
838
- return __async(this, null, function* () {
839
- const res = yield this.baseRequest.post(`/users/${userId}/pending-transactions/${pendingTransactionId}/accept`);
840
- return res;
841
- });
842
- }
843
- getOnRampConfig() {
844
- return __async(this, null, function* () {
845
- const res = yield this.baseRequest.get(`/on-ramp-config`);
846
- return res.data;
847
- });
848
- }
849
- createOnRampPurchase(_e) {
850
- return __async(this, null, function* () {
851
- var _f = _e, {
852
- userId,
853
- params: {
854
- type,
855
- walletType,
856
- address,
857
- provider,
858
- networks,
859
- assets,
860
- defaultNetwork,
861
- defaultAsset,
862
- fiat,
863
- fiatQuantity,
864
- testMode = false
865
- }
866
- } = _f, params = __objRest(_f, [
867
- "userId",
868
- "params"
869
- ]);
870
- const [key, identifier] = extractWalletRef(params);
871
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
872
- const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, {
873
- type,
874
- provider,
875
- walletType,
876
- address,
877
- networks,
878
- assets,
879
- defaultAsset,
880
- defaultNetwork,
881
- fiat,
882
- fiatQuantity,
883
- testMode
884
- });
885
- return res.data;
886
- });
887
- }
888
- updateOnRampPurchase(_g) {
889
- return __async(this, null, function* () {
890
- var _h = _g, {
891
- userId,
892
- purchaseId,
893
- updates
894
- } = _h, params = __objRest(_h, [
895
- "userId",
896
- "purchaseId",
897
- "updates"
898
- ]);
899
- const [key, identifier] = extractWalletRef(params);
900
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
901
- const res = yield this.baseRequest.patch(
902
- `/users/${userId}/${walletString}/purchases/${purchaseId}`,
903
- updates
904
- );
905
- return res.data;
906
- });
907
- }
908
- getOnRampPurchase(_i) {
909
- return __async(this, null, function* () {
910
- var _j = _i, {
911
- userId,
912
- purchaseId
913
- } = _j, params = __objRest(_j, [
914
- "userId",
915
- "purchaseId"
916
- ]);
917
- const [key, identifier] = extractWalletRef(params);
918
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
919
- const res = yield this.baseRequest.get(`/users/${userId}/${walletString}/purchases/${purchaseId}`);
920
- return res;
921
- });
922
- }
923
- signMoonPayUrl(_0, _1) {
924
- return __async(this, arguments, function* (userId, {
925
- url,
926
- type,
927
- cosmosPrefix,
928
- testMode,
929
- walletId,
930
- externalWalletAddress
931
- }) {
932
- const walletString = walletId ? `wallets/${walletId}` : `external-wallets/${externalWalletAddress}`;
933
- const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/moonpay-sign`, {
934
- url,
935
- type,
936
- cosmosPrefix,
937
- testMode
938
- });
939
- return res;
940
- });
941
- }
942
- generateOffRampTx(_0, _1) {
943
- return __async(this, arguments, function* (userId, {
944
- provider,
945
- chainId,
946
- contractAddress,
947
- testMode,
948
- walletId,
949
- walletType,
950
- destinationAddress,
951
- sourceAddress,
952
- assetQuantity
953
- }) {
954
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-generate`, {
955
- provider,
956
- testMode,
957
- chainId,
958
- contractAddress,
959
- walletId,
960
- walletType,
961
- destinationAddress,
962
- sourceAddress,
963
- assetQuantity
964
- });
965
- return res.data;
966
- });
967
- }
968
- sendOffRampTx(_0, _1) {
969
- return __async(this, arguments, function* (userId, {
970
- tx,
971
- signature,
972
- network,
973
- walletId,
974
- walletType
975
- }) {
976
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-send`, {
977
- tx,
978
- signature,
979
- network,
980
- walletType
981
- });
982
- return res.data;
983
- });
984
- }
985
- distributeParaShare(_k) {
986
- return __async(this, null, function* () {
987
- var _l = _k, {
988
- userId,
989
- walletId
990
- } = _l, rest = __objRest(_l, [
991
- "userId",
992
- "walletId"
993
- ]);
994
- const body = rest;
995
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body);
996
- return res;
997
- });
998
- }
999
- keepSessionAlive(userId) {
1000
- return __async(this, null, function* () {
1001
- const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`);
1002
- return res.data;
1003
- });
1004
- }
1005
- persistRecoveryPublicKeys(userId, publicKeys) {
1006
- return __async(this, null, function* () {
1007
- const res = yield this.baseRequest.post(`/users/${userId}/recovery-public-keys`, { publicKeys });
1008
- return res.data;
1009
- });
1010
- }
1011
- getRecoveryPublicKeys(userId) {
1012
- return __async(this, null, function* () {
1013
- const res = yield this.baseRequest.get(`/users/${userId}/recovery-public-keys`);
1014
- return res.data;
1015
- });
1016
- }
1017
- uploadEncryptedWalletPrivateKey(userId, encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId) {
1018
- return __async(this, null, function* () {
1019
- const body = { encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId };
1020
- const res = yield this.baseRequest.post(`/users/${userId}/encrypted-wallet-private-keys`, body);
1021
- return res.data;
1022
- });
1023
- }
1024
- getEncryptedWalletPrivateKeys(userId, encryptionKeyHash) {
1025
- return __async(this, null, function* () {
1026
- const res = yield this.baseRequest.get(`/users/${userId}/encrypted-wallet-private-keys/${encryptionKeyHash}`);
1027
- return res.data;
1028
- });
1029
- }
1030
- getConversionRate(chainId, symbol, currency) {
1031
- return __async(this, null, function* () {
1032
- const params = { symbol, currency };
1033
- const res = yield this.baseRequest.get(`/chains/${chainId}/conversion-rate`, { params });
1034
- return res.data;
1035
- });
1036
- }
1037
- getGasEstimate(chainId, totalGasPrice) {
1038
- return __async(this, null, function* () {
1039
- const params = { totalGasPrice };
1040
- const res = yield this.baseRequest.get(`/chains/${chainId}/gas-estimate`, { params });
1041
- return res.data;
1042
- });
1043
- }
1044
- getGasOracle(chainId) {
1045
- return __async(this, null, function* () {
1046
- const res = yield this.baseRequest.get(`/chains/${chainId}/gas-oracle`);
1047
- return res.data;
1048
- });
1049
- }
1050
- // GET /users/:userId/wallets/:walletId/refresh-done
1051
- isRefreshDone(userId, walletId, partnerId, protocolId) {
1052
- return __async(this, null, function* () {
1053
- const queryParams = {};
1054
- if (partnerId) queryParams["partnerId"] = partnerId;
1055
- if (protocolId) queryParams["protocolId"] = protocolId;
1056
- const query = qs.stringify(queryParams);
1057
- const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/refresh-done?${query}`);
1058
- return res.data;
1059
- });
1060
- }
1061
- deletePendingTransaction(userId, pendingTransactionId) {
1062
- return __async(this, null, function* () {
1063
- const res = yield this.baseRequest.delete(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
1064
- return res.data;
1065
- });
1066
- }
1067
- // POST /users/:userId/passwords/key
1068
- addSessionPasswordPublicKey(userId, body) {
1069
- return __async(this, null, function* () {
1070
- const res = yield this.baseRequest.post(`/users/${userId}/passwords/key`, body);
1071
- return res;
1072
- });
1073
- }
1074
- getSupportedAuthMethods(auth) {
1075
- return __async(this, null, function* () {
1076
- const res = yield this.baseRequest.get("/users/supported-auth-methods", {
1077
- params: __spreadValues({}, auth)
1078
- });
1079
- return res.data;
1080
- });
1081
- }
1082
- getPasswords(auth) {
1083
- return __async(this, null, function* () {
1084
- const res = yield this.baseRequest.get("/users/passwords", {
1085
- params: __spreadValues({}, auth)
1086
- });
1087
- return res.data.passwords;
1088
- });
1089
- }
1090
- // POST /passwords/verify
1091
- verifyPasswordChallenge(partnerId, body) {
1092
- return __async(this, null, function* () {
1093
- const res = yield this.baseRequest.post(`/passwords/verify`, body, {
1094
- headers: {
1095
- [PARTNER_ID_HEADER_NAME]: partnerId
1096
- }
1097
- });
1098
- return res;
1099
- });
1100
- }
1101
- getEncryptedWalletPrivateKey(passwordId) {
1102
- return __async(this, null, function* () {
1103
- const queryParams = {};
1104
- queryParams["passwordId"] = passwordId;
1105
- const query = qs.stringify(queryParams);
1106
- const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
1107
- return res;
1108
- });
1109
- }
1110
- // GET /users/:userId
1111
- getUser(userId) {
1112
- return __async(this, null, function* () {
1113
- const res = yield this.baseRequest.get(`/users/${userId}`);
1114
- return res.data;
1115
- });
1116
- }
1117
- };
1118
- var client_default = Client;
1119
-
1120
- // src/types/auth.ts
1121
- var AUTH_TYPES = [
1122
- "email",
1123
- "phone",
1124
- "phoneLegacy",
1125
- "farcaster",
1126
- "telegram",
1127
- "userId",
1128
- "externalWallet",
1129
- "discord",
1130
- "x",
1131
- "customId"
1132
- ];
1133
- var EncryptorType = /* @__PURE__ */ ((EncryptorType2) => {
1134
- EncryptorType2["USER"] = "USER";
1135
- EncryptorType2["RECOVERY"] = "RECOVERY";
1136
- EncryptorType2["BIOMETRICS"] = "BIOMETRICS";
1137
- EncryptorType2["PASSWORD"] = "PASSWORD";
1138
- return EncryptorType2;
1139
- })(EncryptorType || {});
1140
- var KeyShareType = /* @__PURE__ */ ((KeyShareType2) => {
1141
- KeyShareType2["USER"] = "USER";
1142
- KeyShareType2["RECOVERY"] = "RECOVERY";
1143
- return KeyShareType2;
1144
- })(KeyShareType || {});
1145
- var PasswordStatus = /* @__PURE__ */ ((PasswordStatus2) => {
1146
- PasswordStatus2["PENDING"] = "PENDING";
1147
- PasswordStatus2["COMPLETE"] = "COMPLETE";
1148
- return PasswordStatus2;
1149
- })(PasswordStatus || {});
1150
- var PublicKeyStatus = /* @__PURE__ */ ((PublicKeyStatus2) => {
1151
- PublicKeyStatus2["PENDING"] = "PENDING";
1152
- PublicKeyStatus2["COMPLETE"] = "COMPLETE";
1153
- return PublicKeyStatus2;
1154
- })(PublicKeyStatus || {});
1155
- var PublicKeyType = /* @__PURE__ */ ((PublicKeyType2) => {
1156
- PublicKeyType2["MOBILE"] = "MOBILE";
1157
- PublicKeyType2["WEB"] = "WEB";
1158
- return PublicKeyType2;
1159
- })(PublicKeyType || {});
1160
- var OAuthMethod = /* @__PURE__ */ ((OAuthMethod2) => {
1161
- OAuthMethod2["GOOGLE"] = "GOOGLE";
1162
- OAuthMethod2["TWITTER"] = "TWITTER";
1163
- OAuthMethod2["APPLE"] = "APPLE";
1164
- OAuthMethod2["DISCORD"] = "DISCORD";
1165
- OAuthMethod2["FACEBOOK"] = "FACEBOOK";
1166
- OAuthMethod2["FARCASTER"] = "FARCASTER";
1167
- OAuthMethod2["TELEGRAM"] = "TELEGRAM";
1168
- return OAuthMethod2;
1169
- })(OAuthMethod || {});
1170
- var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
1171
- AuthMethod2["PASSWORD"] = "PASSWORD";
1172
- AuthMethod2["PASSKEY"] = "PASSKEY";
1173
- return AuthMethod2;
1174
- })(AuthMethod || {});
1175
-
1176
- // src/types/email.ts
1177
- var EmailTheme = /* @__PURE__ */ ((EmailTheme2) => {
1178
- EmailTheme2["LIGHT"] = "light";
1179
- EmailTheme2["DARK"] = "dark";
1180
- return EmailTheme2;
1181
- })(EmailTheme || {});
1182
-
1183
- // src/types/onRamp.ts
1184
- var OnRampProvider = /* @__PURE__ */ ((OnRampProvider2) => {
1185
- OnRampProvider2["RAMP"] = "RAMP";
1186
- OnRampProvider2["STRIPE"] = "STRIPE";
1187
- OnRampProvider2["MOONPAY"] = "MOONPAY";
1188
- return OnRampProvider2;
1189
- })(OnRampProvider || {});
1190
- var OnRampAsset = /* @__PURE__ */ ((OnRampAsset2) => {
1191
- OnRampAsset2["ETHEREUM"] = "ETHEREUM";
1192
- OnRampAsset2["USDC"] = "USDC";
1193
- OnRampAsset2["TETHER"] = "TETHER";
1194
- OnRampAsset2["POLYGON"] = "POLYGON";
1195
- OnRampAsset2["SOLANA"] = "SOLANA";
1196
- OnRampAsset2["ATOM"] = "ATOM";
1197
- OnRampAsset2["CELO"] = "CELO";
1198
- OnRampAsset2["CUSD"] = "CUSD";
1199
- OnRampAsset2["CEUR"] = "CEUR";
1200
- OnRampAsset2["CREAL"] = "CREAL";
1201
- return OnRampAsset2;
1202
- })(OnRampAsset || {});
1203
- var OnRampPurchaseStatus = /* @__PURE__ */ ((OnRampPurchaseStatus2) => {
1204
- OnRampPurchaseStatus2["INITIATED"] = "INITIATED";
1205
- OnRampPurchaseStatus2["FINISHED"] = "FINISHED";
1206
- OnRampPurchaseStatus2["CANCELLED"] = "CANCELLED";
1207
- return OnRampPurchaseStatus2;
1208
- })(OnRampPurchaseStatus || {});
1209
- var OnRampPurchaseType = /* @__PURE__ */ ((OnRampPurchaseType2) => {
1210
- OnRampPurchaseType2["BUY"] = "BUY";
1211
- OnRampPurchaseType2["SELL"] = "SELL";
1212
- return OnRampPurchaseType2;
1213
- })(OnRampPurchaseType || {});
1214
-
1215
- // src/types/wallet.ts
1216
- var WalletScheme = /* @__PURE__ */ ((WalletScheme2) => {
1217
- WalletScheme2["DKLS"] = "DKLS";
1218
- WalletScheme2["CGGMP"] = "CGGMP";
1219
- WalletScheme2["ED25519"] = "ED25519";
1220
- return WalletScheme2;
1221
- })(WalletScheme || {});
1222
- var WalletType = /* @__PURE__ */ ((WalletType2) => {
1223
- WalletType2["EVM"] = "EVM";
1224
- WalletType2["SOLANA"] = "SOLANA";
1225
- WalletType2["COSMOS"] = "COSMOS";
1226
- return WalletType2;
1227
- })(WalletType || {});
1228
- var Chain = /* @__PURE__ */ ((Chain2) => {
1229
- Chain2["ETH"] = "ETH";
1230
- Chain2["CELO"] = "CELO";
1231
- Chain2["MATIC"] = "MATIC";
1232
- return Chain2;
1233
- })(Chain || {});
1234
- var Network = /* @__PURE__ */ ((Network2) => {
1235
- Network2["ETHEREUM"] = "ETHEREUM";
1236
- Network2["SEPOLIA"] = "SEPOLIA";
1237
- Network2["ARBITRUM"] = "ARBITRUM";
1238
- Network2["BASE"] = "BASE";
1239
- Network2["OPTIMISM"] = "OPTIMISM";
1240
- Network2["POLYGON"] = "POLYGON";
1241
- Network2["SOLANA"] = "SOLANA";
1242
- Network2["COSMOS"] = "COSMOS";
1243
- Network2["CELO"] = "CELO";
1244
- Network2["NOBLE"] = "NOBLE";
1245
- return Network2;
1246
- })(Network || {});
1247
- var PREGEN_IDENTIFIER_TYPES = [
1248
- "EMAIL",
1249
- "PHONE",
1250
- "CUSTOM_ID",
1251
- "DISCORD",
1252
- "TWITTER",
1253
- "TELEGRAM",
1254
- "FARCASTER"
1255
- ];
1256
- var NON_ED25519 = ["DKLS" /* DKLS */, "CGGMP" /* CGGMP */];
1257
-
1258
- // src/index.ts
1259
- var src_default = client_default;
1
+ import "./chunk-BBZEL7EG.js";
2
+ export * from "./client.js";
3
+ export * from "./types/index.js";
4
+ export * from "./utils.js";
5
+ export * from "./error.js";
6
+ import Client from "./client.js";
7
+ var src_default = Client;
1260
8
  export {
1261
- AUTH_TYPES,
1262
- AuthMethod,
1263
- Chain,
1264
- EmailTheme,
1265
- EncryptorType,
1266
- KeyShareType,
1267
- NON_ED25519,
1268
- Network,
1269
- OAuthMethod,
1270
- OnRampAsset,
1271
- OnRampProvider,
1272
- OnRampPurchaseStatus,
1273
- OnRampPurchaseType,
1274
- PREGEN_IDENTIFIER_TYPES,
1275
- ParaApiError,
1276
- PasswordStatus,
1277
- PublicKeyStatus,
1278
- PublicKeyType,
1279
- WalletScheme,
1280
- WalletType,
1281
- src_default as default,
1282
- extractAuthInfo,
1283
- extractWalletRef,
1284
- handleResponseError,
1285
- handleResponseSuccess,
1286
- isCustomId,
1287
- isDiscord,
1288
- isEmail,
1289
- isExternalWallet,
1290
- isExternalWalletAddress,
1291
- isFarcaster,
1292
- isPhone,
1293
- isPhoneLegacy,
1294
- isPregenAuth,
1295
- isPrimary,
1296
- isTelegram,
1297
- isUserId,
1298
- isVerifiedAuth,
1299
- isWalletId,
1300
- isX,
1301
- toPregenIds,
1302
- toPregenTypeAndId
9
+ src_default as default
1303
10
  };