@getpara/core-sdk 2.0.0-fc.3 → 2.1.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.
Files changed (63) hide show
  1. package/dist/cjs/ParaCore.js +1119 -319
  2. package/dist/cjs/constants.js +10 -1
  3. package/dist/cjs/index.js +23 -3
  4. package/dist/cjs/shares/KeyContainer.js +3 -3
  5. package/dist/cjs/shares/enclave.js +287 -0
  6. package/dist/cjs/shares/shareDistribution.js +16 -1
  7. package/dist/cjs/transmission/transmissionUtils.js +4 -3
  8. package/dist/cjs/types/{theme.js → assets.js} +2 -2
  9. package/dist/cjs/types/coreApi.js +7 -2
  10. package/dist/cjs/types/events.js +2 -0
  11. package/dist/cjs/types/index.js +0 -21
  12. package/dist/cjs/types/popup.js +1 -0
  13. package/dist/cjs/utils/config.js +108 -0
  14. package/dist/cjs/utils/index.js +5 -1
  15. package/dist/cjs/utils/onRamps.js +2 -3
  16. package/dist/cjs/utils/url.js +10 -9
  17. package/dist/cjs/utils/wallet.js +18 -0
  18. package/dist/cjs/{types/onRamps.js → utils/window.js} +17 -12
  19. package/dist/esm/ParaCore.js +1123 -323
  20. package/dist/esm/constants.js +7 -1
  21. package/dist/esm/index.js +24 -5
  22. package/dist/esm/shares/KeyContainer.js +3 -3
  23. package/dist/esm/shares/enclave.js +247 -0
  24. package/dist/esm/shares/shareDistribution.js +16 -1
  25. package/dist/esm/transmission/transmissionUtils.js +4 -3
  26. package/dist/esm/types/coreApi.js +7 -2
  27. package/dist/esm/types/events.js +2 -0
  28. package/dist/esm/types/index.js +0 -16
  29. package/dist/esm/types/popup.js +1 -0
  30. package/dist/esm/utils/config.js +86 -0
  31. package/dist/esm/utils/index.js +2 -0
  32. package/dist/esm/utils/onRamps.js +2 -3
  33. package/dist/esm/utils/url.js +10 -9
  34. package/dist/esm/utils/wallet.js +17 -0
  35. package/dist/esm/utils/window.js +16 -0
  36. package/dist/types/ParaCore.d.ts +91 -20
  37. package/dist/types/PlatformUtils.d.ts +2 -1
  38. package/dist/types/constants.d.ts +3 -0
  39. package/dist/types/index.d.ts +6 -4
  40. package/dist/types/shares/enclave.d.ts +83 -0
  41. package/dist/types/shares/shareDistribution.d.ts +4 -2
  42. package/dist/types/types/assets.d.ts +14 -0
  43. package/dist/types/types/config.d.ts +3 -2
  44. package/dist/types/types/coreApi.d.ts +47 -7
  45. package/dist/types/types/events.d.ts +7 -2
  46. package/dist/types/types/index.d.ts +0 -4
  47. package/dist/types/types/methods.d.ts +57 -12
  48. package/dist/types/types/popup.d.ts +2 -1
  49. package/dist/types/types/wallet.d.ts +8 -4
  50. package/dist/types/utils/config.d.ts +7 -0
  51. package/dist/types/utils/index.d.ts +2 -0
  52. package/dist/types/utils/onRamps.d.ts +9 -10
  53. package/dist/types/utils/url.d.ts +3 -3
  54. package/dist/types/utils/wallet.d.ts +1 -0
  55. package/dist/types/utils/window.d.ts +2 -0
  56. package/package.json +3 -3
  57. package/dist/cjs/types/recovery.js +0 -34
  58. package/dist/esm/types/onRamps.js +0 -11
  59. package/dist/esm/types/recovery.js +0 -12
  60. package/dist/types/types/onRamps.d.ts +0 -10
  61. package/dist/types/types/recovery.d.ts +0 -7
  62. package/dist/types/types/theme.d.ts +0 -12
  63. /package/dist/esm/types/{theme.js → assets.js} +0 -0
@@ -1,10 +1,10 @@
1
- import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts } from '@getpara/user-management-client';
2
- import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse, FarcasterParams, TelegramParams, OAuthParams } from './methods.js';
1
+ import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts, AuthMethod, ServerAuthStateSignup, ServerAuthStateLogin, ServerAuthStateDone } from '@getpara/user-management-client';
2
+ import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse, FarcasterParams, TelegramParams, OAuthParams, NewCredentialUrlParams, AuthStateDone } from './methods.js';
3
3
  import { ParaCore } from '../ParaCore.js';
4
4
  import { FullSignatureRes, Wallet } from './wallet.js';
