@getpara/react-core 2.19.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/index.d.ts +37 -0
- package/dist/index.js +73 -0
- package/dist/mutations.d.ts +29 -0
- package/dist/mutations.js +60 -0
- package/dist/package.json +4 -0
- package/dist/provider/ParaProviderCore.d.ts +85 -0
- package/dist/provider/ParaProviderCore.js +124 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +28 -0
- package/dist/provider/actions/getEmbeddedAccount.js +82 -0
- package/dist/provider/actions/getWallet.js +34 -0
- package/dist/provider/actions/index.d.ts +38 -0
- package/dist/provider/actions/index.js +75 -0
- package/dist/provider/actions/utils.d.ts +4 -0
- package/dist/provider/actions/utils.js +32 -0
- package/dist/provider/hooks/aa/alchemy.d.ts +22 -0
- package/dist/provider/hooks/aa/alchemy.js +47 -0
- package/dist/provider/hooks/aa/biconomy.d.ts +22 -0
- package/dist/provider/hooks/aa/biconomy.js +47 -0
- package/dist/provider/hooks/aa/cdp.d.ts +21 -0
- package/dist/provider/hooks/aa/cdp.js +47 -0
- package/dist/provider/hooks/aa/createSmartAccountHook.d.ts +18 -0
- package/dist/provider/hooks/aa/createSmartAccountHook.js +96 -0
- package/dist/provider/hooks/aa/gelato.d.ts +21 -0
- package/dist/provider/hooks/aa/gelato.js +47 -0
- package/dist/provider/hooks/aa/index.d.ts +12 -0
- package/dist/provider/hooks/aa/index.js +48 -0
- package/dist/provider/hooks/aa/pimlico.d.ts +22 -0
- package/dist/provider/hooks/aa/pimlico.js +47 -0
- package/dist/provider/hooks/aa/porto.d.ts +22 -0
- package/dist/provider/hooks/aa/porto.js +47 -0
- package/dist/provider/hooks/aa/rhinestone.d.ts +22 -0
- package/dist/provider/hooks/aa/rhinestone.js +47 -0
- package/dist/provider/hooks/aa/safe.d.ts +22 -0
- package/dist/provider/hooks/aa/safe.js +47 -0
- package/dist/provider/hooks/aa/thirdweb.d.ts +18 -0
- package/dist/provider/hooks/aa/thirdweb.js +47 -0
- package/dist/provider/hooks/aa/types.d.ts +34 -0
- package/dist/provider/hooks/aa/types.js +0 -0
- package/dist/provider/hooks/aa/zerodev.d.ts +22 -0
- package/dist/provider/hooks/aa/zerodev.js +47 -0
- package/dist/provider/hooks/index.d.ts +4 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/index.d.ts +30 -0
- package/dist/provider/hooks/mutations/index.js +92 -0
- package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.d.ts +34 -0
- package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.js +39 -0
- package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.d.ts +34 -0
- package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.js +39 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +34 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.js +42 -0
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +34 -0
- package/dist/provider/hooks/mutations/useCreateGuestWallets.js +42 -0
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +34 -0
- package/dist/provider/hooks/mutations/useCreatePregenWallet.js +42 -0
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +34 -0
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.js +39 -0
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +34 -0
- package/dist/provider/hooks/mutations/useCreateWallet.js +42 -0
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +34 -0
- package/dist/provider/hooks/mutations/useCreateWalletPerType.js +39 -0
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +34 -0
- package/dist/provider/hooks/mutations/useEnable2fa.js +39 -0
- package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +39 -0
- package/dist/provider/hooks/mutations/useExportPrivateKey.js +63 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +34 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.js +39 -0
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +34 -0
- package/dist/provider/hooks/mutations/useIssueJwt.js +39 -0
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +33 -0
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +39 -0
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +34 -0
- package/dist/provider/hooks/mutations/useLoginExternalWallet.js +42 -0
- package/dist/provider/hooks/mutations/useLogout.d.ts +34 -0
- package/dist/provider/hooks/mutations/useLogout.js +39 -0
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +34 -0
- package/dist/provider/hooks/mutations/useResendVerificationCode.js +42 -0
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +34 -0
- package/dist/provider/hooks/mutations/useSetup2fa.js +39 -0
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +34 -0
- package/dist/provider/hooks/mutations/useSignMessage.js +39 -0
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +34 -0
- package/dist/provider/hooks/mutations/useSignTransaction.js +42 -0
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +34 -0
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.js +42 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +34 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.js +42 -0
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +34 -0
- package/dist/provider/hooks/mutations/useVerify2fa.js +39 -0
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +34 -0
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.js +42 -0
- package/dist/provider/hooks/mutations/useVerifyFarcaster.js +43 -0
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +34 -0
- package/dist/provider/hooks/mutations/useVerifyNewAccount.js +42 -0
- package/dist/provider/hooks/mutations/useVerifyOAuth.js +40 -0
- package/dist/provider/hooks/mutations/useVerifyTelegram.js +40 -0
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +34 -0
- package/dist/provider/hooks/mutations/useWaitForLogin.js +42 -0
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +34 -0
- package/dist/provider/hooks/mutations/useWaitForSignup.js +39 -0
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +34 -0
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +39 -0
- package/dist/provider/hooks/queries/createAccountHook.d.ts +49 -0
- package/dist/provider/hooks/queries/createAccountHook.js +132 -0
- package/dist/provider/hooks/queries/index.d.ts +5 -0
- package/dist/provider/hooks/queries/index.js +20 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +65 -0
- package/dist/provider/hooks/queries/useAccount.js +65 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +7 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +49 -0
- package/dist/provider/hooks/queries/useParaStatus.d.ts +15 -0
- package/dist/provider/hooks/queries/useParaStatus.js +32 -0
- package/dist/provider/hooks/queries/useWallet.js +43 -0
- package/dist/provider/hooks/utils/index.d.ts +2 -0
- package/dist/provider/hooks/utils/index.js +6 -0
- package/dist/provider/hooks/utils/useClient.d.ts +7 -0
- package/dist/provider/hooks/utils/useClient.js +8 -0
- package/dist/provider/hooks/utils/useCoreWalletState.d.ts +17 -0
- package/dist/provider/hooks/utils/useCoreWalletState.js +47 -0
- package/dist/provider/index.d.ts +5 -0
- package/dist/provider/index.js +11 -0
- package/dist/provider/stores/CoreStoreContext.d.ts +13 -0
- package/dist/provider/stores/CoreStoreContext.js +14 -0
- package/dist/provider/stores/createCoreStore.d.ts +26 -0
- package/dist/provider/stores/createCoreStore.js +61 -0
- package/dist/provider/stores/index.d.ts +4 -0
- package/dist/provider/stores/index.js +9 -0
- package/dist/provider/stores/slices/client.d.ts +3 -0
- package/dist/provider/stores/slices/client.js +7 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/config.js +9 -0
- package/dist/provider/stores/slices/index.d.ts +4 -0
- package/dist/provider/stores/slices/index.js +10 -0
- package/dist/provider/stores/slices/paraState.d.ts +3 -0
- package/dist/provider/stores/slices/paraState.js +7 -0
- package/dist/provider/stores/slices/wallet.d.ts +3 -0
- package/dist/provider/stores/slices/wallet.js +11 -0
- package/dist/provider/stores/types.d.ts +28 -0
- package/dist/provider/stores/types.js +0 -0
- package/dist/provider/utils/renameMutations.d.ts +11 -0
- package/dist/provider/utils/renameMutations.js +39 -0
- package/dist/queries.d.ts +2 -0
- package/dist/queries.js +6 -0
- package/package.json +73 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UsePortoSmartAccountParams } from '@getpara/aa-porto';
|
|
2
|
+
import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
|
|
3
|
+
import type { SmartAccountEnhancement } from './types.js';
|
|
4
|
+
export declare const PORTO_ACCOUNT_BASE_KEY = "PARA_PORTO_ACCOUNT";
|
|
5
|
+
/**
|
|
6
|
+
* Factory that creates a `usePortoSmartAccount` hook with an optional enhancer.
|
|
7
|
+
* Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createPortoSmartAccountHook: (useEnhancer?: (params: UsePortoSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-porto").PortoAccountConfig & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
12
|
+
/**
|
|
13
|
+
* React / React Native hook to create and manage a Porto smart account.
|
|
14
|
+
*
|
|
15
|
+
* Porto operates in EIP-7702 mode only. No API key required — Porto uses its own relay RPC.
|
|
16
|
+
* On testnets, Porto's relay sponsors gas by default. For mainnet, pass `merchantUrl`.
|
|
17
|
+
*
|
|
18
|
+
* Requires `@getpara/aa-porto` to be installed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const usePortoSmartAccount: (params?: import("@getpara/aa-porto").PortoAccountConfig & {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { createSmartAccountHook } from "./createSmartAccountHook.js";
|
|
22
|
+
const PORTO_ACCOUNT_BASE_KEY = "PARA_PORTO_ACCOUNT";
|
|
23
|
+
const createPortoSmartAccountHook = (useEnhancer) => createSmartAccountHook(
|
|
24
|
+
{
|
|
25
|
+
queryKeyBase: PORTO_ACCOUNT_BASE_KEY,
|
|
26
|
+
getQueryKey: (params) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return [(_a = params.chain) == null ? void 0 : _a.id, params.merchantUrl];
|
|
29
|
+
},
|
|
30
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
31
|
+
let mod;
|
|
32
|
+
try {
|
|
33
|
+
mod = yield import("@getpara/aa-porto");
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw new Error("[@getpara/react-core] Please install @getpara/aa-porto to use usePortoSmartAccount");
|
|
36
|
+
}
|
|
37
|
+
return mod.createPortoSmartAccount(params);
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
useEnhancer
|
|
41
|
+
);
|
|
42
|
+
const usePortoSmartAccount = createPortoSmartAccountHook();
|
|
43
|
+
export {
|
|
44
|
+
PORTO_ACCOUNT_BASE_KEY,
|
|
45
|
+
createPortoSmartAccountHook,
|
|
46
|
+
usePortoSmartAccount
|
|
47
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UseRhinestoneSmartAccountParams } from '@getpara/aa-rhinestone';
|
|
2
|
+
import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
|
|
3
|
+
import type { SmartAccountEnhancement } from './types.js';
|
|
4
|
+
export declare const RHINESTONE_SMART_ACCOUNT_BASE_KEY = "PARA_RHINESTONE_SMART_ACCOUNT";
|
|
5
|
+
/**
|
|
6
|
+
* Factory that creates a `useRhinestoneSmartAccount` hook with an optional enhancer.
|
|
7
|
+
* Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createRhinestoneSmartAccountHook: (useEnhancer?: (params: UseRhinestoneSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-rhinestone").RhinestoneSmartAccountConfig & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
12
|
+
/**
|
|
13
|
+
* React / React Native hook to create and manage a Rhinestone smart account.
|
|
14
|
+
*
|
|
15
|
+
* Rhinestone operates in EIP-4337 mode only. Uses Rhinestone's orchestrator
|
|
16
|
+
* with Pimlico's bundler infrastructure.
|
|
17
|
+
*
|
|
18
|
+
* Requires `@getpara/aa-rhinestone` to be installed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useRhinestoneSmartAccount: (params?: import("@getpara/aa-rhinestone").RhinestoneSmartAccountConfig & {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { createSmartAccountHook } from "./createSmartAccountHook.js";
|
|
22
|
+
const RHINESTONE_SMART_ACCOUNT_BASE_KEY = "PARA_RHINESTONE_SMART_ACCOUNT";
|
|
23
|
+
const createRhinestoneSmartAccountHook = (useEnhancer) => createSmartAccountHook(
|
|
24
|
+
{
|
|
25
|
+
queryKeyBase: RHINESTONE_SMART_ACCOUNT_BASE_KEY,
|
|
26
|
+
getQueryKey: (p) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return [(_a = p.chain) == null ? void 0 : _a.id, p.rpcUrl, p.rhinestoneApiKey, p.pimlicoApiKey];
|
|
29
|
+
},
|
|
30
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
31
|
+
let mod;
|
|
32
|
+
try {
|
|
33
|
+
mod = yield import("@getpara/aa-rhinestone");
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw new Error("[@getpara/react-core] Please install @getpara/aa-rhinestone to use useRhinestoneSmartAccount");
|
|
36
|
+
}
|
|
37
|
+
return mod.createRhinestoneSmartAccount(params);
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
useEnhancer
|
|
41
|
+
);
|
|
42
|
+
const useRhinestoneSmartAccount = createRhinestoneSmartAccountHook();
|
|
43
|
+
export {
|
|
44
|
+
RHINESTONE_SMART_ACCOUNT_BASE_KEY,
|
|
45
|
+
createRhinestoneSmartAccountHook,
|
|
46
|
+
useRhinestoneSmartAccount
|
|
47
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UseSafeSmartAccountParams } from '@getpara/aa-safe';
|
|
2
|
+
import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
|
|
3
|
+
import type { SmartAccountEnhancement } from './types.js';
|
|
4
|
+
export declare const SAFE_SMART_ACCOUNT_BASE_KEY = "PARA_SAFE_SMART_ACCOUNT";
|
|
5
|
+
/**
|
|
6
|
+
* Factory that creates a `useSafeSmartAccount` hook with an optional enhancer.
|
|
7
|
+
* Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createSafeSmartAccountHook: (useEnhancer?: (params: UseSafeSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-safe").SafeSmartAccountConfig & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
12
|
+
/**
|
|
13
|
+
* React / React Native hook to create and manage a Safe smart account.
|
|
14
|
+
*
|
|
15
|
+
* Safe operates in EIP-4337 mode only. Uses permissionless's Safe implementation
|
|
16
|
+
* with Pimlico's bundler and paymaster infrastructure.
|
|
17
|
+
*
|
|
18
|
+
* Requires `@getpara/aa-safe` to be installed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useSafeSmartAccount: (params?: import("@getpara/aa-safe").SafeSmartAccountConfig & {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { createSmartAccountHook } from "./createSmartAccountHook.js";
|
|
22
|
+
const SAFE_SMART_ACCOUNT_BASE_KEY = "PARA_SAFE_SMART_ACCOUNT";
|
|
23
|
+
const createSafeSmartAccountHook = (useEnhancer) => createSmartAccountHook(
|
|
24
|
+
{
|
|
25
|
+
queryKeyBase: SAFE_SMART_ACCOUNT_BASE_KEY,
|
|
26
|
+
getQueryKey: (p) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return [p.pimlicoApiKey, (_a = p.chain) == null ? void 0 : _a.id, p.rpcUrl, p.safeVersion, (_b = p.saltNonce) == null ? void 0 : _b.toString()];
|
|
29
|
+
},
|
|
30
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
31
|
+
let mod;
|
|
32
|
+
try {
|
|
33
|
+
mod = yield import("@getpara/aa-safe");
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw new Error("[@getpara/react-core] Please install @getpara/aa-safe to use useSafeSmartAccount");
|
|
36
|
+
}
|
|
37
|
+
return mod.createSafeSmartAccount(params);
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
useEnhancer
|
|
41
|
+
);
|
|
42
|
+
const useSafeSmartAccount = createSafeSmartAccountHook();
|
|
43
|
+
export {
|
|
44
|
+
SAFE_SMART_ACCOUNT_BASE_KEY,
|
|
45
|
+
createSafeSmartAccountHook,
|
|
46
|
+
useSafeSmartAccount
|
|
47
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UseThirdwebSmartAccountParams } from '@getpara/aa-thirdweb';
|
|
2
|
+
import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
|
|
3
|
+
import type { SmartAccountEnhancement } from './types.js';
|
|
4
|
+
export declare const THIRDWEB_SMART_ACCOUNT_BASE_KEY = "PARA_THIRDWEB_SMART_ACCOUNT";
|
|
5
|
+
/**
|
|
6
|
+
* Factory that creates a `useThirdwebSmartAccount` hook with an optional enhancer.
|
|
7
|
+
* Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createThirdwebSmartAccountHook: (useEnhancer?: (params: UseThirdwebSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
10
|
+
/**
|
|
11
|
+
* React / React Native hook to create and manage a Thirdweb smart account.
|
|
12
|
+
*
|
|
13
|
+
* Supports both EIP-4337 and EIP-7702 modes. Uses Thirdweb's smart wallet
|
|
14
|
+
* infrastructure with optional gas sponsorship.
|
|
15
|
+
*
|
|
16
|
+
* Requires `@getpara/aa-thirdweb` to be installed.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useThirdwebSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { createSmartAccountHook } from "./createSmartAccountHook.js";
|
|
22
|
+
const THIRDWEB_SMART_ACCOUNT_BASE_KEY = "PARA_THIRDWEB_SMART_ACCOUNT";
|
|
23
|
+
const createThirdwebSmartAccountHook = (useEnhancer) => createSmartAccountHook(
|
|
24
|
+
{
|
|
25
|
+
queryKeyBase: THIRDWEB_SMART_ACCOUNT_BASE_KEY,
|
|
26
|
+
getQueryKey: (p) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return [p.clientId, (_a = p.chain) == null ? void 0 : _a.id, p.mode, p.sponsorGas, p.factoryAddress, p.accountAddress];
|
|
29
|
+
},
|
|
30
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
31
|
+
let mod;
|
|
32
|
+
try {
|
|
33
|
+
mod = yield import("@getpara/aa-thirdweb");
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw new Error("[@getpara/react-core] Please install @getpara/aa-thirdweb to use useThirdwebSmartAccount");
|
|
36
|
+
}
|
|
37
|
+
return mod.createThirdwebSmartAccount(params);
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
useEnhancer
|
|
41
|
+
);
|
|
42
|
+
const useThirdwebSmartAccount = createThirdwebSmartAccountHook();
|
|
43
|
+
export {
|
|
44
|
+
THIRDWEB_SMART_ACCOUNT_BASE_KEY,
|
|
45
|
+
createThirdwebSmartAccountHook,
|
|
46
|
+
useThirdwebSmartAccount
|
|
47
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type ParaCore from '@getpara/core-sdk';
|
|
2
|
+
import type { Hex, LocalAccount, WalletClient } from 'viem';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for `createSmartAccountHook` — defines how a provider hook
|
|
5
|
+
* creates its smart account client.
|
|
6
|
+
*/
|
|
7
|
+
export interface SmartAccountHookConfig<TParams, TResult> {
|
|
8
|
+
queryKeyBase: string;
|
|
9
|
+
getQueryKey: (params: TParams) => unknown[];
|
|
10
|
+
createClient: (params: TParams & {
|
|
11
|
+
para: ParaCore;
|
|
12
|
+
address?: Hex;
|
|
13
|
+
signer?: LocalAccount | WalletClient;
|
|
14
|
+
}) => Promise<TResult | null>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Return value from an enhancer hook. Provides an optional external signer
|
|
18
|
+
* and loading state so the base hook can wait for it.
|
|
19
|
+
*/
|
|
20
|
+
export interface SmartAccountEnhancement {
|
|
21
|
+
/** External signer (e.g. wagmi WalletClient) to use instead of Para embedded wallet. */
|
|
22
|
+
signer?: LocalAccount | WalletClient | null;
|
|
23
|
+
/** Address of the external signer, if available. */
|
|
24
|
+
signerAddress?: Hex | null;
|
|
25
|
+
/** True while the signer is still loading (e.g. wagmi useWalletClient pending). */
|
|
26
|
+
isLoading?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Return type of hooks created by `createSmartAccountHook`.
|
|
30
|
+
* Extends React Query's `UseQueryResult` with a convenient `smartAccount` alias.
|
|
31
|
+
*/
|
|
32
|
+
export type UseSmartAccountResult<TResult> = import('@tanstack/react-query').UseQueryResult<TResult | null | undefined, Error> & {
|
|
33
|
+
smartAccount: TResult | null | undefined;
|
|
34
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UseZeroDevSmartAccountParams } from '@getpara/aa-zerodev';
|
|
2
|
+
import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
|
|
3
|
+
import type { SmartAccountEnhancement } from './types.js';
|
|
4
|
+
export declare const ZERODEV_SMART_ACCOUNT_BASE_KEY = "PARA_ZERODEV_SMART_ACCOUNT";
|
|
5
|
+
/**
|
|
6
|
+
* Factory that creates a `useZeroDevSmartAccount` hook with an optional enhancer.
|
|
7
|
+
* Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createZeroDevSmartAccountHook: (useEnhancer?: (params: UseZeroDevSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-zerodev").ZeroDevSmartAccountConfig & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
12
|
+
/**
|
|
13
|
+
* React / React Native hook to create and manage a ZeroDev smart account.
|
|
14
|
+
*
|
|
15
|
+
* Supports both EIP-4337 and EIP-7702 modes. Uses ZeroDev's Kernel account
|
|
16
|
+
* with ECDSA validation and gas sponsorship.
|
|
17
|
+
*
|
|
18
|
+
* Requires `@getpara/aa-zerodev` to be installed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useZeroDevSmartAccount: (params?: import("@getpara/aa-zerodev").ZeroDevSmartAccountConfig & {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
}) => import("./types.js").UseSmartAccountResult<SmartAccount>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { createSmartAccountHook } from "./createSmartAccountHook.js";
|
|
22
|
+
const ZERODEV_SMART_ACCOUNT_BASE_KEY = "PARA_ZERODEV_SMART_ACCOUNT";
|
|
23
|
+
const createZeroDevSmartAccountHook = (useEnhancer) => createSmartAccountHook(
|
|
24
|
+
{
|
|
25
|
+
queryKeyBase: ZERODEV_SMART_ACCOUNT_BASE_KEY,
|
|
26
|
+
getQueryKey: (p) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return [p.projectId, (_a = p.chain) == null ? void 0 : _a.id, p.rpcUrl, p.bundlerUrl, p.paymasterUrl, p.mode];
|
|
29
|
+
},
|
|
30
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
31
|
+
let mod;
|
|
32
|
+
try {
|
|
33
|
+
mod = yield import("@getpara/aa-zerodev");
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw new Error("[@getpara/react-core] Please install @getpara/aa-zerodev to use useZeroDevSmartAccount");
|
|
36
|
+
}
|
|
37
|
+
return mod.createZeroDevSmartAccount(params);
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
useEnhancer
|
|
41
|
+
);
|
|
42
|
+
const useZeroDevSmartAccount = createZeroDevSmartAccountHook();
|
|
43
|
+
export {
|
|
44
|
+
ZERODEV_SMART_ACCOUNT_BASE_KEY,
|
|
45
|
+
createZeroDevSmartAccountHook,
|
|
46
|
+
useZeroDevSmartAccount
|
|
47
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { useSignMessage, SIGN_MESSAGE_KEY } from './useSignMessage.js';
|
|
2
|
+
export { useSignTransaction, SIGN_TRANSACTION_KEY } from './useSignTransaction.js';
|
|
3
|
+
export { useLogout, LOGOUT_KEY } from './useLogout.js';
|
|
4
|
+
export { useKeepSessionAlive, KEEP_SESSION_ALIVE_KEY } from './useKeepSessionAlive.js';
|
|
5
|
+
export { useCreateWallet, CREATE_WALLET_KEY } from './useCreateWallet.js';
|
|
6
|
+
export { useCreateWalletPerType, CREATE_WALLET_PER_TYPE_KEY } from './useCreateWalletPerType.js';
|
|
7
|
+
export { useCreatePregenWallet, CREATE_PREGEN_WALLET_KEY } from './useCreatePregenWallet.js';
|
|
8
|
+
export { useCreatePregenWalletPerType, CREATE_PREGEN_WALLET_PER_TYPE_KEY } from './useCreatePregenWalletPerType.js';
|
|
9
|
+
export { useClaimPregenWallets, CLAIM_PREGEN_WALLETS_KEY } from './useClaimPregenWallets.js';
|
|
10
|
+
export { useHasPregenWallet, HAS_PREGEN_WALLET_KEY } from './useHasPregenWallet.js';
|
|
11
|
+
export { useUpdatePregenWalletIdentifier, UPDATE_PREGEN_WALLET_IDENTIFIER_KEY } from './useUpdatePregenWalletIdentifier.js';
|
|
12
|
+
export { useCreateGuestWallets, CREATE_GUEST_WALLETS_KEY } from './useCreateGuestWallets.js';
|
|
13
|
+
export { useSignUpOrLogIn, SIGN_UP_LOG_IN_KEY } from './useSignUpOrLogIn.js';
|
|
14
|
+
export { useVerifyNewAccount, VERIFY_NEW_ACCOUNT_KEY } from './useVerifyNewAccount.js';
|
|
15
|
+
export { useSetup2fa, SETUP_2FA_KEY } from './useSetup2fa.js';
|
|
16
|
+
export { useEnable2fa, ENABLE_2FA_KEY } from './useEnable2fa.js';
|
|
17
|
+
export { useVerify2fa, VERIFY_2FA_KEY } from './useVerify2fa.js';
|
|
18
|
+
export { useIssueJwt, ISSUE_JWT_KEY } from './useIssueJwt.js';
|
|
19
|
+
export { useResendVerificationCode, RESEND_VERIFICATION_CODE_KEY } from './useResendVerificationCode.js';
|
|
20
|
+
export { useExportPrivateKey, EXPORT_PRIVATE_KEY_KEY } from './useExportPrivateKey.js';
|
|
21
|
+
export { useAuthenticateWithEmailOrPhone, AUTHENTICATE_EMAIL_OR_PHONE_KEY } from './useAuthenticateWithEmailOrPhone.js';
|
|
22
|
+
export { useAuthenticateWithOAuth, AUTHENTICATE_OAUTH_KEY } from './useAuthenticateWithOAuth.js';
|
|
23
|
+
export { useLoginExternalWallet, LOGIN_EXTERNAL_WALLET_KEY } from './useLoginExternalWallet.js';
|
|
24
|
+
export { useVerifyExternalWallet, VERIFY_EXTERNAL_WALLET_KEY } from './useVerifyExternalWallet.js';
|
|
25
|
+
export { useVerifyOAuth, VERIFY_OAUTH_KEY } from './useVerifyOAuth.js';
|
|
26
|
+
export { useVerifyFarcaster, VERIFY_FARCASTER_KEY } from './useVerifyFarcaster.js';
|
|
27
|
+
export { useVerifyTelegram, VERIFY_TELEGRAM_KEY } from './useVerifyTelegram.js';
|
|
28
|
+
export { useWaitForLogin, WAIT_FOR_LOG_IN_KEY } from './useWaitForLogin.js';
|
|
29
|
+
export { useWaitForSignup, WAIT_FOR_SIGN_UP_KEY } from './useWaitForSignup.js';
|
|
30
|
+
export { useWaitForWalletCreation, WAIT_FOR_WALLET_CREATION_KEY } from './useWaitForWalletCreation.js';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useSignMessage, SIGN_MESSAGE_KEY } from "./useSignMessage.js";
|
|
2
|
+
import { useSignTransaction, SIGN_TRANSACTION_KEY } from "./useSignTransaction.js";
|
|
3
|
+
import { useLogout, LOGOUT_KEY } from "./useLogout.js";
|
|
4
|
+
import { useKeepSessionAlive, KEEP_SESSION_ALIVE_KEY } from "./useKeepSessionAlive.js";
|
|
5
|
+
import { useCreateWallet, CREATE_WALLET_KEY } from "./useCreateWallet.js";
|
|
6
|
+
import { useCreateWalletPerType, CREATE_WALLET_PER_TYPE_KEY } from "./useCreateWalletPerType.js";
|
|
7
|
+
import { useCreatePregenWallet, CREATE_PREGEN_WALLET_KEY } from "./useCreatePregenWallet.js";
|
|
8
|
+
import { useCreatePregenWalletPerType, CREATE_PREGEN_WALLET_PER_TYPE_KEY } from "./useCreatePregenWalletPerType.js";
|
|
9
|
+
import { useClaimPregenWallets, CLAIM_PREGEN_WALLETS_KEY } from "./useClaimPregenWallets.js";
|
|
10
|
+
import { useHasPregenWallet, HAS_PREGEN_WALLET_KEY } from "./useHasPregenWallet.js";
|
|
11
|
+
import { useUpdatePregenWalletIdentifier, UPDATE_PREGEN_WALLET_IDENTIFIER_KEY } from "./useUpdatePregenWalletIdentifier.js";
|
|
12
|
+
import { useCreateGuestWallets, CREATE_GUEST_WALLETS_KEY } from "./useCreateGuestWallets.js";
|
|
13
|
+
import { useSignUpOrLogIn, SIGN_UP_LOG_IN_KEY } from "./useSignUpOrLogIn.js";
|
|
14
|
+
import { useVerifyNewAccount, VERIFY_NEW_ACCOUNT_KEY } from "./useVerifyNewAccount.js";
|
|
15
|
+
import { useSetup2fa, SETUP_2FA_KEY } from "./useSetup2fa.js";
|
|
16
|
+
import { useEnable2fa, ENABLE_2FA_KEY } from "./useEnable2fa.js";
|
|
17
|
+
import { useVerify2fa, VERIFY_2FA_KEY } from "./useVerify2fa.js";
|
|
18
|
+
import { useIssueJwt, ISSUE_JWT_KEY } from "./useIssueJwt.js";
|
|
19
|
+
import { useResendVerificationCode, RESEND_VERIFICATION_CODE_KEY } from "./useResendVerificationCode.js";
|
|
20
|
+
import { useExportPrivateKey, EXPORT_PRIVATE_KEY_KEY } from "./useExportPrivateKey.js";
|
|
21
|
+
import { useAuthenticateWithEmailOrPhone, AUTHENTICATE_EMAIL_OR_PHONE_KEY } from "./useAuthenticateWithEmailOrPhone.js";
|
|
22
|
+
import { useAuthenticateWithOAuth, AUTHENTICATE_OAUTH_KEY } from "./useAuthenticateWithOAuth.js";
|
|
23
|
+
import { useLoginExternalWallet, LOGIN_EXTERNAL_WALLET_KEY } from "./useLoginExternalWallet.js";
|
|
24
|
+
import { useVerifyExternalWallet, VERIFY_EXTERNAL_WALLET_KEY } from "./useVerifyExternalWallet.js";
|
|
25
|
+
import { useVerifyOAuth, VERIFY_OAUTH_KEY } from "./useVerifyOAuth.js";
|
|
26
|
+
import { useVerifyFarcaster, VERIFY_FARCASTER_KEY } from "./useVerifyFarcaster.js";
|
|
27
|
+
import { useVerifyTelegram, VERIFY_TELEGRAM_KEY } from "./useVerifyTelegram.js";
|
|
28
|
+
import { useWaitForLogin, WAIT_FOR_LOG_IN_KEY } from "./useWaitForLogin.js";
|
|
29
|
+
import { useWaitForSignup, WAIT_FOR_SIGN_UP_KEY } from "./useWaitForSignup.js";
|
|
30
|
+
import { useWaitForWalletCreation, WAIT_FOR_WALLET_CREATION_KEY } from "./useWaitForWalletCreation.js";
|
|
31
|
+
export {
|
|
32
|
+
AUTHENTICATE_EMAIL_OR_PHONE_KEY,
|
|
33
|
+
AUTHENTICATE_OAUTH_KEY,
|
|
34
|
+
CLAIM_PREGEN_WALLETS_KEY,
|
|
35
|
+
CREATE_GUEST_WALLETS_KEY,
|
|
36
|
+
CREATE_PREGEN_WALLET_KEY,
|
|
37
|
+
CREATE_PREGEN_WALLET_PER_TYPE_KEY,
|
|
38
|
+
CREATE_WALLET_KEY,
|
|
39
|
+
CREATE_WALLET_PER_TYPE_KEY,
|
|
40
|
+
ENABLE_2FA_KEY,
|
|
41
|
+
EXPORT_PRIVATE_KEY_KEY,
|
|
42
|
+
HAS_PREGEN_WALLET_KEY,
|
|
43
|
+
ISSUE_JWT_KEY,
|
|
44
|
+
KEEP_SESSION_ALIVE_KEY,
|
|
45
|
+
LOGIN_EXTERNAL_WALLET_KEY,
|
|
46
|
+
LOGOUT_KEY,
|
|
47
|
+
RESEND_VERIFICATION_CODE_KEY,
|
|
48
|
+
SETUP_2FA_KEY,
|
|
49
|
+
SIGN_MESSAGE_KEY,
|
|
50
|
+
SIGN_TRANSACTION_KEY,
|
|
51
|
+
SIGN_UP_LOG_IN_KEY,
|
|
52
|
+
UPDATE_PREGEN_WALLET_IDENTIFIER_KEY,
|
|
53
|
+
VERIFY_2FA_KEY,
|
|
54
|
+
VERIFY_EXTERNAL_WALLET_KEY,
|
|
55
|
+
VERIFY_FARCASTER_KEY,
|
|
56
|
+
VERIFY_NEW_ACCOUNT_KEY,
|
|
57
|
+
VERIFY_OAUTH_KEY,
|
|
58
|
+
VERIFY_TELEGRAM_KEY,
|
|
59
|
+
WAIT_FOR_LOG_IN_KEY,
|
|
60
|
+
WAIT_FOR_SIGN_UP_KEY,
|
|
61
|
+
WAIT_FOR_WALLET_CREATION_KEY,
|
|
62
|
+
useAuthenticateWithEmailOrPhone,
|
|
63
|
+
useAuthenticateWithOAuth,
|
|
64
|
+
useClaimPregenWallets,
|
|
65
|
+
useCreateGuestWallets,
|
|
66
|
+
useCreatePregenWallet,
|
|
67
|
+
useCreatePregenWalletPerType,
|
|
68
|
+
useCreateWallet,
|
|
69
|
+
useCreateWalletPerType,
|
|
70
|
+
useEnable2fa,
|
|
71
|
+
useExportPrivateKey,
|
|
72
|
+
useHasPregenWallet,
|
|
73
|
+
useIssueJwt,
|
|
74
|
+
useKeepSessionAlive,
|
|
75
|
+
useLoginExternalWallet,
|
|
76
|
+
useLogout,
|
|
77
|
+
useResendVerificationCode,
|
|
78
|
+
useSetup2fa,
|
|
79
|
+
useSignMessage,
|
|
80
|
+
useSignTransaction,
|
|
81
|
+
useSignUpOrLogIn,
|
|
82
|
+
useUpdatePregenWalletIdentifier,
|
|
83
|
+
useVerify2fa,
|
|
84
|
+
useVerifyExternalWallet,
|
|
85
|
+
useVerifyFarcaster,
|
|
86
|
+
useVerifyNewAccount,
|
|
87
|
+
useVerifyOAuth,
|
|
88
|
+
useVerifyTelegram,
|
|
89
|
+
useWaitForLogin,
|
|
90
|
+
useWaitForSignup,
|
|
91
|
+
useWaitForWalletCreation
|
|
92
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AuthenticateWithEmailOrPhoneParams } from '@getpara/core-sdk';
|
|
2
|
+
export declare const AUTHENTICATE_EMAIL_OR_PHONE_KEY = "AUTHENTICATE_EMAIL_OR_PHONE";
|
|
3
|
+
/**
|
|
4
|
+
* React hook for the `authenticateWithEmailOrPhone` mutation.
|
|
5
|
+
*
|
|
6
|
+
* Returns a mutation result object with all standard fields from `useMutation`, except:
|
|
7
|
+
* - `mutate` and `mutateAsync` are replaced by:
|
|
8
|
+
* - `authenticateWithEmailOrPhone`: function to trigger the mutation (same as `mutate`)
|
|
9
|
+
* - `authenticateWithEmailOrPhoneAsync`: async function to trigger the mutation (same as `mutateAsync`)
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const { authenticateWithEmailOrPhone, authenticateWithEmailOrPhoneAsync } = useAuthenticateWithEmailOrPhone();
|
|
13
|
+
* authenticateWithEmailOrPhone({ ...params });
|
|
14
|
+
* // or
|
|
15
|
+
* await authenticateWithEmailOrPhoneAsync({ ...params });
|
|
16
|
+
*/
|
|
17
|
+
export declare const useAuthenticateWithEmailOrPhone: () => {
|
|
18
|
+
error: Error;
|
|
19
|
+
isSuccess: boolean;
|
|
20
|
+
data: import("@getpara/core-sdk").AuthenticateResponse;
|
|
21
|
+
variables: AuthenticateWithEmailOrPhoneParams;
|
|
22
|
+
isError: boolean;
|
|
23
|
+
isIdle: boolean;
|
|
24
|
+
isPending: boolean;
|
|
25
|
+
status: "error" | "idle" | "pending" | "success";
|
|
26
|
+
reset: () => void;
|
|
27
|
+
context: unknown;
|
|
28
|
+
failureCount: number;
|
|
29
|
+
failureReason: Error;
|
|
30
|
+
isPaused: boolean;
|
|
31
|
+
submittedAt: number;
|
|
32
|
+
authenticateWithEmailOrPhone: import("@tanstack/react-query").UseMutateFunction<import("@getpara/core-sdk").AuthenticateResponse, Error, AuthenticateWithEmailOrPhoneParams, unknown>;
|
|
33
|
+
authenticateWithEmailOrPhoneAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@getpara/core-sdk").AuthenticateResponse, Error, AuthenticateWithEmailOrPhoneParams, unknown>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { useMutation } from "@tanstack/react-query";
|
|
22
|
+
import { useClient } from "../utils/index.js";
|
|
23
|
+
import { renameMutations } from "../../utils/renameMutations.js";
|
|
24
|
+
import { authenticateWithEmailOrPhone } from "../../actions/index.js";
|
|
25
|
+
const AUTHENTICATE_EMAIL_OR_PHONE_KEY = "AUTHENTICATE_EMAIL_OR_PHONE";
|
|
26
|
+
const useAuthenticateWithEmailOrPhone = () => {
|
|
27
|
+
const para = useClient();
|
|
28
|
+
const mutation = useMutation({
|
|
29
|
+
mutationKey: [AUTHENTICATE_EMAIL_OR_PHONE_KEY],
|
|
30
|
+
mutationFn: (params) => __async(void 0, null, function* () {
|
|
31
|
+
return authenticateWithEmailOrPhone(para, params);
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
return renameMutations(mutation, "authenticateWithEmailOrPhone");
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
AUTHENTICATE_EMAIL_OR_PHONE_KEY,
|
|
38
|
+
useAuthenticateWithEmailOrPhone
|
|
39
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AuthenticateWithOAuthParams } from '@getpara/core-sdk';
|
|
2
|
+
export declare const AUTHENTICATE_OAUTH_KEY = "AUTHENTICATE_OAUTH";
|
|
3
|
+
/**
|
|
4
|
+
* React hook for the `authenticateWithOAuth` mutation.
|
|
5
|
+
*
|
|
6
|
+
* Returns a mutation result object with all standard fields from `useMutation`, except:
|
|
7
|
+
* - `mutate` and `mutateAsync` are replaced by:
|
|
8
|
+
* - `authenticateWithOAuth`: function to trigger the mutation (same as `mutate`)
|
|
9
|
+
* - `authenticateWithOAuthAsync`: async function to trigger the mutation (same as `mutateAsync`)
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const { authenticateWithOAuth, authenticateWithOAuthAsync } = useAuthenticateWithOAuth();
|
|
13
|
+
* authenticateWithOAuth({ ...params });
|
|
14
|
+
* // or
|
|
15
|
+
* await authenticateWithOAuthAsync({ ...params });
|
|
16
|
+
*/
|
|
17
|
+
export declare const useAuthenticateWithOAuth: () => {
|
|
18
|
+
error: Error;
|
|
19
|
+
isSuccess: boolean;
|
|
20
|
+
data: import("@getpara/core-sdk").AuthenticateResponse;
|
|
21
|
+
variables: AuthenticateWithOAuthParams;
|
|
22
|
+
isError: boolean;
|
|
23
|
+
isIdle: boolean;
|
|
24
|
+
isPending: boolean;
|
|
25
|
+
status: "error" | "idle" | "pending" | "success";
|
|
26
|
+
reset: () => void;
|
|
27
|
+
context: unknown;
|
|
28
|
+
failureCount: number;
|
|
29
|
+
failureReason: Error;
|
|
30
|
+
isPaused: boolean;
|
|
31
|
+
submittedAt: number;
|
|
32
|
+
authenticateWithOAuth: import("@tanstack/react-query").UseMutateFunction<import("@getpara/core-sdk").AuthenticateResponse, Error, AuthenticateWithOAuthParams, unknown>;
|
|
33
|
+
authenticateWithOAuthAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@getpara/core-sdk").AuthenticateResponse, Error, AuthenticateWithOAuthParams, unknown>;
|
|
34
|
+
};
|