@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,47 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useCoreStore } from "../../stores/CoreStoreContext.js";
|
|
3
|
+
import { useClient } from "./useClient.js";
|
|
4
|
+
const useCoreWalletState = () => {
|
|
5
|
+
const client = useClient();
|
|
6
|
+
const selectedWalletId = useCoreStore((state) => state.selectedWalletId);
|
|
7
|
+
const selectedWalletType = useCoreStore((state) => state.selectedWalletType);
|
|
8
|
+
const setStoredSelectedWallet = useCoreStore((state) => state.setSelectedWallet);
|
|
9
|
+
const clearSelectedWallet = useCoreStore((state) => state.clearSelectedWallet);
|
|
10
|
+
const setSelectedWallet = useCallback(
|
|
11
|
+
({ id, type }) => {
|
|
12
|
+
try {
|
|
13
|
+
const validId = client == null ? void 0 : client.findWalletId(id, type ? { type: [type] } : void 0);
|
|
14
|
+
if (validId !== id) {
|
|
15
|
+
clearSelectedWallet();
|
|
16
|
+
} else {
|
|
17
|
+
setStoredSelectedWallet(id, type);
|
|
18
|
+
}
|
|
19
|
+
} catch (e) {
|
|
20
|
+
clearSelectedWallet();
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
[client, clearSelectedWallet, setStoredSelectedWallet]
|
|
24
|
+
);
|
|
25
|
+
const updateSelectedWallet = useCallback(() => {
|
|
26
|
+
if (!client) {
|
|
27
|
+
clearSelectedWallet();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!selectedWalletId || !client.findWallet(selectedWalletId)) {
|
|
31
|
+
const defaultWallet = client.findWallet(void 0, void 0, { forbidPregen: true });
|
|
32
|
+
setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
|
|
33
|
+
}
|
|
34
|
+
}, [clearSelectedWallet, setSelectedWallet, client, selectedWalletId]);
|
|
35
|
+
return {
|
|
36
|
+
selectedWallet: {
|
|
37
|
+
id: selectedWalletId,
|
|
38
|
+
type: selectedWalletType,
|
|
39
|
+
address: selectedWalletId ? client == null ? void 0 : client.getDisplayAddress(selectedWalletId, { addressType: selectedWalletType }) : void 0
|
|
40
|
+
},
|
|
41
|
+
setSelectedWallet,
|
|
42
|
+
updateSelectedWallet
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
useCoreWalletState
|
|
47
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ParaProviderCore, type ParaProviderCoreProps, type ParaClientConfig, type ParaClientConfigWithFactory, type CoreProviderConfig, type CoreCallbacks, type ParaCallbackEvent, } from './ParaProviderCore.js';
|
|
2
|
+
export * from './stores/index.js';
|
|
3
|
+
export * from './hooks/index.js';
|
|
4
|
+
export * from './actions/index.js';
|
|
5
|
+
export { renameMutations, type Compute } from './utils/renameMutations.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ParaProviderCore
|
|
3
|
+
} from "./ParaProviderCore.js";
|
|
4
|
+
export * from "./stores/index.js";
|
|
5
|
+
export * from "./hooks/index.js";
|
|
6
|
+
export * from "./actions/index.js";
|
|
7
|
+
import { renameMutations } from "./utils/renameMutations.js";
|
|
8
|
+
export {
|
|
9
|
+
ParaProviderCore,
|
|
10
|
+
renameMutations
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type StoreApi } from 'zustand';
|
|
2
|
+
import type { CoreStore } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* React context that provides the store instance. Platform SDKs (web, RN) provide
|
|
5
|
+
* either a plain CoreStore or an extended store that includes platform-specific slices.
|
|
6
|
+
* Core hooks read from this context via `useCoreStore()`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CoreStoreContext: import("react").Context<StoreApi<CoreStore>>;
|
|
9
|
+
/**
|
|
10
|
+
* Hook to select state from the core store provided via context.
|
|
11
|
+
* Works with both plain CoreStore and extended stores (e.g. web store with modal slices).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useCoreStore<T>(selector: (state: CoreStore) => T): T;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { useStore as useZustandStore } from "zustand";
|
|
3
|
+
const CoreStoreContext = createContext(null);
|
|
4
|
+
function useCoreStore(selector) {
|
|
5
|
+
const store = useContext(CoreStoreContext);
|
|
6
|
+
if (!store) {
|
|
7
|
+
throw new Error("useCoreStore must be used within a ParaProviderCore (or a platform provider that wraps it).");
|
|
8
|
+
}
|
|
9
|
+
return useZustandStore(store, selector);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
CoreStoreContext,
|
|
13
|
+
useCoreStore
|
|
14
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CoreStore } from './types.js';
|
|
2
|
+
export type CorePersistedState = Pick<CoreStore, 'selectedWalletId' | 'selectedWalletType'>;
|
|
3
|
+
/**
|
|
4
|
+
* Platform-agnostic storage adapter interface.
|
|
5
|
+
* Web: pass `localStorage`. React Native: pass `AsyncStorage`.
|
|
6
|
+
*/
|
|
7
|
+
export interface ParaStorageAdapter {
|
|
8
|
+
getItem: (key: string) => string | null | Promise<string | null>;
|
|
9
|
+
setItem: (key: string, value: string) => void | Promise<void>;
|
|
10
|
+
removeItem: (key: string) => void | Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare function createCoreStore(options?: {
|
|
13
|
+
storage?: ParaStorageAdapter;
|
|
14
|
+
}): Omit<import("zustand").StoreApi<CoreStore>, "setState" | "persist"> & {
|
|
15
|
+
setState(partial: CoreStore | Partial<CoreStore> | ((state: CoreStore) => CoreStore | Partial<CoreStore>), replace?: false): unknown;
|
|
16
|
+
setState(state: CoreStore | ((state: CoreStore) => CoreStore), replace: true): unknown;
|
|
17
|
+
persist: {
|
|
18
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<CoreStore, CorePersistedState, unknown>>) => void;
|
|
19
|
+
clearStorage: () => void;
|
|
20
|
+
rehydrate: () => Promise<void> | void;
|
|
21
|
+
hasHydrated: () => boolean;
|
|
22
|
+
onHydrate: (fn: (state: CoreStore) => void) => () => void;
|
|
23
|
+
onFinishHydration: (fn: (state: CoreStore) => void) => () => void;
|
|
24
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<CoreStore, CorePersistedState, unknown>>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { createStore } from "zustand";
|
|
18
|
+
import { createJSONStorage, persist } from "zustand/middleware";
|
|
19
|
+
import { PARA_STORAGE_PREFIX } from "@getpara/core-sdk";
|
|
20
|
+
import {
|
|
21
|
+
createCoreClientSlice,
|
|
22
|
+
createCoreWalletSlice,
|
|
23
|
+
createCoreConfigSlice,
|
|
24
|
+
createCoreParaStateSlice
|
|
25
|
+
} from "./slices/index.js";
|
|
26
|
+
const memoryStorage = /* @__PURE__ */ (() => {
|
|
27
|
+
const store = /* @__PURE__ */ new Map();
|
|
28
|
+
return {
|
|
29
|
+
getItem: (key) => {
|
|
30
|
+
var _a;
|
|
31
|
+
return (_a = store.get(key)) != null ? _a : null;
|
|
32
|
+
},
|
|
33
|
+
setItem: (key, value) => {
|
|
34
|
+
store.set(key, value);
|
|
35
|
+
},
|
|
36
|
+
removeItem: (key) => {
|
|
37
|
+
store.delete(key);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
function createCoreStore(options) {
|
|
42
|
+
var _a;
|
|
43
|
+
const storage = (_a = options == null ? void 0 : options.storage) != null ? _a : memoryStorage;
|
|
44
|
+
return createStore()(
|
|
45
|
+
persist(
|
|
46
|
+
(...a) => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, createCoreClientSlice(...a)), createCoreWalletSlice(...a)), createCoreConfigSlice(...a)), createCoreParaStateSlice(...a)),
|
|
47
|
+
{
|
|
48
|
+
version: 1,
|
|
49
|
+
name: `${PARA_STORAGE_PREFIX}core-state`,
|
|
50
|
+
storage: createJSONStorage(() => storage),
|
|
51
|
+
partialize: (state) => ({
|
|
52
|
+
selectedWalletId: state.selectedWalletId,
|
|
53
|
+
selectedWalletType: state.selectedWalletType
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
createCoreStore
|
|
61
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./slices/index.js";
|
|
3
|
+
import { createCoreStore } from "./createCoreStore.js";
|
|
4
|
+
import { CoreStoreContext, useCoreStore } from "./CoreStoreContext.js";
|
|
5
|
+
export {
|
|
6
|
+
CoreStoreContext,
|
|
7
|
+
createCoreStore,
|
|
8
|
+
useCoreStore
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const createCoreConfigSlice = (set) => ({
|
|
2
|
+
appName: "",
|
|
3
|
+
setAppName: (appName) => set({ appName }),
|
|
4
|
+
farcasterMiniAppConfig: void 0,
|
|
5
|
+
setFarcasterMiniAppConfig: (farcasterMiniAppConfig) => set({ farcasterMiniAppConfig })
|
|
6
|
+
});
|
|
7
|
+
export {
|
|
8
|
+
createCoreConfigSlice
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createCoreClientSlice } from "./client.js";
|
|
2
|
+
import { createCoreWalletSlice } from "./wallet.js";
|
|
3
|
+
import { createCoreConfigSlice } from "./config.js";
|
|
4
|
+
import { createCoreParaStateSlice } from "./paraState.js";
|
|
5
|
+
export {
|
|
6
|
+
createCoreClientSlice,
|
|
7
|
+
createCoreConfigSlice,
|
|
8
|
+
createCoreParaStateSlice,
|
|
9
|
+
createCoreWalletSlice
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const createCoreWalletSlice = (set) => ({
|
|
2
|
+
rpcUrl: void 0,
|
|
3
|
+
setRpcUrl: (rpcUrl) => set({ rpcUrl }),
|
|
4
|
+
selectedWalletId: void 0,
|
|
5
|
+
selectedWalletType: void 0,
|
|
6
|
+
setSelectedWallet: (selectedWalletId, selectedWalletType) => set({ selectedWalletId, selectedWalletType }),
|
|
7
|
+
clearSelectedWallet: () => set({ selectedWalletId: void 0, selectedWalletType: void 0 })
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
createCoreWalletSlice
|
|
11
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type ParaCore from '@getpara/core-sdk';
|
|
2
|
+
import type { StateSnapshot, TWalletType } from '@getpara/core-sdk';
|
|
3
|
+
export interface FarcasterMiniAppConfig {
|
|
4
|
+
disableAutoConnect?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface CoreClientSlice {
|
|
7
|
+
client?: ParaCore;
|
|
8
|
+
setClient: (_: ParaCore) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface CoreWalletSlice {
|
|
11
|
+
rpcUrl?: string;
|
|
12
|
+
setRpcUrl: (_?: string) => void;
|
|
13
|
+
selectedWalletId?: string;
|
|
14
|
+
selectedWalletType?: TWalletType;
|
|
15
|
+
setSelectedWallet: (_?: string, __?: TWalletType) => void;
|
|
16
|
+
clearSelectedWallet: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface CoreConfigSlice {
|
|
19
|
+
appName: string;
|
|
20
|
+
setAppName: (_: string) => void;
|
|
21
|
+
farcasterMiniAppConfig?: FarcasterMiniAppConfig;
|
|
22
|
+
setFarcasterMiniAppConfig: (_?: FarcasterMiniAppConfig) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface CoreParaStateSlice {
|
|
25
|
+
paraState?: StateSnapshot;
|
|
26
|
+
setParaState: (_: StateSnapshot) => void;
|
|
27
|
+
}
|
|
28
|
+
export type CoreStore = CoreClientSlice & CoreWalletSlice & CoreConfigSlice & CoreParaStateSlice;
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DefaultError, UseMutateAsyncFunction, UseMutateFunction, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
+
export type Compute<type> = {
|
|
3
|
+
[key in keyof type]: type[key];
|
|
4
|
+
} & unknown;
|
|
5
|
+
type RenamedMutationResult<TData, TError, TVariables, TContext, TName extends string> = Omit<UseMutationResult<TData, TError, TVariables, TContext>, 'mutate' | 'mutateAsync'> & {
|
|
6
|
+
[K in TName]: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
7
|
+
} & {
|
|
8
|
+
[K in `${TName}Async`]: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
9
|
+
};
|
|
10
|
+
export declare function renameMutations<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown, TName extends string = string>(mutationObj: UseMutationResult<TData, TError, TVariables, TContext>, name: TName): Compute<RenamedMutationResult<TData, TError, TVariables, TContext, TName>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
function renameMutations(mutationObj, name) {
|
|
30
|
+
const newMutations = {
|
|
31
|
+
[name]: mutationObj.mutate,
|
|
32
|
+
[`${name}Async`]: mutationObj.mutateAsync
|
|
33
|
+
};
|
|
34
|
+
const _a = mutationObj, { mutate: _, mutateAsync: __ } = _a, rest = __objRest(_a, ["mutate", "mutateAsync"]);
|
|
35
|
+
return __spreadValues(__spreadValues({}, newMutations), rest);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
renameMutations
|
|
39
|
+
};
|
package/dist/queries.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getpara/react-core",
|
|
3
|
+
"version": "2.19.0",
|
|
4
|
+
"description": "Platform-agnostic ParaProvider, hooks, and store for Para SDK",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./internal": {
|
|
16
|
+
"types": "./dist/provider/index.d.ts",
|
|
17
|
+
"import": "./dist/provider/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./mutations": {
|
|
20
|
+
"types": "./dist/mutations.d.ts",
|
|
21
|
+
"import": "./dist/mutations.js"
|
|
22
|
+
},
|
|
23
|
+
"./queries": {
|
|
24
|
+
"types": "./dist/queries.d.ts",
|
|
25
|
+
"import": "./dist/queries.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"typesVersions": {
|
|
29
|
+
"*": {
|
|
30
|
+
"internal": [
|
|
31
|
+
"./dist/provider/index.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"mutations": [
|
|
34
|
+
"./dist/mutations.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"queries": [
|
|
37
|
+
"./dist/queries.d.ts"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"package.json"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "rm -rf dist && node ./scripts/build.mjs; tsc --emitDeclarationOnly || true",
|
|
47
|
+
"test": "vitest run"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@getpara/core-sdk": "2.19.0",
|
|
51
|
+
"zustand": "^5.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@tanstack/react-query": "^5.74.0",
|
|
55
|
+
"@testing-library/dom": "^10.4.0",
|
|
56
|
+
"@testing-library/react": "^16.3.0",
|
|
57
|
+
"@types/react": "^18.3.3",
|
|
58
|
+
"esbuild": "^0.25.0",
|
|
59
|
+
"glob": "^11.0.2",
|
|
60
|
+
"jsdom": "^25.0.0",
|
|
61
|
+
"react": "^18.3.1",
|
|
62
|
+
"react-dom": "^18.3.1",
|
|
63
|
+
"typescript": "^5.8.3",
|
|
64
|
+
"viem": "2.42.1",
|
|
65
|
+
"vitest": "^3.0.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"@tanstack/react-query": ">=5",
|
|
69
|
+
"react": ">=18",
|
|
70
|
+
"viem": ">=2"
|
|
71
|
+
},
|
|
72
|
+
"gitHead": "7dc9400777adb653c0cc28e0d9236424eb384467"
|
|
73
|
+
}
|