5
5
  import { AccountLinkInProgress } from './auth.js';
6
- export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "issueJwt", "getLinkedAccounts", "accountLinkInProgress"];
7
- export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress"];
6
+ export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "issueJwt", "getLinkedAccounts", "accountLinkInProgress", "addCredential", "exportPrivateKey"];
7
+ export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode", "supportedUserAuthMethods"];
8
8
  export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
9
9
  export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
10
10
  params: infer P;
@@ -118,6 +118,8 @@ export type CoreMethods = Record<CoreMethodName, {
118
118
  getOAuthUrl: {
119
119
  params: OAuthUrlParams & {
120
120
  sessionLookupId?: string;
121
+ encryptionKey?: string;
122
+ portalCallbackParams?: Record<string, string>;
121
123
  };
122
124
  response: string;
123
125
  };
@@ -143,16 +145,28 @@ export type CoreMethods = Record<CoreMethodName, {
143
145
  * The external wallet information to use for login.
144
146
  */
145
147
  externalWallet: ExternalWalletInfo | ExternalWalletInfo[];
148
+ /**
149
+ * The chain ID used to generate the SIWE message.
150
+ */
151
+ chainId?: string;
152
+ /**
153
+ * The URI used to generate the SIWE message.
154
+ */
155
+ uri?: string;
146
156
  };
147
157
  response: AuthStateVerifyOrLogin;
148
158
  };
149
159
  verifyExternalWallet: {
150
- params: AuthStateBaseParams & VerifyExternalWalletParams;
151
- response: AuthStateSignup;
160
+ params: (AuthStateBaseParams & {
161
+ serverAuthState: ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone;
162
+ }) | (AuthStateBaseParams & VerifyExternalWalletParams & {
163
+ serverAuthState?: undefined;
164
+ });
165
+ response: AuthStateSignup | AuthStateLogin | AuthStateDone;
152
166
  };
153
167
  resendVerificationCode: {
154
168
  params: {
155
- type?: 'SIGNUP' | 'LINK_ACCOUNT';
169
+ type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
156
170
  } | undefined;
157
171
  response: void;
158
172
  };
@@ -482,6 +496,20 @@ export type CoreMethods = Record<CoreMethodName, {
482
496
  userId: string;
483
497
  };
484
498
  };
499
+ addCredential: {
500
+ params: Pick<NewCredentialUrlParams, 'authMethod'>;
501
+ response: Promise<string>;
502
+ };
503
+ exportPrivateKey: {
504
+ params: {
505
+ walletId?: string;
506
+ shouldOpenPopup?: boolean;
507
+ } | undefined;
508
+ response: {
509
+ popupWindow?: Window;
510
+ url: string;
511
+ };
512
+ };
485
513
  };
