@getpara/core-sdk 1.7.1 → 2.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +471 -400
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js +479 -400
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/types/ParaCore.d.ts +35 -73
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/external/userManagementClient.d.ts +1 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/types/config.d.ts +1 -19
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/{params.d.ts → methods.d.ts} +17 -3
- package/dist/types/types/wallet.d.ts +2 -3
- package/dist/types/utils/autobind.d.ts +1 -0
- package/dist/types/utils/formatting.d.ts +0 -2
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/json.d.ts +1 -0
- package/dist/types/utils/phone.d.ts +7 -0
- package/dist/types/utils/wallet.d.ts +3 -2
- package/package.json +3 -3
- package/dist/cjs/package.json +0 -3
- package/dist/esm/package.json +0 -4
package/dist/esm/index.js.br
CHANGED
|
Binary file
|
package/dist/esm/index.js.gz
CHANGED
|
Binary file
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AuthMethod, BackupKitEmailProps, CurrentWalletIds, EmailTheme, WalletEntity, WalletType, WalletParams, OAuthMethod, OnRampPurchaseCreateParams, OnRampPurchase, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth, SupportedWalletTypes, AuthIdentifier, ExternalWalletLoginRes, SessionInfo, PrimaryAuth, PrimaryAuthType } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet,
|
|
3
|
+
import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, PortalUrlOptions, ConstructorOpts, RecoveryStatus, CoreAuthInfo, AuthExtras, VerifyExternalWallet, ExternalWalletConnectionType } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
|
-
import { CountryCallingCode } from 'libphonenumber-js';
|
|
6
5
|
export declare abstract class ParaCore {
|
|
7
6
|
#private;
|
|
8
7
|
static version?: string;
|
|
9
8
|
ctx: Ctx;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
farcasterUsername
|
|
14
|
-
telegramUserId
|
|
9
|
+
get authInfo(): CoreAuthInfo | undefined;
|
|
10
|
+
get email(): AuthIdentifier<'email'> | undefined;
|
|
11
|
+
get phone(): AuthIdentifier<'phone'> | undefined;
|
|
12
|
+
get farcasterUsername(): AuthIdentifier<'farcaster'> | undefined;
|
|
13
|
+
get telegramUserId(): AuthIdentifier<'telegram'> | undefined;
|
|
14
|
+
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
15
|
+
get externalWalletConnectionType(): ExternalWalletConnectionType;
|
|
15
16
|
userId?: string;
|
|
16
17
|
private sessionCookie?;
|
|
17
18
|
private isAwaitingAccountCreation;
|
|
@@ -22,8 +23,8 @@ export declare abstract class ParaCore {
|
|
|
22
23
|
get isPhone(): boolean;
|
|
23
24
|
get isFarcaster(): boolean;
|
|
24
25
|
get isTelegram(): boolean;
|
|
25
|
-
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
26
26
|
get isExternalWalletAuth(): boolean;
|
|
27
|
+
get partnerId(): string | undefined;
|
|
27
28
|
/**
|
|
28
29
|
* The IDs of the currently active wallets, for each supported wallet type. Any signer integrations will default to the first viable wallet ID in this dictionary.
|
|
29
30
|
*/
|
|
@@ -114,10 +115,12 @@ export declare abstract class ParaCore {
|
|
|
114
115
|
portalTheme?: Theme;
|
|
115
116
|
private disableProviderModal?;
|
|
116
117
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
118
|
+
get cosmosPrefix(): string | undefined;
|
|
117
119
|
get isWalletTypeEnabled(): Partial<Record<WalletType, boolean>>;
|
|
118
120
|
private platformUtils;
|
|
119
121
|
private localStorageGetItem;
|
|
120
122
|
private localStorageSetItem;
|
|
123
|
+
private localStorageRemoveItem;
|
|
121
124
|
private sessionStorageGetItem;
|
|
122
125
|
private sessionStorageSetItem;
|
|
123
126
|
private sessionStorageRemoveItem;
|
|
@@ -168,20 +171,16 @@ export declare abstract class ParaCore {
|
|
|
168
171
|
* @param opts - Additional constructor options; see `ConstructorOpts`.
|
|
169
172
|
* @returns - A new ParaCore instance.
|
|
170
173
|
*/
|
|
171
|
-
constructor(env: Environment, apiKey
|
|
174
|
+
constructor(env: Environment, apiKey: string, opts?: ConstructorOpts);
|
|
172
175
|
private initializeFromStorage;
|
|
173
|
-
private
|
|
176
|
+
private updateAuthInfoFromStorage;
|
|
174
177
|
private updateUserIdFromStorage;
|
|
175
|
-
private updatePhoneFromStorage;
|
|
176
|
-
private updateCountryCodeFromStorage;
|
|
177
|
-
private updateEmailFromStorage;
|
|
178
178
|
private updateWalletsFromStorage;
|
|
179
179
|
private updateWalletIdsFromStorage;
|
|
180
180
|
private updateSessionCookieFromStorage;
|
|
181
181
|
private updateLoginEncryptionKeyPairFromStorage;
|
|
182
182
|
private updateExternalWalletsFromStorage;
|
|
183
|
-
touchSession(regenerate?: boolean): Promise<
|
|
184
|
-
private setSupportedWalletTypes;
|
|
183
|
+
touchSession(regenerate?: boolean): Promise<SessionInfo>;
|
|
185
184
|
private getVerificationEmailProps;
|
|
186
185
|
private getBackupKitEmailProps;
|
|
187
186
|
/**
|
|
@@ -190,6 +189,10 @@ export declare abstract class ParaCore {
|
|
|
190
189
|
* Init only needs to be called for storage that is async.
|
|
191
190
|
*/
|
|
192
191
|
init(): Promise<void>;
|
|
192
|
+
protected setAuth(auth: PrimaryAuth, { extras, userId }?: {
|
|
193
|
+
extras?: AuthExtras;
|
|
194
|
+
userId?: string;
|
|
195
|
+
}): Promise<typeof this.authInfo>;
|
|
193
196
|
/**
|
|
194
197
|
* Sets the email associated with the `ParaCore` instance.
|
|
195
198
|
* @param email - Email to set.
|
|
@@ -205,7 +208,7 @@ export declare abstract class ParaCore {
|
|
|
205
208
|
* @param phone - Phone number to set.
|
|
206
209
|
* @param countryCode - Country Code to set.
|
|
207
210
|
*/
|
|
208
|
-
setPhoneNumber(phone: string, countryCode
|
|
211
|
+
setPhoneNumber(phone: `+${number}` | string, countryCode?: string): Promise<void>;
|
|
209
212
|
/**
|
|
210
213
|
* Sets the farcaster username associated with the `ParaCore` instance.
|
|
211
214
|
* @param farcasterUsername - Farcaster Username to set.
|
|
@@ -248,19 +251,11 @@ export declare abstract class ParaCore {
|
|
|
248
251
|
* @returns - email associated with the `ParaCore` instance.
|
|
249
252
|
*/
|
|
250
253
|
getEmail(): string | undefined;
|
|
251
|
-
/**
|
|
252
|
-
* Gets the phone object associated with the `ParaCore` instance.
|
|
253
|
-
* @returns - phone object with phone number and country code associated with the `ParaCore` instance.
|
|
254
|
-
*/
|
|
255
|
-
getPhone(): {
|
|
256
|
-
phone?: string;
|
|
257
|
-
countryCode?: string;
|
|
258
|
-
};
|
|
259
254
|
/**
|
|
260
255
|
* Gets the formatted phone number associated with the `ParaCore` instance.
|
|
261
256
|
* @returns - formatted phone number associated with the `ParaCore` instance.
|
|
262
257
|
*/
|
|
263
|
-
getPhoneNumber():
|
|
258
|
+
getPhoneNumber(): `+${number}` | undefined;
|
|
264
259
|
/**
|
|
265
260
|
* Gets the farcaster username associated with the `ParaCore` instance.
|
|
266
261
|
* @returns - farcaster username associated with the `ParaCore` instance.
|
|
@@ -271,16 +266,6 @@ export declare abstract class ParaCore {
|
|
|
271
266
|
sessionLookupId?: string;
|
|
272
267
|
newDeviceSessionLookupId?: string;
|
|
273
268
|
}): Promise<void>;
|
|
274
|
-
/**
|
|
275
|
-
* Fetches the most recent OAuth account metadata for the signed-in user.
|
|
276
|
-
* If applicable, this will include the user's most recent metadata from their Google, Apple, Facebook, X, Discord, Farcaster, or Telegram account, the last time they signed in to your app.
|
|
277
|
-
* @returns {Promise<AccountMetadata>} the user's account metadata.
|
|
278
|
-
*/
|
|
279
|
-
getAccountMetadata(): Promise<AccountMetadata>;
|
|
280
|
-
/**
|
|
281
|
-
* The prefix for the instance's managed Cosmos wallets. Defaults to `'cosmos'`.
|
|
282
|
-
*/
|
|
283
|
-
cosmosPrefix?: string;
|
|
284
269
|
/**
|
|
285
270
|
* Validates that a wallet ID is present on the instance, usable, and matches the desired filters.
|
|
286
271
|
* If no ID is passed, this will instead return the first valid, usable wallet ID that matches the filters.
|
|
@@ -315,7 +300,7 @@ export declare abstract class ParaCore {
|
|
|
315
300
|
* @param partnerId: string - id of the partner to get the portal URL for
|
|
316
301
|
* @returns - portal URL
|
|
317
302
|
*/
|
|
318
|
-
protected getPortalURL(
|
|
303
|
+
protected getPortalURL(): Promise<string>;
|
|
319
304
|
private getWebAuthURLForCreate;
|
|
320
305
|
private getPasswordURLForCreate;
|
|
321
306
|
private getShortUrl;
|
|
@@ -367,10 +352,7 @@ export declare abstract class ParaCore {
|
|
|
367
352
|
* @param {string} opts.countryCode - the country code.
|
|
368
353
|
* @returns true if user exists, false otherwise.
|
|
369
354
|
*/
|
|
370
|
-
checkIfUserExistsByPhone(
|
|
371
|
-
phone: string;
|
|
372
|
-
countryCode: string;
|
|
373
|
-
}): Promise<boolean>;
|
|
355
|
+
checkIfUserExistsByPhone(auth: Auth<'phone'>): Promise<boolean>;
|
|
374
356
|
/**
|
|
375
357
|
* Creates a new user.
|
|
376
358
|
* @param {Object} opts the options object
|
|
@@ -383,7 +365,7 @@ export declare abstract class ParaCore {
|
|
|
383
365
|
* @param {string} opts.phone - the phone number to use for creating the user.
|
|
384
366
|
* @param {string} opts.countryCode - the country code to use for creating the user.
|
|
385
367
|
*/
|
|
386
|
-
createUserByPhone(
|
|
368
|
+
createUserByPhone(auth: Auth<'phone'>): Promise<void>;
|
|
387
369
|
/**
|
|
388
370
|
* Logs in or creates a new user using an external wallet address.
|
|
389
371
|
* @param {Object} opts the options object
|
|
@@ -392,10 +374,6 @@ export declare abstract class ParaCore {
|
|
|
392
374
|
* @param {string} opts.provider the name of the provider for the external wallet.
|
|
393
375
|
*/
|
|
394
376
|
externalWalletLogin(wallet: ExternalWalletInfo): Promise<ExternalWalletLoginRes>;
|
|
395
|
-
/**
|
|
396
|
-
* Returns whether or not the user is connected with only an external wallet, not an external wallet with Para auth.
|
|
397
|
-
*/
|
|
398
|
-
protected isUsingExternalWallet(): boolean;
|
|
399
377
|
/**
|
|
400
378
|
* Passes the email code obtained from the user for verification.
|
|
401
379
|
* @param {Object} opts the options object
|
|
@@ -405,12 +383,7 @@ export declare abstract class ParaCore {
|
|
|
405
383
|
verifyEmail({ verificationCode }: {
|
|
406
384
|
verificationCode: string;
|
|
407
385
|
}): Promise<string>;
|
|
408
|
-
verifyExternalWallet({ address, signedMessage, cosmosPublicKeyHex, cosmosSigner, }:
|
|
409
|
-
address: string;
|
|
410
|
-
signedMessage: string;
|
|
411
|
-
cosmosPublicKeyHex?: string;
|
|
412
|
-
cosmosSigner?: string;
|
|
413
|
-
}): Promise<string>;
|
|
386
|
+
verifyExternalWallet({ address, signedMessage, cosmosPublicKeyHex, cosmosSigner, }: VerifyExternalWallet): Promise<string>;
|
|
414
387
|
/**
|
|
415
388
|
* Passes the phone code obtained from the user for verification.
|
|
416
389
|
* @param {Object} opts the options object
|
|
@@ -451,9 +424,7 @@ export declare abstract class ParaCore {
|
|
|
451
424
|
* @param {string} opts.verificationCode - verification code to received via 2FA.
|
|
452
425
|
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
453
426
|
*/
|
|
454
|
-
verify2FAForPhone({ phone,
|
|
455
|
-
phone: string;
|
|
456
|
-
countryCode: string;
|
|
427
|
+
verify2FAForPhone({ phone, verificationCode, }: Auth<'phone'> & {
|
|
457
428
|
verificationCode: string;
|
|
458
429
|
}): Promise<{
|
|
459
430
|
initiatedAt?: Date;
|
|
@@ -525,13 +496,12 @@ export declare abstract class ParaCore {
|
|
|
525
496
|
* @returns `true` if active, `false` otherwise
|
|
526
497
|
**/
|
|
527
498
|
isFullyLoggedIn(): Promise<boolean>;
|
|
528
|
-
protected supportedAuthMethods(auth: Auth): Promise<Set<AuthMethod>>;
|
|
499
|
+
protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
|
|
529
500
|
/**
|
|
530
501
|
* Get hints associated with the users stored biometrics.
|
|
531
502
|
* @returns Array containing useragents and AAGuids for stored biometrics
|
|
532
503
|
*/
|
|
533
504
|
protected getUserBiometricLocationHints(): Promise<BiometricLocationHint[]>;
|
|
534
|
-
private setAuth;
|
|
535
505
|
/**
|
|
536
506
|
* Initiates a login.
|
|
537
507
|
* @param {Object} opts the options object
|
|
@@ -539,7 +509,7 @@ export declare abstract class ParaCore {
|
|
|
539
509
|
* @param {boolean} opts.useShortURL - whether to shorten the link
|
|
540
510
|
* @returns - the WebAuth URL for logging in
|
|
541
511
|
**/
|
|
542
|
-
initiateUserLogin({ useShortUrl, ...auth }:
|
|
512
|
+
initiateUserLogin({ useShortUrl, ...auth }: PrimaryAuth & {
|
|
543
513
|
useShortUrl?: boolean;
|
|
544
514
|
}): Promise<string>;
|
|
545
515
|
/**
|
|
@@ -547,7 +517,7 @@ export declare abstract class ParaCore {
|
|
|
547
517
|
* @param email - the email to login with
|
|
548
518
|
* @returns - a set of supported auth methods for the user
|
|
549
519
|
**/
|
|
550
|
-
initiateUserLoginV2(auth:
|
|
520
|
+
initiateUserLoginV2(auth: PrimaryAuth): Promise<Set<AuthMethod>>;
|
|
551
521
|
/**
|
|
552
522
|
* Initiates a login.
|
|
553
523
|
* @param opts the options object
|
|
@@ -563,7 +533,7 @@ export declare abstract class ParaCore {
|
|
|
563
533
|
* Waits for the session to be active.
|
|
564
534
|
**/
|
|
565
535
|
waitForAccountCreation({ popupWindow }?: {
|
|
566
|
-
popupWindow?: Window;
|
|
536
|
+
popupWindow?: Window | null;
|
|
567
537
|
}): Promise<boolean>;
|
|
568
538
|
waitForPasskeyAndCreateWallet({ popupWindow, }?: {
|
|
569
539
|
popupWindow?: Window;
|
|
@@ -580,6 +550,7 @@ export declare abstract class ParaCore {
|
|
|
580
550
|
* @return {Object} `{userExists: boolean; username: string; pfpUrl?: string | null }` - the user's information and whether the user already exists.
|
|
581
551
|
*/
|
|
582
552
|
waitForFarcasterStatus(): Promise<{
|
|
553
|
+
userId: string;
|
|
583
554
|
userExists: boolean;
|
|
584
555
|
username: string;
|
|
585
556
|
pfpUrl?: string | null;
|
|
@@ -605,7 +576,7 @@ export declare abstract class ParaCore {
|
|
|
605
576
|
* @return {Object} `{ email?: string; isError?: boolean; userExists: boolean; }` the result data
|
|
606
577
|
*/
|
|
607
578
|
waitForOAuth({ popupWindow }?: {
|
|
608
|
-
popupWindow?: Window;
|
|
579
|
+
popupWindow?: Window | null;
|
|
609
580
|
}): Promise<{
|
|
610
581
|
email?: string;
|
|
611
582
|
isError?: boolean;
|
|
@@ -620,7 +591,7 @@ export declare abstract class ParaCore {
|
|
|
620
591
|
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
621
592
|
**/
|
|
622
593
|
waitForLoginAndSetup({ popupWindow, skipSessionRefresh, }?: {
|
|
623
|
-
popupWindow?: Window;
|
|
594
|
+
popupWindow?: Window | null;
|
|
624
595
|
skipSessionRefresh?: boolean;
|
|
625
596
|
}): Promise<LoginResponse>;
|
|
626
597
|
/**
|
|
@@ -638,13 +609,7 @@ export declare abstract class ParaCore {
|
|
|
638
609
|
* Call this method after login to ensure that the user ID is set
|
|
639
610
|
* internally.
|
|
640
611
|
**/
|
|
641
|
-
protected userSetupAfterLogin(): Promise<
|
|
642
|
-
data: {
|
|
643
|
-
partnerId?: string;
|
|
644
|
-
needsWallet?: boolean;
|
|
645
|
-
sessionLookupId: string;
|
|
646
|
-
};
|
|
647
|
-
}>;
|
|
612
|
+
protected userSetupAfterLogin(): Promise<SessionInfo>;
|
|
648
613
|
/**
|
|
649
614
|
* Get transmission shares associated with session.
|
|
650
615
|
* @param {Object} opts the options object.
|
|
@@ -914,12 +879,9 @@ export declare abstract class ParaCore {
|
|
|
914
879
|
keepSessionAlive(): Promise<boolean>;
|
|
915
880
|
/**
|
|
916
881
|
* Serialize the current session for import by another Para instance.
|
|
917
|
-
* @param {boolean} excludeSigners - whether or not to exclude the signer from the exported wallets.
|
|
918
882
|
* @returns {string} the serialized session
|
|
919
883
|
*/
|
|
920
|
-
exportSession(
|
|
921
|
-
excludeSigners?: boolean;
|
|
922
|
-
}): string;
|
|
884
|
+
exportSession(): string;
|
|
923
885
|
/**
|
|
924
886
|
* Imports a session serialized by another Para instance.
|
|
925
887
|
* @param {string} serializedInstanceBase64 the serialized session
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare const PARA_CORE_VERSION: string;
|
|
2
2
|
export declare const PREFIX = "@CAPSULE/";
|
|
3
|
+
export declare const LOCAL_STORAGE_AUTH_INFO: string;
|
|
3
4
|
export declare const LOCAL_STORAGE_EMAIL: string;
|
|
4
5
|
export declare const LOCAL_STORAGE_PHONE: string;
|
|
5
6
|
export declare const LOCAL_STORAGE_COUNTRY_CODE: string;
|
|
6
7
|
export declare const LOCAL_STORAGE_FARCASTER_USERNAME: string;
|
|
7
8
|
export declare const LOCAL_STORAGE_TELEGRAM_USER_ID: string;
|
|
8
|
-
export declare const LOCAL_STORAGE_EXTERNAL_WALLET_USER_ID: string;
|
|
9
9
|
export declare const LOCAL_STORAGE_USER_ID: string;
|
|
10
10
|
export declare const LOCAL_STORAGE_ED25519_WALLETS: string;
|
|
11
11
|
export declare const LOCAL_STORAGE_WALLETS: string;
|
|
@@ -6,7 +6,7 @@ export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: bo
|
|
|
6
6
|
export declare function initClient({ env, version, apiKey, partnerId, useFetchAdapter, retrieveSessionCookie, persistSessionCookie, }: {
|
|
7
7
|
env: Environment;
|
|
8
8
|
version?: string;
|
|
9
|
-
apiKey
|
|
9
|
+
apiKey: string;
|
|
10
10
|
partnerId?: string;
|
|
11
11
|
useFetchAdapter?: boolean;
|
|
12
12
|
retrieveSessionCookie?: () => string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
|
-
export { AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
|
|
3
|
-
export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, } from './types/index.js';
|
|
2
|
+
export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
|
|
3
|
+
export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthExtras, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, } from './types/index.js';
|
|
4
4
|
export * from './types/events.js';
|
|
5
5
|
export * from './types/config.js';
|
|
6
|
-
export { getPortalDomain,
|
|
6
|
+
export { getPortalDomain, entityToWallet } from './utils/index.js';
|
|
7
7
|
export { PREFIX as STORAGE_PREFIX } from './constants.js';
|
|
8
8
|
export { distributeNewShare } from './shares/shareDistribution.js';
|
|
9
9
|
export { KeyContainer } from './shares/KeyContainer.js';
|
|
@@ -16,6 +16,7 @@ export * from './external/userManagementClient.js';
|
|
|
16
16
|
export * from './errors.js';
|
|
17
17
|
export * from './utils/formatting.js';
|
|
18
18
|
export * from './utils/polling.js';
|
|
19
|
+
export * from './utils/phone.js';
|
|
19
20
|
export { isWalletSupported } from './utils/wallet.js';
|
|
20
21
|
export { getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
|
|
21
22
|
export { getPortalBaseURL } from './utils/url.js';
|
|
@@ -11,7 +11,7 @@ export declare enum Environment {
|
|
|
11
11
|
}
|
|
12
12
|
export interface Ctx {
|
|
13
13
|
env: Environment;
|
|
14
|
-
apiKey
|
|
14
|
+
apiKey: string;
|
|
15
15
|
client: Client;
|
|
16
16
|
disableWorkers?: boolean;
|
|
17
17
|
offloadMPCComputationURL?: string;
|
|
@@ -57,17 +57,6 @@ export type deprecated__OnRampConfig = {
|
|
|
57
57
|
export type SupportedWalletTypeConfig = {
|
|
58
58
|
optional?: boolean;
|
|
59
59
|
};
|
|
60
|
-
export type deprecated__SupportedWalletTypesOpt = {
|
|
61
|
-
[WalletType.EVM]?: boolean | SupportedWalletTypeConfig;
|
|
62
|
-
[WalletType.SOLANA]?: boolean | SupportedWalletTypeConfig;
|
|
63
|
-
[WalletType.COSMOS]?: boolean | (SupportedWalletTypeConfig & {
|
|
64
|
-
prefix?: string;
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
export type SupportedWalletTypes = {
|
|
68
|
-
type: WalletType;
|
|
69
|
-
optional?: boolean;
|
|
70
|
-
}[];
|
|
71
60
|
export interface ConstructorOpts {
|
|
72
61
|
useStorageOverrides?: boolean;
|
|
73
62
|
disableWorkers?: boolean;
|
|
@@ -144,13 +133,6 @@ export interface ConstructorOpts {
|
|
|
144
133
|
* @deprecated configure this through the developer portal
|
|
145
134
|
*/
|
|
146
135
|
homepageUrl?: string;
|
|
147
|
-
/**
|
|
148
|
-
* Which type of wallet your application supports, in the form `{ [WalletType]: true }`. Currently allowed values for `WalletType` are `'EVM'`, `'SOLANA'`, or `'COSMOS'`.
|
|
149
|
-
*
|
|
150
|
-
* To specify which prefix to use for new Cosmos wallets, pass `{ COSMOS: { prefix: 'your-prefix' } }`. Defaults to `'cosmos'`.
|
|
151
|
-
* @deprecated Configure your app's supported wallet types in the Para Developer Portal.
|
|
152
|
-
*/
|
|
153
|
-
supportedWalletTypes?: deprecated__SupportedWalletTypesOpt;
|
|
154
136
|
/**
|
|
155
137
|
* If `true`, the SDK will use the device's temporary session storage instead of saving user and wallet data to local storage.
|
|
156
138
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthType, WalletType } from '@getpara/user-management-client';
|
|
1
|
+
import { AuthType, PrimaryAuthInfo, WalletType } from '@getpara/user-management-client';
|
|
2
2
|
import { Theme } from './theme.js';
|
|
3
3
|
export type EmbeddedWalletType = Exclude<WalletType, never>;
|
|
4
4
|
export type ExternalWalletType = Exclude<WalletType, never>;
|
|
@@ -7,11 +7,10 @@ export type ExternalWalletInfo = {
|
|
|
7
7
|
type: ExternalWalletType;
|
|
8
8
|
provider?: string;
|
|
9
9
|
addressBech32?: string;
|
|
10
|
-
ensName?: string | null;
|
|
11
|
-
ensAvatar?: string | null;
|
|
12
10
|
withFullParaAuth?: boolean;
|
|
13
11
|
};
|
|
14
12
|
export type VerifyExternalWallet = {
|
|
13
|
+
address: string;
|
|
15
14
|
signedMessage: string;
|
|
16
15
|
cosmosPublicKeyHex?: string;
|
|
17
16
|
cosmosSigner?: string;
|
|
@@ -30,6 +29,20 @@ export type PortalUrlOptions = {
|
|
|
30
29
|
displayName?: string;
|
|
31
30
|
pfpUrl?: string;
|
|
32
31
|
};
|
|
32
|
+
export type AuthExtras = {
|
|
33
|
+
/**
|
|
34
|
+
* The current user's third-party username.
|
|
35
|
+
*/
|
|
36
|
+
username?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The current user's third-party display name.
|
|
39
|
+
*/
|
|
40
|
+
displayName?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The current user's third-party profile picture URL.
|
|
43
|
+
*/
|
|
44
|
+
pfpUrl?: string;
|
|
45
|
+
};
|
|
33
46
|
export type GetWebAuthUrlForLoginParams = {
|
|
34
47
|
/**
|
|
35
48
|
* The session ID for the URL.
|
|
@@ -64,3 +77,4 @@ export type GetWebAuthUrlForLoginParams = {
|
|
|
64
77
|
*/
|
|
65
78
|
pfpUrl?: string;
|
|
66
79
|
};
|
|
80
|
+
export type CoreAuthInfo = PrimaryAuthInfo & AuthExtras;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PartnerEntity, TPregenIdentifierType, WalletScheme } from '@getpara/user-management-client';
|
|
2
|
-
import { EmbeddedWalletType, ExternalWalletType } from './
|
|
2
|
+
import { EmbeddedWalletType, ExternalWalletType } from './methods.js';
|
|
3
3
|
export interface Wallet {
|
|
4
4
|
createdAt?: string;
|
|
5
5
|
id: string;
|
|
@@ -20,8 +20,6 @@ export interface Wallet {
|
|
|
20
20
|
lastUsedPartner?: PartnerEntity;
|
|
21
21
|
lastUsedPartnerId?: string;
|
|
22
22
|
isExternal?: boolean;
|
|
23
|
-
ensName?: string | null;
|
|
24
|
-
ensAvatar?: string | null;
|
|
25
23
|
isExternalWithParaAuth?: boolean;
|
|
26
24
|
}
|
|
27
25
|
/** @deprecated */
|
|
@@ -40,3 +38,4 @@ export interface DeniedSignatureResWithUrl extends DeniedSignatureRes {
|
|
|
40
38
|
}
|
|
41
39
|
export type SignatureRes = SuccessfulSignatureRes | DeniedSignatureRes;
|
|
42
40
|
export type FullSignatureRes = SuccessfulSignatureRes | DeniedSignatureResWithUrl;
|
|
41
|
+
export type ExternalWalletConnectionType = 'NONE' | 'CONNECTION_ONLY' | 'AUTHENTICATED';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function autoBind(instance: any): void;
|
|
@@ -14,5 +14,3 @@ export declare function getCosmosAddress(publicKey: string, prefix: string): str
|
|
|
14
14
|
export declare function truncateAddress(str: string, addressType: WalletTypeProp, { prefix }?: {
|
|
15
15
|
prefix?: string;
|
|
16
16
|
}): string;
|
|
17
|
-
export declare function stringToPhoneNumber(str: string): string;
|
|
18
|
-
export declare function normalizePhoneNumber(countryCode: string, number: string): string | undefined;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
export * from './autobind.js';
|
|
1
2
|
export * from './events.js';
|
|
2
3
|
export * from './formatting.js';
|
|
4
|
+
export * from './json.js';
|
|
5
|
+
export * from './listeners.js';
|
|
3
6
|
export * from './onRamps.js';
|
|
7
|
+
export * from './phone.js';
|
|
4
8
|
export * from './polling.js';
|
|
5
9
|
export * from './url.js';
|
|
6
10
|
export * from './wallet.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function jsonParse<T = any>(data: string | null | undefined, validate?: (res: any) => res is T): T | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function formatPhoneNumber(phone: string | undefined, countryCode?: string | undefined, opts?: {
|
|
2
|
+
forDisplay: undefined | false;
|
|
3
|
+
}): `+${number}` | null;
|
|
4
|
+
export declare function formatPhoneNumber(phone: string | undefined, countryCode: string | undefined, opts: {
|
|
5
|
+
forDisplay: true;
|
|
6
|
+
}): string | null;
|
|
7
|
+
export declare function displayPhoneNumber(phone: string, countryCode?: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TPregenIdentifierType, WalletEntity, WalletScheme, WalletType } from '@getpara/user-management-client';
|
|
2
|
-
import {
|
|
1
|
+
import { SupportedWalletTypes, TPregenIdentifierType, WalletEntity, WalletScheme, WalletType } from '@getpara/user-management-client';
|
|
2
|
+
import { Wallet, WalletTypeProp } from '../types/index.js';
|
|
3
3
|
export declare const WalletSchemeTypeMap: Record<WalletScheme, Partial<Record<WalletType, true>>>;
|
|
4
4
|
export declare function isPregenIdentifierMatch(a: string | null | undefined, b: string | null | undefined, type: TPregenIdentifierType): boolean;
|
|
5
5
|
export declare function isWalletSupported(types: WalletType[], wallet: Omit<Wallet, 'signer'>): boolean;
|
|
@@ -8,3 +8,4 @@ export declare function getWalletTypes(schemes: WalletScheme[]): WalletType[];
|
|
|
8
8
|
export declare function getEquivalentTypes(types: WalletTypeProp[] | WalletTypeProp): WalletType[];
|
|
9
9
|
export declare function entityToWallet(w: WalletEntity): Omit<Wallet, 'signer'>;
|
|
10
10
|
export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
|
|
11
|
+
export declare function supportedWalletTypesEq(a: SupportedWalletTypes, b: SupportedWalletTypes): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-dev.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@celo/utils": "^8.0.0",
|
|
11
11
|
"@cosmjs/encoding": "^0.32.4",
|
|
12
|
-
"@getpara/user-management-client": "
|
|
12
|
+
"@getpara/user-management-client": "2.0.0-dev.0",
|
|
13
13
|
"@noble/hashes": "^1.5.0",
|
|
14
14
|
"base64url": "^3.0.1",
|
|
15
15
|
"ethereumjs-util": "7.1.5",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"require": "./dist/cjs/index.js"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "f94ef031ef0e1894f5f0800e55f6ca2904641780"
|
|
44
44
|
}
|
package/dist/cjs/package.json
DELETED
package/dist/esm/package.json
DELETED