@cofhe/react 0.0.0-beta-20260420143138 → 0.0.0-beta-20260421071014
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.cjs +723 -275
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +10 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +50 -44
- package/dist/index.d.ts +50 -44
- package/dist/index.js +654 -206
- package/dist/index.js.map +1 -1
- package/dist/styles.css +10 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ 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,
|
|
8
|
+
import { WalletClient, PublicClient, Address, ContractFunctionName, Hash, Abi as Abi$1, ContractFunctionArgs, Chain, WriteContractParameters, Account, SimulateContractReturnType, SimulateContractParameters, TransactionReceipt } from 'viem';
|
|
9
9
|
import { Abi, CofheReturnType, CofheInputArgsPreTransform, CofheFirstReturnFheType } from '@cofhe/abi';
|
|
10
10
|
import { Permit } from '@cofhe/sdk/permits';
|
|
11
11
|
import BigNumber from 'bignumber.js';
|
|
@@ -14731,49 +14731,6 @@ declare const useCofheWalletClient: () => {
|
|
|
14731
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>>;
|
|
14732
14732
|
} | undefined;
|
|
14733
14733
|
|
|
14734
|
-
type UseCofheReadContractQueryOptions<TAbi extends Abi, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = Omit<UseQueryOptions<CofheReturnType<TAbi, TfunctionName>, Error>, 'queryKey' | 'queryFn'> & {
|
|
14735
|
-
enabled?: boolean;
|
|
14736
|
-
};
|
|
14737
|
-
/**
|
|
14738
|
-
* Generic hook: read a contract and return the result (with permit/error gating support).
|
|
14739
|
-
* is Cofhe-ABI aware: returns CofheReturnType (but doesn't support TArgs typing yet).
|
|
14740
|
-
*/
|
|
14741
|
-
type UseCofheReadContractResult<TAbi extends Abi, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = UseQueryResult<CofheReturnType<TAbi, TfunctionName>, Error> & {
|
|
14742
|
-
disabledDueToMissingValidPermit: boolean;
|
|
14743
|
-
};
|
|
14744
|
-
|
|
14745
|
-
declare const TASK_MANAGER_IS_ENABLED_ABI: readonly [{
|
|
14746
|
-
readonly type: "function";
|
|
14747
|
-
readonly name: "isEnabled";
|
|
14748
|
-
readonly inputs: readonly [];
|
|
14749
|
-
readonly outputs: readonly [{
|
|
14750
|
-
readonly name: "enabled";
|
|
14751
|
-
readonly type: "bool";
|
|
14752
|
-
readonly internalType: "bool";
|
|
14753
|
-
}];
|
|
14754
|
-
readonly stateMutability: "view";
|
|
14755
|
-
}];
|
|
14756
|
-
type UseCofheEnabledOptions = UseCofheReadContractQueryOptions<typeof TASK_MANAGER_IS_ENABLED_ABI, 'isEnabled'>;
|
|
14757
|
-
type UseCofheEnabledResult = UseCofheReadContractResult<typeof TASK_MANAGER_IS_ENABLED_ABI, 'isEnabled'>;
|
|
14758
|
-
/**
|
|
14759
|
-
* Reads `TaskManager.isEnabled()` to determine whether Cofhe is enabled on the connected chain.
|
|
14760
|
-
*/
|
|
14761
|
-
declare function useCofheEnabled(options?: UseCofheEnabledOptions): UseCofheEnabledResult;
|
|
14762
|
-
|
|
14763
|
-
declare const useCofheActivePermit: () => {
|
|
14764
|
-
permit: Permit;
|
|
14765
|
-
isValid: boolean;
|
|
14766
|
-
} | undefined;
|
|
14767
|
-
declare const useCofheAllPermits: () => Permit[];
|
|
14768
|
-
type Callbacks = {
|
|
14769
|
-
onSuccess?: () => void;
|
|
14770
|
-
onError?: (error: Error) => void;
|
|
14771
|
-
};
|
|
14772
|
-
declare const useCofheRemovePermit: ({ onSuccess, onError }?: Callbacks) => (hashToRemove: string) => Promise<void>;
|
|
14773
|
-
declare const useCofheSelectPermit: ({ onSuccess, onError }?: Callbacks) => (hashToSet: string) => void;
|
|
14774
|
-
|
|
14775
|
-
declare const useCofheClient: () => CofheClient<CofheConfigWithReact>;
|
|
14776
|
-
|
|
14777
14734
|
/**
|
|
14778
14735
|
* Token types shared across hooks/components/utils.
|
|
14779
14736
|
*
|
|
@@ -14798,6 +14755,8 @@ type Erc20Pair = {
|
|
|
14798
14755
|
declare const TOKEN_CONFIDENTIALITY_SUPPORT: {
|
|
14799
14756
|
readonly wrapped: {
|
|
14800
14757
|
readonly enabled: true;
|
|
14758
|
+
readonly label: "Wrapped confidential token";
|
|
14759
|
+
readonly confidentialValueType: "uint128";
|
|
14801
14760
|
readonly publicBalanceSource: "erc20Pair";
|
|
14802
14761
|
readonly operations: {
|
|
14803
14762
|
readonly confidentialBalance: true;
|
|
@@ -14811,6 +14770,8 @@ declare const TOKEN_CONFIDENTIALITY_SUPPORT: {
|
|
|
14811
14770
|
};
|
|
14812
14771
|
readonly pure: {
|
|
14813
14772
|
readonly enabled: false;
|
|
14773
|
+
readonly label: "Pure confidential token";
|
|
14774
|
+
readonly confidentialValueType: "uint64";
|
|
14814
14775
|
readonly publicBalanceSource: null;
|
|
14815
14776
|
readonly operations: {
|
|
14816
14777
|
readonly confidentialBalance: false;
|
|
@@ -14824,6 +14785,8 @@ declare const TOKEN_CONFIDENTIALITY_SUPPORT: {
|
|
|
14824
14785
|
};
|
|
14825
14786
|
readonly dual: {
|
|
14826
14787
|
readonly enabled: false;
|
|
14788
|
+
readonly label: "Dual-balance confidential token";
|
|
14789
|
+
readonly confidentialValueType: "uint64";
|
|
14827
14790
|
readonly publicBalanceSource: "token";
|
|
14828
14791
|
readonly operations: {
|
|
14829
14792
|
readonly confidentialBalance: false;
|
|
@@ -14854,6 +14817,49 @@ type Token = {
|
|
|
14854
14817
|
};
|
|
14855
14818
|
};
|
|
14856
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
|
+
|
|
14857
14863
|
type TokenList = {
|
|
14858
14864
|
name: string;
|
|
14859
14865
|
timestamp: string;
|