486
514
  export type InternalMethods = {
487
515
  linkAccount: {
@@ -522,6 +550,18 @@ export type InternalMethods = {
522
550
  params: Omit<VerifyExternalWalletParams, 'externalWallet'>;
523
551
  response: LinkedAccounts;
524
552
  };
553
+ prepareLogin: {
554
+ params: void;
555
+ response: string;
556
+ };
557
+ sendLoginCode: {
558
+ params: void;
559
+ response: void;
560
+ };
561
+ supportedUserAuthMethods: {
562
+ params: void;
563
+ response: Promise<Set<AuthMethod>>;
564
+ };
525
565
  };
526
566
  export type CoreInterface = {
527
567
  [key in keyof CoreMethods]: Partial<CoreMethod<key>>;
@@ -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, TAuthMethod, 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';
15
+ export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN' | 'oAuth' | 'oAuthCallback' | 'loginOTP' | 'telegramLoginVerify' | 'loginFarcaster' | 'switchWallets' | 'addNewCredential' | 'exportPrivateKey' | 'loginExternalWallet' | 'connectExternalWallet';
18
16
  export type PortalUrlOptions = {
19
17
  params?: Record<string, string | undefined | null>;
20
18
  isForNewDevice?: boolean;
@@ -25,12 +23,19 @@ 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;
29
+ addNewCredentialType?: TAuthMethod;
30
+ addNewCredentialPasswordId?: string;
31
+ addNewCredentialPasskeyId?: string;
32
+ useLegacyUrl?: boolean;
28
33
  };
29
34
  export type WithAuthMethod = {
30
35
  /**
31
- * Which authorization method to use for the URL, either `'passkey'` or `'passwprd'`.
36
+ * Which authorization method to use for the URL, either `'PASSKEY'`, `'PASSWORD'` or `'PIN'`.
32
37
  */
33
- authMethod?: Uppercase<AuthMethod>;
38
+ authMethod?: Uppercase<TAuthMethod>;
34
39
  };
35
40
  export type WithCustomTheme = {
36
41
  /**
@@ -76,21 +81,27 @@ export type FarcasterParams = PollParams & {
76
81
  * You will need to display the URI as a QR code.
77
82
  */
78
83
  onConnectUri?: (uri: string) => void;
84
+ serverAuthState?: VerifyThirdPartyAuth;
79
85
  };
80
86
  export type TelegramParams = {
81
87
  /**
82
88
  * The response received from the Telegram login bot.
83
89
  */
84
- telegramAuthResponse: TelegramAuthResponse;
90
+ telegramAuthResponse?: TelegramAuthResponse;
91
+ serverAuthState?: VerifyThirdPartyAuth;
85
92
  };
86
93
  export type LoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
87
94
  sessionId?: string;
88
95
  };
89
- export type NewCredentialUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
96
+ export type NewCredentialUrlParams = WithCustomTheme & WithShorten & {
90
97
  /**
91
98
  * Whether the URL is meant to add a passkey for a previous user on a new device. Defaults to `false`.
92
99
  */
93
100
  isForNewDevice?: boolean;
101
+ /**
102
+ * The authentication method to add.
103
+ */
104
+ authMethod?: TAuthMethod;
94
105
  };
95
106
  export type OAuthUrlParams = {
96
107
  /**
@@ -110,11 +121,22 @@ export type OAuthParams = OAuthUrlParams & PollParams & {
110
121
  /**
111
122
  * A callback function that will be invoked with the OAuth URL when it is available.
112
123
  * For example, you can use this to open the URL in a new window or tab.
124
+ *
125
+ * You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
113
126
  */
114
127
  onOAuthUrl?: (url: string) => void;
128
+ /**
129
+ * A callback function that will be invoked with the OAuth popup window when it is available.
130
+ * If supplied, a window will automatically be opened for you if running on an applicable platform.
131
+ *
132
+ * You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
133
+ */
134
+ onOAuthPopup?: (popup: Window) => void;
115
135
  };
116
136
  export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
117
- export type AuthStateVerify = ServerAuthStateVerify;
137
+ export type AuthStateVerify = ServerAuthStateVerify & {
138
+ loginUrl?: string;
139
+ };
118
140
  export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & WithIsPasskeySupported & {
119
141
  /**
120
142
  * 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.
@@ -128,6 +150,14 @@ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & Wi
128
150
  * A Para Portal URL for logging in via a password.
129
151
  */
130
152
  passwordUrl?: string;
153
+ /**
154
+ * A Para Portal URL for logging in via a PIN.
155
+ */
156
+ pinUrl?: string;
157
+ /**
158
+ * Supported login auth methods for this session.
159
+ */
160
+ loginAuthMethods?: TAuthMethod[];
131
161
  };
132
162
  export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & WithIsPasskeySupported & {
133
163
  /**
@@ -138,6 +168,10 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
138
168
  * A Para Portal URL for creating a new user password.
139
169
  */
140
170
  passwordUrl?: string;
171
+ /**
172
+ * A Para Portal URL for creating a new user PIN.
173
+ */
174
+ pinUrl?: string;
141
175
  /**
142
176
  * The Para system ID for the newly generated passkey.
143
177
  */
@@ -146,11 +180,22 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
146
180
  * The Para system ID for the newly generated password.
147
181
  */
148
182
  passwordId?: string;
183
+ /**
184
+ * The Para system ID for the newly generated PIN.
185
+ */
186
+ pinId?: string;
187
+ /**
188
+ * Supported signup auth methods for this session.
189
+ */
190
+ signupAuthMethods?: TAuthMethod[];
191
+ };
192
+ export type AuthStateDone = Omit<ServerAuthStateDone, 'authMethods'> & {
193
+ authMethods: TAuthMethod[];
149
194
  };
150
195
  export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
151
- export type AuthStateSignupOrLogin = AuthStateSignup | AuthStateLogin;
152
- export type OAuthResponse = AuthStateSignupOrLogin;
153
- export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup;
196
+ export type AuthStateSignupOrLoginOrDone = AuthStateSignup | AuthStateLogin | AuthStateDone;
197
+ export type OAuthResponse = AuthStateSignupOrLoginOrDone;
198
+ export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup | AuthStateDone;
154
199
  export type Verify2faParams = {
155
200
  auth: VerifiedAuth;
156
201
  verificationCode: string;
@@ -4,5 +4,6 @@ export declare enum PopupType {
4
4
  LOGIN_PASSKEY = "LOGIN_PASSKEY",
5
5
  CREATE_PASSKEY = "CREATE_PASSKEY",
6
6
  OAUTH = "OAUTH",
7
- ON_RAMP_TRANSACTION = "ON_RAMP_TRANSACTION"
7
+ ON_RAMP_TRANSACTION = "ON_RAMP_TRANSACTION",
8
+ EXPORT_PRIVATE_KEY = "EXPORT_PRIVATE_KEY"
8
9
  }
@@ -1,5 +1,5 @@
1
- import { EmbeddedWalletType, ExternalWalletType, PartnerEntity, TExternalWallet, 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' | 'sharesPersisted'> {
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;
@@ -20,12 +20,16 @@ export interface Wallet {
20
20
  lastUsedPartnerId?: string;
21
21
  isExternal?: boolean;
22
22
  isExternalWithParaAuth?: boolean;
23
- externalProviderId?: TExternalWallet;
23
+ externalProviderId?: string;
24
24
  isExternalWithVerification?: boolean;
25
25
  isExternalConnectionOnly?: boolean;
26
26
  ensName?: string | null;
27
27
  ensAvatar?: string | null;
28
28
  }
29
+ export type AvailableWallet = Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'partner' | 'ensName' | 'ensAvatar' | 'isExternal' | 'externalProviderId' | 'isExternalConnectionOnly'> & {
30
+ addressShort?: string;
31
+ displayName?: string;
32
+ };
29
33
  /** @deprecated */
30
34
  export declare enum PregenIdentifierType {
31
35
  EMAIL = "EMAIL",
@@ -0,0 +1,7 @@
1
+ import { BalancesConfig } from '@getpara/user-management-client';
2
+ /**
3
+ * Validates if an object is a valid BalancesConfig
4
+ * @param obj - The object to validate
5
+ * @returns True if the object is a valid BalancesConfig, false otherwise
6
+ */
7
+ export declare function validateBalancesConfig(obj: any): obj is BalancesConfig;
@@ -1,4 +1,5 @@
1
1
  export * from './autobind.js';
2
+ export * from './config.js';
2
3
  export * from './events.js';
3
4
  export * from './formatting.js';
4
5
  export * from './json.js';
@@ -9,3 +10,4 @@ export * from './polling.js';
9
10
  export * from './types.js';
10
11
  export * from './url.js';
11
12
  export * from './wallet.js';
13
+ export * from './window.js';
@@ -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;
@@ -1,9 +1,9 @@
1
1
  import { Ctx, Environment } from '../types/index.js';
2
- export declare function getPortalDomain(env: Environment, isE2E?: boolean): "localhost" | "app.sandbox.usecapsule.com" | "app.beta.usecapsule.com" | "app.usecapsule.com";
2
+ export declare function getPortalDomain(env: Environment, isE2E?: boolean, isLegacy?: boolean): string;
3
3
  export declare function getPortalBaseURL({ env, isE2E }: {
4
4
  env: Environment;
5
5
  isE2E?: boolean;
6
- }, useLocalIp?: boolean, isForWasm?: boolean): string;
6
+ }, useLocalIp?: boolean, isForWasm?: boolean, isLegacy?: boolean): string;
7
7
  export declare function getParaConnectDomain(env: Environment): "localhost" | "connect.sandbox.getpara.com" | "connect.beta.getpara.com" | "connect.getpara.com";
8
8
  export declare function getParaConnectBaseUrl({ env }: {
9
9
  env: Environment;
@@ -13,4 +13,4 @@ export declare function constructUrl({ base, path, params, }: {
13
13
  path: string;
14
14
  params?: Record<string, string | undefined | null>;
15
15
  }): string;
16
- export declare function shortenUrl(ctx: Ctx, url: string): Promise<string>;
16
+ export declare function shortenUrl(ctx: Ctx, url: string, isLegacy?: boolean): Promise<string>;
@@ -11,3 +11,4 @@ export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
11
11
  export declare function supportedWalletTypesEq(a: SupportedWalletTypes, b: SupportedWalletTypes): boolean;
12
12
  export declare function mergeCurrentWalletIds(original: CurrentWalletIds, additional: CurrentWalletIds): CurrentWalletIds;
13
13
  export declare function newUuid(): string;
14
+ export declare function currentWalletIdsEq(a: CurrentWalletIds | undefined, b: CurrentWalletIds | undefined): boolean;
@@ -0,0 +1,2 @@
1
+ import { Ctx, Environment } from '../types/index.js';
2
+ export declare function isPortal(ctx: Ctx, env?: Environment): boolean;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.0.0-fc.3",
3
+ "version": "2.1.0",
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-fc.3",
8
+ "@getpara/user-management-client": "2.1.0",
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": "5ba068331384bed874c0da0d3d0e1fed6bf03ff9",
30
+ "gitHead": "3ae7f836324a3a2a8a57156e16304aeaf0d37b42",
31
31
  "main": "dist/cjs/index.js",
32
32
  "module": "dist/esm/index.js",
33
33
  "scripts": {
@@ -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