@getpara/core-sdk 2.12.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ParaCore.js +793 -2003
- package/dist/cjs/constants.js +4 -1
- package/dist/cjs/services/AuthService.js +787 -0
- package/dist/cjs/services/BaseAuthFlowService.js +78 -0
- package/dist/cjs/services/ExternalWalletService.js +386 -0
- package/dist/cjs/services/LoginFlowService.js +163 -0
- package/dist/cjs/services/PollingService.js +448 -0
- package/dist/cjs/services/PortalUrlService.js +379 -0
- package/dist/cjs/services/PregenWalletService.js +442 -0
- package/dist/cjs/services/SessionManagementService.js +280 -0
- package/dist/cjs/services/SignupFlowService.js +185 -0
- package/dist/cjs/services/VerificationFlowService.js +242 -0
- package/dist/cjs/services/WalletService.js +577 -0
- package/dist/cjs/services/types/AuthServiceTypes.js +15 -0
- package/dist/cjs/services/types/BaseAuthFlowServiceTypes.js +15 -0
- package/dist/cjs/services/types/ExternalWalletServiceTypes.js +15 -0
- package/dist/cjs/services/types/LoginFlowServiceTypes.js +15 -0
- package/dist/cjs/services/types/PollingServiceTypes.js +15 -0
- package/dist/cjs/services/types/PortalUrlServiceTypes.js +15 -0
- package/dist/cjs/services/types/PregenWalletServiceTypes.js +15 -0
- package/dist/cjs/services/types/SessionManagementServiceTypes.js +15 -0
- package/dist/cjs/services/types/SignupFlowServiceTypes.js +15 -0
- package/dist/cjs/services/types/VerificationFlowServiceTypes.js +15 -0
- package/dist/cjs/services/types/WalletServiceTypes.js +15 -0
- package/dist/cjs/services/types/index.js +15 -0
- package/dist/cjs/state/CoreStateManager.js +297 -0
- package/dist/cjs/state/actors/authenticateWithEmailOrPhone.js +50 -0
- package/dist/cjs/state/actors/authenticateWithExternalWallet.js +50 -0
- package/dist/cjs/state/actors/authenticateWithFarcaster.js +50 -0
- package/dist/cjs/state/actors/authenticateWithFarcasterLegacy.js +50 -0
- package/dist/cjs/state/actors/authenticateWithTelegram.js +50 -0
- package/dist/cjs/state/actors/authenticateWithTelegramLegacy.js +50 -0
- package/dist/cjs/state/actors/checkUserState.js +53 -0
- package/dist/cjs/state/actors/claimWallets.js +56 -0
- package/dist/cjs/state/actors/connectExternalConnectors.js +54 -0
- package/dist/cjs/state/actors/connectExternalWallet.js +50 -0
- package/dist/cjs/state/actors/createGuestWallets.js +50 -0
- package/dist/cjs/state/actors/createWallets.js +73 -0
- package/dist/cjs/state/actors/polling.js +91 -0
- package/dist/cjs/state/actors/processAuthentication.js +50 -0
- package/dist/cjs/state/actors/setupAfterLogin.js +52 -0
- package/dist/cjs/state/actors/setupPara.js +50 -0
- package/dist/cjs/state/actors/signExternalWalletVerification.js +79 -0
- package/dist/cjs/state/actors/switchExternalWallet.js +50 -0
- package/dist/cjs/state/actors/verifyExternalWallet.js +50 -0
- package/dist/cjs/state/actors/verifyNewAccount.js +50 -0
- package/dist/cjs/state/actors/waitForExternalWalletProviders.js +54 -0
- package/dist/cjs/state/machines/authStateMachine.helpers.js +137 -0
- package/dist/cjs/state/machines/authStateMachine.js +1084 -0
- package/dist/cjs/state/machines/coreStateMachine.js +383 -0
- package/dist/cjs/state/machines/walletStateMachine.js +437 -0
- package/dist/cjs/state/types/auth.js +15 -0
- package/dist/cjs/state/types/core.js +15 -0
- package/dist/cjs/state/types/wallet.js +15 -0
- package/dist/cjs/types/{auth.js → accountLinking.js} +3 -3
- package/dist/cjs/types/authState.js +15 -0
- package/dist/cjs/types/coreApi.js +3 -1
- package/dist/cjs/types/index.js +2 -2
- package/dist/cjs/types/serviceInterfaces.js +15 -0
- package/dist/cjs/types/util.js +15 -0
- package/dist/cjs/utils/formatting.js +6 -0
- package/dist/cjs/utils/retryBackoff.js +30 -0
- package/dist/cjs/utils/stateErrorHelpers.js +60 -0
- package/dist/cjs/utils/stateListener.js +129 -0
- package/dist/esm/ParaCore.js +796 -2031
- package/dist/esm/constants.js +3 -1
- package/dist/esm/services/AuthService.js +717 -0
- package/dist/esm/services/BaseAuthFlowService.js +25 -0
- package/dist/esm/services/ExternalWalletService.js +327 -0
- package/dist/esm/services/LoginFlowService.js +97 -0
- package/dist/esm/services/PollingService.js +389 -0
- package/dist/esm/services/PortalUrlService.js +320 -0
- package/dist/esm/services/PregenWalletService.js +393 -0
- package/dist/esm/services/SessionManagementService.js +236 -0
- package/dist/esm/services/SignupFlowService.js +119 -0
- package/dist/esm/services/VerificationFlowService.js +178 -0
- package/dist/esm/services/WalletService.js +514 -0
- package/dist/esm/services/types/AuthServiceTypes.js +0 -0
- package/dist/esm/services/types/BaseAuthFlowServiceTypes.js +0 -0
- package/dist/esm/services/types/ExternalWalletServiceTypes.js +0 -0
- package/dist/esm/services/types/LoginFlowServiceTypes.js +0 -0
- package/dist/esm/services/types/PollingServiceTypes.js +0 -0
- package/dist/esm/services/types/PortalUrlServiceTypes.js +0 -0
- package/dist/esm/services/types/PregenWalletServiceTypes.js +0 -0
- package/dist/esm/services/types/SessionManagementServiceTypes.js +0 -0
- package/dist/esm/services/types/SignupFlowServiceTypes.js +0 -0
- package/dist/esm/services/types/VerificationFlowServiceTypes.js +0 -0
- package/dist/esm/services/types/WalletServiceTypes.js +0 -0
- package/dist/esm/services/types/index.js +0 -0
- package/dist/esm/state/CoreStateManager.js +261 -0
- package/dist/esm/state/actors/authenticateWithEmailOrPhone.js +10 -0
- package/dist/esm/state/actors/authenticateWithExternalWallet.js +10 -0
- package/dist/esm/state/actors/authenticateWithFarcaster.js +10 -0
- package/dist/esm/state/actors/authenticateWithFarcasterLegacy.js +10 -0
- package/dist/esm/state/actors/authenticateWithTelegram.js +10 -0
- package/dist/esm/state/actors/authenticateWithTelegramLegacy.js +10 -0
- package/dist/esm/state/actors/checkUserState.js +13 -0
- package/dist/esm/state/actors/claimWallets.js +16 -0
- package/dist/esm/state/actors/connectExternalConnectors.js +14 -0
- package/dist/esm/state/actors/connectExternalWallet.js +10 -0
- package/dist/esm/state/actors/createGuestWallets.js +10 -0
- package/dist/esm/state/actors/createWallets.js +20 -0
- package/dist/esm/state/actors/polling.js +55 -0
- package/dist/esm/state/actors/processAuthentication.js +10 -0
- package/dist/esm/state/actors/setupAfterLogin.js +12 -0
- package/dist/esm/state/actors/setupPara.js +10 -0
- package/dist/esm/state/actors/signExternalWalletVerification.js +15 -0
- package/dist/esm/state/actors/switchExternalWallet.js +10 -0
- package/dist/esm/state/actors/verifyExternalWallet.js +10 -0
- package/dist/esm/state/actors/verifyNewAccount.js +10 -0
- package/dist/esm/state/actors/waitForExternalWalletProviders.js +14 -0
- package/dist/esm/state/machines/authStateMachine.helpers.js +92 -0
- package/dist/esm/state/machines/authStateMachine.js +1039 -0
- package/dist/esm/state/machines/coreStateMachine.js +343 -0
- package/dist/esm/state/machines/walletStateMachine.js +382 -0
- package/dist/esm/state/types/auth.js +0 -0
- package/dist/esm/state/types/core.js +0 -0
- package/dist/esm/state/types/wallet.js +0 -0
- package/dist/esm/types/authState.js +0 -0
- package/dist/esm/types/coreApi.js +3 -1
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/serviceInterfaces.js +0 -0
- package/dist/esm/types/util.js +0 -0
- package/dist/esm/utils/formatting.js +6 -0
- package/dist/esm/utils/retryBackoff.js +7 -0
- package/dist/esm/utils/stateErrorHelpers.js +37 -0
- package/dist/esm/utils/stateListener.js +106 -0
- package/dist/types/ParaCore.d.ts +190 -119
- package/dist/types/PlatformUtils.d.ts +23 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/services/AuthService.d.ts +72 -0
- package/dist/types/services/BaseAuthFlowService.d.ts +28 -0
- package/dist/types/services/ExternalWalletService.d.ts +44 -0
- package/dist/types/services/LoginFlowService.d.ts +9 -0
- package/dist/types/services/PollingService.d.ts +35 -0
- package/dist/types/services/PortalUrlService.d.ts +26 -0
- package/dist/types/services/PregenWalletService.d.ts +38 -0
- package/dist/types/services/SessionManagementService.d.ts +28 -0
- package/dist/types/services/SignupFlowService.d.ts +10 -0
- package/dist/types/services/VerificationFlowService.d.ts +17 -0
- package/dist/types/services/WalletService.d.ts +54 -0
- package/dist/types/services/types/AuthServiceTypes.d.ts +147 -0
- package/dist/types/services/types/BaseAuthFlowServiceTypes.d.ts +4 -0
- package/dist/types/services/types/ExternalWalletServiceTypes.d.ts +67 -0
- package/dist/types/services/types/LoginFlowServiceTypes.d.ts +19 -0
- package/dist/types/services/types/PollingServiceTypes.d.ts +82 -0
- package/dist/types/services/types/PortalUrlServiceTypes.d.ts +46 -0
- package/dist/types/services/types/PregenWalletServiceTypes.d.ts +73 -0
- package/dist/types/services/types/SessionManagementServiceTypes.d.ts +27 -0
- package/dist/types/services/types/SignupFlowServiceTypes.d.ts +18 -0
- package/dist/types/services/types/VerificationFlowServiceTypes.d.ts +90 -0
- package/dist/types/services/types/WalletServiceTypes.d.ts +109 -0
- package/dist/types/services/types/index.d.ts +11 -0
- package/dist/types/state/CoreStateManager.d.ts +36 -0
- package/dist/types/state/actors/authenticateWithEmailOrPhone.d.ts +8 -0
- package/dist/types/state/actors/authenticateWithExternalWallet.d.ts +8 -0
- package/dist/types/state/actors/authenticateWithFarcaster.d.ts +3 -0
- package/dist/types/state/actors/authenticateWithFarcasterLegacy.d.ts +3 -0
- package/dist/types/state/actors/authenticateWithTelegram.d.ts +3 -0
- package/dist/types/state/actors/authenticateWithTelegramLegacy.d.ts +8 -0
- package/dist/types/state/actors/checkUserState.d.ts +6 -0
- package/dist/types/state/actors/claimWallets.d.ts +8 -0
- package/dist/types/state/actors/connectExternalConnectors.d.ts +4 -0
- package/dist/types/state/actors/connectExternalWallet.d.ts +3 -0
- package/dist/types/state/actors/createGuestWallets.d.ts +3 -0
- package/dist/types/state/actors/createWallets.d.ts +10 -0
- package/dist/types/state/actors/polling.d.ts +3 -0
- package/dist/types/state/actors/processAuthentication.d.ts +10 -0
- package/dist/types/state/actors/setupAfterLogin.d.ts +5 -0
- package/dist/types/state/actors/setupPara.d.ts +2 -0
- package/dist/types/state/actors/signExternalWalletVerification.d.ts +7 -0
- package/dist/types/state/actors/switchExternalWallet.d.ts +3 -0
- package/dist/types/state/actors/verifyExternalWallet.d.ts +8 -0
- package/dist/types/state/actors/verifyNewAccount.d.ts +8 -0
- package/dist/types/state/actors/waitForExternalWalletProviders.d.ts +2 -0
- package/dist/types/state/machines/authStateMachine.d.ts +2570 -0
- package/dist/types/state/machines/authStateMachine.helpers.d.ts +57 -0
- package/dist/types/state/machines/coreStateMachine.d.ts +22033 -0
- package/dist/types/state/machines/walletStateMachine.d.ts +1049 -0
- package/dist/types/state/types/auth.d.ts +113 -0
- package/dist/types/state/types/core.d.ts +114 -0
- package/dist/types/state/types/wallet.d.ts +76 -0
- package/dist/types/types/authState.d.ts +66 -0
- package/dist/types/types/config.d.ts +5 -0
- package/dist/types/types/coreApi.d.ts +148 -298
- package/dist/types/types/index.d.ts +3 -1
- package/dist/types/types/methods.d.ts +1 -191
- package/dist/types/types/serviceInterfaces.d.ts +125 -0
- package/dist/types/types/util.d.ts +43 -0
- package/dist/types/types/wallet.d.ts +3 -1
- package/dist/types/utils/retryBackoff.d.ts +2 -0
- package/dist/types/utils/stateErrorHelpers.d.ts +2 -0
- package/dist/types/utils/stateListener.d.ts +47 -0
- package/package.json +5 -4
- /package/dist/esm/types/{auth.js → accountLinking.js} +0 -0
- /package/dist/types/types/{auth.d.ts → accountLinking.d.ts} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ExternalWalletInfo, TExternalWalletType } from '@getpara/user-management-client';
|
|
2
|
+
import type { Wallet } from '../../types/wallet';
|
|
3
|
+
import type { ConnectExternalWalletParams } from './AuthServiceTypes';
|
|
4
|
+
export type ExternalWallets = Record<string, Wallet>;
|
|
5
|
+
export type ExternalWalletConnectionType = 'NONE' | 'CONNECTION_ONLY' | 'AUTHENTICATED' | 'VERIFICATION';
|
|
6
|
+
export type SetExternalWalletParams = {
|
|
7
|
+
externalWallet: ExternalWalletInfo[] | ExternalWalletInfo;
|
|
8
|
+
};
|
|
9
|
+
export type SetExternalWalletMethod = (_: SetExternalWalletParams) => Promise<void>;
|
|
10
|
+
export type SetExternalWalletsParams = {
|
|
11
|
+
externalWallets: Record<string, Wallet> | ((current: Record<string, Wallet>) => Record<string, Wallet>);
|
|
12
|
+
};
|
|
13
|
+
export type SetExternalWalletsMethod = (_: SetExternalWalletsParams) => Promise<void>;
|
|
14
|
+
export type AddExternalWalletsParams = {
|
|
15
|
+
externalWallets: ExternalWalletInfo[];
|
|
16
|
+
};
|
|
17
|
+
export type AddExternalWalletsMethod = (_: AddExternalWalletsParams) => Promise<void>;
|
|
18
|
+
export interface PerformConnectExternalWalletResponse {
|
|
19
|
+
externalWallet: ExternalWalletInfo;
|
|
20
|
+
chainId: string;
|
|
21
|
+
}
|
|
22
|
+
export type PerformConnectExternalWalletMethod = (_: ConnectExternalWalletParams) => Promise<PerformConnectExternalWalletResponse>;
|
|
23
|
+
export interface ExternalWalletInterface {
|
|
24
|
+
address: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface WatchWalletChangeCallbackParams {
|
|
27
|
+
/**
|
|
28
|
+
* The external wallet information to use for login.
|
|
29
|
+
*/
|
|
30
|
+
externalWallet: Pick<ExternalWalletInfo, 'address' | 'type' | 'provider' | 'providerId'>;
|
|
31
|
+
}
|
|
32
|
+
export interface BaseExternalWalletProviderInterface {
|
|
33
|
+
disconnect: () => Promise<void>;
|
|
34
|
+
getAddress: () => Promise<string | null>;
|
|
35
|
+
connectParaConnector: () => Promise<void>;
|
|
36
|
+
signMessage: (_: {
|
|
37
|
+
message: string;
|
|
38
|
+
address: string;
|
|
39
|
+
}) => Promise<Omit<SignMessageResponse, 'address'>>;
|
|
40
|
+
watchDisconnection: (callback: () => Promise<void>) => () => void;
|
|
41
|
+
watchWalletChange: (callback: (_: WatchWalletChangeCallbackParams) => void) => () => void;
|
|
42
|
+
}
|
|
43
|
+
export interface InitExternalWalletProviderParams {
|
|
44
|
+
type: TExternalWalletType;
|
|
45
|
+
interface: BaseExternalWalletProviderInterface;
|
|
46
|
+
}
|
|
47
|
+
export type InitExternalWalletProviderMethod = (_: InitExternalWalletProviderParams) => Promise<void>;
|
|
48
|
+
export type ExternalSignMessageParams = {
|
|
49
|
+
type: TExternalWalletType;
|
|
50
|
+
address: string;
|
|
51
|
+
message: string;
|
|
52
|
+
};
|
|
53
|
+
export interface SignMessageResponse {
|
|
54
|
+
address: string;
|
|
55
|
+
signature: string;
|
|
56
|
+
cosmosPublicKeyHex?: string;
|
|
57
|
+
cosmosSigner?: string;
|
|
58
|
+
addressBech32?: string;
|
|
59
|
+
}
|
|
60
|
+
export type SignMessageMethod = (_: ExternalSignMessageParams) => Promise<SignMessageResponse>;
|
|
61
|
+
export type SwitchExternalWalletParams = WatchWalletChangeCallbackParams;
|
|
62
|
+
export type SwitchExternalWalletMethod = (_: SwitchExternalWalletParams) => Promise<void>;
|
|
63
|
+
export type PerformSwitchExternalWalletParams = WatchWalletChangeCallbackParams;
|
|
64
|
+
export interface PerformSwitchExternalWalletResponse {
|
|
65
|
+
externalWallet: ExternalWalletInfo;
|
|
66
|
+
}
|
|
67
|
+
export type PerformSwitchExternalWalletMethod = (_: PerformSwitchExternalWalletParams) => Promise<PerformSwitchExternalWalletResponse>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PollingCallbacks } from './PollingServiceTypes';
|
|
2
|
+
export type PrepareLoginMethod = () => Promise<string>;
|
|
3
|
+
export interface WaitForLoginParams extends PollingCallbacks {
|
|
4
|
+
/**
|
|
5
|
+
* Whether to skip the session refresh
|
|
6
|
+
*/
|
|
7
|
+
skipSessionRefresh?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface WaitForLoginResponse {
|
|
10
|
+
/**
|
|
11
|
+
* Whether the signed-in user still needs to create one or more wallets for this application.
|
|
12
|
+
*/
|
|
13
|
+
needsWallet?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The partner ID for the current application.
|
|
16
|
+
*/
|
|
17
|
+
partnerId?: string;
|
|
18
|
+
}
|
|
19
|
+
export type WaitForLoginMethod = (_: WaitForLoginParams) => Promise<WaitForLoginResponse>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ServerAuthState, TOAuthMethod } from '@getpara/user-management-client';
|
|
2
|
+
import type { ActorRef } from 'xstate';
|
|
3
|
+
import type { WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
|
|
4
|
+
import { BaseOAuthUrlParams } from './PortalUrlServiceTypes.js';
|
|
5
|
+
import { AuthenticationOutput } from '../../state/types/auth.js';
|
|
6
|
+
import { OAuthRedirectCallbacks } from './AuthServiceTypes.js';
|
|
7
|
+
export type PollingCallbacks = {
|
|
8
|
+
/**
|
|
9
|
+
* Callback fired on each poll attempt.
|
|
10
|
+
*/
|
|
11
|
+
onPoll?: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Callback fired when the polling is canceled.
|
|
14
|
+
*/
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Signal to cancel the polling.
|
|
18
|
+
*/
|
|
19
|
+
isCanceled?: () => boolean;
|
|
20
|
+
};
|
|
21
|
+
export interface PollingConfig<T> extends PollingCallbacks {
|
|
22
|
+
init?: () => Promise<void>;
|
|
23
|
+
checkCondition: PollFunction<T>;
|
|
24
|
+
maxPolls?: number;
|
|
25
|
+
intervalMs?: number;
|
|
26
|
+
timeoutMs?: number;
|
|
27
|
+
id?: string;
|
|
28
|
+
}
|
|
29
|
+
export type PollingResult<T> = {
|
|
30
|
+
type: 'COMPLETE';
|
|
31
|
+
data: T;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'CANCEL';
|
|
34
|
+
} | {
|
|
35
|
+
type: 'ERROR';
|
|
36
|
+
error: 'TIMEOUT' | 'MAX_POLLS_EXCEEDED' | 'INITIALIZATION_FAILED';
|
|
37
|
+
};
|
|
38
|
+
export type PollFunction<T> = () => Promise<{
|
|
39
|
+
finished: boolean;
|
|
40
|
+
data?: T;
|
|
41
|
+
}>;
|
|
42
|
+
export interface WaitForOAuthEventParams extends WithCustomTheme, WithUseShortUrls, OAuthRedirectCallbacks {
|
|
43
|
+
method: Extract<TOAuthMethod, 'FARCASTER' | 'TELEGRAM'>;
|
|
44
|
+
isCanceled?: PollingCallbacks['isCanceled'];
|
|
45
|
+
appScheme?: BaseOAuthUrlParams['appScheme'];
|
|
46
|
+
}
|
|
47
|
+
export type WaitForOAuthEventResponse = AuthenticationOutput;
|
|
48
|
+
export type WaitForOAuthEventMethod = (_: WaitForOAuthEventParams) => Promise<WaitForOAuthEventResponse>;
|
|
49
|
+
export interface WaitForTelegramEventParams extends WaitForOAuthEventParams {
|
|
50
|
+
}
|
|
51
|
+
export type WaitForTelegramEventResponse = AuthenticationOutput;
|
|
52
|
+
export type WaitForTelegramEventMethod = (_: WaitForTelegramEventParams) => Promise<WaitForTelegramEventResponse>;
|
|
53
|
+
export interface WaitForFarcasterEventParams extends WaitForOAuthEventParams {
|
|
54
|
+
}
|
|
55
|
+
export type WaitForFarcasterEventResponse = AuthenticationOutput;
|
|
56
|
+
export type WaitForFarcasterEventMethod = (_: WaitForFarcasterEventParams) => Promise<WaitForFarcasterEventResponse>;
|
|
57
|
+
export interface InitOAuthPollingParams extends WithCustomTheme, WithUseShortUrls, BaseOAuthUrlParams, OAuthRedirectCallbacks {
|
|
58
|
+
}
|
|
59
|
+
export interface InitOAuthPollingResponse {
|
|
60
|
+
sessionLookupId: string;
|
|
61
|
+
}
|
|
62
|
+
export type InitOAuthPollingMethod = (_: InitOAuthPollingParams) => Promise<InitOAuthPollingResponse>;
|
|
63
|
+
export interface WaitForFarcasterAuthParams {
|
|
64
|
+
onSuccess: (serverAuthState: ServerAuthState) => void;
|
|
65
|
+
}
|
|
66
|
+
export type WaitForFarcasterAuthMethod = (_: WaitForFarcasterAuthParams) => PollFunction<null>;
|
|
67
|
+
export interface WaitForOAuthParams {
|
|
68
|
+
onSuccess: (serverAuthState: ServerAuthState) => void;
|
|
69
|
+
}
|
|
70
|
+
export type WaitForOAuthMethod = (_: WaitForOAuthParams) => PollFunction<null>;
|
|
71
|
+
export interface WaitForWalletsParams {
|
|
72
|
+
parent: ActorRef<any, any>;
|
|
73
|
+
}
|
|
74
|
+
export type WaitForWalletsMethod = (_: WaitForWalletsParams) => PollFunction<null>;
|
|
75
|
+
export interface WaitForWalletAddressParams {
|
|
76
|
+
walletId: string;
|
|
77
|
+
}
|
|
78
|
+
export type WaitForWalletAddressMethod = (_: WaitForWalletAddressParams) => PollFunction<null>;
|
|
79
|
+
export interface WaitForPregenWalletAddressParams {
|
|
80
|
+
walletId: string;
|
|
81
|
+
}
|
|
82
|
+
export type WaitForPregenWalletAddressMethod = (_: WaitForPregenWalletAddressParams) => PollFunction<null>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TAuthMethod, Theme, TOAuthMethod } from '@getpara/user-management-client';
|
|
2
|
+
import type { AccountLinkInProgress, WithAuthMethod, WithCustomTheme, WithSessionId, WithShorten } from '../../types/index.js';
|
|
3
|
+
type Device = {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
encryptionKey: string;
|
|
6
|
+
};
|
|
7
|
+
export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN' | 'oAuth' | 'oAuthCallback' | 'loginOTP' | 'telegramLoginVerify' | 'loginFarcaster' | 'switchWallets' | 'addNewCredential' | 'exportPrivateKey' | 'loginExternalWallet' | 'connectExternalWallet';
|
|
8
|
+
export type PortalUrlOptions = {
|
|
9
|
+
params?: Record<string, string | undefined | null>;
|
|
10
|
+
isForNewDevice?: boolean;
|
|
11
|
+
thisDevice?: Device;
|
|
12
|
+
newDevice?: Device;
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
portalTheme?: Theme;
|
|
15
|
+
pathId?: string;
|
|
16
|
+
shorten?: boolean;
|
|
17
|
+
isEmbedded?: boolean;
|
|
18
|
+
oAuthMethod?: GetOAuthUrlParams['method'];
|
|
19
|
+
appScheme?: string;
|
|
20
|
+
encryptionKey?: string;
|
|
21
|
+
addNewCredentialType?: TAuthMethod;
|
|
22
|
+
addNewCredentialPasswordId?: string;
|
|
23
|
+
addNewCredentialPasskeyId?: string;
|
|
24
|
+
useLegacyUrl?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type ConstructPortalUrlMethod = (type: PortalUrlType, opts?: PortalUrlOptions) => Promise<string>;
|
|
27
|
+
export type GetLoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & WithSessionId;
|
|
28
|
+
export type GetLoginUrlMethod = (_: GetLoginUrlParams) => Promise<string>;
|
|
29
|
+
export type BaseOAuthUrlParams = {
|
|
30
|
+
/**
|
|
31
|
+
* The third-party OAuth service.
|
|
32
|
+
*/
|
|
33
|
+
method: Exclude<TOAuthMethod, 'TELEGRAM' | 'FARCASTER'>;
|
|
34
|
+
/**
|
|
35
|
+
* The app scheme to redirect to after OAuth is complete.
|
|
36
|
+
*/
|
|
37
|
+
appScheme?: string;
|
|
38
|
+
};
|
|
39
|
+
export interface GetOAuthUrlParams extends BaseOAuthUrlParams {
|
|
40
|
+
sessionLookupId?: string;
|
|
41
|
+
encryptionKey?: string;
|
|
42
|
+
portalCallbackParams?: Record<string, string>;
|
|
43
|
+
accountLinkInProgress?: AccountLinkInProgress;
|
|
44
|
+
}
|
|
45
|
+
export type GetOAuthUrlMethod = (_: GetOAuthUrlParams) => Promise<string>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { CurrentWalletIds, PregenAuth, PregenOrGuestAuth, ServerAuthState, TWalletType, WalletEntity } from '@getpara/user-management-client';
|
|
2
|
+
import type { Wallet } from '../../types';
|
|
3
|
+
export interface FetchPregenWalletsFromOverrideParams {
|
|
4
|
+
authInfo: ServerAuthState['auth'];
|
|
5
|
+
}
|
|
6
|
+
export type FetchPregenWalletsFromOverrideMethod = (_: FetchPregenWalletsFromOverrideParams) => Promise<void>;
|
|
7
|
+
export interface ClaimPregenWalletsParams {
|
|
8
|
+
/**
|
|
9
|
+
* The pregen identifier for the wallet to claim. If not provided, will attempt to claim all wallets in storage.
|
|
10
|
+
*/
|
|
11
|
+
pregenId?: PregenAuth;
|
|
12
|
+
}
|
|
13
|
+
export type ClaimPregenWalletsResponse = string | undefined;
|
|
14
|
+
export type ClaimPregenWalletsMethod = (_?: ClaimPregenWalletsParams) => Promise<ClaimPregenWalletsResponse>;
|
|
15
|
+
export interface PerformClaimPregenWalletsResponse {
|
|
16
|
+
walletIds: CurrentWalletIds;
|
|
17
|
+
recoverySecret: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export type PerformClaimPregenWalletsMethod = () => Promise<PerformClaimPregenWalletsResponse>;
|
|
20
|
+
export interface GetPregenWalletsParams {
|
|
21
|
+
/**
|
|
22
|
+
* The pregen ID for the wallets to fetch. If not provided, all available wallets will be retrieved.
|
|
23
|
+
*/
|
|
24
|
+
pregenId?: PregenAuth;
|
|
25
|
+
}
|
|
26
|
+
export type GetPregenWalletsResponse = WalletEntity[];
|
|
27
|
+
export type GetPregenWalletsMethod = (_?: GetPregenWalletsParams) => Promise<GetPregenWalletsResponse>;
|
|
28
|
+
export interface CreatePregenWalletParams {
|
|
29
|
+
/**
|
|
30
|
+
* The type of wallet to create, 'EVM' | 'SOLANA' | 'COSMOS'
|
|
31
|
+
*/
|
|
32
|
+
type: TWalletType;
|
|
33
|
+
/**
|
|
34
|
+
* The pregen identifier for the wallet, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
|
|
35
|
+
*/
|
|
36
|
+
pregenId: PregenOrGuestAuth;
|
|
37
|
+
}
|
|
38
|
+
export type CreatePregenWalletResponse = Wallet;
|
|
39
|
+
export type CreatePregenWalletMethod = (_: CreatePregenWalletParams) => Promise<CreatePregenWalletResponse>;
|
|
40
|
+
export interface CreatePregenWalletPerTypeParams {
|
|
41
|
+
/**
|
|
42
|
+
* The wallet types to create. If not provided, defaults to your application's `supportedWalletTypes` setting.
|
|
43
|
+
*/
|
|
44
|
+
types?: TWalletType[];
|
|
45
|
+
/**
|
|
46
|
+
* The pregen identifier for the wallets, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
|
|
47
|
+
*/
|
|
48
|
+
pregenId: PregenAuth;
|
|
49
|
+
}
|
|
50
|
+
export type CreatePregenWalletPerTypeResponse = Wallet[];
|
|
51
|
+
export type CreatePregenWalletPerTypeMethod = (_: CreatePregenWalletPerTypeParams) => Promise<CreatePregenWalletPerTypeResponse>;
|
|
52
|
+
export interface UpdatePregenWalletIdentifierParams {
|
|
53
|
+
/**
|
|
54
|
+
* The ID of the pregen wallet to update.
|
|
55
|
+
*/
|
|
56
|
+
walletId: string;
|
|
57
|
+
/**
|
|
58
|
+
* The new identifier for the wallet.
|
|
59
|
+
*/
|
|
60
|
+
newPregenId: PregenAuth;
|
|
61
|
+
}
|
|
62
|
+
export type UpdatePregenWalletIdentifierMethod = (_: UpdatePregenWalletIdentifierParams) => Promise<void>;
|
|
63
|
+
export interface HasPregenWalletParams {
|
|
64
|
+
/**
|
|
65
|
+
* The pregen ID for the wallet to check.
|
|
66
|
+
*/
|
|
67
|
+
pregenId: PregenAuth;
|
|
68
|
+
}
|
|
69
|
+
export type HasPregenWalletMethod = (_: HasPregenWalletParams) => Promise<boolean>;
|
|
70
|
+
export type CreateGuestWalletsResponse = Wallet[];
|
|
71
|
+
export type CreateGuestWalletsMethod = () => Promise<CreateGuestWalletsResponse>;
|
|
72
|
+
export type PerformCreateGuestWalletsResponse = Wallet[];
|
|
73
|
+
export type PerformCreateGuestWalletsMethod = () => Promise<PerformCreateGuestWalletsResponse>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SessionInfo } from '@getpara/user-management-client';
|
|
2
|
+
export type TouchSessionMethod = (_?: boolean) => Promise<SessionInfo>;
|
|
3
|
+
export type IsSessionActiveMethod = () => Promise<boolean>;
|
|
4
|
+
export type IsFullyLoggedInMethod = () => Promise<boolean>;
|
|
5
|
+
export interface RefreshSessionParams {
|
|
6
|
+
shouldOpenPopup?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type RefreshSessionMethod = (_?: RefreshSessionParams) => Promise<string>;
|
|
9
|
+
export type KeepSessionAliveMethod = () => Promise<boolean>;
|
|
10
|
+
export type GetVerificationTokenMethod = () => Promise<string>;
|
|
11
|
+
export interface IssueJwtParams {
|
|
12
|
+
/**
|
|
13
|
+
* The index of the Para RSA keypair to use for signing the JWT. Defaults to `0`.
|
|
14
|
+
*/
|
|
15
|
+
keyIndex?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface IssueJwtResponse {
|
|
18
|
+
/**
|
|
19
|
+
* The Para JWT token.
|
|
20
|
+
*/
|
|
21
|
+
token: string;
|
|
22
|
+
/**
|
|
23
|
+
* The `keyid`` / `kid` of the keypair used to sign the JWT.
|
|
24
|
+
*/
|
|
25
|
+
keyId: string;
|
|
26
|
+
}
|
|
27
|
+
export type IssueJwtMethod = (_?: IssueJwtParams) => Promise<IssueJwtResponse>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CurrentWalletIds } from '@getpara/user-management-client';
|
|
2
|
+
import type { PollingCallbacks } from './PollingServiceTypes';
|
|
3
|
+
export interface WaitForSignupParams extends PollingCallbacks {
|
|
4
|
+
}
|
|
5
|
+
export type WaitForSignupMethod = (_: WaitForSignupParams) => Promise<true>;
|
|
6
|
+
export interface WaitForWalletCreationParams extends PollingCallbacks {
|
|
7
|
+
}
|
|
8
|
+
export interface WaitForWalletCreationResponse {
|
|
9
|
+
/**
|
|
10
|
+
* The IDs of the newly created wallets.
|
|
11
|
+
*/
|
|
12
|
+
walletIds: CurrentWalletIds;
|
|
13
|
+
/**
|
|
14
|
+
* The recovery secret for the new wallets, if available.
|
|
15
|
+
*/
|
|
16
|
+
recoverySecret?: string;
|
|
17
|
+
}
|
|
18
|
+
export type WaitForWalletCreationMethod = (_?: WaitForWalletCreationParams) => Promise<WaitForWalletCreationResponse>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ExternalWalletInfo, ServerAuthState, ServerAuthStateDone, ServerAuthStateLogin, ServerAuthStateSignup, TelegramAuthResponse, VerifyThirdPartyAuth } from '@getpara/user-management-client';
|
|
2
|
+
import type { AuthStateDone, AuthStateLogin, AuthStateSignup, OAuthResponse, WithCustomTheme, WithUseShortUrls } from '../../types';
|
|
3
|
+
import type { PollingCallbacks } from './PollingServiceTypes';
|
|
4
|
+
export interface VerifyNewAccountParams extends WithCustomTheme, WithUseShortUrls {
|
|
5
|
+
/**
|
|
6
|
+
* The verification code entered by the user.
|
|
7
|
+
*/
|
|
8
|
+
verificationCode: string;
|
|
9
|
+
}
|
|
10
|
+
export type VerifyNewAccountResponse = AuthStateSignup;
|
|
11
|
+
export type VerifyNewAccountMethod = (_: VerifyNewAccountParams) => Promise<VerifyNewAccountResponse>;
|
|
12
|
+
export interface PerformVerifyNewAccountParams extends VerifyNewAccountParams {
|
|
13
|
+
}
|
|
14
|
+
interface PerformVerifyNewAccountResponse {
|
|
15
|
+
authState: ServerAuthStateSignup;
|
|
16
|
+
opts: WithCustomTheme & WithUseShortUrls;
|
|
17
|
+
}
|
|
18
|
+
export type PerformVerifyNewAccountMethod = (_: PerformVerifyNewAccountParams) => Promise<PerformVerifyNewAccountResponse>;
|
|
19
|
+
export interface BaseVerifyExternalWalletParams {
|
|
20
|
+
/**
|
|
21
|
+
* The external wallet information to verify.
|
|
22
|
+
*/
|
|
23
|
+
externalWallet: ExternalWalletInfo;
|
|
24
|
+
/**
|
|
25
|
+
* The signature of the signed verification string.
|
|
26
|
+
* If not provided, the signing of the `signatureVerificationMessage` message will be triggered.
|
|
27
|
+
*/
|
|
28
|
+
signedMessage?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The message that should be signed to verify ownership of the external wallet.
|
|
31
|
+
*/
|
|
32
|
+
signatureVerificationMessage?: string;
|
|
33
|
+
/**
|
|
34
|
+
* For Cosmos wallets, the wallet's public key as a hex string.
|
|
35
|
+
*/
|
|
36
|
+
cosmosPublicKeyHex?: string;
|
|
37
|
+
/**
|
|
38
|
+
* For Cosmos wallets, the base64 signer string.
|
|
39
|
+
*/
|
|
40
|
+
cosmosSigner?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Session lookup ID used from the Para portal requests to obtain the original user session.
|
|
43
|
+
*/
|
|
44
|
+
sessionLookupId?: string;
|
|
45
|
+
}
|
|
46
|
+
export type VerifyExternalWalletParams = WithCustomTheme & WithUseShortUrls & ({
|
|
47
|
+
serverAuthState: ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone;
|
|
48
|
+
} | ({
|
|
49
|
+
serverAuthState?: undefined;
|
|
50
|
+
} & BaseVerifyExternalWalletParams));
|
|
51
|
+
export type VerifyExternalWalletResponse = AuthStateSignup | AuthStateLogin | AuthStateDone;
|
|
52
|
+
export type VerifyExternalWalletMethod = (_: VerifyExternalWalletParams) => Promise<VerifyExternalWalletResponse>;
|
|
53
|
+
export type RetryVerifyExternalWalletMethod = () => Promise<VerifyExternalWalletResponse>;
|
|
54
|
+
export interface PerformVerifyExternalWalletResponse {
|
|
55
|
+
authState: ServerAuthState;
|
|
56
|
+
opts: WithCustomTheme & WithUseShortUrls;
|
|
57
|
+
sessionLookupId?: string;
|
|
58
|
+
}
|
|
59
|
+
export type PerformVerifyExternalWalletMethod = (_: VerifyExternalWalletParams) => Promise<PerformVerifyExternalWalletResponse>;
|
|
60
|
+
export interface VerifyTelegramParams extends WithCustomTheme, WithUseShortUrls {
|
|
61
|
+
/**
|
|
62
|
+
* The response received from the Telegram login bot.
|
|
63
|
+
*/
|
|
64
|
+
telegramAuthResponse?: TelegramAuthResponse;
|
|
65
|
+
serverAuthState?: VerifyThirdPartyAuth;
|
|
66
|
+
}
|
|
67
|
+
export type VerifyTelegramMethod = (_: VerifyTelegramParams) => Promise<OAuthResponse>;
|
|
68
|
+
export interface PerformVerifyTelegramResponse {
|
|
69
|
+
authState: ServerAuthState;
|
|
70
|
+
opts: WithCustomTheme & WithUseShortUrls;
|
|
71
|
+
sessionLookupId?: string;
|
|
72
|
+
}
|
|
73
|
+
export type PerformVerifyTelegramMethod = (_: VerifyTelegramParams) => Promise<PerformVerifyTelegramResponse>;
|
|
74
|
+
export interface VerifyFarcasterParams extends WithCustomTheme, WithUseShortUrls, PollingCallbacks {
|
|
75
|
+
/**
|
|
76
|
+
* A callback function that will be invoked with the Farcaster Connect URI when it is available.
|
|
77
|
+
* You will need to display the URI as a QR code.
|
|
78
|
+
*/
|
|
79
|
+
onConnectUri?: (uri: string) => void;
|
|
80
|
+
serverAuthState?: VerifyThirdPartyAuth;
|
|
81
|
+
}
|
|
82
|
+
export type VerifyFarcasterResponse = OAuthResponse;
|
|
83
|
+
export type VerifyFarcasterMethod = (_: VerifyFarcasterParams) => Promise<VerifyFarcasterResponse>;
|
|
84
|
+
export interface PerformVerifyFarcasterResponse {
|
|
85
|
+
authState?: ServerAuthState;
|
|
86
|
+
opts: WithCustomTheme & WithUseShortUrls;
|
|
87
|
+
sessionLookupId?: string;
|
|
88
|
+
}
|
|
89
|
+
export type PerformVerifyFarcasterMethod = (_: VerifyFarcasterParams) => Promise<PerformVerifyFarcasterResponse>;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { BackupKitEmailProps, CurrentWalletIds, TWalletType, WalletEntity } from '@getpara/user-management-client';
|
|
2
|
+
import type { Wallet, WalletFilters, WalletNoSigner } from '../../types';
|
|
3
|
+
export type SetWalletsParams = Record<string, Wallet>;
|
|
4
|
+
export type SetWalletsMethod = (_: SetWalletsParams) => Promise<void>;
|
|
5
|
+
export interface RefreshShareParams {
|
|
6
|
+
walletId: string;
|
|
7
|
+
share: string;
|
|
8
|
+
oldPartnerId?: string;
|
|
9
|
+
newPartnerId?: string;
|
|
10
|
+
keyShareProtocolId?: string;
|
|
11
|
+
redistributeBackupEncryptedShares?: boolean;
|
|
12
|
+
emailProps?: BackupKitEmailProps;
|
|
13
|
+
}
|
|
14
|
+
export interface RefreshShareResponse {
|
|
15
|
+
protocolId: string;
|
|
16
|
+
recoverySecret?: string;
|
|
17
|
+
signer: string;
|
|
18
|
+
}
|
|
19
|
+
export type RefreshShareMethod = (_: RefreshShareParams) => Promise<RefreshShareResponse>;
|
|
20
|
+
export type GetTypesToCreateMethod = (_?: Uppercase<TWalletType>[]) => Promise<TWalletType[]>;
|
|
21
|
+
interface SetCurrentWalletIdsOptions {
|
|
22
|
+
needsWallet?: boolean;
|
|
23
|
+
sessionLookupId?: string;
|
|
24
|
+
newDeviceSessionLookupId?: string;
|
|
25
|
+
}
|
|
26
|
+
export type SetCurrentWalletIdsParams = [CurrentWalletIds, SetCurrentWalletIdsOptions?];
|
|
27
|
+
export type SetCurrentWalletIdsMethod = (...params: SetCurrentWalletIdsParams) => Promise<void>;
|
|
28
|
+
export interface CreateWalletParams {
|
|
29
|
+
type?: Uppercase<TWalletType>;
|
|
30
|
+
skipDistribute?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export type CreateWalletResponse = [Wallet, string | undefined];
|
|
33
|
+
export type CreateWalletMethod = (_?: CreateWalletParams) => Promise<CreateWalletResponse>;
|
|
34
|
+
export interface CreateWalletPerTypeParams {
|
|
35
|
+
/**
|
|
36
|
+
* Array of the wallet types to create
|
|
37
|
+
*/
|
|
38
|
+
types?: Uppercase<TWalletType>[];
|
|
39
|
+
/**
|
|
40
|
+
* If `true`, skip distributing the new wallets shares.
|
|
41
|
+
*/
|
|
42
|
+
skipDistribute?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface CreateWalletPerTypeResponse {
|
|
45
|
+
/**
|
|
46
|
+
* Array of the created wallets
|
|
47
|
+
*/
|
|
48
|
+
wallets: Wallet[];
|
|
49
|
+
/**
|
|
50
|
+
* The `CurrentWalletIds` value for the new wallets
|
|
51
|
+
*/
|
|
52
|
+
walletIds: CurrentWalletIds;
|
|
53
|
+
/**
|
|
54
|
+
* The recovery secret for the new wallets, if available.
|
|
55
|
+
*/
|
|
56
|
+
recoverySecret?: string;
|
|
57
|
+
}
|
|
58
|
+
export type CreateWalletPerTypeMethod = (_?: CreateWalletPerTypeParams) => Promise<CreateWalletPerTypeResponse>;
|
|
59
|
+
export type FindWalletIdParams = [string?, WalletFilters?];
|
|
60
|
+
export type FindWalletIdMethod = (...params: FindWalletIdParams) => string;
|
|
61
|
+
export type FindWalletByAddressParams = [string?, WalletFilters?];
|
|
62
|
+
export type FindWalletByAddressMethod = (...params: FindWalletByAddressParams) => Wallet | undefined;
|
|
63
|
+
export type FindWalletParams = [string?, TWalletType?, WalletFilters?];
|
|
64
|
+
export type FindWalletMethod = (...params: FindWalletParams) => WalletNoSigner | undefined;
|
|
65
|
+
interface GetDisplayAddressOptions {
|
|
66
|
+
truncate?: boolean;
|
|
67
|
+
addressType?: TWalletType | undefined;
|
|
68
|
+
cosmosPrefix?: string;
|
|
69
|
+
targetLength?: number;
|
|
70
|
+
}
|
|
71
|
+
export type GetDisplayAddressParams = [string, GetDisplayAddressOptions?];
|
|
72
|
+
export type GetDisplayAddressMethod = (...params: GetDisplayAddressParams) => string;
|
|
73
|
+
export type GetIdenticonHashParams = [string, TWalletType?];
|
|
74
|
+
export type GetIdenticonHashMethod = (...params: GetIdenticonHashParams) => string | undefined;
|
|
75
|
+
export type IsWalletSupportedMethod = (_: WalletNoSigner) => boolean;
|
|
76
|
+
export type IsWalletOwnedMethod = (_: Wallet) => boolean;
|
|
77
|
+
export type IsWalletUsableMethod = (_: string, __?: WalletFilters, ___?: boolean) => boolean;
|
|
78
|
+
export type GetWalletsByTypeParams = TWalletType;
|
|
79
|
+
export type GetWalletsByTypeMethod = (_: GetWalletsByTypeParams) => Wallet[];
|
|
80
|
+
export type AssertIsValidWalletIdMethod = (_: string, __?: WalletFilters) => void;
|
|
81
|
+
export type AssertIsValidWalletTypeMethod = (_: string, __?: TWalletType[]) => Promise<TWalletType>;
|
|
82
|
+
export type FetchWalletsMethod = () => Promise<WalletEntity[]>;
|
|
83
|
+
export interface GetWalletBalanceParams {
|
|
84
|
+
walletId: string;
|
|
85
|
+
rpcUrl?: string;
|
|
86
|
+
}
|
|
87
|
+
export type GetWalletBalanceMethod = (_: GetWalletBalanceParams) => Promise<string>;
|
|
88
|
+
export type GetUserShareMethod = () => string | null;
|
|
89
|
+
export type SetUserShareMethod = (_: string | null) => Promise<void>;
|
|
90
|
+
export interface DistributeNewWalletShareParams {
|
|
91
|
+
/**
|
|
92
|
+
* The ID of the wallet whose share to distribute.
|
|
93
|
+
*/
|
|
94
|
+
walletId: string;
|
|
95
|
+
/**
|
|
96
|
+
* The user share string.
|
|
97
|
+
*/
|
|
98
|
+
userShare?: string;
|
|
99
|
+
/**
|
|
100
|
+
* If `true`, skip biometric share creation.
|
|
101
|
+
*/
|
|
102
|
+
skipBiometricShareCreation?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* If `true`, force a session refresh.
|
|
105
|
+
*/
|
|
106
|
+
forceRefresh?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export type DistributeNewWalletShareMethod = (_: DistributeNewWalletShareParams) => Promise<string>;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type * from './AuthServiceTypes';
|
|
2
|
+
export type * from './BaseAuthFlowServiceTypes';
|
|
3
|
+
export type * from './ExternalWalletServiceTypes';
|
|
4
|
+
export type * from './LoginFlowServiceTypes';
|
|
5
|
+
export type * from './PollingServiceTypes';
|
|
6
|
+
export type * from './PortalUrlServiceTypes';
|
|
7
|
+
export type * from './PregenWalletServiceTypes';
|
|
8
|
+
export type * from './SessionManagementServiceTypes';
|
|
9
|
+
export type * from './SignupFlowServiceTypes';
|
|
10
|
+
export type * from './VerificationFlowServiceTypes';
|
|
11
|
+
export type * from './WalletServiceTypes';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ParaCore } from '../ParaCore.js';
|
|
2
|
+
import { CoreEvents, CoreState } from './types/core.js';
|
|
3
|
+
import { AuthEvents } from './types/auth.js';
|
|
4
|
+
import { WalletEvents } from './types/wallet.js';
|
|
5
|
+
export declare class CoreStateManager {
|
|
6
|
+
private service;
|
|
7
|
+
private listeners;
|
|
8
|
+
private childSubscriptions;
|
|
9
|
+
private currentAuthRefId;
|
|
10
|
+
private currentWalletRefId;
|
|
11
|
+
private lastNotifiedState;
|
|
12
|
+
private devLog;
|
|
13
|
+
constructor(paraCore: ParaCore);
|
|
14
|
+
private subscribeToChildMachines;
|
|
15
|
+
private subscribeToChildRef;
|
|
16
|
+
start(): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
send(event: CoreEvents | AuthEvents | WalletEvents): void;
|
|
19
|
+
getSnapshot(): CoreState;
|
|
20
|
+
onStateChange(listener: (state: CoreState) => void): () => void;
|
|
21
|
+
private getAuthMachineState;
|
|
22
|
+
private getWalletMachineState;
|
|
23
|
+
/**
|
|
24
|
+
* Computes AuthStateInfo from the auth machine context.
|
|
25
|
+
* Extracts all data needed by UI consumers from authStateResult.
|
|
26
|
+
*/
|
|
27
|
+
private computeAuthStateInfo;
|
|
28
|
+
private mapXStateToCoreState;
|
|
29
|
+
private static readonly CORE_LOADING_STATES;
|
|
30
|
+
private static readonly AUTH_LOADING_STATES;
|
|
31
|
+
private static readonly WALLET_LOADING_STATES;
|
|
32
|
+
private isLoadingState;
|
|
33
|
+
private notifyListeners;
|
|
34
|
+
private statesEqual;
|
|
35
|
+
private authStateInfoEqual;
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
|
|
2
|
+
import { ServerAuthState } from '@getpara/user-management-client';
|
|
3
|
+
import { AuthService } from '../../services/AuthService.js';
|
|
4
|
+
import { SignUpOrLogInParams } from '../../services/types/AuthServiceTypes.js';
|
|
5
|
+
export declare const createAuthenticateWithEmailOrPhoneActor: (authService: AuthService) => import("xstate").PromiseActorLogic<{
|
|
6
|
+
authState: ServerAuthState;
|
|
7
|
+
opts: WithCustomTheme & WithUseShortUrls;
|
|
8
|
+
}, SignUpOrLogInParams, import("xstate").EventObject>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
|
|
2
|
+
import { ServerAuthState } from '@getpara/user-management-client';
|
|
3
|
+
import { AuthService } from '../../services/AuthService.js';
|
|
4
|
+
import { LoginExternalWalletParams } from '../../services/types/AuthServiceTypes.js';
|
|
5
|
+
export declare const createAuthenticateWithExternalWalletActor: (authService: AuthService) => import("xstate").PromiseActorLogic<{
|
|
6
|
+
authState: ServerAuthState;
|
|
7
|
+
opts: WithCustomTheme & WithUseShortUrls;
|
|
8
|
+
}, LoginExternalWalletParams, import("xstate").EventObject>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PollingService } from '../../services/PollingService.js';
|
|
2
|
+
import { WaitForFarcasterEventParams } from '../../services/types/PollingServiceTypes.js';
|
|
3
|
+
export declare const createAuthenticateWithFarcasterActor: (pollingService: PollingService) => import("xstate").PromiseActorLogic<import("../types/auth.js").AuthenticationOutput, WaitForFarcasterEventParams, import("xstate").EventObject>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AuthService } from '../../services/AuthService.js';
|
|
2
|
+
import { PerformVerifyFarcasterResponse, VerifyFarcasterParams } from '../../services/types/VerificationFlowServiceTypes.js';
|
|
3
|
+
export declare const createAuthenticateWithFarcasterLegacyActor: (authService: AuthService) => import("xstate").PromiseActorLogic<PerformVerifyFarcasterResponse, VerifyFarcasterParams, import("xstate").EventObject>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PollingService } from '../../services/PollingService.js';
|
|
2
|
+
import { WaitForTelegramEventParams } from '../../services/types/PollingServiceTypes.js';
|
|
3
|
+
export declare const createAuthenticateWithTelegramActor: (pollingService: PollingService) => import("xstate").PromiseActorLogic<import("../types/auth.js").AuthenticationOutput, WaitForTelegramEventParams, import("xstate").EventObject>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
|
|
2
|
+
import { ServerAuthState } from '@getpara/user-management-client';
|
|
3
|
+
import { AuthService } from '../../services/AuthService.js';
|
|
4
|
+
import { VerifyTelegramParams } from '../../services/types/VerificationFlowServiceTypes.js';
|
|
5
|
+
export declare const createAuthenticateWithTelegramLegacyActor: (authService: AuthService) => import("xstate").PromiseActorLogic<{
|
|
6
|
+
authState: ServerAuthState;
|
|
7
|
+
opts: WithCustomTheme & WithUseShortUrls;
|
|
8
|
+
}, VerifyTelegramParams, import("xstate").EventObject>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StateMachineInterface } from '../../types/serviceInterfaces.js';
|
|
2
|
+
export declare const createCheckUserStateActor: (paraCoreInterface: StateMachineInterface) => import("xstate").PromiseActorLogic<{
|
|
3
|
+
isAuthenticated: boolean;
|
|
4
|
+
isFullyLoggedIn: boolean;
|
|
5
|
+
isGuestMode: boolean;
|
|
6
|
+
}, {}, import("xstate").EventObject>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CurrentWalletIds } from '@getpara/user-management-client';
|
|
2
|
+
import { PregenWalletService } from '../../services/PregenWalletService.js';
|
|
3
|
+
export declare const createClaimWalletsActor: (pregenWalletService: PregenWalletService) => import("xstate").PromiseActorLogic<{
|
|
4
|
+
walletIds: CurrentWalletIds;
|
|
5
|
+
recoverySecret: string | undefined;
|
|
6
|
+
}, {
|
|
7
|
+
retryCount?: number;
|
|
8
|
+
}, import("xstate").EventObject>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExternalWalletService } from '../../services/ExternalWalletService.js';
|
|
2
|
+
export declare const createConnectParaConnectorsActor: (externalWalletService: ExternalWalletService) => import("xstate").PromiseActorLogic<void, void | {
|
|
3
|
+
retryCount?: number;
|
|
4
|
+
}, import("xstate").EventObject>;
|