@getpara/core-sdk 2.0.0-dev.1 → 2.0.0-dev.2

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 (97) hide show
  1. package/dist/cjs/ParaCore.js +3378 -0
  2. package/dist/cjs/PlatformUtils.js +15 -0
  3. package/dist/cjs/StorageUtils.js +15 -0
  4. package/dist/cjs/constants.js +87 -0
  5. package/dist/cjs/cryptography/utils.js +350 -0
  6. package/dist/cjs/errors.js +51 -0
  7. package/dist/cjs/external/mpcComputationClient.js +62 -0
  8. package/dist/cjs/external/userManagementClient.js +106 -0
  9. package/dist/cjs/index.js +100 -5043
  10. package/dist/cjs/package.json +3 -0
  11. package/dist/cjs/shares/KeyContainer.js +89 -0
  12. package/dist/cjs/shares/recovery.js +127 -0
  13. package/dist/cjs/shares/shareDistribution.js +104 -0
  14. package/dist/cjs/transmission/transmissionUtils.js +93 -0
  15. package/dist/cjs/types/auth.js +33 -0
  16. package/dist/cjs/types/config.js +43 -0
  17. package/dist/cjs/types/coreApi.js +89 -0
  18. package/dist/cjs/types/events.js +41 -0
  19. package/dist/cjs/types/index.js +54 -0
  20. package/dist/cjs/types/methods.js +15 -0
  21. package/dist/cjs/types/onRamps.js +33 -0
  22. package/dist/cjs/types/popup.js +35 -0
  23. package/dist/cjs/types/recovery.js +34 -0
  24. package/dist/cjs/types/theme.js +15 -0
  25. package/dist/cjs/types/wallet.js +31 -0
  26. package/dist/cjs/utils/autobind.js +41 -0
  27. package/dist/cjs/utils/events.js +45 -0
  28. package/dist/cjs/utils/formatting.js +116 -0
  29. package/dist/cjs/utils/index.js +41 -0
  30. package/dist/cjs/utils/json.js +37 -0
  31. package/dist/cjs/utils/listeners.js +71 -0
  32. package/dist/cjs/utils/onRamps.js +92 -0
  33. package/dist/cjs/utils/phone.js +73 -0
  34. package/dist/cjs/utils/polling.js +58 -0
  35. package/dist/cjs/utils/types.js +29 -0
  36. package/dist/cjs/utils/url.js +135 -0
  37. package/dist/cjs/utils/wallet.js +159 -0
  38. package/dist/esm/ParaCore.js +3343 -0
  39. package/dist/esm/PlatformUtils.js +0 -0
  40. package/dist/esm/StorageUtils.js +0 -0
  41. package/dist/esm/chunk-7B52C2XE.js +70 -0
  42. package/dist/esm/constants.js +45 -0
  43. package/dist/esm/cryptography/utils.js +282 -0
  44. package/dist/esm/errors.js +27 -0
  45. package/dist/esm/external/mpcComputationClient.js +30 -0
  46. package/dist/esm/external/userManagementClient.js +71 -0
  47. package/dist/esm/index.js +76 -5011
  48. package/dist/esm/package.json +4 -0
  49. package/dist/esm/shares/KeyContainer.js +57 -0
  50. package/dist/esm/shares/recovery.js +74 -0
  51. package/dist/esm/shares/shareDistribution.js +64 -0
  52. package/dist/esm/transmission/transmissionUtils.js +42 -0
  53. package/dist/esm/types/auth.js +11 -0
  54. package/dist/esm/types/config.js +20 -0
  55. package/dist/esm/types/coreApi.js +66 -0
  56. package/dist/esm/types/events.js +19 -0
  57. package/dist/esm/types/index.js +23 -0
  58. package/dist/esm/types/methods.js +0 -0
  59. package/dist/esm/types/onRamps.js +11 -0
  60. package/dist/esm/types/popup.js +13 -0
  61. package/dist/esm/types/recovery.js +12 -0
  62. package/dist/esm/types/theme.js +0 -0
  63. package/dist/esm/types/wallet.js +9 -0
  64. package/dist/esm/utils/autobind.js +19 -0
  65. package/dist/esm/utils/events.js +11 -0
  66. package/dist/esm/utils/formatting.js +76 -0
  67. package/dist/esm/utils/index.js +11 -0
  68. package/dist/esm/utils/json.js +15 -0
  69. package/dist/esm/utils/listeners.js +38 -0
  70. package/dist/esm/utils/onRamps.js +66 -0
  71. package/dist/esm/utils/phone.js +39 -0
  72. package/dist/esm/utils/polling.js +18 -0
  73. package/dist/esm/utils/types.js +7 -0
  74. package/dist/esm/utils/url.js +90 -0
  75. package/dist/esm/utils/wallet.js +103 -0
  76. package/dist/types/ParaCore.d.ts +115 -449
  77. package/dist/types/PlatformUtils.d.ts +4 -5
  78. package/dist/types/constants.d.ts +16 -13
  79. package/dist/types/index.d.ts +3 -3
  80. package/dist/types/shares/KeyContainer.d.ts +0 -2
  81. package/dist/types/types/auth.d.ts +16 -0
  82. package/dist/types/types/config.d.ts +12 -5
  83. package/dist/types/types/coreApi.d.ts +152 -58
  84. package/dist/types/types/events.d.ts +4 -1
  85. package/dist/types/types/index.d.ts +1 -0
  86. package/dist/types/types/methods.d.ts +49 -57
  87. package/dist/types/types/onRamps.d.ts +3 -3
  88. package/dist/types/types/wallet.d.ts +8 -3
  89. package/dist/types/utils/formatting.d.ts +5 -2
  90. package/dist/types/utils/onRamps.d.ts +12 -5
  91. package/dist/types/utils/phone.d.ts +4 -0
  92. package/dist/types/utils/wallet.d.ts +8 -7
  93. package/package.json +27 -26
  94. package/dist/cjs/index.js.br +0 -0
  95. package/dist/cjs/index.js.gz +0 -0
  96. package/dist/esm/index.js.br +0 -0
  97. package/dist/esm/index.js.gz +0 -0
