@cofhe/react 0.4.0 → 0.5.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/dist/index.d.ts CHANGED
@@ -5,18 +5,40 @@ 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';
7
7
  import * as viem from 'viem';
8
- import { WalletClient, PublicClient, Address, Hash, Abi, ContractFunctionName, ContractFunctionArgs, Chain, WriteContractParameters, Account, TransactionReceipt } from 'viem';
8
+ import { WalletClient, PublicClient, Address, ContractFunctionName, Hash, Abi as Abi$1, ContractFunctionArgs, Chain, WriteContractParameters, Account, SimulateContractReturnType, SimulateContractParameters, TransactionReceipt } from 'viem';
9
+ import { Abi, CofheReturnType, CofheInputArgsPreTransform, CofheFirstReturnFheType } from '@cofhe/abi';
9
10
  import { Permit } from '@cofhe/sdk/permits';
10
11
  import BigNumber from 'bignumber.js';
11
12
  import * as zustand_middleware from 'zustand/middleware';
12
13
  import * as zustand from 'zustand';
13
- import { Abi as Abi$1, CofheReturnType, CofheInputArgsPreTransform, CofheFirstReturnFheType } from '@cofhe/abi';
14
14
  export { createCofheClient } from '@cofhe/sdk/web';
15
15
 
16
+ type CofheReactLoggerMethod = ((...args: unknown[]) => void) | null;
17
+ /**
18
+ * Logger used by @cofhe/react internal debug logs.
19
+ *
20
+ * - Omitted/undefined: disables internal logging
21
+ * - Object: enables logging and calls only the provided methods
22
+ * - Method set to null: disables that method
23
+ */
24
+ type CofheReactLogger = {
25
+ log?: CofheReactLoggerMethod;
26
+ warn?: CofheReactLoggerMethod;
27
+ debug?: CofheReactLoggerMethod;
28
+ error?: CofheReactLoggerMethod;
29
+ };
30
+ type CofheReactLoggerResolved = {
31
+ log: (...args: unknown[]) => void;
32
+ warn: (...args: unknown[]) => void;
33
+ debug: (...args: unknown[]) => void;
34
+ error: (...args: unknown[]) => void;
35
+ };
16
36
  declare const CofheReactConfigSchema: z.ZodObject<{
17
37
  shareablePermits: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
18
38
  enableShieldUnshield: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
19
39
  autogeneratePermits: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
40
+ projectName: z.ZodDefault<z.ZodOptional<z.ZodString>>;
41
+ logger: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodCustom<CofheReactLogger | null, CofheReactLogger | null>>>, z.ZodTransform<CofheReactLoggerResolved, CofheReactLogger | null>>;
20
42
  permitExpirationOptions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
21
43
  label: z.ZodString;
22
44
  intervalSeconds: z.ZodNumber;
@@ -105,7 +127,7 @@ type PageState<K extends keyof FloatingButtonPagePropsMap = FloatingButtonPage$1
105
127
 
106
128
  type FloatingButtonPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
107
129
  type FloatingButtonPositionType = 'fixed' | 'absolute';
108
- interface FnxFloatingButtonProps extends BaseProps {
130
+ interface CofheFloatingButtonProps extends BaseProps {
109
131
  children?: React.ReactNode;
110
132
  /** Position of the floating button */
111
133
  position?: FloatingButtonPosition;
@@ -177,6 +199,7 @@ declare const useCofhePublicClient: () => {
177
199
  number: blockTag extends "pending" ? null : bigint;
178
200
  nonce: blockTag extends "pending" ? null : `0x${string}`;
179
201
  hash: blockTag extends "pending" ? null : `0x${string}`;
202
+ size: bigint;
180
203
  timestamp: bigint;
181
204
  logsBloom: blockTag extends "pending" ? null : `0x${string}`;
182
205
  baseFeePerGas: bigint | null;
@@ -193,7 +216,6 @@ declare const useCofhePublicClient: () => {
193
216
  receiptsRoot: viem.Hex;
194
217
  sealFields: viem.Hex[];
195
218
  sha3Uncles: viem.Hash;
196
- size: bigint;
197
219
  stateRoot: viem.Hash;
198
220
  totalDifficulty: bigint | null;
199
221
  transactionsRoot: viem.Hash;
@@ -13566,6 +13588,7 @@ declare const useCofheWalletClient: () => {
13566
13588
  id: string;
13567
13589
  }>;
13568
13590
  sendCallsSync: <const calls extends readonly unknown[], chainOverride extends viem.Chain | undefined = undefined>(parameters: viem.SendCallsSyncParameters<viem.Chain | undefined, viem.Account | undefined, chainOverride, calls>) => Promise<{
13591
+ version: string;
13569
13592
  atomic: boolean;
13570
13593
  capabilities?: {
13571
13594
  [key: string]: any;
@@ -13575,7 +13598,6 @@ declare const useCofheWalletClient: () => {
13575
13598
  chainId: number;
13576
13599
  id: string;
13577
13600
  receipts?: viem.WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
13578
- version: string;
13579
13601
  statusCode: number;
13580
13602
  status: "pending" | "success" | "failure" | undefined;
13581
13603
  }>;
@@ -14709,20 +14731,6 @@ declare const useCofheWalletClient: () => {
14709
14731
  } & viem.ExactPartial<Pick<viem.PublicActions<viem.Transport, viem.Chain | undefined, viem.Account | undefined>, "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<viem.WalletActions<viem.Chain | undefined, viem.Account | undefined>, "sendTransaction" | "writeContract">>>(fn: (client: viem.Client<viem.Transport, viem.Chain | undefined, viem.Account | undefined, viem.WalletRpcSchema, viem.WalletActions<viem.Chain | undefined, viem.Account | undefined>>) => client) => viem.Client<viem.Transport, viem.Chain | undefined, viem.Account | undefined, viem.WalletRpcSchema, { [K in keyof client]: client[K]; } & viem.WalletActions<viem.Chain | undefined, viem.Account | undefined>>;
14710
14732
  } | undefined;
14711
14733
 
14712
- declare const useCofheActivePermit: () => {
14713
- permit: Permit;
14714
- isValid: boolean;
14715
- } | undefined;
14716
- declare const useCofheAllPermits: () => Permit[];
14717
- type Callbacks = {
14718
- onSuccess?: () => void;
14719
- onError?: (error: Error) => void;
14720
- };
14721
- declare const useCofheRemovePermit: ({ onSuccess, onError }?: Callbacks) => (hashToRemove: string) => Promise<void>;
14722
- declare const useCofheSelectPermit: ({ onSuccess, onError }?: Callbacks) => (hashToSet: string) => void;
14723
-
14724
- declare const useCofheClient: () => CofheClient<CofheConfigWithReact>;
14725
-
14726
14734
  /**
14727
14735
  * Token types shared across hooks/components/utils.
14728
14736
  *
@@ -14744,6 +14752,54 @@ type Erc20Pair = {
14744
14752
  decimals: number;
14745
14753
  logoURI?: string;
14746
14754
  };
14755
+ declare const TOKEN_CONFIDENTIALITY_SUPPORT: {
14756
+ readonly wrapped: {
14757
+ readonly enabled: true;
14758
+ readonly label: "Wrapped confidential token";
14759
+ readonly confidentialValueType: "uint128";
14760
+ readonly publicBalanceSource: "erc20Pair";
14761
+ readonly operations: {
14762
+ readonly confidentialBalance: true;
14763
+ readonly transfer: true;
14764
+ readonly publicBalance: true;
14765
+ readonly shield: true;
14766
+ readonly unshield: true;
14767
+ readonly claim: true;
14768
+ readonly claimable: true;
14769
+ };
14770
+ };
14771
+ readonly pure: {
14772
+ readonly enabled: false;
14773
+ readonly label: "Pure confidential token";
14774
+ readonly confidentialValueType: "uint64";
14775
+ readonly publicBalanceSource: null;
14776
+ readonly operations: {
14777
+ readonly confidentialBalance: false;
14778
+ readonly transfer: false;
14779
+ readonly publicBalance: false;
14780
+ readonly shield: false;
14781
+ readonly unshield: false;
14782
+ readonly claim: false;
14783
+ readonly claimable: false;
14784
+ };
14785
+ };
14786
+ readonly dual: {
14787
+ readonly enabled: false;
14788
+ readonly label: "Dual-balance confidential token";
14789
+ readonly confidentialValueType: "uint64";
14790
+ readonly publicBalanceSource: "token";
14791
+ readonly operations: {
14792
+ readonly confidentialBalance: false;
14793
+ readonly transfer: false;
14794
+ readonly publicBalance: false;
14795
+ readonly shield: false;
14796
+ readonly unshield: false;
14797
+ readonly claim: false;
14798
+ readonly claimable: false;
14799
+ };
14800
+ };
14801
+ };
14802
+ type TokenConfidentialityType = keyof typeof TOKEN_CONFIDENTIALITY_SUPPORT;
14747
14803
  type Token = {
14748
14804
  chainId: number;
14749
14805
  address: `0x${string}`;
@@ -14753,7 +14809,7 @@ type Token = {
14753
14809
  logoURI?: string;
14754
14810
  extensions: Record<string, unknown> & {
14755
14811
  fhenix: {
14756
- confidentialityType: 'wrapped' | 'pure' | 'dual';
14812
+ confidentialityType: TokenConfidentialityType;
14757
14813
  confidentialValueType: 'uint64' | 'uint128';
14758
14814
  /** ERC20 pair for wrapped tokens - contains underlying token info */
14759
14815
  erc20Pair?: Erc20Pair;
@@ -14761,6 +14817,49 @@ type Token = {
14761
14817
  };
14762
14818
  };
14763
14819
 
14820
+ type UseCofheReadContractQueryOptions<TAbi extends Abi, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = Omit<UseQueryOptions<CofheReturnType<TAbi, TfunctionName>, Error>, 'queryKey' | 'queryFn'> & {
14821
+ enabled?: boolean;
14822
+ };
14823
+ /**
14824
+ * Generic hook: read a contract and return the result (with permit/error gating support).
14825
+ * is Cofhe-ABI aware: returns CofheReturnType (but doesn't support TArgs typing yet).
14826
+ */
14827
+ type UseCofheReadContractResult<TAbi extends Abi, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = UseQueryResult<CofheReturnType<TAbi, TfunctionName>, Error> & {
14828
+ disabledDueToMissingValidPermit: boolean;
14829
+ };
14830
+
14831
+ declare const TASK_MANAGER_IS_ENABLED_ABI: readonly [{
14832
+ readonly type: "function";
14833
+ readonly name: "isEnabled";
14834
+ readonly inputs: readonly [];
14835
+ readonly outputs: readonly [{
14836
+ readonly name: "enabled";
14837
+ readonly type: "bool";
14838
+ readonly internalType: "bool";
14839
+ }];
14840
+ readonly stateMutability: "view";
14841
+ }];
14842
+ type UseCofheEnabledOptions = UseCofheReadContractQueryOptions<typeof TASK_MANAGER_IS_ENABLED_ABI, 'isEnabled'>;
14843
+ type UseCofheEnabledResult = UseCofheReadContractResult<typeof TASK_MANAGER_IS_ENABLED_ABI, 'isEnabled'>;
14844
+ /**
14845
+ * Reads `TaskManager.isEnabled()` to determine whether Cofhe is enabled on the connected chain.
14846
+ */
14847
+ declare function useCofheEnabled(options?: UseCofheEnabledOptions): UseCofheEnabledResult;
14848
+
14849
+ declare const useCofheActivePermit: () => {
14850
+ permit: Permit;
14851
+ isValid: boolean;
14852
+ } | undefined;
14853
+ declare const useCofheAllPermits: () => Permit[];
14854
+ type Callbacks = {
14855
+ onSuccess?: () => void;
14856
+ onError?: (error: Error) => void;
14857
+ };
14858
+ declare const useCofheRemovePermit: ({ onSuccess, onError }?: Callbacks) => (hashToRemove: string) => Promise<void>;
14859
+ declare const useCofheSelectPermit: ({ onSuccess, onError }?: Callbacks) => (hashToSet: string) => void;
14860
+
14861
+ declare const useCofheClient: () => CofheClient<CofheConfigWithReact>;
14862
+
14764
14863
  type TokenList = {
14765
14864
  name: string;
14766
14865
  timestamp: string;
@@ -14806,7 +14905,7 @@ type UseConfidentialTokenBalanceResult = {
14806
14905
  isFetching: boolean;
14807
14906
  /** Refetch function */
14808
14907
  refetch: () => Promise<unknown>;
14809
- disabledDueToMissingPermit: boolean;
14908
+ disabledDueToMissingValidPermit: boolean;
14810
14909
  };
14811
14910
  /**
14812
14911
  * Hook to get confidential (encrypted) balance for a token with convenient formatting.
@@ -14823,7 +14922,7 @@ type WalletWriteContractInputWithExtras<TExtras> = {
14823
14922
  extras: TExtras;
14824
14923
  };
14825
14924
  type WalletWriteContractMutationVariables<TExtras> = WalletWriteContractParamsAny | WalletWriteContractInputWithExtras<TExtras>;
14826
- type WalletWriteContractParams<TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, 'payable' | 'nonpayable'>, TArgs extends ContractFunctionArgs<TAbi, 'payable' | 'nonpayable', TFunctionName>, TChainOverride extends Chain | undefined = undefined> = WriteContractParameters<TAbi, TFunctionName, TArgs, Chain | undefined, Account | undefined, TChainOverride>;
14925
+ type WalletWriteContractParams<TAbi extends Abi$1 | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, 'payable' | 'nonpayable'>, TArgs extends ContractFunctionArgs<TAbi, 'payable' | 'nonpayable', TFunctionName>, TChainOverride extends Chain | undefined = undefined> = WriteContractParameters<TAbi, TFunctionName, TArgs, Chain | undefined, Account | undefined, TChainOverride>;
14827
14926
  type useCofheWriteContractOptions<TExtras = unknown> = Omit<UseMutationOptions<Hash, Error, WalletWriteContractMutationVariables<TExtras>, unknown>, 'mutationFn'>;
14828
14927
  /**
14829
14928
  * Low-level mutation hook: call `walletClient.writeContract`.
@@ -14831,11 +14930,11 @@ type useCofheWriteContractOptions<TExtras = unknown> = Omit<UseMutationOptions<H
14831
14930
  * Unlike `useCofheWriteContract`, this accepts viem's full `writeContract` parameter type.
14832
14931
  */
14833
14932
  declare function useCofheWriteContract<TExtras = unknown>(options?: useCofheWriteContractOptions<TExtras>): UseMutationResult<Hash, Error, WalletWriteContractMutationVariables<TExtras>, unknown> & {
14834
- writeContractAsync: <TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, 'payable' | 'nonpayable'>, TArgs extends ContractFunctionArgs<TAbi, 'payable' | 'nonpayable', TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
14933
+ writeContractAsync: <TAbi extends Abi$1 | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, 'payable' | 'nonpayable'>, TArgs extends ContractFunctionArgs<TAbi, 'payable' | 'nonpayable', TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
14835
14934
  writeContractInput: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride>;
14836
14935
  extras: TExtras;
14837
14936
  }) => Promise<Hash>;
14838
- writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, 'payable' | 'nonpayable'>, TArgs extends ContractFunctionArgs<TAbi, 'payable' | 'nonpayable', TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
14937
+ writeContract: <TAbi extends Abi$1 | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, 'payable' | 'nonpayable'>, TArgs extends ContractFunctionArgs<TAbi, 'payable' | 'nonpayable', TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
14839
14938
  writeContractInput: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride>;
14840
14939
  extras: TExtras;
14841
14940
  }) => void;
@@ -14921,6 +15020,21 @@ declare function useCofheTokenTransfer(writeMutationOptions?: UseCofheTokenTrans
14921
15020
  encryptAmountAndSendToken: ({ input, encryptionOptions }: EncryptAndSendInput) => Promise<`0x${string}`>;
14922
15021
  };
14923
15022
 
15023
+ type CofheSimulateWriteContractCallArgs<TAbi extends Abi$1 | readonly unknown[] = Abi$1, TFunctionName extends ContractFunctionName<TAbi, 'nonpayable' | 'payable'> = ContractFunctionName<TAbi, 'nonpayable' | 'payable'>, TArgs extends ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName> = ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName>, TChainOverride extends Chain | undefined = Chain | undefined> = SimulateContractParameters<TAbi, TFunctionName, TArgs, Chain | undefined, TChainOverride, Account | Address | undefined>;
15024
+ type CofheSimulateWriteContractData<TAbi extends Abi$1 | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, 'nonpayable' | 'payable'>, TArgs extends ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName>, TChainOverride extends Chain | undefined> = SimulateContractReturnType<TAbi, TFunctionName, TArgs, Chain | undefined, Account | undefined, TChainOverride, Account | Address | undefined>;
15025
+ type UseCofheSimulateWriteContractQueryOptions<TData, TSelectedData> = Omit<UseQueryOptions<TData, Error, TSelectedData>, 'queryKey' | 'queryFn'> & {
15026
+ enabled?: boolean;
15027
+ };
15028
+ declare function useCofheSimulateWriteContract<TAbi extends Abi$1 | readonly unknown[] = Abi$1, TFunctionName extends ContractFunctionName<TAbi, 'nonpayable' | 'payable'> = ContractFunctionName<TAbi, 'nonpayable' | 'payable'>, TArgs extends ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName> = ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName>, TChainOverride extends Chain | undefined = Chain | undefined, TSelectedData = CofheSimulateWriteContractData<TAbi, TFunctionName, TArgs, TChainOverride>>(callArgs?: CofheSimulateWriteContractCallArgs<TAbi, TFunctionName, TArgs, TChainOverride>, queryOptions?: UseCofheSimulateWriteContractQueryOptions<CofheSimulateWriteContractData<TAbi, TFunctionName, TArgs, TChainOverride>, TSelectedData>): UseQueryResult<TSelectedData, Error>;
15029
+
15030
+ declare function getCofheTokenShieldCallArgs(params: {
15031
+ token: Token;
15032
+ amount: bigint;
15033
+ account: Address;
15034
+ }): {
15035
+ main: CofheSimulateWriteContractCallArgs;
15036
+ approval?: CofheSimulateWriteContractCallArgs;
15037
+ };
14924
15038
  type UnshieldClaim = {
14925
15039
  ctHash: bigint;
14926
15040
  requestedAmount: bigint;
@@ -14939,8 +15053,7 @@ type UseTokenShieldInput = {
14939
15053
  type UseTokenShieldOptions = Omit<UseMutationOptions<`0x${string}`, Error, UseTokenShieldInput>, 'mutationFn'>;
14940
15054
  /**
14941
15055
  * Hook to shield tokens (convert regular balance to confidential)
14942
- * - Dual tokens: calls `shield(uint256 amount)`
14943
- * - Wrapped tokens: TBD (needs approval flow)
15056
+ * Wrapped tokens call `encrypt` or `encryptETH`, depending on the paired asset.
14944
15057
  * @param options - Optional React Query mutation options
14945
15058
  * @returns Mutation result with transaction hash
14946
15059
  */
@@ -14959,9 +15072,10 @@ declare enum TransactionActionType {
14959
15072
  ShieldSend = "shieldSend",
14960
15073
  Shield = "shield",
14961
15074
  Unshield = "unshield",
14962
- Claim = "claim"
15075
+ Claim = "claim",
15076
+ Approve = "approve"
14963
15077
  }
14964
- type TransactionActionString = 'Shielded Transfer' | 'Shield' | 'Unshield' | 'Claim';
15078
+ type TransactionActionString = 'Shielded Transfer' | 'Shield' | 'Unshield' | 'Claim' | 'Approve';
14965
15079
  type BaseTransaction = {
14966
15080
  hash: `0x${string}`;
14967
15081
  status: TransactionStatus;
@@ -14981,10 +15095,13 @@ type SendingTransaction = BaseTransaction & {
14981
15095
  type ClaimingTransaction = BaseTransaction & {
14982
15096
  actionType: TransactionActionType.Claim;
14983
15097
  };
15098
+ type ApprovingTransaction = BaseTransaction & {
15099
+ actionType: TransactionActionType.Approve;
15100
+ };
14984
15101
  type UnshieldingTransaction = BaseTransaction & {
14985
15102
  actionType: TransactionActionType.Unshield;
14986
15103
  };
14987
- type Transaction = UnshieldingTransaction | ShieldingTransaction | SendingTransaction | ClaimingTransaction;
15104
+ type Transaction = UnshieldingTransaction | ShieldingTransaction | SendingTransaction | ClaimingTransaction | ApprovingTransaction;
14988
15105
  type NewTransaction = DistributiveOmit<Transaction, 'status' | 'timestamp'>;
14989
15106
  interface TransactionStore {
14990
15107
  transactions: ChainRecord<HashRecord<Transaction>>;
@@ -15012,10 +15129,15 @@ declare const useTransactionStore: zustand.UseBoundStore<Omit<zustand.StoreApi<T
15012
15129
  };
15013
15130
  }>;
15014
15131
 
15132
+ declare function getCofheTokenUnshieldCallArgs(params: {
15133
+ token: Token;
15134
+ amount: bigint;
15135
+ account: Address;
15136
+ }): CofheSimulateWriteContractCallArgs;
15015
15137
  type UseTokenUnshieldMutationInput = {
15016
15138
  /** Token object with confidentialityType */
15017
15139
  token: Token;
15018
- /** Amount to unshield (in token's smallest unit, uint64 max for dual) */
15140
+ /** Amount to unshield (in token's smallest unit) */
15019
15141
  amount: bigint;
15020
15142
  /** Optional callback for status updates during the operation */
15021
15143
  onStatusChange?: (message: string) => void;
@@ -15108,6 +15230,10 @@ declare function useCofheTokenUnshield(input: UseCofheTokenUnshieldInput): {
15108
15230
  mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<`0x${string}`, Error, UseTokenUnshieldMutationInput, unknown>;
15109
15231
  };
15110
15232
 
15233
+ declare function getCofheTokenClaimUnshieldedCallArgs(params: {
15234
+ token: Token;
15235
+ account: Address;
15236
+ }): CofheSimulateWriteContractCallArgs;
15111
15237
  type UseClaimUnshieldInput = {
15112
15238
  /** Token object with confidentialityType */
15113
15239
  token: Token;
@@ -15117,8 +15243,7 @@ type UseClaimUnshieldInput = {
15117
15243
  type UseClaimUnshieldOptions = Omit<UseMutationOptions<`0x${string}`, Error, UseClaimUnshieldInput>, 'mutationFn'>;
15118
15244
  /**
15119
15245
  * Hook to claim unshielded tokens after decryption completes
15120
- * - Dual tokens: calls `claimUnshielded()`
15121
- * - Wrapped tokens: calls `claimAllDecrypted()`
15246
+ * Wrapped tokens call `claimAllDecrypted()`.
15122
15247
  * @param options - Optional React Query mutation options
15123
15248
  * @returns Mutation result with transaction hash
15124
15249
  */
@@ -15131,7 +15256,7 @@ declare function constructUnshieldClaimsQueryKey({ chainId, tokenAddress, confid
15131
15256
  accountAddress: Address | undefined;
15132
15257
  }): (string | number | undefined)[];
15133
15258
  /**
15134
- * Unified unshield claims summary - works for both dual and wrapped tokens
15259
+ * Unshield claims summary for wrapped tokens.
15135
15260
  */
15136
15261
  type UnshieldClaimsSummary = {
15137
15262
  /** Total amount that can be claimed now (decrypted and not claimed) */
@@ -15151,7 +15276,7 @@ type UseUnshieldClaimsInput = {
15151
15276
  };
15152
15277
  type UseUnshieldClaimsOptions = Omit<UseQueryOptions<UnshieldClaimsSummary, Error>, 'queryKey' | 'queryFn'>;
15153
15278
  /**
15154
- * Unified hook to fetch unshield claims for any token type (dual or wrapped)
15279
+ * Hook to fetch wrapped-token unshield claims.
15155
15280
  * @param input - Token object and optional account address
15156
15281
  * @param queryOptions - Optional React Query options
15157
15282
  * @returns Query result with UnshieldClaimsSummary
@@ -15234,24 +15359,11 @@ type UseTokensWithPublicBalancesResult = {
15234
15359
  *
15235
15360
  * Public balance source:
15236
15361
  * - `wrapped`: underlying `erc20Pair` (or native ETH)
15237
- * - `dual`: token contract `balanceOf` (ERC20)
15238
- * - `pure`: skipped (no public balance)
15239
15362
  */
15240
15363
  declare function useTokensWithPublicBalances({ chainId: _chainId, accountAddress, displayDecimals }?: UseTokensWithPublicBalancesInput, options?: {
15241
15364
  enabled?: boolean;
15242
15365
  } & Omit<UseTokenBalanceOptions, 'select'>): UseTokensWithPublicBalancesResult;
15243
15366
 
15244
- type UseCofheReadContractQueryOptions<TAbi extends Abi$1, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = Omit<UseQueryOptions<CofheReturnType<TAbi, TfunctionName>, Error>, 'queryKey' | 'queryFn'> & {
15245
- enabled?: boolean;
15246
- };
15247
- /**
15248
- * Generic hook: read a contract and return the result (with permit/error gating support).
15249
- * is Cofhe-ABI aware: returns CofheReturnType (but doesn't support TArgs typing yet).
15250
- */
15251
- type UseCofheReadContractResult<TAbi extends Abi$1, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = UseQueryResult<CofheReturnType<TAbi, TfunctionName>, Error> & {
15252
- disabledDueToMissingPermit: boolean;
15253
- };
15254
-
15255
15367
  type Input$1 = {
15256
15368
  publicClient?: PublicClient;
15257
15369
  walletClient?: WalletClient;
@@ -15328,13 +15440,29 @@ type UseCoingeckoContractMarketChartRangeOptions = Omit<UseQueryOptions<Coingeck
15328
15440
  */
15329
15441
  declare function useCoingeckoContractMarketChartRange({ chainId, contractAddress, enabled: enabledInput, apiBaseUrl, platformIdOverride, vsCurrency, rangeMs, }: UseCoingeckoContractMarketChartRangeInput, queryOptions?: UseCoingeckoContractMarketChartRangeOptions): UseQueryResult<CoingeckoMarketChartPoint[] | null, Error>;
15330
15442
 
15443
+ type UseTokenAllowanceInput = {
15444
+ /** ERC20 token contract address */
15445
+ tokenAddress?: Address;
15446
+ /** Allowance owner */
15447
+ ownerAddress?: Address;
15448
+ /** Allowance spender */
15449
+ spenderAddress?: Address;
15450
+ };
15451
+ type UseTokenAllowanceOptions<TSelectedData = bigint> = Omit<UseQueryOptions<bigint, Error, TSelectedData>, 'queryKey' | 'queryFn'>;
15452
+ type UseTokenAllowanceResult = {
15453
+ data?: bigint;
15454
+ isFetching: boolean;
15455
+ refetch: () => Promise<unknown>;
15456
+ };
15457
+ declare function useTokenAllowance({ tokenAddress, ownerAddress, spenderAddress }: UseTokenAllowanceInput, options?: UseTokenAllowanceOptions): UseTokenAllowanceResult;
15458
+
15331
15459
  type NoInferLocal<T> = [T][T extends any ? 0 : never];
15332
- type ConfidentialityAwareAbiArgs<TAbi extends Abi | readonly unknown[], TFunctionName extends string> = NoInferLocal<Exclude<CofheInputArgsPreTransform<TAbi, TFunctionName>, undefined>>;
15460
+ type ConfidentialityAwareAbiArgs<TAbi extends Abi$1 | readonly unknown[], TFunctionName extends string> = NoInferLocal<Exclude<CofheInputArgsPreTransform<TAbi, TFunctionName>, undefined>>;
15333
15461
  declare function useCofheEncryptAndWriteContract<TExtraVars = unknown>({ encrypingMutationOptions, writingMutationOptions, }?: {
15334
15462
  encrypingMutationOptions?: UseCofheEncryptOptions;
15335
15463
  writingMutationOptions?: useCofheWriteContractOptions<TExtraVars>;
15336
15464
  }): {
15337
- encryptAndWrite: <const TAbi extends Abi, TFunctionName extends ContractFunctionName<TAbi, "payable" | "nonpayable">, TChainOverride extends Chain | undefined = undefined>(args: {
15465
+ encryptAndWrite: <const TAbi extends Abi$1, TFunctionName extends ContractFunctionName<TAbi, "payable" | "nonpayable">, TChainOverride extends Chain | undefined = undefined>(args: {
15338
15466
  params: Omit<WriteContractParameters<TAbi, TFunctionName, ContractFunctionArgs<TAbi, "payable" | "nonpayable", TFunctionName>, Chain | undefined, Account | undefined, TChainOverride>, "args" | "functionName"> & {
15339
15467
  functionName: TFunctionName;
15340
15468
  };
@@ -15348,23 +15476,23 @@ declare function useCofheEncryptAndWriteContract<TExtraVars = unknown>({ encrypi
15348
15476
  isEncrypting: boolean;
15349
15477
  stepsState: StepsState;
15350
15478
  };
15351
- write: _tanstack_react_query.UseMutationResult<`0x${string}`, Error, WriteContractParameters<Abi | readonly unknown[], string, readonly unknown[], Chain | undefined, Account | undefined, Chain | undefined> | WalletWriteContractInputWithExtras<TExtraVars>, unknown> & {
15352
- writeContractAsync: <TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "nonpayable" | "payable">, TArgs extends ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
15479
+ write: _tanstack_react_query.UseMutationResult<`0x${string}`, Error, WriteContractParameters<Abi$1 | readonly unknown[], string, readonly unknown[], Chain | undefined, Account | undefined, Chain | undefined> | WalletWriteContractInputWithExtras<TExtraVars>, unknown> & {
15480
+ writeContractAsync: <TAbi extends Abi$1 | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "nonpayable" | "payable">, TArgs extends ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
15353
15481
  writeContractInput: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride>;
15354
15482
  extras: TExtraVars;
15355
15483
  }) => Promise<viem.Hash>;
15356
- writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "nonpayable" | "payable">, TArgs extends ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
15484
+ writeContract: <TAbi extends Abi$1 | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "nonpayable" | "payable">, TArgs extends ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
15357
15485
  writeContractInput: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride>;
15358
15486
  extras: TExtraVars;
15359
15487
  }) => void;
15360
15488
  };
15361
15489
  };
15362
15490
 
15363
- type SupportedFheTypeFromReturn<TAbi extends Abi, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = CofheFirstReturnFheType<TAbi, TfunctionName> extends FheTypes ? CofheFirstReturnFheType<TAbi, TfunctionName> : FheTypes;
15491
+ type SupportedFheTypeFromReturn<TAbi extends Abi$1, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = CofheFirstReturnFheType<TAbi, TfunctionName> extends FheTypes ? CofheFirstReturnFheType<TAbi, TfunctionName> : FheTypes;
15364
15492
  /**
15365
15493
  * Generic hook: read a confidential contract value and decrypt it.
15366
15494
  */
15367
- declare function useCofheReadContractAndDecrypt<TAbi extends Abi, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>, TFheType extends FheTypes = SupportedFheTypeFromReturn<TAbi, TfunctionName>, TDecryptedSelectedData = UnsealedItem<TFheType>>(params: {
15495
+ declare function useCofheReadContractAndDecrypt<TAbi extends Abi$1, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>, TFheType extends FheTypes = SupportedFheTypeFromReturn<TAbi, TfunctionName>, TDecryptedSelectedData = UnsealedItem<TFheType>>(params: {
15368
15496
  address?: Address;
15369
15497
  abi?: TAbi;
15370
15498
  functionName?: TfunctionName;
@@ -15376,10 +15504,10 @@ declare function useCofheReadContractAndDecrypt<TAbi extends Abi, TfunctionName
15376
15504
  }): {
15377
15505
  encrypted: UseCofheReadContractResult<TAbi, TfunctionName>;
15378
15506
  decrypted: UseQueryResult<TDecryptedSelectedData, Error>;
15379
- disabledDueToMissingPermit: boolean;
15507
+ disabledDueToMissingValidPermit: boolean;
15380
15508
  };
15381
15509
 
15382
- declare const FnxFloatingButtonWithProvider: React.FC<FnxFloatingButtonProps>;
15510
+ declare const CofheFloatingButtonWithProvider: React.FC<CofheFloatingButtonProps>;
15383
15511
 
15384
15512
  declare const MainPage: React.FC;
15385
15513
 
@@ -15437,7 +15565,7 @@ declare module '../pagesConfig/types' {
15437
15565
  }
15438
15566
  }
15439
15567
 
15440
- interface FnxEncryptInputProps extends BaseProps {
15568
+ interface CofheEncryptInputProps extends BaseProps {
15441
15569
  /** Placeholder text for the text field */
15442
15570
  placeholder?: string;
15443
15571
  /** Initial value for the text field */
@@ -15469,7 +15597,7 @@ interface FnxEncryptInputProps extends BaseProps {
15469
15597
  /** Callback when encryption fails */
15470
15598
  onEncryptError?: (_error: string) => void;
15471
15599
  }
15472
- declare const FnxEncryptInput: React.FC<FnxEncryptInputProps>;
15600
+ declare const CofheEncryptInput: React.FC<CofheEncryptInputProps>;
15473
15601
 
15474
15602
  /**
15475
15603
  * Gets the block explorer URL for a given chain ID
@@ -15536,12 +15664,9 @@ declare const truncateHash: (value: string, start?: number, end?: number) => str
15536
15664
  */
15537
15665
  declare const formatRelativeTime: (timestamp: number) => string;
15538
15666
 
15539
- declare const fheTypeToString: (fheType: FheTypeValue) => "unknown" | "ebool" | "euint8" | "euint16" | "euint32" | "euint64" | "euint128" | "eaddress";
15540
- declare const encryptedValueToString: (fheType: FheTypeValue, handle: bigint) => string;
15541
-
15542
15667
  type Input = {
15543
15668
  cause?: GeneratePermitPageProps['cause'];
15544
15669
  };
15545
15670
  declare const useCofheNavigateToCreatePermit: () => ({ cause }?: Input) => void;
15546
15671
 
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 };
15672
+ export { type ClaimableAmountByTokenAddress, type CofheClientConfig, type CofheContextValue, CofheEncryptInput, type CofheFloatingButtonProps, CofheFloatingButtonWithProvider, CofheProvider, type CofheProviderProps, type CofheReactLogger, type CofheReactLoggerMethod, type CofheConfigWithReact as CofhesdkConfigWithReact, type CoingeckoMarketChartPoint, ETH_ADDRESS_LOWERCASE, type Erc20Pair, FheTypesList, type FloatingButtonPosition, 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, formatRelativeTime, getBlockExplorerAddressUrl, getBlockExplorerTokenUrl, getBlockExplorerTxUrl, getBlockExplorerUrl, getCofheTokenClaimUnshieldedCallArgs, getCofheTokenShieldCallArgs, getCofheTokenUnshieldCallArgs, isEthPair, isWrappedEthToken, statusToString, truncateHash, useCofheActivePermit, useCofheAllPermits, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheEnabled, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheNavigateToCreatePermit, useCofhePublicClient, useCofheReadContractAndDecrypt, useCofheRemovePermit, useCofheSelectPermit, useCofheSimulateWriteContract, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenShield, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheTokensWithExistingEncryptedBalances, useCofheWalletClient, useCofheWriteContract, useCoingeckoContractMarketChartRange, useCoingeckoUsdPrice, useInternalQueryClient, useTokenAllowance, useTokensWithPublicBalances, useTransactionReceiptsByHash, useTransactionStore };