@getpara/core-sdk 2.0.0-dev.0 → 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.
- package/dist/cjs/ParaCore.js +3378 -0
- package/dist/cjs/PlatformUtils.js +15 -0
- package/dist/cjs/StorageUtils.js +15 -0
- package/dist/cjs/constants.js +87 -0
- package/dist/cjs/cryptography/utils.js +350 -0
- package/dist/cjs/errors.js +51 -0
- package/dist/cjs/external/mpcComputationClient.js +62 -0
- package/dist/cjs/external/userManagementClient.js +106 -0
- package/dist/cjs/index.js +102 -4080
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/shares/KeyContainer.js +89 -0
- package/dist/cjs/shares/recovery.js +127 -0
- package/dist/cjs/shares/shareDistribution.js +104 -0
- package/dist/cjs/transmission/transmissionUtils.js +93 -0
- package/dist/cjs/types/auth.js +33 -0
- package/dist/cjs/types/config.js +43 -0
- package/dist/cjs/types/coreApi.js +89 -0
- package/dist/cjs/types/events.js +41 -0
- package/dist/cjs/types/index.js +54 -0
- package/dist/cjs/types/methods.js +15 -0
- package/dist/cjs/types/onRamps.js +33 -0
- package/dist/cjs/types/popup.js +35 -0
- package/dist/cjs/types/recovery.js +34 -0
- package/dist/cjs/types/theme.js +15 -0
- package/dist/cjs/types/wallet.js +31 -0
- package/dist/cjs/utils/autobind.js +41 -0
- package/dist/cjs/utils/events.js +45 -0
- package/dist/cjs/utils/formatting.js +116 -0
- package/dist/cjs/utils/index.js +41 -0
- package/dist/cjs/utils/json.js +37 -0
- package/dist/cjs/utils/listeners.js +71 -0
- package/dist/cjs/utils/onRamps.js +92 -0
- package/dist/cjs/utils/phone.js +73 -0
- package/dist/cjs/utils/polling.js +58 -0
- package/dist/cjs/utils/types.js +29 -0
- package/dist/cjs/utils/url.js +135 -0
- package/dist/cjs/utils/wallet.js +159 -0
- package/dist/esm/ParaCore.js +3343 -0
- package/dist/esm/PlatformUtils.js +0 -0
- package/dist/esm/StorageUtils.js +0 -0
- package/dist/esm/chunk-7B52C2XE.js +70 -0
- package/dist/esm/constants.js +45 -0
- package/dist/esm/cryptography/utils.js +282 -0
- package/dist/esm/errors.js +27 -0
- package/dist/esm/external/mpcComputationClient.js +30 -0
- package/dist/esm/external/userManagementClient.js +71 -0
- package/dist/esm/index.js +78 -4049
- package/dist/esm/package.json +4 -0
- package/dist/esm/shares/KeyContainer.js +57 -0
- package/dist/esm/shares/recovery.js +74 -0
- package/dist/esm/shares/shareDistribution.js +64 -0
- package/dist/esm/transmission/transmissionUtils.js +42 -0
- package/dist/esm/types/auth.js +11 -0
- package/dist/esm/types/config.js +20 -0
- package/dist/esm/types/coreApi.js +66 -0
- package/dist/esm/types/events.js +19 -0
- package/dist/esm/types/index.js +23 -0
- package/dist/esm/types/methods.js +0 -0
- package/dist/esm/types/onRamps.js +11 -0
- package/dist/esm/types/popup.js +13 -0
- package/dist/esm/types/recovery.js +12 -0
- package/dist/esm/types/theme.js +0 -0
- package/dist/esm/types/wallet.js +9 -0
- package/dist/esm/utils/autobind.js +19 -0
- package/dist/esm/utils/events.js +11 -0
- package/dist/esm/utils/formatting.js +76 -0
- package/dist/esm/utils/index.js +11 -0
- package/dist/esm/utils/json.js +15 -0
- package/dist/esm/utils/listeners.js +38 -0
- package/dist/esm/utils/onRamps.js +66 -0
- package/dist/esm/utils/phone.js +39 -0
- package/dist/esm/utils/polling.js +18 -0
- package/dist/esm/utils/types.js +7 -0
- package/dist/esm/utils/url.js +90 -0
- package/dist/esm/utils/wallet.js +103 -0
- package/dist/types/ParaCore.d.ts +140 -367
- package/dist/types/PlatformUtils.d.ts +4 -5
- package/dist/types/constants.d.ts +17 -13
- package/dist/types/index.d.ts +5 -4
- package/dist/types/shares/KeyContainer.d.ts +0 -2
- package/dist/types/types/auth.d.ts +16 -0
- package/dist/types/types/config.d.ts +12 -5
- package/dist/types/types/coreApi.d.ts +531 -0
- package/dist/types/types/events.d.ts +4 -1
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/methods.d.ts +145 -42
- package/dist/types/types/onRamps.d.ts +3 -3
- package/dist/types/types/wallet.d.ts +8 -4
- package/dist/types/utils/formatting.d.ts +5 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/onRamps.d.ts +12 -5
- package/dist/types/utils/phone.d.ts +6 -2
- package/dist/types/utils/types.d.ts +2 -0
- package/dist/types/utils/url.d.ts +2 -1
- package/dist/types/utils/wallet.d.ts +9 -7
- package/package.json +27 -26
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
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<
|
|
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<
|
|
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,17 +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
|
|
4
|
-
export declare const LOCAL_STORAGE_EMAIL
|
|
5
|
-
export declare const LOCAL_STORAGE_PHONE
|
|
6
|
-
export declare const LOCAL_STORAGE_COUNTRY_CODE
|
|
7
|
-
export declare const LOCAL_STORAGE_FARCASTER_USERNAME
|
|
8
|
-
export declare const LOCAL_STORAGE_TELEGRAM_USER_ID
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
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;
|
|
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";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
|
-
export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
|
|
3
|
-
export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type
|
|
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
|
+
export * from './types/coreApi.js';
|
|
4
5
|
export * from './types/events.js';
|
|
5
6
|
export * from './types/config.js';
|
|
6
|
-
export { getPortalDomain, entityToWallet } from './utils/index.js';
|
|
7
|
+
export { getPortalDomain, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
|
|
7
8
|
export { PREFIX as STORAGE_PREFIX } from './constants.js';
|
|
8
9
|
export { distributeNewShare } from './shares/shareDistribution.js';
|
|
9
10
|
export { KeyContainer } from './shares/KeyContainer.js';
|
|
@@ -18,7 +19,7 @@ export * from './utils/formatting.js';
|
|
|
18
19
|
export * from './utils/polling.js';
|
|
19
20
|
export * from './utils/phone.js';
|
|
20
21
|
export { isWalletSupported } from './utils/wallet.js';
|
|
21
|
-
export { getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
|
|
22
|
+
export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
|
|
22
23
|
export { getPortalBaseURL } from './utils/url.js';
|
|
23
24
|
export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
|
|
24
25
|
export declare const paraVersion: 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,
|
|
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?:
|
|
32
|
-
scheme?:
|
|
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
|
}
|
|
@@ -0,0 +1,531 @@
|
|
|
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
|
+
import { ParaCore } from '../ParaCore.js';
|
|
4
|
+
import { FullSignatureRes, Wallet } from './wallet.js';
|
|
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"];
|
|
8
|
+
export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
|
|
9
|
+
export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
10
|
+
params: infer P;
|
|
11
|
+
} ? P : never;
|
|
12
|
+
export type CoreMethodIsGetter<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
13
|
+
isGetter: true;
|
|
14
|
+
} ? true : false;
|
|
15
|
+
export type CoreMethodResponse<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
16
|
+
response: infer R;
|
|
17
|
+
} ? CoreMethods[method] extends {
|
|
18
|
+
sync: true;
|
|
19
|
+
} ? R : Promise<R> : void;
|
|
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>;
|
|
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>;
|
|
36
|
+
export type CoreMethods = Record<CoreMethodName, {
|
|
37
|
+
params?: unknown;
|
|
38
|
+
response?: unknown;
|
|
39
|
+
sync?: true;
|
|
40
|
+
}> & {
|
|
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: {
|
|
52
|
+
params: WithCustomTheme & WithUseShortUrls & {
|
|
53
|
+
/**
|
|
54
|
+
* The user's email address or phone number, in the form `{ email: '...' } | { phone: '+1...' }`}
|
|
55
|
+
*/
|
|
56
|
+
auth: VerifiedAuth;
|
|
57
|
+
};
|
|
58
|
+
response: AuthStateVerify | AuthStateLogin;
|
|
59
|
+
};
|
|
60
|
+
verifyNewAccount: {
|
|
61
|
+
params: WithCustomTheme & WithUseShortUrls & {
|
|
62
|
+
/**
|
|
63
|
+
* The verification code entered by the user.
|
|
64
|
+
*/
|
|
65
|
+
verificationCode: string;
|
|
66
|
+
};
|
|
67
|
+
response: AuthStateSignup;
|
|
68
|
+
};
|
|
69
|
+
waitForLogin: {
|
|
70
|
+
params: PollParams & {
|
|
71
|
+
/**
|
|
72
|
+
* Whether to skip the session refresh
|
|
73
|
+
*/
|
|
74
|
+
skipSessionRefresh?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* A function returning a boolean, indicating whether the login process should be cancelled.
|
|
77
|
+
*/
|
|
78
|
+
isCanceled?: () => boolean;
|
|
79
|
+
};
|
|
80
|
+
response: {
|
|
81
|
+
/**
|
|
82
|
+
* Whether the signed-in user still needs to create one or more wallets for this application.
|
|
83
|
+
*/
|
|
84
|
+
needsWallet?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* The partner ID for the current application.
|
|
87
|
+
*/
|
|
88
|
+
partnerId?: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
waitForSignup: {
|
|
92
|
+
params: PollParams & {
|
|
93
|
+
/**
|
|
94
|
+
* A function returning a boolean, indicating whether the signup process should be cancelled.
|
|
95
|
+
*/
|
|
96
|
+
isCanceled?: () => boolean;
|
|
97
|
+
};
|
|
98
|
+
response: true;
|
|
99
|
+
};
|
|
100
|
+
waitForWalletCreation: {
|
|
101
|
+
params: PollParams & {
|
|
102
|
+
/**
|
|
103
|
+
* A function returning a boolean, indicating whether wallet creation should be cancelled.
|
|
104
|
+
*/
|
|
105
|
+
isCanceled?: () => boolean;
|
|
106
|
+
};
|
|
107
|
+
response: {
|
|
108
|
+
/**
|
|
109
|
+
* The IDs of the newly created wallets.
|
|
110
|
+
*/
|
|
111
|
+
walletIds: CurrentWalletIds;
|
|
112
|
+
/**
|
|
113
|
+
* The recovery secret for the new wallets, if available.
|
|
114
|
+
*/
|
|
115
|
+
recoverySecret?: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
getOAuthUrl: {
|
|
119
|
+
params: OAuthUrlParams & {
|
|
120
|
+
sessionLookupId?: string;
|
|
121
|
+
};
|
|
122
|
+
response: string;
|
|
123
|
+
};
|
|
124
|
+
verifyOAuth: {
|
|
125
|
+
params: AuthStateBaseParams & OAuthParams;
|
|
126
|
+
response: OAuthResponse;
|
|
127
|
+
};
|
|
128
|
+
getFarcasterConnectUri: {
|
|
129
|
+
params: void;
|
|
130
|
+
response: string;
|
|
131
|
+
};
|
|
132
|
+
verifyFarcaster: {
|
|
133
|
+
params: AuthStateBaseParams & FarcasterParams;
|
|
134
|
+
response: OAuthResponse;
|
|
135
|
+
};
|
|
136
|
+
verifyTelegram: {
|
|
137
|
+
params: AuthStateBaseParams & TelegramParams;
|
|
138
|
+
response: OAuthResponse;
|
|
139
|
+
};
|
|
140
|
+
loginExternalWallet: {
|
|
141
|
+
params: AuthStateBaseParams & {
|
|
142
|
+
/**
|
|
143
|
+
* The external wallet information to use for login.
|
|
144
|
+
*/
|
|
145
|
+
externalWallet: ExternalWalletInfo | ExternalWalletInfo[];
|
|
146
|
+
};
|
|
147
|
+
response: AuthStateVerifyOrLogin;
|
|
148
|
+
};
|
|
149
|
+
verifyExternalWallet: {
|
|
150
|
+
params: AuthStateBaseParams & VerifyExternalWalletParams;
|
|
151
|
+
response: AuthStateSignup;
|
|
152
|
+
};
|
|
153
|
+
resendVerificationCode: {
|
|
154
|
+
params: {
|
|
155
|
+
type?: 'SIGNUP' | 'LINK_ACCOUNT';
|
|
156
|
+
} | undefined;
|
|
157
|
+
response: void;
|
|
158
|
+
};
|
|
159
|
+
logout: {
|
|
160
|
+
params: {
|
|
161
|
+
/**
|
|
162
|
+
* Whether to remove all pregen wallets from storage.
|
|
163
|
+
*/
|
|
164
|
+
clearPregenWallets?: boolean;
|
|
165
|
+
};
|
|
166
|
+
response: void;
|
|
167
|
+
};
|
|
168
|
+
clearStorage: {
|
|
169
|
+
params: StorageType | undefined;
|
|
170
|
+
response: void;
|
|
171
|
+
};
|
|
172
|
+
isSessionActive: {
|
|
173
|
+
params: void;
|
|
174
|
+
response: boolean;
|
|
175
|
+
};
|
|
176
|
+
isFullyLoggedIn: {
|
|
177
|
+
params: void;
|
|
178
|
+
response: boolean;
|
|
179
|
+
};
|
|
180
|
+
refreshSession: {
|
|
181
|
+
params: {
|
|
182
|
+
shouldOpenPopup?: boolean;
|
|
183
|
+
};
|
|
184
|
+
response: string;
|
|
185
|
+
};
|
|
186
|
+
keepSessionAlive: {
|
|
187
|
+
params: void;
|
|
188
|
+
response: boolean;
|
|
189
|
+
};
|
|
190
|
+
exportSession: {
|
|
191
|
+
params: {
|
|
192
|
+
/**
|
|
193
|
+
* Whether to exclude the wallet signers from the exported session.
|
|
194
|
+
*/
|
|
195
|
+
excludeSigners?: boolean;
|
|
196
|
+
};
|
|
197
|
+
response: string;
|
|
198
|
+
sync: true;
|
|
199
|
+
};
|
|
200
|
+
importSession: {
|
|
201
|
+
params: string;
|
|
202
|
+
response: void;
|
|
203
|
+
};
|
|
204
|
+
getVerificationToken: {
|
|
205
|
+
params: void;
|
|
206
|
+
response: string;
|
|
207
|
+
};
|
|
208
|
+
setup2fa: {
|
|
209
|
+
params: void;
|
|
210
|
+
response: Setup2faResponse;
|
|
211
|
+
};
|
|
212
|
+
enable2fa: {
|
|
213
|
+
params: {
|
|
214
|
+
/**
|
|
215
|
+
* The two-factor authentication code entered by the user.
|
|
216
|
+
*/
|
|
217
|
+
verificationCode: string;
|
|
218
|
+
};
|
|
219
|
+
response: void;
|
|
220
|
+
};
|
|
221
|
+
verify2fa: {
|
|
222
|
+
params: {
|
|
223
|
+
/**
|
|
224
|
+
* The email or phone number for the user to verify, in the form `{ email: '...' } | { phone: '+1...' }`
|
|
225
|
+
*/
|
|
226
|
+
auth: VerifiedAuth;
|
|
227
|
+
/**
|
|
228
|
+
* The two-factor authentication code entered by the user.
|
|
229
|
+
*/
|
|
230
|
+
verificationCode: string;
|
|
231
|
+
};
|
|
232
|
+
response: Verify2faResponse;
|
|
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
|
+
};
|
|
244
|
+
fetchWallets: {
|
|
245
|
+
params: void;
|
|
246
|
+
response: WalletEntity[];
|
|
247
|
+
};
|
|
248
|
+
createWallet: {
|
|
249
|
+
params: {
|
|
250
|
+
type?: Uppercase<TWalletType>;
|
|
251
|
+
skipDistribute?: boolean;
|
|
252
|
+
};
|
|
253
|
+
response: [Wallet, string | undefined];
|
|
254
|
+
};
|
|
255
|
+
createWalletPerType: {
|
|
256
|
+
params: {
|
|
257
|
+
/**
|
|
258
|
+
* Array of the wallet types to create
|
|
259
|
+
*/
|
|
260
|
+
types?: Uppercase<TWalletType>[];
|
|
261
|
+
/**
|
|
262
|
+
* If `true`, skip distributing the new wallets shares.
|
|
263
|
+
*/
|
|
264
|
+
skipDistribute?: boolean;
|
|
265
|
+
};
|
|
266
|
+
response: {
|
|
267
|
+
/**
|
|
268
|
+
* Array of the created wallets
|
|
269
|
+
*/
|
|
270
|
+
wallets: Wallet[];
|
|
271
|
+
/**
|
|
272
|
+
* The `CurrentWalletIds` value for the new wallets
|
|
273
|
+
*/
|
|
274
|
+
walletIds: CurrentWalletIds;
|
|
275
|
+
/**
|
|
276
|
+
* The recovery secret for the new wallets, if available.
|
|
277
|
+
*/
|
|
278
|
+
recoverySecret?: string;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
getPregenWallets: {
|
|
282
|
+
params: {
|
|
283
|
+
/**
|
|
284
|
+
* The pregen ID for the wallets to fetch. If not provided, all available wallets will be retrieved.
|
|
285
|
+
*/
|
|
286
|
+
pregenId?: PregenAuth;
|
|
287
|
+
};
|
|
288
|
+
response: WalletEntity[];
|
|
289
|
+
};
|
|
290
|
+
updatePregenWalletIdentifier: {
|
|
291
|
+
params: {
|
|
292
|
+
/**
|
|
293
|
+
* The ID of the pregen wallet to update.
|
|
294
|
+
*/
|
|
295
|
+
walletId: string;
|
|
296
|
+
/**
|
|
297
|
+
* The new identifer for the wallet.
|
|
298
|
+
*/
|
|
299
|
+
newPregenId: PregenAuth;
|
|
300
|
+
};
|
|
301
|
+
response: void;
|
|
302
|
+
};
|
|
303
|
+
hasPregenWallet: {
|
|
304
|
+
params: {
|
|
305
|
+
/**
|
|
306
|
+
* The pregen ID for the wallet to check.
|
|
307
|
+
*/
|
|
308
|
+
pregenId: PregenAuth;
|
|
309
|
+
};
|
|
310
|
+
response: boolean;
|
|
311
|
+
};
|
|
312
|
+
createPregenWallet: {
|
|
313
|
+
params: {
|
|
314
|
+
/**
|
|
315
|
+
* The type of wallet to create, 'EVM' | 'SOLANA' | 'COSMOS'
|
|
316
|
+
*/
|
|
317
|
+
type: TWalletType;
|
|
318
|
+
/**
|
|
319
|
+
* The pregen identifier for the wallet, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
|
|
320
|
+
*/
|
|
321
|
+
pregenId: PregenAuth;
|
|
322
|
+
};
|
|
323
|
+
response: Wallet;
|
|
324
|
+
};
|
|
325
|
+
createPregenWalletPerType: {
|
|
326
|
+
params: {
|
|
327
|
+
/**
|
|
328
|
+
* The wallet types to create. If not provided, defaults to your application's `supportedWalletTypes` setting.
|
|
329
|
+
*/
|
|
330
|
+
types?: TWalletType[];
|
|
331
|
+
/**
|
|
332
|
+
* The pregen identifier for the wallets, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
|
|
333
|
+
*/
|
|
334
|
+
pregenId: PregenAuth;
|
|
335
|
+
};
|
|
336
|
+
response: Wallet[];
|
|
337
|
+
};
|
|
338
|
+
claimPregenWallets: {
|
|
339
|
+
params: {
|
|
340
|
+
/**
|
|
341
|
+
* The pregen identifier for the wallet to claim. If not provided, will attempt to claim all wallets in storage.
|
|
342
|
+
*/
|
|
343
|
+
pregenId?: PregenAuth;
|
|
344
|
+
};
|
|
345
|
+
response: string | undefined;
|
|
346
|
+
};
|
|
347
|
+
createGuestWallets: {
|
|
348
|
+
params: void;
|
|
349
|
+
response: Wallet[];
|
|
350
|
+
};
|
|
351
|
+
distributeNewWalletShare: {
|
|
352
|
+
params: {
|
|
353
|
+
/**
|
|
354
|
+
* The ID of the wallet whose share to distribute.
|
|
355
|
+
*/
|
|
356
|
+
walletId: string;
|
|
357
|
+
/**
|
|
358
|
+
* The user share string.
|
|
359
|
+
*/
|
|
360
|
+
userShare?: string;
|
|
361
|
+
/**
|
|
362
|
+
* If `true`, skip biometric share creation.
|
|
363
|
+
*/
|
|
364
|
+
skipBiometricShareCreation?: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* If `true`, force a session refresh.
|
|
367
|
+
*/
|
|
368
|
+
forceRefresh?: boolean;
|
|
369
|
+
};
|
|
370
|
+
response: string;
|
|
371
|
+
};
|
|
372
|
+
getUserShare: {
|
|
373
|
+
params: void;
|
|
374
|
+
response: string | null;
|
|
375
|
+
sync: true;
|
|
376
|
+
};
|
|
377
|
+
setUserShare: {
|
|
378
|
+
params: string | null;
|
|
379
|
+
response: void;
|
|
380
|
+
};
|
|
381
|
+
refreshShare: {
|
|
382
|
+
params: {
|
|
383
|
+
walletId: string;
|
|
384
|
+
share: string;
|
|
385
|
+
oldPartnerId?: string;
|
|
386
|
+
newPartnerId?: string;
|
|
387
|
+
keyShareProtocolId?: string;
|
|
388
|
+
redistributeBackupEncryptedShares?: boolean;
|
|
389
|
+
emailProps?: BackupKitEmailProps;
|
|
390
|
+
};
|
|
391
|
+
response: {
|
|
392
|
+
protocolId: string;
|
|
393
|
+
recoverySecret?: string;
|
|
394
|
+
signer: string;
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
signMessage: {
|
|
398
|
+
params: PollParams & {
|
|
399
|
+
/**
|
|
400
|
+
* The ID of the wallet to use for signing.
|
|
401
|
+
*/
|
|
402
|
+
walletId: string;
|
|
403
|
+
/**
|
|
404
|
+
* The message to sign as a base64-encoded string.
|
|
405
|
+
*/
|
|
406
|
+
messageBase64: string;
|
|
407
|
+
/**
|
|
408
|
+
* The duration in milliseconds to wait before the signing operation times out.
|
|
409
|
+
*/
|
|
410
|
+
timeoutMs?: number;
|
|
411
|
+
/**
|
|
412
|
+
* For Cosmos transactions, the `SignDoc` as a base64-encoded string.
|
|
413
|
+
*/
|
|
414
|
+
cosmosSignDocBase64?: string;
|
|
415
|
+
/**
|
|
416
|
+
* A callback that returns a boolean, indicating whether the signing operation should be cancelled.
|
|
417
|
+
*/
|
|
418
|
+
isCanceled?: () => boolean;
|
|
419
|
+
};
|
|
420
|
+
response: FullSignatureRes;
|
|
421
|
+
};
|
|
422
|
+
signTransaction: {
|
|
423
|
+
params: PollParams & {
|
|
424
|
+
/**
|
|
425
|
+
* The ID of the wallet to use for signing.
|
|
426
|
+
*/
|
|
427
|
+
walletId: string;
|
|
428
|
+
/**
|
|
429
|
+
* The transaction to sign as a base64-encoded string.
|
|
430
|
+
*/
|
|
431
|
+
rlpEncodedTxBase64: string;
|
|
432
|
+
/**
|
|
433
|
+
* For EVM transactions, the chain ID.
|
|
434
|
+
*/
|
|
435
|
+
chainId: string;
|
|
436
|
+
/**
|
|
437
|
+
* The duration in milliseconds to wait before the signing operation times out.
|
|
438
|
+
*/
|
|
439
|
+
timeoutMs?: number;
|
|
440
|
+
/**
|
|
441
|
+
* A callback that returns a boolean, indicating whether the signing operation should be cancelled.
|
|
442
|
+
*/
|
|
443
|
+
isCanceled?: () => boolean;
|
|
444
|
+
};
|
|
445
|
+
response: FullSignatureRes;
|
|
446
|
+
};
|
|
447
|
+
initiateOnRampTransaction: {
|
|
448
|
+
params: WalletParams & {
|
|
449
|
+
/**
|
|
450
|
+
* The on-ramp transaction options.
|
|
451
|
+
*/
|
|
452
|
+
params: OnRampPurchaseCreateParams;
|
|
453
|
+
/**
|
|
454
|
+
* Whether to open a popup window for the user to complete the transaction.
|
|
455
|
+
*/
|
|
456
|
+
shouldOpenPopup?: boolean;
|
|
457
|
+
};
|
|
458
|
+
response: {
|
|
459
|
+
/**
|
|
460
|
+
* The newly created on-ramp transaction.
|
|
461
|
+
*/
|
|
462
|
+
onRampPurchase: OnRampPurchase;
|
|
463
|
+
/**
|
|
464
|
+
* A Para Portal URL for the user to complete the transaction.
|
|
465
|
+
*/
|
|
466
|
+
portalUrl: string;
|
|
467
|
+
};
|
|
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
|
+
};
|
|
525
|
+
};
|
|
526
|
+
export type CoreInterface = {
|
|
527
|
+
[key in keyof CoreMethods]: Partial<CoreMethod<key>>;
|
|
528
|
+
};
|
|
529
|
+
export type InternalInterface = {
|
|
530
|
+
[key in keyof InternalMethods]: Partial<InternalMethod<key>>;
|
|
531
|
+
};
|