@@ -1,11 +1,10 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { BackupKitEmailProps, TPregenIdentifierType, WalletType } from '@getpara/user-management-client';
1
+ import { BackupKitEmailProps, TPregenIdentifierType, TWalletType, SDKType } from '@getpara/user-management-client';
4
2
  import { Ctx, PopupType, SignatureRes } from './types/index.js';
5
3
  import { StorageUtils } from './StorageUtils.js';
6
4
  export interface PlatformUtils {
5
+ sdkType: SDKType;
7
6
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
8
- keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
7
+ keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
9
8
  sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
10
9
  signer: string;
11
10
  walletId: string;
@@ -14,7 +13,7 @@ export interface PlatformUtils {
14
13
  signer: string;
15
14
  protocolId?: string;
16
15
  }>;
17
- preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
16
+ preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
18
17
  sessionCookie: string): Promise<{
19
18
  signer: string;
20
19
  walletId: string;
@@ -1,18 +1,21 @@
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;
4
- export declare const LOCAL_STORAGE_EMAIL: string;
5
- export declare const LOCAL_STORAGE_PHONE: string;
6
- export declare const LOCAL_STORAGE_COUNTRY_CODE: string;
7
- export declare const LOCAL_STORAGE_FARCASTER_USERNAME: string;
8
- export declare const LOCAL_STORAGE_TELEGRAM_USER_ID: string;
9
- export declare const LOCAL_STORAGE_USER_ID: string;
10
- export declare const LOCAL_STORAGE_ED25519_WALLETS: string;
11
- export declare const LOCAL_STORAGE_WALLETS: string;
12
- export declare const LOCAL_STORAGE_EXTERNAL_WALLETS: string;
13
- export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS: string;
14
- export declare const LOCAL_STORAGE_SESSION_COOKIE: string;
15
- export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR: string;
3
+ export declare const LOCAL_STORAGE_AUTH_INFO = "@CAPSULE/authInfo";
4
+ export declare const LOCAL_STORAGE_EMAIL = "@CAPSULE/e-mail";
5
+ export declare const LOCAL_STORAGE_PHONE = "@CAPSULE/phone";
6
+ export declare const LOCAL_STORAGE_COUNTRY_CODE = "@CAPSULE/countryCode";
7
+ export declare const LOCAL_STORAGE_FARCASTER_USERNAME = "@CAPSULE/farcasterUsername";
8
+ export declare const LOCAL_STORAGE_TELEGRAM_USER_ID = "@CAPSULE/telegramUserId";
9
+ export declare const LOCAL_STORAGE_EXTERNAL_WALLET_USER_ID = "@CAPSULE/externalWalletUserId";
10
+ export declare const LOCAL_STORAGE_USER_ID = "@CAPSULE/userId";
11
+ export declare const LOCAL_STORAGE_ED25519_WALLETS = "@CAPSULE/ed25519Wallets";
12
+ export declare const LOCAL_STORAGE_WALLETS = "@CAPSULE/wallets";
13
+ export declare const LOCAL_STORAGE_EXTERNAL_WALLETS = "@CAPSULE/externalWallets";
14
+ export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS = "@CAPSULE/currentWalletIds";
15
+ export declare const LOCAL_STORAGE_SESSION_COOKIE = "@CAPSULE/sessionCookie";
16
+ export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = "@CAPSULE/loginEncryptionKeyPair";
16
17
  export declare const POLLING_INTERVAL_MS = 2000;
17
18
  export declare const SHORT_POLLING_INTERVAL_MS = 1000;
18
19
  export declare const POLLING_TIMEOUT_MS = 300000;
20
+ export declare const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
21
+ export declare const ACCOUNT_LINK_CONFLICT = "Account already linked";
@@ -1,6 +1,6 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
- export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, 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 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, } from './types/index.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';
4
4
  export * from './types/coreApi.js';
