@getpara/core-sdk 2.0.0-alpha.52 → 2.0.0-alpha.54

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.
Files changed (65) hide show
  1. package/dist/cjs/ParaCore.js +280 -69
  2. package/dist/cjs/constants.js +7 -1
  3. package/dist/cjs/index.js +8 -2
  4. package/dist/cjs/shares/enclave.js +266 -0
  5. package/dist/cjs/shares/shareDistribution.js +16 -1
  6. package/dist/cjs/types/{theme.js → assets.js} +2 -2
  7. package/dist/cjs/types/events.js +2 -0
  8. package/dist/cjs/types/index.js +0 -21
  9. package/dist/cjs/utils/formatting.js +41 -0
  10. package/dist/cjs/utils/onRamps.js +2 -3
  11. package/dist/cjs/utils/wallet.js +3 -0
  12. package/dist/esm/ParaCore.js +282 -72
  13. package/dist/esm/{chunk-7B52C2XE.js → chunk-W5CT3TVS.js} +2 -0
  14. package/dist/esm/constants.js +6 -2
  15. package/dist/esm/cryptography/utils.js +1 -1
  16. package/dist/esm/errors.js +1 -1
  17. package/dist/esm/external/mpcComputationClient.js +1 -1
  18. package/dist/esm/external/userManagementClient.js +1 -1
  19. package/dist/esm/index.js +9 -4
  20. package/dist/esm/shares/KeyContainer.js +1 -1
  21. package/dist/esm/shares/enclave.js +226 -0
  22. package/dist/esm/shares/recovery.js +1 -1
  23. package/dist/esm/shares/shareDistribution.js +17 -2
  24. package/dist/esm/transmission/transmissionUtils.js +1 -1
  25. package/dist/esm/types/auth.js +1 -1
  26. package/dist/esm/types/config.js +1 -1
  27. package/dist/esm/types/coreApi.js +1 -1
  28. package/dist/esm/types/events.js +3 -1
  29. package/dist/esm/types/index.js +0 -16
  30. package/dist/esm/types/popup.js +1 -1
  31. package/dist/esm/types/wallet.js +1 -1
  32. package/dist/esm/utils/autobind.js +1 -1
  33. package/dist/esm/utils/events.js +1 -1
  34. package/dist/esm/utils/formatting.js +41 -1
  35. package/dist/esm/utils/json.js +1 -1
  36. package/dist/esm/utils/listeners.js +1 -1
  37. package/dist/esm/utils/onRamps.js +3 -4
  38. package/dist/esm/utils/phone.js +1 -1
  39. package/dist/esm/utils/polling.js +1 -1
  40. package/dist/esm/utils/types.js +1 -1
  41. package/dist/esm/utils/url.js +1 -1
  42. package/dist/esm/utils/wallet.js +4 -1
  43. package/dist/types/ParaCore.d.ts +27 -3
  44. package/dist/types/constants.d.ts +2 -0
  45. package/dist/types/index.d.ts +4 -3
  46. package/dist/types/shares/enclave.d.ts +81 -0
  47. package/dist/types/shares/shareDistribution.d.ts +4 -2
  48. package/dist/types/types/assets.d.ts +14 -0
  49. package/dist/types/types/config.d.ts +3 -2
  50. package/dist/types/types/coreApi.d.ts +1 -0
  51. package/dist/types/types/events.d.ts +7 -2
  52. package/dist/types/types/index.d.ts +0 -4
  53. package/dist/types/types/methods.d.ts +15 -9
  54. package/dist/types/types/wallet.d.ts +3 -3
  55. package/dist/types/utils/formatting.d.ts +10 -1
  56. package/dist/types/utils/onRamps.d.ts +9 -10
  57. package/package.json +3 -3
  58. package/dist/cjs/types/onRamps.js +0 -33
  59. package/dist/cjs/types/recovery.js +0 -34
  60. package/dist/esm/types/onRamps.js +0 -11
  61. package/dist/esm/types/recovery.js +0 -12
  62. package/dist/types/types/onRamps.d.ts +0 -10
  63. package/dist/types/types/recovery.d.ts +0 -7
  64. package/dist/types/types/theme.d.ts +0 -12
  65. /package/dist/esm/types/{theme.js → assets.js} +0 -0
