@getpara/react-core 2.24.0 → 2.25.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 +1 -0
- package/dist/index.js +3 -0
- package/dist/mutations.d.ts +1 -0
- package/dist/mutations.js +2 -0
- package/dist/provider/actions/index.d.ts +2 -1
- package/dist/provider/actions/index.js +2 -0
- package/dist/provider/hooks/mutations/index.d.ts +1 -0
- package/dist/provider/hooks/mutations/index.js +3 -0
- package/dist/provider/hooks/mutations/useRequestFaucet.d.ts +98 -0
- package/dist/provider/hooks/mutations/useRequestFaucet.js +68 -0
- package/dist/provider/hooks/queries/createAccountHook.js +7 -9
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { useVerify2fa } from './provider/hooks/mutations/useVerify2fa.js';
|
|
|
26
26
|
export { useIssueJwt } from './provider/hooks/mutations/useIssueJwt.js';
|
|
27
27
|
export { useResendVerificationCode } from './provider/hooks/mutations/useResendVerificationCode.js';
|
|
28
28
|
export { useExportPrivateKey, EXPORT_PRIVATE_KEY_KEY } from './provider/hooks/mutations/useExportPrivateKey.js';
|
|
29
|
+
export { useRequestFaucet, REQUEST_FAUCET_KEY } from './provider/hooks/mutations/useRequestFaucet.js';
|
|
29
30
|
export { useAuthenticateWithEmailOrPhone } from './provider/hooks/mutations/useAuthenticateWithEmailOrPhone.js';
|
|
30
31
|
export { useAuthenticateWithOAuth } from './provider/hooks/mutations/useAuthenticateWithOAuth.js';
|
|
31
32
|
export { useLoginExternalWallet } from './provider/hooks/mutations/useLoginExternalWallet.js';
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { useVerify2fa } from "./provider/hooks/mutations/useVerify2fa.js";
|
|
|
24
24
|
import { useIssueJwt } from "./provider/hooks/mutations/useIssueJwt.js";
|
|
25
25
|
import { useResendVerificationCode } from "./provider/hooks/mutations/useResendVerificationCode.js";
|
|
26
26
|
import { useExportPrivateKey, EXPORT_PRIVATE_KEY_KEY } from "./provider/hooks/mutations/useExportPrivateKey.js";
|
|
27
|
+
import { useRequestFaucet, REQUEST_FAUCET_KEY } from "./provider/hooks/mutations/useRequestFaucet.js";
|
|
27
28
|
import { useAuthenticateWithEmailOrPhone } from "./provider/hooks/mutations/useAuthenticateWithEmailOrPhone.js";
|
|
28
29
|
import { useAuthenticateWithOAuth } from "./provider/hooks/mutations/useAuthenticateWithOAuth.js";
|
|
29
30
|
import { useLoginExternalWallet } from "./provider/hooks/mutations/useLoginExternalWallet.js";
|
|
@@ -36,6 +37,7 @@ import { useWaitForSignup } from "./provider/hooks/mutations/useWaitForSignup.js
|
|
|
36
37
|
import { useWaitForWalletCreation } from "./provider/hooks/mutations/useWaitForWalletCreation.js";
|
|
37
38
|
export {
|
|
38
39
|
EXPORT_PRIVATE_KEY_KEY,
|
|
40
|
+
REQUEST_FAUCET_KEY,
|
|
39
41
|
useAccount,
|
|
40
42
|
useAuthenticateWithEmailOrPhone,
|
|
41
43
|
useAuthenticateWithOAuth,
|
|
@@ -56,6 +58,7 @@ export {
|
|
|
56
58
|
useLoginExternalWallet,
|
|
57
59
|
useLogout,
|
|
58
60
|
useParaStatus,
|
|
61
|
+
useRequestFaucet,
|
|
59
62
|
useResendVerificationCode,
|
|
60
63
|
useSetup2fa,
|
|
61
64
|
useSignMessage,
|
package/dist/mutations.d.ts
CHANGED
|
@@ -27,3 +27,4 @@ export { useWaitForLogin } from './provider/hooks/mutations/useWaitForLogin.js';
|
|
|
27
27
|
export { useWaitForSignup } from './provider/hooks/mutations/useWaitForSignup.js';
|
|
28
28
|
export { useWaitForWalletCreation } from './provider/hooks/mutations/useWaitForWalletCreation.js';
|
|
29
29
|
export { useExportPrivateKey } from './provider/hooks/mutations/useExportPrivateKey.js';
|
|
30
|
+
export { useRequestFaucet } from './provider/hooks/mutations/useRequestFaucet.js';
|
package/dist/mutations.js
CHANGED
|
@@ -27,6 +27,7 @@ import { useWaitForLogin } from "./provider/hooks/mutations/useWaitForLogin.js";
|
|
|
27
27
|
import { useWaitForSignup } from "./provider/hooks/mutations/useWaitForSignup.js";
|
|
28
28
|
import { useWaitForWalletCreation } from "./provider/hooks/mutations/useWaitForWalletCreation.js";
|
|
29
29
|
import { useExportPrivateKey } from "./provider/hooks/mutations/useExportPrivateKey.js";
|
|
30
|
+
import { useRequestFaucet } from "./provider/hooks/mutations/useRequestFaucet.js";
|
|
30
31
|
export {
|
|
31
32
|
useAuthenticateWithEmailOrPhone,
|
|
32
33
|
useAuthenticateWithOAuth,
|
|
@@ -43,6 +44,7 @@ export {
|
|
|
43
44
|
useKeepSessionAlive,
|
|
44
45
|
useLoginExternalWallet,
|
|
45
46
|
useLogout,
|
|
47
|
+
useRequestFaucet,
|
|
46
48
|
useResendVerificationCode,
|
|
47
49
|
useSetup2fa,
|
|
48
50
|
useSignMessage,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type ParaCore from '@getpara/core-sdk';
|
|
2
|
-
import type { SignUpOrLogInParams, SignUpOrLogInResponse, WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, VerifyOAuthProcessParams, OAuthResponse, VerifyFarcasterParams, VerifyTelegramParams, LoginExternalWalletParams, LoginExternalWalletResponse, VerifyExternalWalletParams, VerifyExternalWalletResponse, Setup2faResponse, Enable2faParams, Verify2faParams, Verify2faResponse, LogoutParams, ResendVerificationCodeParams, CreateWalletParams, CreateWalletResponse, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreatePregenWalletParams, CreatePregenWalletResponse, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateGuestWalletsResponse, SignMessageParams, SignTransactionParams, FullSignatureRes, GetWalletBalanceParams, IssueJwtParams, IssueJwtResponse, GetLinkedAccountsParams, GetLinkedAccountsResponse, AddCredentialParams, ExportPrivateKeyParams, ExportPrivateKeyResponse, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '@getpara/core-sdk';
|
|
2
|
+
import type { SignUpOrLogInParams, SignUpOrLogInResponse, WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, VerifyOAuthProcessParams, OAuthResponse, VerifyFarcasterParams, VerifyTelegramParams, LoginExternalWalletParams, LoginExternalWalletResponse, VerifyExternalWalletParams, VerifyExternalWalletResponse, Setup2faResponse, Enable2faParams, Verify2faParams, Verify2faResponse, LogoutParams, ResendVerificationCodeParams, CreateWalletParams, CreateWalletResponse, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreatePregenWalletParams, CreatePregenWalletResponse, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateGuestWalletsResponse, SignMessageParams, SignTransactionParams, FullSignatureRes, GetWalletBalanceParams, IssueJwtParams, IssueJwtResponse, GetLinkedAccountsParams, GetLinkedAccountsResponse, AddCredentialParams, ExportPrivateKeyParams, ExportPrivateKeyResponse, RequestFaucetParams, RequestFaucetResponse, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '@getpara/core-sdk';
|
|
3
3
|
export { generateCoreAction, type CoreAction } from './utils.js';
|
|
4
4
|
export { getEmbeddedAccount, type Account } from './getEmbeddedAccount.js';
|
|
5
5
|
export { getWallet } from './getWallet.js';
|
|
@@ -39,5 +39,6 @@ export declare const issueJwt: (para?: ParaCore, args?: IssueJwtParams) => Promi
|
|
|
39
39
|
export declare const getLinkedAccounts: (para?: ParaCore, args?: GetLinkedAccountsParams) => Promise<GetLinkedAccountsResponse>;
|
|
40
40
|
export declare const addCredential: (para?: ParaCore, args?: AddCredentialParams) => Promise<string>;
|
|
41
41
|
export declare const exportPrivateKey: (para?: ParaCore, args?: ExportPrivateKeyParams) => Promise<ExportPrivateKeyResponse>;
|
|
42
|
+
export declare const requestFaucet: (para?: ParaCore, args?: RequestFaucetParams) => Promise<RequestFaucetResponse>;
|
|
42
43
|
export declare const authenticateWithEmailOrPhone: (para?: ParaCore, args?: AuthenticateWithEmailOrPhoneParams) => Promise<AuthenticateWithEmailOrPhoneResponse>;
|
|
43
44
|
export declare const authenticateWithOAuth: (para?: ParaCore, args?: AuthenticateWithOAuthParams) => Promise<AuthenticateWithOAuthResponse>;
|
|
@@ -33,6 +33,7 @@ const issueJwt = generateCoreAction("issueJwt");
|
|
|
33
33
|
const getLinkedAccounts = generateCoreAction("getLinkedAccounts");
|
|
34
34
|
const addCredential = generateCoreAction("addCredential");
|
|
35
35
|
const exportPrivateKey = generateCoreAction("exportPrivateKey");
|
|
36
|
+
const requestFaucet = generateCoreAction("requestFaucet");
|
|
36
37
|
const authenticateWithEmailOrPhone = generateCoreAction("authenticateWithEmailOrPhone");
|
|
37
38
|
const authenticateWithOAuth = generateCoreAction("authenticateWithOAuth");
|
|
38
39
|
export {
|
|
@@ -57,6 +58,7 @@ export {
|
|
|
57
58
|
keepSessionAlive,
|
|
58
59
|
loginExternalWallet,
|
|
59
60
|
logout,
|
|
61
|
+
requestFaucet,
|
|
60
62
|
resendVerificationCode,
|
|
61
63
|
setup2fa,
|
|
62
64
|
signMessage,
|
|
@@ -18,6 +18,7 @@ export { useVerify2fa, VERIFY_2FA_KEY } from './useVerify2fa.js';
|
|
|
18
18
|
export { useIssueJwt, ISSUE_JWT_KEY } from './useIssueJwt.js';
|
|
19
19
|
export { useResendVerificationCode, RESEND_VERIFICATION_CODE_KEY } from './useResendVerificationCode.js';
|
|
20
20
|
export { useExportPrivateKey, EXPORT_PRIVATE_KEY_KEY } from './useExportPrivateKey.js';
|
|
21
|
+
export { useRequestFaucet, REQUEST_FAUCET_KEY } from './useRequestFaucet.js';
|
|
21
22
|
export { useAuthenticateWithEmailOrPhone, AUTHENTICATE_EMAIL_OR_PHONE_KEY } from './useAuthenticateWithEmailOrPhone.js';
|
|
22
23
|
export { useAuthenticateWithOAuth, AUTHENTICATE_OAUTH_KEY } from './useAuthenticateWithOAuth.js';
|
|
23
24
|
export { useLoginExternalWallet, LOGIN_EXTERNAL_WALLET_KEY } from './useLoginExternalWallet.js';
|
|
@@ -18,6 +18,7 @@ import { useVerify2fa, VERIFY_2FA_KEY } from "./useVerify2fa.js";
|
|
|
18
18
|
import { useIssueJwt, ISSUE_JWT_KEY } from "./useIssueJwt.js";
|
|
19
19
|
import { useResendVerificationCode, RESEND_VERIFICATION_CODE_KEY } from "./useResendVerificationCode.js";
|
|
20
20
|
import { useExportPrivateKey, EXPORT_PRIVATE_KEY_KEY } from "./useExportPrivateKey.js";
|
|
21
|
+
import { useRequestFaucet, REQUEST_FAUCET_KEY } from "./useRequestFaucet.js";
|
|
21
22
|
import { useAuthenticateWithEmailOrPhone, AUTHENTICATE_EMAIL_OR_PHONE_KEY } from "./useAuthenticateWithEmailOrPhone.js";
|
|
22
23
|
import { useAuthenticateWithOAuth, AUTHENTICATE_OAUTH_KEY } from "./useAuthenticateWithOAuth.js";
|
|
23
24
|
import { useLoginExternalWallet, LOGIN_EXTERNAL_WALLET_KEY } from "./useLoginExternalWallet.js";
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
KEEP_SESSION_ALIVE_KEY,
|
|
45
46
|
LOGIN_EXTERNAL_WALLET_KEY,
|
|
46
47
|
LOGOUT_KEY,
|
|
48
|
+
REQUEST_FAUCET_KEY,
|
|
47
49
|
RESEND_VERIFICATION_CODE_KEY,
|
|
48
50
|
SETUP_2FA_KEY,
|
|
49
51
|
SIGN_MESSAGE_KEY,
|
|
@@ -74,6 +76,7 @@ export {
|
|
|
74
76
|
useKeepSessionAlive,
|
|
75
77
|
useLoginExternalWallet,
|
|
76
78
|
useLogout,
|
|
79
|
+
useRequestFaucet,
|
|
77
80
|
useResendVerificationCode,
|
|
78
81
|
useSetup2fa,
|
|
79
82
|
useSignMessage,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { RequestFaucetParams, RequestFaucetResponse } from '@getpara/core-sdk';
|
|
2
|
+
export declare const REQUEST_FAUCET_KEY = "REQUEST_FAUCET";
|
|
3
|
+
/**
|
|
4
|
+
* Caller-facing args for `useRequestFaucet`. `walletId` is optional here because
|
|
5
|
+
* the hook resolves it from the active wallet when omitted. The underlying
|
|
6
|
+
* `requestFaucet` action requires `walletId` — the hook fills it in or throws.
|
|
7
|
+
*/
|
|
8
|
+
export type UseRequestFaucetArgs = Omit<RequestFaucetParams, 'walletId'> & {
|
|
9
|
+
walletId?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* React hook for the `requestFaucet` mutation.
|
|
13
|
+
*
|
|
14
|
+
* Requests testnet faucet funds for the active wallet. Automatically fills in
|
|
15
|
+
* the walletId from the active wallet if not provided. Throws if neither the
|
|
16
|
+
* caller nor the active wallet supplies a walletId.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const { requestFaucet, requestFaucetAsync } = useRequestFaucet();
|
|
20
|
+
* const { transactionHash } = await requestFaucetAsync({ chain: 'ETHEREUM_SEPOLIA' });
|
|
21
|
+
*/
|
|
22
|
+
export declare const useRequestFaucet: () => {
|
|
23
|
+
data: undefined;
|
|
24
|
+
variables: undefined;
|
|
25
|
+
error: null;
|
|
26
|
+
isError: false;
|
|
27
|
+
isIdle: true;
|
|
28
|
+
isPending: false;
|
|
29
|
+
isSuccess: false;
|
|
30
|
+
status: "idle";
|
|
31
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
32
|
+
reset: () => void;
|
|
33
|
+
context: unknown;
|
|
34
|
+
failureCount: number;
|
|
35
|
+
failureReason: Error;
|
|
36
|
+
isPaused: boolean;
|
|
37
|
+
submittedAt: number;
|
|
38
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
39
|
+
requestFaucet: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
40
|
+
requestFaucetAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
41
|
+
} | {
|
|
42
|
+
data: undefined;
|
|
43
|
+
variables: UseRequestFaucetArgs;
|
|
44
|
+
error: null;
|
|
45
|
+
isError: false;
|
|
46
|
+
isIdle: false;
|
|
47
|
+
isPending: true;
|
|
48
|
+
isSuccess: false;
|
|
49
|
+
status: "pending";
|
|
50
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
51
|
+
reset: () => void;
|
|
52
|
+
context: unknown;
|
|
53
|
+
failureCount: number;
|
|
54
|
+
failureReason: Error;
|
|
55
|
+
isPaused: boolean;
|
|
56
|
+
submittedAt: number;
|
|
57
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
58
|
+
requestFaucet: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
59
|
+
requestFaucetAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
60
|
+
} | {
|
|
61
|
+
data: undefined;
|
|
62
|
+
error: Error;
|
|
63
|
+
variables: UseRequestFaucetArgs;
|
|
64
|
+
isError: true;
|
|
65
|
+
isIdle: false;
|
|
66
|
+
isPending: false;
|
|
67
|
+
isSuccess: false;
|
|
68
|
+
status: "error";
|
|
69
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
70
|
+
reset: () => void;
|
|
71
|
+
context: unknown;
|
|
72
|
+
failureCount: number;
|
|
73
|
+
failureReason: Error;
|
|
74
|
+
isPaused: boolean;
|
|
75
|
+
submittedAt: number;
|
|
76
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
77
|
+
requestFaucet: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
78
|
+
requestFaucetAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
79
|
+
} | {
|
|
80
|
+
data: RequestFaucetResponse;
|
|
81
|
+
error: null;
|
|
82
|
+
variables: UseRequestFaucetArgs;
|
|
83
|
+
isError: false;
|
|
84
|
+
isIdle: false;
|
|
85
|
+
isPending: false;
|
|
86
|
+
isSuccess: true;
|
|
87
|
+
status: "success";
|
|
88
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
89
|
+
reset: () => void;
|
|
90
|
+
context: unknown;
|
|
91
|
+
failureCount: number;
|
|
92
|
+
failureReason: Error;
|
|
93
|
+
isPaused: boolean;
|
|
94
|
+
submittedAt: number;
|
|
95
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
96
|
+
requestFaucet: import("@tanstack/react-query").UseMutateFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
97
|
+
requestFaucetAsync: import("@tanstack/react-query").UseMutateAsyncFunction<RequestFaucetResponse, Error, UseRequestFaucetArgs, unknown>;
|
|
98
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
import { useMutation } from "@tanstack/react-query";
|
|
41
|
+
import { useClient } from "../utils/index.js";
|
|
42
|
+
import { renameMutations } from "../../utils/renameMutations.js";
|
|
43
|
+
import { requestFaucet } from "../../actions/index.js";
|
|
44
|
+
import { useWallet } from "../queries/index.js";
|
|
45
|
+
const REQUEST_FAUCET_KEY = "REQUEST_FAUCET";
|
|
46
|
+
const useRequestFaucet = () => {
|
|
47
|
+
const para = useClient();
|
|
48
|
+
const { data: activeWallet } = useWallet();
|
|
49
|
+
const mutation = useMutation({
|
|
50
|
+
mutationKey: [REQUEST_FAUCET_KEY],
|
|
51
|
+
mutationFn: (args) => __async(void 0, null, function* () {
|
|
52
|
+
var _a;
|
|
53
|
+
const walletId = (_a = args == null ? void 0 : args.walletId) != null ? _a : activeWallet == null ? void 0 : activeWallet.id;
|
|
54
|
+
if (!walletId) {
|
|
55
|
+
throw new Error("No wallet selected \u2014 pass walletId explicitly or set an active wallet.");
|
|
56
|
+
}
|
|
57
|
+
return yield requestFaucet(para, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
return renameMutations(
|
|
61
|
+
mutation,
|
|
62
|
+
"requestFaucet"
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
REQUEST_FAUCET_KEY,
|
|
67
|
+
useRequestFaucet
|
|
68
|
+
};
|
|
@@ -45,10 +45,14 @@ import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
|
|
|
45
45
|
const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
46
46
|
function useInvalidation(connections, queryKey) {
|
|
47
47
|
const queryClient = useQueryClient();
|
|
48
|
-
const lastConnectionStateRef = useRef(
|
|
48
|
+
const lastConnectionStateRef = useRef(null);
|
|
49
49
|
const invalidationTimeoutRef = useRef(null);
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
const key = Object.entries(connections).map(([k, v]) => `${k}:${v}`).join(",");
|
|
52
|
+
if (lastConnectionStateRef.current === null) {
|
|
53
|
+
lastConnectionStateRef.current = key;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
52
56
|
if (key === lastConnectionStateRef.current) return;
|
|
53
57
|
lastConnectionStateRef.current = key;
|
|
54
58
|
if (invalidationTimeoutRef.current) clearTimeout(invalidationTimeoutRef.current);
|
|
@@ -74,18 +78,12 @@ function createAccountHook(useExternalWallets) {
|
|
|
74
78
|
connections: {},
|
|
75
79
|
data: {}
|
|
76
80
|
};
|
|
77
|
-
const queryKey = [
|
|
78
|
-
ACCOUNT_BASE_KEY,
|
|
79
|
-
isFullyLoggedIn != null ? isFullyLoggedIn : null,
|
|
80
|
-
isFullyLoggedInLoading,
|
|
81
|
-
(_b = client == null ? void 0 : client.userId) != null ? _b : null,
|
|
82
|
-
...external.queryKeys
|
|
83
|
-
];
|
|
81
|
+
const queryKey = [ACCOUNT_BASE_KEY, isFullyLoggedIn != null ? isFullyLoggedIn : null, (_b = client == null ? void 0 : client.userId) != null ? _b : null, ...external.queryKeys];
|
|
84
82
|
const connectionsKey = JSON.stringify(external.connections);
|
|
85
83
|
const connections = useMemo(() => external.connections, [connectionsKey]);
|
|
86
84
|
useInvalidation(connections, queryKey);
|
|
87
85
|
const { data, isLoading } = useQuery({
|
|
88
|
-
enabled: isSuccess && !!client,
|
|
86
|
+
enabled: isSuccess && !!client && !isFullyLoggedInLoading,
|
|
89
87
|
queryKey,
|
|
90
88
|
queryFn: () => __async(this, null, function* () {
|
|
91
89
|
const paraAccount = yield getEmbeddedAccount(client, isFullyLoggedIn);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"description": "Platform-agnostic ParaProvider, hooks, and store for Para SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -82,17 +82,17 @@
|
|
|
82
82
|
"test": "vitest run"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@getpara/core-sdk": "2.
|
|
85
|
+
"@getpara/core-sdk": "2.25.0",
|
|
86
86
|
"zustand": "^5.0.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@cosmjs/amino": "^0.32.0",
|
|
90
90
|
"@cosmjs/proto-signing": "^0.32.0",
|
|
91
|
-
"@getpara/cosmjs-v0-integration": "2.
|
|
92
|
-
"@getpara/ethers-v6-integration": "2.
|
|
93
|
-
"@getpara/solana-signers-v2-integration": "2.
|
|
94
|
-
"@getpara/stellar-sdk-v14-integration": "2.
|
|
95
|
-
"@getpara/viem-v2-integration": "2.
|
|
91
|
+
"@getpara/cosmjs-v0-integration": "2.25.0",
|
|
92
|
+
"@getpara/ethers-v6-integration": "2.25.0",
|
|
93
|
+
"@getpara/solana-signers-v2-integration": "2.25.0",
|
|
94
|
+
"@getpara/stellar-sdk-v14-integration": "2.25.0",
|
|
95
|
+
"@getpara/viem-v2-integration": "2.25.0",
|
|
96
96
|
"@solana/signers": "^2.0.0",
|
|
97
97
|
"@tanstack/react-query": "^5.74.0",
|
|
98
98
|
"@testing-library/dom": "^10.4.0",
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
"optional": true
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "f84342134a0634491c88b9c5a2117121978db6bf"
|
|
138
138
|
}
|