5
5
  export * from './types/events.js';
6
6
  export * from './types/config.js';
@@ -19,7 +19,7 @@ export * from './utils/formatting.js';
19
19
  export * from './utils/polling.js';
20
20
  export * from './utils/phone.js';
21
21
  export { isWalletSupported } from './utils/wallet.js';
22
- export { getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
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
25
  export declare const paraVersion: string;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export declare class KeyContainer {
4
2
  walletId: string;
5
3
  keyshare: string;
@@ -0,0 +1,16 @@
1
+ import { ExternalWalletInfo, TLinkedAccountType } from '@getpara/user-management-client';
2
+ export type AccountLinkInProgress = {
3
+ id: string;
4
+ type: TLinkedAccountType;
5
+ identifier?: string;
6
+ isComplete: boolean;
7
+ externalWallet?: ExternalWalletInfo & {
8
+ signatureVerificationMessage: string;
9
+ };
10
+ };
11
+ export declare enum AccountLinkError {
12
+ NotAuthenticated = "No user is currently authenticated",
13
+ Conflict = "Account already linked",
14
+ Canceled = "Account linking was canceled",
15
+ Unknown = "An unknown error occurred"
16
+ }
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, WalletScheme, WalletType } from '@getpara/user-management-client';
2
+ import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType } from '@getpara/user-management-client';
3
3
  import { Theme } from './theme.js';