@@ -1,13 +1,15 @@
1
- import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, PartnerEntity, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams, SupportedAccountLinks, OnRampPurchase } from '@getpara/user-management-client';
1
+ import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, PartnerEntity, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams, SupportedAccountLinks, OnRampPurchase, BalancesConfig, Theme } from '@getpara/user-management-client';
2
2
  import type { pki as pkiType } from 'node-forge';
3
- import { Ctx, Environment, Theme, WalletFilters, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse } from './types/index.js';
3
+ import { Ctx, Environment, WalletFilters, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse } from './types/index.js';
4
4
  import { PlatformUtils } from './PlatformUtils.js';
5
5
  export declare abstract class ParaCore implements CoreInterface {
6
6
  #private;
7
+ popupWindow: Window | null;
7
8
  static version?: string;
8
9
  ctx: Ctx;
9
10
  protected isNativePasskey: boolean;
10
11
  protected isPartnerOptional?: boolean;
12
+ protected setModalError(_error?: string): void;
11
13
  isReady: boolean;
12
14
  get authInfo(): CoreAuthInfo | undefined;
13
15
  get email(): AuthIdentifier<'email'> | undefined;
@@ -20,6 +22,9 @@ export declare abstract class ParaCore implements CoreInterface {
20
22
  userId?: string;
21
23
  accountLinkInProgress: AccountLinkInProgress | undefined;
22
24
  private sessionCookie?;
25
+ isEnclaveUser: boolean;
26
+ private enclaveJwt?;
27
+ private enclaveRefreshJwt?;
23
28
  private isAwaitingAccountCreation;
24
29
  private isAwaitingLogin;
25
30
  private isAwaitingFarcaster;
@@ -146,6 +151,10 @@ export declare abstract class ParaCore implements CoreInterface {
146
151
  private sessionStorageRemoveItem;
147
152
  retrieveSessionCookie: () => string | undefined;
148
153
  persistSessionCookie: (cookie: string) => void;
154
+ retrieveEnclaveJwt: () => string;
155
+ persistEnclaveJwt: (jwt: string) => void;
156
+ retrieveEnclaveRefreshJwt: () => string;
157
+ persistEnclaveRefreshJwt: (jwt: string) => void;
149
158
  /**
150
159
  * Remove all local storage and prefixed session storage.
151
160
  * @param {'local' | 'session' | 'secure' | 'all'} type - Type of storage to clear. Defaults to 'all'.
@@ -201,6 +210,7 @@ export declare abstract class ParaCore implements CoreInterface {
201
210
  private wrapMethodsWithErrorTracking;
202
211
  private initializeFromStorage;
203
212
  private updateAuthInfoFromStorage;
213
+ private updateEnclaveJwtFromStorage;
204
214
  private updateUserIdFromStorage;
205
215
  private updateWalletsFromStorage;
206
216
  private updateWalletIdsFromStorage;
@@ -227,6 +237,16 @@ export declare abstract class ParaCore implements CoreInterface {
227
237
  extras?: AuthExtras;
228
238
  userId?: string;
229
239
  }): Promise<typeof this.authInfo>;
240
+ /**
241
+ * Display an error message in the modal (if available)
242
+ * @internal
243
+ */
244
+ protected displayModalError(error?: string): void;
245
+ /**
246
+ * Handle specific touchSession errors with user-friendly messages
247
+ * @private
248
+ */
249
+ private handleTouchSessionError;
230
250
  protected assertUserId({ allowGuestMode }?: {
231
251
  allowGuestMode?: boolean;
232
252
  }): string;
@@ -690,7 +710,7 @@ export declare abstract class ParaCore implements CoreInterface {
690
710
  url?: string;
691
711
  }>;
692
712
  /**
693
- * Returns a Para Portal URL for logging in with a WebAuth passkey, password or PIN.
713
+ * Returns a Para Portal URL for logging in with a WebAuth passkey, password, PIN or OTP.
694
714
  * @param {Object} opts the options object
695
715
  * @param {String} opts.auth - the user auth to sign up or log in with, in the form ` { email: string } | { phone: `+${number}` } `
696
716
  * @param {boolean} opts.useShortUrls - whether to shorten the generated portal URLs
@@ -708,5 +728,9 @@ export declare abstract class ParaCore implements CoreInterface {
708
728
  accountLinkInProgress?: AccountLinkInProgress;
709
729
  } & Partial<Pick<VerifyLinkParams, 'verificationCode' | 'telegramAuthResponse'> & VerifyExternalWalletParams>): Promise<LinkedAccounts>;
710
730
  protected verifyEmailOrPhoneLink({ verificationCode, }: InternalMethodParams<'verifyEmailOrPhoneLink'>): InternalMethodResponse<'verifyEmailOrPhoneLink'>;
731
+ protected getProfileBalance({ config, refetch }?: {
732
+ config?: BalancesConfig;
733
+ refetch?: boolean;
734
+ }): Promise<import("@getpara/user-management-client").ProfileBalance>;
711
735
  protected sendLoginCode(): Promise<void>;
712
736
  }
@@ -14,6 +14,8 @@ export declare const LOCAL_STORAGE_WALLETS = "@CAPSULE/wallets";
14
14
  export declare const LOCAL_STORAGE_EXTERNAL_WALLETS = "@CAPSULE/externalWallets";
15
15
  export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS = "@CAPSULE/currentWalletIds";
16
16
  export declare const LOCAL_STORAGE_SESSION_COOKIE = "@CAPSULE/sessionCookie";
17
+ export declare const LOCAL_STORAGE_ENCLAVE_JWT = "@CAPSULE/enclaveJwt";
18
+ export declare const LOCAL_STORAGE_ENCLAVE_REFRESH_JWT = "@CAPSULE/enclaveRefreshJwt";
17
19
  export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = "@CAPSULE/loginEncryptionKeyPair";
18
20
  export declare const POLLING_INTERVAL_MS = 2000;
19
21
  export declare const SHORT_POLLING_INTERVAL_MS = 1000;
@@ -1,10 +1,10 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
- export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TOAuthMethod, type TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, } from '@getpara/user-management-client';
3
- export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, type AccountLinkInProgress, AccountLinkError, type InternalInterface, } from './types/index.js';
2
+ export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, AuthMethodStatus, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TNetwork, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, type TOnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAssets, type OnRampPurchase, type OnRampAssetInfo, type ProviderAssetInfo, OnRampMethod, type Theme, OAuthMethod, type TOAuthMethod, type TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, type AssetMetadata, type AssetMetadataIndexed, type AssetValue, type BalancesConfig, type WalletBalance, type ProfileBalance, type OfframpDepositRequest, RecoveryStatus, ThemeMode, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, } from '@getpara/user-management-client';
3
+ export { PopupType, PregenIdentifierType, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type Wallet, type GetWalletBalanceParams, type AccountLinkInProgress, AccountLinkError, type InternalInterface, } from './types/index.js';
4
4
  export * from './types/coreApi.js';
5
5
  export * from './types/events.js';
6
6
  export * from './types/config.js';
7
- export { getPortalDomain, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
7
+ export { getPortalDomain, dispatchEvent, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
8
8
  export { PREFIX as STORAGE_PREFIX, PARA_PREFIX as PARA_STORAGE_PREFIX } from './constants.js';
9
9
  export { distributeNewShare } from './shares/shareDistribution.js';
10
10
  export { KeyContainer } from './shares/KeyContainer.js';
@@ -22,5 +22,6 @@ export { isWalletSupported } from './utils/wallet.js';
22
22
  export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
23
23
  export { getPortalBaseURL } from './utils/url.js';
24
24
  export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
25
+ export type { ShareData } from './shares/enclave.js';
25
26
  export declare const paraVersion: string;
26
27
  export default ParaCore;
@@ -0,0 +1,81 @@
1
+ import UserManagementClient from '@getpara/user-management-client';
2
+ export interface ShareData {
3
+ userId: string;
4
+ walletId: string;
5
+ walletScheme: string;
6
+ partnerId?: string;
7
+ protocolId?: string;
8
+ signer: string;
9
+ createdAt?: string;
10
+ updatedAt?: string;
11
+ }
12
+ export interface ShareQuery {
13
+ userId: string;
14
+ walletId?: string;
15
+ partnerId?: string;
16
+ }
17
+ export interface EncryptedPayload {
18
+ encryptedData: string;
19
+ keyId: string;
20
+ algorithm: string;
21
+ ephemeral: string;
22
+ }
23
+ /**
24
+ * Enclave client for secure key share operations
25
+ * Handles encryption/decryption and communication with the enclave service
26
+ */
27
+ export declare class EnclaveClient {
28
+ private userManagementClient;
29
+ private enclavePublicKey;
30
+ private frontendKeyPair;
31
+ private retrieveJwt;
32
+ private persistJwt;
33
+ private retrieveRefreshJwt;
34
+ private persistRefreshJwt;
35
+ constructor({ userManagementClient, retrieveJwt, persistJwt, retrieveRefreshJwt, persistRefreshJwt, }: {
36
+ userManagementClient: UserManagementClient;
37
+ retrieveJwt: () => string;
38
+ persistJwt: (jwt: string) => void;
39
+ retrieveRefreshJwt: () => string;
40
+ persistRefreshJwt: (refreshJwt: string) => void;
41
+ });
42
+ private refreshJwt;
43
+ private withJwtRefreshRetry;
44
+ private issueEnclaveJwt;
45
+ /**
46
+ * Generate a P-256 keypair for the frontend to receive encrypted responses
47
+ */
48
+ private generateFrontendKeyPair;
49
+ /**
50
+ * Get the enclave's public key from the user-management service
51
+ */
52
+ private getEnclavePublicKey;
53
+ /**
54
+ * Import a PEM-formatted public key for use with Web Crypto API
55
+ */
56
+ private importPublicKeyFromPEM;
57
+ /**
58
+ * Export a public key to PEM format
59
+ */
60
+ private exportPublicKeyToPEM;
61
+ /**
62
+ * Encrypt data using P-256 ECIES for the enclave
63
+ */
64
+ private encryptForEnclave;
65
+ /**
66
+ * Decrypt response encrypted for the frontend
67
+ */
68
+ private decryptForFrontend;
69
+ /**
70
+ * Persist key shares to the enclave
71
+ * @param shares Array of share data to persist
72
+ */
73
+ private persistShares;
74
+ /**
75
+ * Retrieve key shares from the enclave
76
+ * @param query Query parameters for finding shares (single query or array of queries)
77
+ */
78
+ private retrieveShares;
79
+ retrieveSharesWithRetry(query: ShareQuery[]): Promise<ShareData[]>;
80
+ persistSharesWithRetry(shares: ShareData[]): Promise<any>;
81
+ }
@@ -1,6 +1,6 @@
1
- import { BackupKitEmailProps } from '@getpara/user-management-client';
1
+ import { BackupKitEmailProps, TWalletScheme } from '@getpara/user-management-client';
2
2
  import { Ctx } from '../types/index.js';
3
- export declare function distributeNewShare({ ctx, userId, walletId, userShare, ignoreRedistributingBackupEncryptedShare, emailProps, partnerId, protocolId, }: {
3
+ export declare function distributeNewShare({ ctx, userId, walletId, userShare, ignoreRedistributingBackupEncryptedShare, emailProps, partnerId, protocolId, isEnclaveUser, walletScheme, }: {
4
4
  ctx: Ctx;
5
5
  userId: string;
6
6
  walletId: string;
@@ -9,4 +9,6 @@ export declare function distributeNewShare({ ctx, userId, walletId, userShare, i
9
9
  emailProps?: BackupKitEmailProps;
10
10
  partnerId?: string;
11
11
  protocolId?: string;
12
+ isEnclaveUser: boolean;
13
+ walletScheme: TWalletScheme;
12
14
  }): Promise<string>;
@@ -0,0 +1,14 @@
1
+ import { TNetwork, TOnRampAsset } from '@getpara/user-management-client';
2
+ import { Wallet } from './wallet.js';
3
+ export type AssetTransferType = 'INBOUND' | 'OUTBOUND';
4
+ export type AssetTransfer = {
5
+ wallet: Omit<Wallet, 'signer'>;
6
+ type: AssetTransferType;
7
+ sourceAddress: string;
8
+ destinationAddress: string;
9
+ asset: TOnRampAsset;
10
+ network: TNetwork;
11
+ quantity: string;
12
+ chainId?: string;
13
+ contractAddress?: string;
14
+ };
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType } from '@getpara/user-management-client';
3
- import { Theme } from './theme.js';
2
+ import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType, Theme } from '@getpara/user-management-client';
3
+ import { EnclaveClient } from '../shares/enclave.js';
4
4
  export declare enum Environment {
5
5
  DEV = "DEV",
6
6
  SANDBOX = "SANDBOX",
@@ -13,6 +13,7 @@ export interface Ctx {
13
13
  env: Environment;
14
14
  apiKey: string;
15
15
  client: Client;
16
+ enclaveClient?: EnclaveClient;
16
17
  disableWorkers?: boolean;
17
18
  offloadMPCComputationURL?: string;
18
19
  mpcComputationClient?: AxiosInstance;
@@ -118,6 +118,7 @@ export type CoreMethods = Record<CoreMethodName, {
118
118
  getOAuthUrl: {
119
119
  params: OAuthUrlParams & {
120
120
  sessionLookupId?: string;
121
+ encryptionKey?: string;
121
122
  };
122
123
  response: string;
123
124
  };
@@ -1,7 +1,8 @@
1
- import { CurrentWalletIds } from '@getpara/user-management-client';
1
+ import { CurrentWalletIds, OnRampPurchase } from '@getpara/user-management-client';
2
2
  import { FullSignatureRes } from './wallet.js';
3
3
  import { Wallet } from './wallet.js';
4
4
  import { CoreMethodResponse } from './coreApi.js';
5
+ import { AssetTransfer } from './assets.js';
5
6
  export declare enum ParaEvent {
6
7
  LOGIN_EVENT = "paraLogin",
7
8
  ACCOUNT_CREATION_EVENT = "paraAccountCreation",
@@ -13,7 +14,9 @@ export declare enum ParaEvent {
13
14
  WALLETS_CHANGE_EVENT = "paraWalletsChange",
14
15
  WALLET_CREATED = "paraWalletCreated",
15
16
  PREGEN_WALLET_CLAIMED = "paraPregenWalletClaimed",
16
- GUEST_WALLETS_CREATED = "paraGuestWalletsCreated"
17
+ GUEST_WALLETS_CREATED = "paraGuestWalletsCreated",
18
+ ASSET_TRANSFERRED = "paraAssetTransferred",
19
+ ONRAMP_TRANSACTION_COMPLETE = "paraOnRampTransactionComplete"
17
20
  }
18
21
  export type BaseEvent<T> = {
19
22
  data: T;
@@ -48,3 +51,5 @@ export type PregenWalletClaimedResponse = {
48
51
  };
49
52
  export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
50
53
  export type GuestWalletsCreatedEvent = CustomEventInit<BaseEvent<CoreMethodResponse<'createGuestWallets'>>>;
54
+ export type AssetTransferredEvent = CustomEventInit<BaseEvent<AssetTransfer>>;
55
+ export type OnRampTransactionCompleteResponse = CustomEventInit<BaseEvent<OnRampPurchase>>;
@@ -3,9 +3,5 @@ export * from './config.js';
3
3
  export * from './coreApi.js';
4
4
  export * from './wallet.js';
5
5
  export * from './methods.js';
6
- export * from './theme.js';
7
- export * from './onRamps.js';
8
6
  export * from './popup.js';
9
- export * from './recovery.js';
10
7
  export * from './events.js';
11
- export { Network, OnRampAsset, OnRampProvider, OnRampPurchaseStatus, type OnRampPurchase, } from '@getpara/user-management-client';
@@ -1,6 +1,4 @@
1
- import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, TOAuthMethod, TWalletType, TelegramAuthResponse } from '@getpara/user-management-client';
2
- import { Theme } from './theme.js';
3
- import { RecoveryStatus } from './recovery.js';
1
+ import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, RecoveryStatus, Theme, TOAuthMethod, TWalletType, TelegramAuthResponse, VerifyThirdPartyAuth, ServerAuthStateDone } from '@getpara/user-management-client';
4
2
  import { Wallet } from './wallet.js';
5
3
  type Device = {
6
4
  sessionId: string;
@@ -14,7 +12,7 @@ export type VerifyExternalWalletV1 = {
14
12
  cosmosPublicKeyHex?: string;
15
13
  cosmosSigner?: string;
16
14
  };
17
- export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN';
15
+ export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN' | 'oAuth' | 'oAuthCallback' | 'loginOTP' | 'telegramLoginVerify' | 'loginFarcaster';
18
16
  export type PortalUrlOptions = {
19
17
  params?: Record<string, string | undefined | null>;
20
18
  isForNewDevice?: boolean;
@@ -25,6 +23,9 @@ export type PortalUrlOptions = {
25
23
  pathId?: string;
26
24
  shorten?: boolean;
27
25
  isEmbedded?: boolean;
26
+ oAuthMethod?: OAuthUrlParams['method'];
27
+ appScheme?: string;
28
+ encryptionKey?: string;
28
29
  };
29
30
  export type WithAuthMethod = {
30
31
  /**
@@ -76,12 +77,14 @@ export type FarcasterParams = PollParams & {
76
77
  * You will need to display the URI as a QR code.
77
78
  */
78
79
  onConnectUri?: (uri: string) => void;
80
+ serverAuthState?: VerifyThirdPartyAuth;
79
81
  };
80
82
  export type TelegramParams = {
81
83
  /**
82
84
  * The response received from the Telegram login bot.
83
85
  */
84
- telegramAuthResponse: TelegramAuthResponse;
86
+ telegramAuthResponse?: TelegramAuthResponse;
87
+ serverAuthState?: VerifyThirdPartyAuth;
85
88
  };
86
89
  export type LoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
87
90
  sessionId?: string;
@@ -123,7 +126,9 @@ export type OAuthParams = OAuthUrlParams & PollParams & {
123
126
  onOAuthPopup?: (popup: Window) => void;
124
127
  };
125
128
  export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
126
- export type AuthStateVerify = ServerAuthStateVerify;
129
+ export type AuthStateVerify = ServerAuthStateVerify & {
130
+ loginUrl?: string;
131
+ };
127
132
  export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & WithIsPasskeySupported & {
128
133
  /**
129
134
  * A Para Portal URL for logging in via a WebAuth passkey. For best compatibility, you should open this URL in a new window or tab.
@@ -168,10 +173,11 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
168
173
  */
169
174
  pinId?: string;
170
175
  };
176
+ export type AuthStateDone = ServerAuthStateDone;
171
177
  export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
172
- export type AuthStateSignupOrLogin = AuthStateSignup | AuthStateLogin;
173
- export type OAuthResponse = AuthStateSignupOrLogin;
174
- export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup;
178
+ export type AuthStateSignupOrLoginOrDone = AuthStateSignup | AuthStateLogin | AuthStateDone;
179
+ export type OAuthResponse = AuthStateSignupOrLoginOrDone;
180
+ export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup | AuthStateDone;
175
181
  export type Verify2faParams = {
176
182
  auth: VerifiedAuth;
177
183
  verificationCode: string;
@@ -1,5 +1,5 @@
1
- import { EmbeddedWalletType, ExternalWalletType, PartnerEntity, TPregenIdentifierType, TWalletScheme } from '@getpara/user-management-client';
2
- export interface Wallet {
1
+ import { IWalletEntity, PartnerEntity, TPregenIdentifierType, TWalletScheme, TWalletType } from '@getpara/user-management-client';
2
+ export interface Wallet extends Omit<IWalletEntity, 'createdAt' | 'updatedAt' | 'lastUsedAt' | 'scheme' | 'type' | 'userId' | 'keyGenComplete'> {
3
3
  createdAt?: string;
4
4
  id: string;
5
5
  name?: string;
@@ -8,7 +8,7 @@ export interface Wallet {
8
8
  addressSecondary?: string;
9
9
  publicKey?: string;
10
10
  scheme?: TWalletScheme;
11
- type?: EmbeddedWalletType | ExternalWalletType;
11
+ type?: TWalletType;
12
12
  isPregen?: boolean;
13
13
  pregenIdentifier?: string;
14
14
  pregenIdentifierType?: TPregenIdentifierType;
@@ -1,4 +1,4 @@
1
- import { TWalletType } from '@getpara/user-management-client';
1
+ import { AssetValue, TWalletType } from '@getpara/user-management-client';
2
2
  export type Hex = `0x${string}`;
3
3
  export interface Signature {
4
4
  r: Hex;
@@ -17,3 +17,12 @@ export declare function truncateAddress(str: string, addressType: TWalletType, {
17
17
  prefix?: string;
18
18
  targetLength?: number;
19
19
  }): string;
20
+ export declare function formatCurrency(value?: AssetValue, { fallback }?: {
21
+ fallback?: string;
22
+ }): string;
23
+ export declare function formatAssetQuantity({ quantity, symbol, decimals, fallback, }: {
24
+ quantity?: number;
25
+ symbol?: string;
26
+ decimals?: number;
27
+ fallback?: string;
28
+ }): string;
@@ -1,19 +1,18 @@
1
- import { Network, OnRampAsset, OnRampProvider, OnRampPurchaseType, TWalletType } from '@getpara/user-management-client';
2
- import { OnRampAssetInfoRow, OnRampAssetInfo } from '../types/index.js';
1
+ import { TNetwork, TOnRampAsset, OnRampProvider, OnRampPurchaseType, OnRampAssetInfoRow, OnRampAssetInfo, TWalletType } from '@getpara/user-management-client';
3
2
  export declare function toAssetInfoArray(data: OnRampAssetInfo): OnRampAssetInfoRow[];
4
3
  export declare function getOnRampNetworks(data: OnRampAssetInfo, { walletType, allowed, assets, providers, action, }?: {
5
4
  walletType?: TWalletType;
6
- allowed?: Network[];
7
- assets?: OnRampAsset[];
5
+ allowed?: TNetwork[];
6
+ assets?: TOnRampAsset[];
8
7
  providers?: OnRampProvider[];
9
8
  action?: OnRampPurchaseType;
10
- }): Network[];
9
+ }): TNetwork[];
11
10
  export declare function getOnRampAssets(data: OnRampAssetInfo, { walletType, network, allowed, providers, action, }?: {
12
11
  walletType?: TWalletType;
13
- network?: Network;
14
- allowed?: OnRampAsset[];
12
+ network?: TNetwork;
13
+ allowed?: TOnRampAsset[];
15
14
  providers?: OnRampProvider[];
16
15
  action?: OnRampPurchaseType;
17
- }): OnRampAsset[];
18
- export declare const NETWORK_PREFIXES: Partial<Record<Network, string>>;
19
- export declare function getNetworkPrefix(network: Network): string | undefined;
16
+ }): TOnRampAsset[];
17
+ export declare const NETWORK_PREFIXES: Partial<Record<TNetwork, string>>;
18
+ export declare function getNetworkPrefix(network: TNetwork): string | undefined;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.0.0-alpha.52",
3
+ "version": "2.0.0-alpha.54",
4
4
  "dependencies": {
5
5
  "@celo/utils": "^8.0.2",
6
6
  "@cosmjs/encoding": "^0.32.4",
7
7
  "@ethereumjs/util": "^9.1.0",
8
- "@getpara/user-management-client": "2.0.0-alpha.52",
8
+ "@getpara/user-management-client": "2.0.0-alpha.54",
9
9
  "@noble/hashes": "^1.5.0",
10
10
  "base64url": "^3.0.1",
11
11
  "libphonenumber-js": "^1.11.7",
@@ -27,7 +27,7 @@
27
27
  "dist",
28
28
  "package.json"
29
29
  ],
30
- "gitHead": "a63dba8c230e9ff2d73b275d3e40091b93aecf1c",
30
+ "gitHead": "680049700f7b36b7ef407cab0fbfadad8c069d74",
31
31
  "main": "dist/cjs/index.js",
32
32
  "module": "dist/esm/index.js",
33
33
  "scripts": {
@@ -1,33 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var onRamps_exports = {};
19
- __export(onRamps_exports, {
20
- OnRampMethod: () => OnRampMethod
21
- });
22
- module.exports = __toCommonJS(onRamps_exports);
23
- var OnRampMethod = /* @__PURE__ */ ((OnRampMethod2) => {
24
- OnRampMethod2["ACH"] = "ACH";
25
- OnRampMethod2["DEBIT"] = "Debit";
26
- OnRampMethod2["CREDIT"] = "Credit";
27
- OnRampMethod2["APPLE_PAY"] = "Apple Pay";
28
- return OnRampMethod2;
29
- })(OnRampMethod || {});
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- OnRampMethod
33
- });
@@ -1,34 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var recovery_exports = {};
19
- __export(recovery_exports, {
20
- RecoveryStatus: () => RecoveryStatus
21
- });
22
- module.exports = __toCommonJS(recovery_exports);
23
- var RecoveryStatus = /* @__PURE__ */ ((RecoveryStatus2) => {
24
- RecoveryStatus2["INITIATED"] = "INITIATED";
25
- RecoveryStatus2["READY"] = "READY";
26
- RecoveryStatus2["EXPIRED"] = "EXPIRED";
27
- RecoveryStatus2["FINISHED"] = "FINISHED";
28
- RecoveryStatus2["CANCELLED"] = "CANCELLED";
29
- return RecoveryStatus2;
30
- })(RecoveryStatus || {});
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- RecoveryStatus
34
- });
@@ -1,11 +0,0 @@
1
- import "../chunk-7B52C2XE.js";
2
- var OnRampMethod = /* @__PURE__ */ ((OnRampMethod2) => {
3
- OnRampMethod2["ACH"] = "ACH";
4
- OnRampMethod2["DEBIT"] = "Debit";
5
- OnRampMethod2["CREDIT"] = "Credit";
6
- OnRampMethod2["APPLE_PAY"] = "Apple Pay";
7
- return OnRampMethod2;
8
- })(OnRampMethod || {});
9
- export {
10
- OnRampMethod
11
- };
@@ -1,12 +0,0 @@
1
- import "../chunk-7B52C2XE.js";
2
- var RecoveryStatus = /* @__PURE__ */ ((RecoveryStatus2) => {
3
- RecoveryStatus2["INITIATED"] = "INITIATED";
4
- RecoveryStatus2["READY"] = "READY";
5
- RecoveryStatus2["EXPIRED"] = "EXPIRED";
6
- RecoveryStatus2["FINISHED"] = "FINISHED";
7
- RecoveryStatus2["CANCELLED"] = "CANCELLED";
8
- return RecoveryStatus2;
9
- })(RecoveryStatus || {});
10
- export {
11
- RecoveryStatus
12
- };
@@ -1,10 +0,0 @@
1
- import { Network, OnRampAsset, OnRampProvider, OnRampPurchaseType, TWalletType } from '@getpara/user-management-client';
2
- export type ProviderAssetInfo = [string, Partial<Record<OnRampPurchaseType, boolean>>];
3
- export type OnRampAssetInfo = Record<TWalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
4
- export type OnRampAssetInfoRow = [TWalletType, Network, OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>];
5
- export declare enum OnRampMethod {
6
- ACH = "ACH",
7
- DEBIT = "Debit",
8
- CREDIT = "Credit",
9
- APPLE_PAY = "Apple Pay"
10
- }
@@ -1,7 +0,0 @@
1
- export declare enum RecoveryStatus {
2
- INITIATED = "INITIATED",
3
- READY = "READY",
4
- EXPIRED = "EXPIRED",
5
- FINISHED = "FINISHED",
6
- CANCELLED = "CANCELLED"
7
- }
@@ -1,12 +0,0 @@
1
- export type Theme = {
2
- foregroundColor?: string;
3
- backgroundColor?: string;
4
- accentColor?: string;
5
- darkForegroundColor?: string;
6
- darkBackgroundColor?: string;
7
- darkAccentColor?: string;
8
- mode?: 'light' | 'dark';
9
- borderRadius?: BorderRadius;
10
- font?: string;
11
- };
12
- export type BorderRadius = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
File without changes