@cofhe/react 0.2.1 → 0.3.1
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/README.md +2 -2
- package/dist/index.cjs +221 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.js +256 -138
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _cofhe_sdk from '@cofhe/sdk';
|
|
3
|
-
import {
|
|
3
|
+
import { CofheConfig, CofheInputConfig, FheTypeValue, CofheClient, CofheClientConnectionState, EncryptStep, EncryptStepCallbackContext, EncryptedItemInput, EncryptableItem, EncryptedItemInputs, FheTypes, UnsealedItem } from '@cofhe/sdk';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { QueryClient, UseQueryOptions, UseQueryResult, UseMutationOptions, UseMutationResult, MutationFunctionContext } from '@tanstack/react-query';
|
|
@@ -11,9 +11,9 @@ import BigNumber from 'bignumber.js';
|
|
|
11
11
|
import * as zustand_middleware from 'zustand/middleware';
|
|
12
12
|
import * as zustand from 'zustand';
|
|
13
13
|
import { Abi as Abi$1, CofheReturnType, CofheInputArgsPreTransform, CofheFirstReturnFheType } from '@cofhe/abi';
|
|
14
|
-
export {
|
|
14
|
+
export { createCofheClient } from '@cofhe/sdk/web';
|
|
15
15
|
|
|
16
|
-
declare const
|
|
16
|
+
declare const CofheReactConfigSchema: z.ZodObject<{
|
|
17
17
|
shareablePermits: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
18
|
enableShieldUnshield: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
19
19
|
autogeneratePermits: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -22,8 +22,8 @@ declare const CofhesdkReactConfigSchema: z.ZodObject<{
|
|
|
22
22
|
intervalSeconds: z.ZodNumber;
|
|
23
23
|
}, z.core.$strip>>>>;
|
|
24
24
|
defaultPermitExpirationSeconds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
25
|
-
pinnedTokens: z.
|
|
26
|
-
tokenLists: z.
|
|
25
|
+
pinnedTokens: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
26
|
+
tokenLists: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>, z.ZodTransform<Partial<Record<number, string[]>>, Record<string, string[]>>>>;
|
|
27
27
|
position: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
28
28
|
"bottom-right": "bottom-right";
|
|
29
29
|
"bottom-left": "bottom-left";
|
|
@@ -38,18 +38,18 @@ declare const CofhesdkReactConfigSchema: z.ZodObject<{
|
|
|
38
38
|
/**
|
|
39
39
|
* Input config type inferred from the schema
|
|
40
40
|
*/
|
|
41
|
-
type
|
|
42
|
-
react?: z.input<typeof
|
|
41
|
+
type CofheReactInputConfig = CofheInputConfig & {
|
|
42
|
+
react?: z.input<typeof CofheReactConfigSchema>;
|
|
43
43
|
};
|
|
44
|
-
type
|
|
45
|
-
react: z.output<typeof
|
|
44
|
+
type CofheConfigWithReact = CofheConfig & {
|
|
45
|
+
react: z.output<typeof CofheReactConfigSchema>;
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
|
-
* Creates a CoFHE
|
|
49
|
-
* @param config -
|
|
48
|
+
* Creates a CoFHE client plus React configuration with reasonable defaults.
|
|
49
|
+
* @param config - Cofhe client input merged with a `react` object (fheKeyStorage defaults to IndexedDB when omitted).
|
|
50
50
|
* @returns The combined client configuration with a validated `react` section and Web defaults applied.
|
|
51
51
|
*/
|
|
52
|
-
declare function
|
|
52
|
+
declare function createCofheConfig(config: CofheReactInputConfig): CofheConfigWithReact;
|
|
53
53
|
|
|
54
54
|
interface BaseProps {
|
|
55
55
|
/** Additional CSS class names */
|
|
@@ -119,7 +119,7 @@ interface FnxFloatingButtonProps extends BaseProps {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
interface CofheContextValue {
|
|
122
|
-
client:
|
|
122
|
+
client: CofheClient<CofheConfigWithReact>;
|
|
123
123
|
state: {
|
|
124
124
|
position: FloatingButtonPosition;
|
|
125
125
|
setPosition: (position: FloatingButtonPosition) => void;
|
|
@@ -130,8 +130,8 @@ interface CofheContextValue {
|
|
|
130
130
|
type CofheProviderProps = {
|
|
131
131
|
children: React.ReactNode;
|
|
132
132
|
queryClient?: QueryClient;
|
|
133
|
-
|
|
134
|
-
config?:
|
|
133
|
+
cofheClient?: CofheClient<CofheConfigWithReact>;
|
|
134
|
+
config?: CofheConfigWithReact;
|
|
135
135
|
walletClient?: WalletClient;
|
|
136
136
|
publicClient?: PublicClient;
|
|
137
137
|
};
|
|
@@ -145,7 +145,7 @@ declare function useCofheContext(): CofheContextValue;
|
|
|
145
145
|
|
|
146
146
|
declare const useInternalQueryClient: () => QueryClient;
|
|
147
147
|
|
|
148
|
-
declare const useCofheConnection: () =>
|
|
148
|
+
declare const useCofheConnection: () => CofheClientConnectionState;
|
|
149
149
|
declare const useCofhePublicClient: () => {
|
|
150
150
|
account: undefined;
|
|
151
151
|
batch?: viem.ClientConfig["batch"] | undefined;
|
|
@@ -14494,9 +14494,9 @@ declare const useCofheWalletClient: () => {
|
|
|
14494
14494
|
[x: `bytes1[${string}]`]: undefined;
|
|
14495
14495
|
[x: `bytes4[${string}]`]: undefined;
|
|
14496
14496
|
[x: `bytes2[${string}]`]: undefined;
|
|
14497
|
+
[x: `bytes5[${string}]`]: undefined;
|
|
14497
14498
|
[x: `bytes7[${string}]`]: undefined;
|
|
14498
14499
|
[x: `bytes3[${string}]`]: undefined;
|
|
14499
|
-
[x: `bytes5[${string}]`]: undefined;
|
|
14500
14500
|
[x: `bytes6[${string}]`]: undefined;
|
|
14501
14501
|
[x: `bytes8[${string}]`]: undefined;
|
|
14502
14502
|
[x: `bytes9[${string}]`]: undefined;
|
|
@@ -14595,9 +14595,9 @@ declare const useCofheWalletClient: () => {
|
|
|
14595
14595
|
bytes1?: undefined;
|
|
14596
14596
|
bytes4?: undefined;
|
|
14597
14597
|
bytes2?: undefined;
|
|
14598
|
+
bytes5?: undefined;
|
|
14598
14599
|
bytes7?: undefined;
|
|
14599
14600
|
bytes3?: undefined;
|
|
14600
|
-
bytes5?: undefined;
|
|
14601
14601
|
bytes6?: undefined;
|
|
14602
14602
|
bytes8?: undefined;
|
|
14603
14603
|
bytes9?: undefined;
|
|
@@ -14721,7 +14721,7 @@ type Callbacks = {
|
|
|
14721
14721
|
declare const useCofheRemovePermit: ({ onSuccess, onError }?: Callbacks) => (hashToRemove: string) => Promise<void>;
|
|
14722
14722
|
declare const useCofheSelectPermit: ({ onSuccess, onError }?: Callbacks) => (hashToSet: string) => void;
|
|
14723
14723
|
|
|
14724
|
-
declare const useCofheClient: () =>
|
|
14724
|
+
declare const useCofheClient: () => CofheClient<CofheConfigWithReact>;
|
|
14725
14725
|
|
|
14726
14726
|
/**
|
|
14727
14727
|
* Token types shared across hooks/components/utils.
|
|
@@ -14733,7 +14733,7 @@ declare const useCofheClient: () => CofhesdkClient<CofhesdkConfigWithReact>;
|
|
|
14733
14733
|
/**
|
|
14734
14734
|
* Special address representing native ETH (used in erc20Pair for ConfidentialETH tokens)
|
|
14735
14735
|
*/
|
|
14736
|
-
declare const
|
|
14736
|
+
declare const ETH_ADDRESS_LOWERCASE: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
14737
14737
|
/**
|
|
14738
14738
|
* ERC20 pair information for wrapped confidential tokens
|
|
14739
14739
|
*/
|
|
@@ -15544,4 +15544,4 @@ type Input = {
|
|
|
15544
15544
|
};
|
|
15545
15545
|
declare const useCofheNavigateToCreatePermit: () => ({ cause }?: Input) => void;
|
|
15546
15546
|
|
|
15547
|
-
export { type ClaimableAmountByTokenAddress, type CofheClientConfig, type CofheContextValue, CofheProvider, type CofheProviderProps, type CofhesdkConfigWithReact, type CoingeckoMarketChartPoint,
|
|
15547
|
+
export { type ClaimableAmountByTokenAddress, type CofheClientConfig, type CofheContextValue, CofheProvider, type CofheProviderProps, type CofheConfigWithReact as CofhesdkConfigWithReact, type CoingeckoMarketChartPoint, ETH_ADDRESS_LOWERCASE, type Erc20Pair, FheTypesList, type FloatingButtonPosition, FnxEncryptInput, type FnxFloatingButtonProps, FnxFloatingButtonWithProvider, MainPage, SettingsPage, type Token, type Transaction, type TransactionActionString, TransactionActionType, TransactionStatus, type TransactionStatusString, type TransactionStore, type UnshieldClaim, type UnshieldClaimsSummary, type UnshieldClaimsSummaryByTokenAddress, type UseCoingeckoContractMarketChartRangeInput, type UseCoingeckoContractMarketChartRangeOptions, type UseCoingeckoUsdPriceInput, type UseCoingeckoUsdPriceOptions, type UseTransactionReceiptsByHashInput, actionToString, createCofheConfig, encryptedValueToString, fheTypeToString, formatRelativeTime, getBlockExplorerAddressUrl, getBlockExplorerTokenUrl, getBlockExplorerTxUrl, getBlockExplorerUrl, isEthPair, isWrappedEthToken, statusToString, truncateHash, useCofheActivePermit, useCofheAllPermits, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheNavigateToCreatePermit, useCofhePublicClient, useCofheReadContractAndDecrypt, useCofheRemovePermit, useCofheSelectPermit, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenShield, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheTokensWithExistingEncryptedBalances, useCofheWalletClient, useCofheWriteContract, useCoingeckoContractMarketChartRange, useCoingeckoUsdPrice, useInternalQueryClient, useTokensWithPublicBalances, useTransactionReceiptsByHash, useTransactionStore };
|