4
4
  export declare enum Environment {
5
5
  DEV = "DEV",
@@ -25,11 +25,9 @@ export interface Ctx {
25
25
  }
26
26
  export type deprecated__NetworkProp = keyof typeof Network | Network;
27
27
  export type deprecated__OnRampProviderProp = keyof typeof OnRampProvider | OnRampProvider;
28
- export type WalletTypeProp = keyof typeof WalletType | WalletType;
29
- export type WalletSchemeProp = keyof typeof WalletScheme | WalletScheme;
30
28
  export type WalletFilters = {
31
- type?: WalletTypeProp[];
32
- scheme?: WalletSchemeProp[];
29
+ type?: TWalletType[];
30
+ scheme?: TWalletScheme[];
33
31
  forbidPregen?: boolean;
34
32
  };
35
33
  export type deprecated__RampConfig = {
@@ -58,6 +56,7 @@ export type SupportedWalletTypeConfig = {
58
56
  optional?: boolean;
59
57
  };
60
58
  export interface ConstructorOpts {
59
+ externalWalletConnectionOnly?: boolean;
61
60
  useStorageOverrides?: boolean;
62
61
  disableWorkers?: boolean;
63
62
  offloadMPCComputationURL?: string;
@@ -141,4 +140,12 @@ export interface ConstructorOpts {
141
140
  * Partner ID set in the Para Portal to track analytics for legacy SDK versions. This variable is unused outside of the Para Portal.
142
141
  */
143
142
  portalPartnerId?: string;
143
+ /**
144
+ * An optional function that fetches the pregenerated wallets for a given identifier so a user can claim them on account creation.
145
+ */
146
+ fetchPregenWalletsOverride?: (opts: {
147
+ pregenId: PregenAuth;
148
+ }) => Promise<{
149
+ userShare?: string;
150
+ }>;
144
151
  }
@@ -1,25 +1,54 @@
1
- import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, TelegramAuthResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, WalletType } from '@getpara/user-management-client';
2
- import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams } from './methods.js';
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';
3
3
  import { ParaCore } from '../ParaCore.js';
4
4
  import { FullSignatureRes, Wallet } from './wallet.js';
5
- export declare const PARA_CORE_METHODS: readonly ["signUpOrLogInV2", "verifyNewAccountV2", "waitForLoginV2", "waitForSignupV2", "waitForWalletCreationV2", "verifyOAuthV2", "verifyFarcasterV2", "verifyTelegramV2", "resendVerificationCode", "loginExternalWalletV2", "verifyExternalWalletV2", "setup2faV2", "enable2faV2", "verify2faV2", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWalletsV2", "hasPregenWalletV2", "updatePregenWalletIdentifierV2", "createPregenWalletV2", "createPregenWalletPerTypeV2", "claimPregenWalletsV2", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction"];
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
8
  export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
7
9
  export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
8
10
  params: infer P;
9
11
  } ? P : never;
12
+ export type CoreMethodIsGetter<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
13
+ isGetter: true;
14
+ } ? true : false;
10
15
  export type CoreMethodResponse<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
11
16
  response: infer R;
12
17
  } ? CoreMethods[method] extends {
13
18
  sync: true;
14
19
  } ? R : Promise<R> : void;
15
- export type CoreMethod<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? () => CoreMethodResponse<method> : (_?: CoreMethodParams<method>) => CoreMethodResponse<method>;
20
+ export type CoreMethod<method extends CoreMethodName & keyof CoreMethods> = CoreMethodIsGetter<method> extends true ? Awaited<CoreMethodResponse<method>> : CoreMethodParams<method> extends void | never ? () => CoreMethodResponse<method> : (_?: CoreMethodParams<method>) => CoreMethodResponse<method>;
16
21
  export type CoreAction<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? (_?: ParaCore) => CoreMethodResponse<method> : (_?: ParaCore, __?: CoreMethodParams<method>) => CoreMethodResponse<method>;
