@getpara/core-sdk 2.0.0-dev.1 → 2.0.0-dev.3
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 +100 -5043
- 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 +76 -5011
- 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 +115 -449
- package/dist/types/PlatformUtils.d.ts +4 -5
- package/dist/types/constants.d.ts +16 -13
- package/dist/types/index.d.ts +3 -3
- 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 +152 -58
- package/dist/types/types/events.d.ts +4 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/methods.d.ts +49 -57
- package/dist/types/types/onRamps.d.ts +3 -3
- package/dist/types/types/wallet.d.ts +8 -3
- package/dist/types/utils/formatting.d.ts +5 -2
- package/dist/types/utils/onRamps.d.ts +12 -5
- package/dist/types/utils/phone.d.ts +4 -0
- package/dist/types/utils/wallet.d.ts +8 -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,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
|
|
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;
|
|
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";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -1,25 +1,54 @@
|
|
|
1
|
-
import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
90
|
-
params:
|
|
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
|
-
|
|
104
|
-
params:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
149
|
+
verifyExternalWallet: {
|
|
136
150
|
params: AuthStateBaseParams & VerifyExternalWalletParams;
|
|
137
151
|
response: AuthStateSignup;
|
|
138
152
|
};
|
|
139
153
|
resendVerificationCode: {
|
|
140
|
-
params:
|
|
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:
|
|
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
|
-
|
|
208
|
+
setup2fa: {
|
|
188
209
|
params: void;
|
|
189
210
|
response: Setup2faResponse;
|
|
190
211
|
};
|
|
191
|
-
|
|
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
|
-
|
|
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<
|
|
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<
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
312
|
+
createPregenWallet: {
|
|
282
313
|
params: {
|
|
283
314
|
/**
|
|
284
315
|
* The type of wallet to create, 'EVM' | 'SOLANA' | 'COSMOS'
|
|
285
316
|
*/
|
|
286
|
-
type:
|
|
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
|
-
|
|
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?:
|
|
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
|
-
|
|
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'>>>;
|