22
+ export type InternalMethodName = (typeof PARA_INTERNAL_METHODS)[number];
23
+ export type InternalMethodParams<method extends InternalMethodName & keyof InternalMethods> = InternalMethods[method] extends {
24
+ params: infer P;
25
+ } ? P : never;
26
+ export type InternalMethodIsGetter<method extends InternalMethodName & keyof InternalMethods> = InternalMethods[method] extends {
27
+ isGetter: true;
28
+ } ? true : false;
29
+ export type InternalMethodResponse<method extends InternalMethodName & keyof InternalMethods> = InternalMethods[method] extends {
30
+ response: infer R;
31
+ } ? InternalMethods[method] extends {
32
+ sync: true;
33
+ } ? R : Promise<R> : void;
34
+ export type InternalMethod<method extends InternalMethodName & keyof InternalMethods> = InternalMethodIsGetter<method> extends true ? Awaited<InternalMethodResponse<method>> : InternalMethodParams<method> extends void | never ? () => InternalMethodResponse<method> : (_?: InternalMethodParams<method>) => InternalMethodResponse<method>;
35
+ export type InternalAction<method extends InternalMethodName & keyof InternalMethods> = InternalMethodParams<method> extends void | never ? (_?: ParaCore) => InternalMethodResponse<method> : (_?: ParaCore, __?: InternalMethodParams<method>) => InternalMethodResponse<method>;
17
36
  export type CoreMethods = Record<CoreMethodName, {
18
37
  params?: unknown;
19
38
  response?: unknown;
20
39
  sync?: true;
21
40
  }> & {
22
- signUpOrLogInV2: {
41
+ accountLinkInProgress: {
42
+ params: never;
43
+ response: AccountLinkInProgress;
44
+ isGetter: true;
45
+ };
46
+ getAuthInfo: {
47
+ params: void;
48
+ response: CoreAuthInfo | undefined;
49
+ sync: true;
50
+ };
51
+ signUpOrLogIn: {
23
52
  params: WithCustomTheme & WithUseShortUrls & {
24
53
  /**
25
54
  * The user's email address or phone number, in the form `{ email: '...' } | { phone: '+1...' }`}
@@ -28,7 +57,7 @@ export type CoreMethods = Record<CoreMethodName, {
28
57
  };
29
58
  response: AuthStateVerify | AuthStateLogin;
30
59
  };
31
- verifyNewAccountV2: {
60
+ verifyNewAccount: {
32
61
  params: WithCustomTheme & WithUseShortUrls & {
33
62
  /**
34
63
  * The verification code entered by the user.
@@ -37,7 +66,7 @@ export type CoreMethods = Record<CoreMethodName, {
37
66
  };
38
67
  response: AuthStateSignup;
39
68
  };
40
- waitForLoginV2: {
69
+ waitForLogin: {
41
70
  params: PollParams & {
42
71
  /**
43
72
  * Whether to skip the session refresh
@@ -59,7 +88,7 @@ export type CoreMethods = Record<CoreMethodName, {
59
88
  partnerId?: string;
60
89
  };
61
90
  };
62
- waitForSignupV2: {
91
+ waitForSignup: {
63
92
  params: PollParams & {
64
93
  /**
65
94
  * A function returning a boolean, indicating whether the signup process should be cancelled.
@@ -68,7 +97,7 @@ export type CoreMethods = Record<CoreMethodName, {
68
97
  };
69
98
  response: true;
70
99
  };
71
- waitForWalletCreationV2: {
100
+ waitForWalletCreation: {
72
101
  params: PollParams & {
73
102
  /**
74
103
  * A function returning a boolean, indicating whether wallet creation should be cancelled.
@@ -86,58 +115,45 @@ export type CoreMethods = Record<CoreMethodName, {
86
115
  recoverySecret?: string;
87
116
  };
88
117
  };
89
- verifyOAuthV2: {
90
- params: AuthStateBaseParams & OAuthUrlParams & PollParams & {
91
- /**
92
- * A function returning a boolean, indicating whether the OAuth process should be cancelled.
93
- */
94
- isCanceled?: () => boolean;
95
- /**
96
- * A callback function that will be invoked with the OAuth URL when it is available.
97
- * For example, you can use this to open the URL in a new window or tab.
98
- */
99
- onOAuthUrl?: (url: string) => void;
118
+ getOAuthUrl: {
119
+ params: OAuthUrlParams & {
120
+ sessionLookupId?: string;
100
121
  };
122
+ response: string;
123
+ };
124
+ verifyOAuth: {
125
+ params: AuthStateBaseParams & OAuthParams;
101
126
  response: OAuthResponse;
102
127
  };
103
- verifyFarcasterV2: {
104
- params: AuthStateBaseParams & PollParams & {
105
- /**
106
- * A function returning a boolean, indicating whether the Farcaster login process should be cancelled.
107
- */
108
- isCanceled?: () => boolean;
109
- /**
110
- * A callback function that will be invoked with the Farcaster Connect URI when it is available.
111
- * You will need to display the URI as a QR code.
112
- */
113
- onConnectUri: (uri: string) => void;
114
- };
128
+ getFarcasterConnectUri: {
129
+ params: void;
130
+ response: string;
131
+ };
132
+ verifyFarcaster: {
133
+ params: AuthStateBaseParams & FarcasterParams;
115
134
  response: OAuthResponse;
116
135
  };
117
- verifyTelegramV2: {
118
- params: AuthStateBaseParams & {
119
- /**
120
- * The response received from the Telegram login bot.
121
- */
122
- telegramAuthResponse: TelegramAuthResponse;
123
- };
136
+ verifyTelegram: {
137
+ params: AuthStateBaseParams & TelegramParams;
124
138
  response: OAuthResponse;
125
139
  };
126
- loginExternalWalletV2: {
140
+ loginExternalWallet: {
127
141
  params: AuthStateBaseParams & {
128
142
  /**
129
143
  * The external wallet information to use for login.
130
144
  */
131
- externalWallet: ExternalWalletInfo;
145
+ externalWallet: ExternalWalletInfo | ExternalWalletInfo[];
132
146
  };
133
147
  response: AuthStateVerifyOrLogin;
134
148
  };
135
- verifyExternalWalletV2: {
149
+ verifyExternalWallet: {
136
150
  params: AuthStateBaseParams & VerifyExternalWalletParams;
137
151
  response: AuthStateSignup;
138
152
  };
139
153
  resendVerificationCode: {
140
- params: void;
154
+ params: {
155
+ type?: 'SIGNUP' | 'LINK_ACCOUNT';
156
+ } | undefined;
141
157
  response: void;
142
158
  };
143
159
  logout: {
@@ -172,7 +188,12 @@ export type CoreMethods = Record<CoreMethodName, {
172
188
  response: boolean;
173
189
  };
174
190
  exportSession: {
175
- params: void;
191
+ params: {
192
+ /**
193
+ * Whether to exclude the wallet signers from the exported session.
194
+ */
195
+ excludeSigners?: boolean;
196
+ };
176
197
  response: string;
177
198
  sync: true;
178
199
  };
@@ -184,11 +205,11 @@ export type CoreMethods = Record<CoreMethodName, {
184
205
  params: void;
185
206
  response: string;
186
207
  };
187
- setup2faV2: {
208
+ setup2fa: {
188
209
  params: void;
189
210
  response: Setup2faResponse;
190
211
  };
191
- enable2faV2: {
212
+ enable2fa: {
192
213
  params: {
193
214
  /**
194
215
  * The two-factor authentication code entered by the user.
@@ -197,7 +218,7 @@ export type CoreMethods = Record<CoreMethodName, {
197
218
  };
198
219
  response: void;
199
220
  };
200
- verify2faV2: {
221
+ verify2fa: {
201
222
  params: {
202
223
  /**
203
224
  * The email or phone number for the user to verify, in the form `{ email: '...' } | { phone: '+1...' }`
@@ -210,13 +231,23 @@ export type CoreMethods = Record<CoreMethodName, {
210
231
  };
211
232
  response: Verify2faResponse;
212
233
  };
234
+ getWallets: {
235
+ params: void;
236
+ response: Record<string, Wallet>;
237
+ sync: true;
238
+ };
239
+ getWalletsByType: {
240
+ params: TWalletType;
241
+ response: Wallet[];
242
+ sync: true;
243
+ };
213
244
  fetchWallets: {
214
245
  params: void;
215
246
  response: WalletEntity[];
216
247
  };
217
248
  createWallet: {
218
249
  params: {
219
- type?: Uppercase<WalletType>;
250
+ type?: Uppercase<TWalletType>;
220
251
  skipDistribute?: boolean;
221
252
  };
222
253
  response: [Wallet, string | undefined];
@@ -226,7 +257,7 @@ export type CoreMethods = Record<CoreMethodName, {
226
257
  /**
227
258
  * Array of the wallet types to create
228
259
  */
229
- types?: Uppercase<WalletType>[];
260
+ types?: Uppercase<TWalletType>[];
230
261
  /**
231
262
  * If `true`, skip distributing the new wallets shares.
232
263
  */
@@ -247,7 +278,7 @@ export type CoreMethods = Record<CoreMethodName, {
247
278
  recoverySecret?: string;
248
279
  };
249
280
  };
250
- getPregenWalletsV2: {
281
+ getPregenWallets: {
251
282
  params: {
252
283
  /**
253
284
  * The pregen ID for the wallets to fetch. If not provided, all available wallets will be retrieved.
@@ -256,7 +287,7 @@ export type CoreMethods = Record<CoreMethodName, {
256
287
  };
257
288
  response: WalletEntity[];
258
289
  };
259
- updatePregenWalletIdentifierV2: {
290
+ updatePregenWalletIdentifier: {
260
291
  params: {
261
292
  /**
262
293
  * The ID of the pregen wallet to update.
@@ -269,7 +300,7 @@ export type CoreMethods = Record<CoreMethodName, {
269
300
  };
270
301
  response: void;
271
302
  };
272
- hasPregenWalletV2: {
303
+ hasPregenWallet: {
273
304
  params: {
274
305
  /**
275
306
  * The pregen ID for the wallet to check.
@@ -278,12 +309,12 @@ export type CoreMethods = Record<CoreMethodName, {
278
309
  };
279
310
  response: boolean;
280
311
  };
281
- createPregenWalletV2: {
312
+ createPregenWallet: {
282
313
  params: {
283
314
  /**
284
315
  * The type of wallet to create, 'EVM' | 'SOLANA' | 'COSMOS'
285
316
  */
286
- type: WalletType;
317
+ type: TWalletType;
287
318
  /**
288
319
  * The pregen identifier for the wallet, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
289
320
  */
@@ -291,12 +322,12 @@ export type CoreMethods = Record<CoreMethodName, {
291
322
  };
292
323
  response: Wallet;
293
324
  };
294
- createPregenWalletPerTypeV2: {
325
+ createPregenWalletPerType: {
295
326
  params: {
296
327
  /**
297
328
  * The wallet types to create. If not provided, defaults to your application's `supportedWalletTypes` setting.
298
329
  */
299
- types?: WalletType[];
330
+ types?: TWalletType[];
300
331
  /**
301
332
  * The pregen identifier for the wallets, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
302
333
  */
@@ -304,7 +335,7 @@ export type CoreMethods = Record<CoreMethodName, {
304
335
  };
305
336
  response: Wallet[];
306
337
  };
307
- claimPregenWalletsV2: {
338
+ claimPregenWallets: {
308
339
  params: {
309
340
  /**
310
341
  * The pregen identifier for the wallet to claim. If not provided, will attempt to claim all wallets in storage.
@@ -313,6 +344,10 @@ export type CoreMethods = Record<CoreMethodName, {
313
344
  };
314
345
  response: string | undefined;
315
346
  };
347
+ createGuestWallets: {
348
+ params: void;
349
+ response: Wallet[];
350
+ };
316
351
  distributeNewWalletShare: {
317
352
  params: {
318
353
  /**
@@ -431,7 +466,66 @@ export type CoreMethods = Record<CoreMethodName, {
431
466
  portalUrl: string;
432
467
  };
433
468
  };
469
+ getWalletBalance: {
470
+ params: GetWalletBalanceParams;
471
+ response: GetWalletBalanceResponse;
472
+ };
473
+ issueJwt: {
474
+ params: IssueJwtParams;
475
+ response: IssueJwtResponse;
476
+ };
477
+ getLinkedAccounts: {
478
+ params: {
479
+ withMetadata?: boolean;
480
+ };
481
+ response: LinkedAccounts & {
482
+ userId: string;
483
+ };
484
+ };
485
+ };
486
+ export type InternalMethods = {
487
+ linkAccount: {
488
+ params: {
489
+ auth: VerifiedAuth;
490
+ } | {
491
+ externalWallet: ExternalWalletInfo;
492
+ } | {
493
+ type: TLinkedAccountType | 'X';
494
+ };
495
+ response: AccountLinkInProgress;
496
+ };
497
+ unlinkAccount: {
498
+ params: {
499
+ linkedAccountId: string;
500
+ };
501
+ response: LinkedAccounts;
502
+ };
503
+ verifyEmailOrPhoneLink: {
504
+ params: {
505
+ verificationCode?: string;
506
+ };
507
+ response: LinkedAccounts;
508
+ };
509
+ verifyOAuthLink: {
510
+ params: OAuthParams;
511
+ response: LinkedAccounts;
512
+ };
513
+ verifyFarcasterLink: {
514
+ params: FarcasterParams;
515
+ response: LinkedAccounts;
516
+ };
517
+ verifyTelegramLink: {
518
+ params: TelegramParams;
519
+ response: LinkedAccounts;
520
+ };
521
+ verifyExternalWalletLink: {
522
+ params: Omit<VerifyExternalWalletParams, 'externalWallet'>;
523
+ response: LinkedAccounts;
524
+ };
434
525
  };
435
526
  export type CoreInterface = {
436
- [key in keyof CoreMethods]: CoreMethod<key>;
527
+ [key in keyof CoreMethods]: Partial<CoreMethod<key>>;
528
+ };
529
+ export type InternalInterface = {
530
+ [key in keyof InternalMethods]: Partial<InternalMethod<key>>;
437
531
  };
@@ -1,6 +1,7 @@
1
1
  import { CurrentWalletIds } from '@getpara/user-management-client';
2
2
  import { FullSignatureRes } from './wallet.js';
3
3
  import { Wallet } from './wallet.js';
4
+ import { CoreMethodResponse } from './coreApi.js';
4
5
  export declare enum ParaEvent {
5
6
  LOGIN_EVENT = "paraLogin",
6
7
  ACCOUNT_CREATION_EVENT = "paraAccountCreation",
@@ -11,7 +12,8 @@ export declare enum ParaEvent {
11
12
  EXTERNAL_WALLET_CHANGE_EVENT = "paraExternalWalletChange",
12
13
  WALLETS_CHANGE_EVENT = "paraWalletsChange",
13
14
  WALLET_CREATED = "paraWalletCreated",
14
- PREGEN_WALLET_CLAIMED = "paraPregenWalletClaimed"
15
+ PREGEN_WALLET_CLAIMED = "paraPregenWalletClaimed",
16
+ GUEST_WALLETS_CREATED = "paraGuestWalletsCreated"
15
17
  }
16
18
  export type BaseEvent<T> = {
17
19
  data: T;
@@ -45,3 +47,4 @@ export type PregenWalletClaimedResponse = {
45
47
  recoverySecret?: string;
46
48
  };
47
49
  export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
50
+ export type GuestWalletsCreatedEvent = CustomEventInit<BaseEvent<CoreMethodResponse<'createGuestWallets'>>>;
@@ -1,3 +1,4 @@
1
+ export * from './auth.js';
1
2
  export * from './config.js';
2
3
  export * from './coreApi.js';
3
4
  export * from './wallet.js';