@cofhe/react 1.1.0-alpha.5 → 1.1.0-alpha.6
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/{chunk-BBZDUNBD.cjs → chunk-3O3XFKDN.cjs} +1 -1
- package/dist/{chunk-BBZDUNBD.cjs.map → chunk-3O3XFKDN.cjs.map} +1 -1
- package/dist/{chunk-6AIHOKTV.js → chunk-CPAI6WMZ.js} +2 -2
- package/dist/index.cjs +83 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +50 -4
- package/dist/index.js.map +1 -1
- package/dist/ui-base.cjs +2 -2
- package/dist/ui-base.js +1 -1
- package/package.json +3 -3
- /package/dist/{chunk-6AIHOKTV.js.map → chunk-CPAI6WMZ.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -16455,6 +16455,38 @@ type UseCofheDecryptForViewListInput<U extends FheTypes> = {
|
|
|
16455
16455
|
*/
|
|
16456
16456
|
declare function useCofheDecryptForViewList<U extends FheTypes, TSelectedData = UnsealedItem<U>>({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptForViewListInput<U>, queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSelectedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSelectedData, Error>[];
|
|
16457
16457
|
|
|
16458
|
+
type UseCofheDecryptForTxListInput = {
|
|
16459
|
+
/** The handles to prove, in the order the results come back; `undefined` entries and the zero handle stay idle. */
|
|
16460
|
+
inputs: ReadonlyArray<bigint | string | undefined>;
|
|
16461
|
+
/**
|
|
16462
|
+
* The ACP to decrypt with: an ACP, the hash of a stored one, the enclosing `<CofheACPScope>`
|
|
16463
|
+
* or the active ACP when omitted, or `null` for handles the contract allowed publicly
|
|
16464
|
+
* (`FHE.allowPublic`), which need none and so never wait for one.
|
|
16465
|
+
*/
|
|
16466
|
+
acp?: CofheACPInput | null;
|
|
16467
|
+
/** The chain the handles live on — the connected chain by default. */
|
|
16468
|
+
chainId?: number;
|
|
16469
|
+
/** The account whose stored ACPs resolve a hash or the active ACP; the connected account by default. */
|
|
16470
|
+
account?: string;
|
|
16471
|
+
onPoll?: DecryptPollCallbackFunction;
|
|
16472
|
+
/** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */
|
|
16473
|
+
timeoutMs?: number;
|
|
16474
|
+
/** How long a submit-time `404 ct_not_found` (handle not indexed yet) is retried; 10 seconds by default. */
|
|
16475
|
+
retry404TimeoutMs?: number;
|
|
16476
|
+
/** Consumer-supplied metadata for debug/activity views, one for all or one per entry. */
|
|
16477
|
+
meta?: CofheDecryptMeta | ((ctHash: bigint | string, index: number) => CofheDecryptMeta);
|
|
16478
|
+
/** Structural context from the originating read (address/method), for recognition. */
|
|
16479
|
+
context?: CofheDecryptContext;
|
|
16480
|
+
};
|
|
16481
|
+
/**
|
|
16482
|
+
* `useCofheDecryptForTx` for a list: one proof query per handle, the same keys, gate and
|
|
16483
|
+
* persistence, returned in the order of `inputs`. For a page that will send one transaction per
|
|
16484
|
+
* item, or one transaction over all of them, with the handles known at render time; the proofs
|
|
16485
|
+
* are ready before the click. The client's `decryptConcurrency` cap bounds how many requests run
|
|
16486
|
+
* at once.
|
|
16487
|
+
*/
|
|
16488
|
+
declare function useCofheDecryptForTxList<TSelectedData = DecryptForTxResult>({ inputs, acp, chainId, account, onPoll, timeoutMs, retry404TimeoutMs, meta, context }: UseCofheDecryptForTxListInput, queryOptions?: Omit<UseQueryOptions<DecryptForTxResult, Error, TSelectedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSelectedData, Error>[];
|
|
16489
|
+
|
|
16458
16490
|
/** Per-call options of the function `useCofheDecrypter` returns. */
|
|
16459
16491
|
type CofheDecryptForViewFnOptions = {
|
|
16460
16492
|
/** Consumer-supplied metadata for debug/activity views. */
|
|
@@ -16759,4 +16791,4 @@ type ResolveReceiptBlockHashOptions = {
|
|
|
16759
16791
|
};
|
|
16760
16792
|
declare function resolveReceiptBlockHash(receipt: TransactionReceipt, publicClient: PublicClient, options?: ResolveReceiptBlockHashOptions): Promise<TransactionReceipt>;
|
|
16761
16793
|
|
|
16762
|
-
export { type ACPState, type AddCofheTransactionInput, type BuiltInTransactionActionType, type ClaimableAmountByTokenAddress, type CofheACPInput, CofheACPScope, type CofheACPScopeValue, type CofheACPStatus, type CofheClientConfig, type CofheContextValue, type CofheDecryptContext, type CofheDecryptForTxFn, type CofheDecryptForTxFnOptions, type CofheDecryptForViewFn, type CofheDecryptForViewFnOptions, type CofheDecryptMeta, CofheProvider, type CofheProviderProps, type PublicClientLike as CofhePublicClientLike, type CofheQueryMeta, type CofheReactLogger, type CofheReactLoggerMethod, type CofheReadContractsContract, type CofheReadContractsData, type CofheReadContractsEntries, type CofheReadContractsEntry, type CofheReadContractsEntryResult, type CofheReadContractsItem, type CofheReadInvalidationDescriptor, type CofheShareLabel, type WalletClientLike as CofheWalletClientLike, type CofheWriteInvalidates, type CofheWriteInvalidationTarget, type CofheConfigWithReact as CofhesdkConfigWithReact, type CoingeckoMarketChartPoint, ConfidentialToken, type CustomTransactionActionType, type DecryptStageState, type DecryptionActivityCategory, type DecryptionActivityResult, type DecryptionActivityRow, type FetchStageState, type InvalidationContextEntry, type InvalidationContextQueryFilters, type JsonValue, type NewTransaction, type QueryFunctionWithInvalidationContext, type ReadContractResult, type SharingTransactionActionType, type Transaction, type TransactionActionString, TransactionActionType, type TransactionRenderer, type TransactionRendererProps, type TransactionRenderers, TransactionStatus, type TransactionStatusString, type TransactionStore, type UnshieldClaim, type UnshieldClaimsSummary, type UnshieldClaimsSummaryByTokenAddress, type UseCofheDecryptForTxInput, type UseCofheDecryptForViewListInput, type UseCofheDecrypterOptions, type UseCofheDecrypterResult, type UseCofheDecryptionActivityOptions, type UseCofheReadContractQueryOptions, type UseCofheReadContractResult, type UseCofheReadContractsQueryOptions, type UseCofheReadContractsResult, type UseCofheShareLabelsResult, type UseCofheTokenTransactionsInput, type UseCofheTokenTransactionsResult, type UseCoingeckoContractMarketChartRangeInput, type UseCoingeckoContractMarketChartRangeOptions, type UseCoingeckoUsdPriceInput, type UseCoingeckoUsdPriceOptions, type UseTransactionReceiptsByHashInput, type WaitUntilRpcAwareAndReadContractOptions, actionToString, addCofheTransaction, asCofhePublicClient, asCofheWalletClient, cofheDecryptForTxQuery, cofheDecryptForViewQuery, constructCofheDecryptForTxQueryKey, constructCofheDecryptForViewQueryKey, constructCofheReadContractQueryForInvalidation, createCofheConfig, findMatchingInvalidationContext, getCofheTokenClaimUnshieldedCallArgs, getCofheTokenShieldCallArgs, getCofheTokenUnshieldCallArgs, invalidateQueriesWithContext, isCustomTransactionActionType, maybeWaitUntilRpcAware, maybeWaitUntilRpcAwareAndReadContract, quantizeAmount, resolveReceiptBlockHash, scaleAmount, statusToString, transactionMatchesToken, tryAsCofhePublicClient, tryAsCofheWalletClient, useCofheACPScope, useCofheACPStatus, useCofheACPs, useCofheActiveACP, useCofheAllACPs, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheCreateACP, useCofheDecrypt, useCofheDecryptForTx, useCofheDecryptForViewList, useCofheDecrypter, useCofheDecryptionActivity, useCofheEnabled, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheImportShared, useCofheIncomingShares, useCofheNavigateToCreateACP, useCofhePublicClient, useCofheReadContract, useCofheReadContractAndDecrypt, useCofheReadContracts, useCofheRemoveACP, useCofheRemoveShare, useCofheRevokeACP, useCofheSelectACP, useCofheShareLabels, useCofheShareOnChain, useCofheSimulateWriteContract, useCofheTaskManagerAddress, useCofheToken, useCofheTokenApprove, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenClaims, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenPublicBalance, useCofheTokenShield, useCofheTokenTransactions, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheTokensWithExistingEncryptedBalances, useCofheTransactions, useCofheWalletClient, useCofheWriteContract, type useCofheWriteContractOptions, useCoingeckoContractMarketChartRange, useCoingeckoUsdPrice, useCustomTokensStore, useInternalQueryClient, useInvalidationContextStore, useKnownCofheToken, useResolvedCofheToken, useTokenAllowance, useTokensWithPublicBalances, useTransactionReceiptsByHash, useTransactionStore, withInvalidationContext };
|
|
16794
|
+
export { type ACPState, type AddCofheTransactionInput, type BuiltInTransactionActionType, type ClaimableAmountByTokenAddress, type CofheACPInput, CofheACPScope, type CofheACPScopeValue, type CofheACPStatus, type CofheClientConfig, type CofheContextValue, type CofheDecryptContext, type CofheDecryptForTxFn, type CofheDecryptForTxFnOptions, type CofheDecryptForViewFn, type CofheDecryptForViewFnOptions, type CofheDecryptMeta, CofheProvider, type CofheProviderProps, type PublicClientLike as CofhePublicClientLike, type CofheQueryMeta, type CofheReactLogger, type CofheReactLoggerMethod, type CofheReadContractsContract, type CofheReadContractsData, type CofheReadContractsEntries, type CofheReadContractsEntry, type CofheReadContractsEntryResult, type CofheReadContractsItem, type CofheReadInvalidationDescriptor, type CofheShareLabel, type WalletClientLike as CofheWalletClientLike, type CofheWriteInvalidates, type CofheWriteInvalidationTarget, type CofheConfigWithReact as CofhesdkConfigWithReact, type CoingeckoMarketChartPoint, ConfidentialToken, type CustomTransactionActionType, type DecryptStageState, type DecryptionActivityCategory, type DecryptionActivityResult, type DecryptionActivityRow, type FetchStageState, type InvalidationContextEntry, type InvalidationContextQueryFilters, type JsonValue, type NewTransaction, type QueryFunctionWithInvalidationContext, type ReadContractResult, type SharingTransactionActionType, type Transaction, type TransactionActionString, TransactionActionType, type TransactionRenderer, type TransactionRendererProps, type TransactionRenderers, TransactionStatus, type TransactionStatusString, type TransactionStore, type UnshieldClaim, type UnshieldClaimsSummary, type UnshieldClaimsSummaryByTokenAddress, type UseCofheDecryptForTxInput, type UseCofheDecryptForTxListInput, type UseCofheDecryptForViewListInput, type UseCofheDecrypterOptions, type UseCofheDecrypterResult, type UseCofheDecryptionActivityOptions, type UseCofheReadContractQueryOptions, type UseCofheReadContractResult, type UseCofheReadContractsQueryOptions, type UseCofheReadContractsResult, type UseCofheShareLabelsResult, type UseCofheTokenTransactionsInput, type UseCofheTokenTransactionsResult, type UseCoingeckoContractMarketChartRangeInput, type UseCoingeckoContractMarketChartRangeOptions, type UseCoingeckoUsdPriceInput, type UseCoingeckoUsdPriceOptions, type UseTransactionReceiptsByHashInput, type WaitUntilRpcAwareAndReadContractOptions, actionToString, addCofheTransaction, asCofhePublicClient, asCofheWalletClient, cofheDecryptForTxQuery, cofheDecryptForViewQuery, constructCofheDecryptForTxQueryKey, constructCofheDecryptForViewQueryKey, constructCofheReadContractQueryForInvalidation, createCofheConfig, findMatchingInvalidationContext, getCofheTokenClaimUnshieldedCallArgs, getCofheTokenShieldCallArgs, getCofheTokenUnshieldCallArgs, invalidateQueriesWithContext, isCustomTransactionActionType, maybeWaitUntilRpcAware, maybeWaitUntilRpcAwareAndReadContract, quantizeAmount, resolveReceiptBlockHash, scaleAmount, statusToString, transactionMatchesToken, tryAsCofhePublicClient, tryAsCofheWalletClient, useCofheACPScope, useCofheACPStatus, useCofheACPs, useCofheActiveACP, useCofheAllACPs, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheCreateACP, useCofheDecrypt, useCofheDecryptForTx, useCofheDecryptForTxList, useCofheDecryptForViewList, useCofheDecrypter, useCofheDecryptionActivity, useCofheEnabled, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheImportShared, useCofheIncomingShares, useCofheNavigateToCreateACP, useCofhePublicClient, useCofheReadContract, useCofheReadContractAndDecrypt, useCofheReadContracts, useCofheRemoveACP, useCofheRemoveShare, useCofheRevokeACP, useCofheSelectACP, useCofheShareLabels, useCofheShareOnChain, useCofheSimulateWriteContract, useCofheTaskManagerAddress, useCofheToken, useCofheTokenApprove, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenClaims, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenPublicBalance, useCofheTokenShield, useCofheTokenTransactions, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheTokensWithExistingEncryptedBalances, useCofheTransactions, useCofheWalletClient, useCofheWriteContract, type useCofheWriteContractOptions, useCoingeckoContractMarketChartRange, useCoingeckoUsdPrice, useCustomTokensStore, useInternalQueryClient, useInvalidationContextStore, useKnownCofheToken, useResolvedCofheToken, useTokenAllowance, useTokensWithPublicBalances, useTransactionReceiptsByHash, useTransactionStore, withInvalidationContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -16455,6 +16455,38 @@ type UseCofheDecryptForViewListInput<U extends FheTypes> = {
|
|
|
16455
16455
|
*/
|
|
16456
16456
|
declare function useCofheDecryptForViewList<U extends FheTypes, TSelectedData = UnsealedItem<U>>({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptForViewListInput<U>, queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSelectedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSelectedData, Error>[];
|
|
16457
16457
|
|
|
16458
|
+
type UseCofheDecryptForTxListInput = {
|
|
16459
|
+
/** The handles to prove, in the order the results come back; `undefined` entries and the zero handle stay idle. */
|
|
16460
|
+
inputs: ReadonlyArray<bigint | string | undefined>;
|
|
16461
|
+
/**
|
|
16462
|
+
* The ACP to decrypt with: an ACP, the hash of a stored one, the enclosing `<CofheACPScope>`
|
|
16463
|
+
* or the active ACP when omitted, or `null` for handles the contract allowed publicly
|
|
16464
|
+
* (`FHE.allowPublic`), which need none and so never wait for one.
|
|
16465
|
+
*/
|
|
16466
|
+
acp?: CofheACPInput | null;
|
|
16467
|
+
/** The chain the handles live on — the connected chain by default. */
|
|
16468
|
+
chainId?: number;
|
|
16469
|
+
/** The account whose stored ACPs resolve a hash or the active ACP; the connected account by default. */
|
|
16470
|
+
account?: string;
|
|
16471
|
+
onPoll?: DecryptPollCallbackFunction;
|
|
16472
|
+
/** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */
|
|
16473
|
+
timeoutMs?: number;
|
|
16474
|
+
/** How long a submit-time `404 ct_not_found` (handle not indexed yet) is retried; 10 seconds by default. */
|
|
16475
|
+
retry404TimeoutMs?: number;
|
|
16476
|
+
/** Consumer-supplied metadata for debug/activity views, one for all or one per entry. */
|
|
16477
|
+
meta?: CofheDecryptMeta | ((ctHash: bigint | string, index: number) => CofheDecryptMeta);
|
|
16478
|
+
/** Structural context from the originating read (address/method), for recognition. */
|
|
16479
|
+
context?: CofheDecryptContext;
|
|
16480
|
+
};
|
|
16481
|
+
/**
|
|
16482
|
+
* `useCofheDecryptForTx` for a list: one proof query per handle, the same keys, gate and
|
|
16483
|
+
* persistence, returned in the order of `inputs`. For a page that will send one transaction per
|
|
16484
|
+
* item, or one transaction over all of them, with the handles known at render time; the proofs
|
|
16485
|
+
* are ready before the click. The client's `decryptConcurrency` cap bounds how many requests run
|
|
16486
|
+
* at once.
|
|
16487
|
+
*/
|
|
16488
|
+
declare function useCofheDecryptForTxList<TSelectedData = DecryptForTxResult>({ inputs, acp, chainId, account, onPoll, timeoutMs, retry404TimeoutMs, meta, context }: UseCofheDecryptForTxListInput, queryOptions?: Omit<UseQueryOptions<DecryptForTxResult, Error, TSelectedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSelectedData, Error>[];
|
|
16489
|
+
|
|
16458
16490
|
/** Per-call options of the function `useCofheDecrypter` returns. */
|
|
16459
16491
|
type CofheDecryptForViewFnOptions = {
|
|
16460
16492
|
/** Consumer-supplied metadata for debug/activity views. */
|
|
@@ -16759,4 +16791,4 @@ type ResolveReceiptBlockHashOptions = {
|
|
|
16759
16791
|
};
|
|
16760
16792
|
declare function resolveReceiptBlockHash(receipt: TransactionReceipt, publicClient: PublicClient, options?: ResolveReceiptBlockHashOptions): Promise<TransactionReceipt>;
|
|
16761
16793
|
|
|
16762
|
-
export { type ACPState, type AddCofheTransactionInput, type BuiltInTransactionActionType, type ClaimableAmountByTokenAddress, type CofheACPInput, CofheACPScope, type CofheACPScopeValue, type CofheACPStatus, type CofheClientConfig, type CofheContextValue, type CofheDecryptContext, type CofheDecryptForTxFn, type CofheDecryptForTxFnOptions, type CofheDecryptForViewFn, type CofheDecryptForViewFnOptions, type CofheDecryptMeta, CofheProvider, type CofheProviderProps, type PublicClientLike as CofhePublicClientLike, type CofheQueryMeta, type CofheReactLogger, type CofheReactLoggerMethod, type CofheReadContractsContract, type CofheReadContractsData, type CofheReadContractsEntries, type CofheReadContractsEntry, type CofheReadContractsEntryResult, type CofheReadContractsItem, type CofheReadInvalidationDescriptor, type CofheShareLabel, type WalletClientLike as CofheWalletClientLike, type CofheWriteInvalidates, type CofheWriteInvalidationTarget, type CofheConfigWithReact as CofhesdkConfigWithReact, type CoingeckoMarketChartPoint, ConfidentialToken, type CustomTransactionActionType, type DecryptStageState, type DecryptionActivityCategory, type DecryptionActivityResult, type DecryptionActivityRow, type FetchStageState, type InvalidationContextEntry, type InvalidationContextQueryFilters, type JsonValue, type NewTransaction, type QueryFunctionWithInvalidationContext, type ReadContractResult, type SharingTransactionActionType, type Transaction, type TransactionActionString, TransactionActionType, type TransactionRenderer, type TransactionRendererProps, type TransactionRenderers, TransactionStatus, type TransactionStatusString, type TransactionStore, type UnshieldClaim, type UnshieldClaimsSummary, type UnshieldClaimsSummaryByTokenAddress, type UseCofheDecryptForTxInput, type UseCofheDecryptForViewListInput, type UseCofheDecrypterOptions, type UseCofheDecrypterResult, type UseCofheDecryptionActivityOptions, type UseCofheReadContractQueryOptions, type UseCofheReadContractResult, type UseCofheReadContractsQueryOptions, type UseCofheReadContractsResult, type UseCofheShareLabelsResult, type UseCofheTokenTransactionsInput, type UseCofheTokenTransactionsResult, type UseCoingeckoContractMarketChartRangeInput, type UseCoingeckoContractMarketChartRangeOptions, type UseCoingeckoUsdPriceInput, type UseCoingeckoUsdPriceOptions, type UseTransactionReceiptsByHashInput, type WaitUntilRpcAwareAndReadContractOptions, actionToString, addCofheTransaction, asCofhePublicClient, asCofheWalletClient, cofheDecryptForTxQuery, cofheDecryptForViewQuery, constructCofheDecryptForTxQueryKey, constructCofheDecryptForViewQueryKey, constructCofheReadContractQueryForInvalidation, createCofheConfig, findMatchingInvalidationContext, getCofheTokenClaimUnshieldedCallArgs, getCofheTokenShieldCallArgs, getCofheTokenUnshieldCallArgs, invalidateQueriesWithContext, isCustomTransactionActionType, maybeWaitUntilRpcAware, maybeWaitUntilRpcAwareAndReadContract, quantizeAmount, resolveReceiptBlockHash, scaleAmount, statusToString, transactionMatchesToken, tryAsCofhePublicClient, tryAsCofheWalletClient, useCofheACPScope, useCofheACPStatus, useCofheACPs, useCofheActiveACP, useCofheAllACPs, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheCreateACP, useCofheDecrypt, useCofheDecryptForTx, useCofheDecryptForViewList, useCofheDecrypter, useCofheDecryptionActivity, useCofheEnabled, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheImportShared, useCofheIncomingShares, useCofheNavigateToCreateACP, useCofhePublicClient, useCofheReadContract, useCofheReadContractAndDecrypt, useCofheReadContracts, useCofheRemoveACP, useCofheRemoveShare, useCofheRevokeACP, useCofheSelectACP, useCofheShareLabels, useCofheShareOnChain, useCofheSimulateWriteContract, useCofheTaskManagerAddress, useCofheToken, useCofheTokenApprove, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenClaims, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenPublicBalance, useCofheTokenShield, useCofheTokenTransactions, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheTokensWithExistingEncryptedBalances, useCofheTransactions, useCofheWalletClient, useCofheWriteContract, type useCofheWriteContractOptions, useCoingeckoContractMarketChartRange, useCoingeckoUsdPrice, useCustomTokensStore, useInternalQueryClient, useInvalidationContextStore, useKnownCofheToken, useResolvedCofheToken, useTokenAllowance, useTokensWithPublicBalances, useTransactionReceiptsByHash, useTransactionStore, withInvalidationContext };
|
|
16794
|
+
export { type ACPState, type AddCofheTransactionInput, type BuiltInTransactionActionType, type ClaimableAmountByTokenAddress, type CofheACPInput, CofheACPScope, type CofheACPScopeValue, type CofheACPStatus, type CofheClientConfig, type CofheContextValue, type CofheDecryptContext, type CofheDecryptForTxFn, type CofheDecryptForTxFnOptions, type CofheDecryptForViewFn, type CofheDecryptForViewFnOptions, type CofheDecryptMeta, CofheProvider, type CofheProviderProps, type PublicClientLike as CofhePublicClientLike, type CofheQueryMeta, type CofheReactLogger, type CofheReactLoggerMethod, type CofheReadContractsContract, type CofheReadContractsData, type CofheReadContractsEntries, type CofheReadContractsEntry, type CofheReadContractsEntryResult, type CofheReadContractsItem, type CofheReadInvalidationDescriptor, type CofheShareLabel, type WalletClientLike as CofheWalletClientLike, type CofheWriteInvalidates, type CofheWriteInvalidationTarget, type CofheConfigWithReact as CofhesdkConfigWithReact, type CoingeckoMarketChartPoint, ConfidentialToken, type CustomTransactionActionType, type DecryptStageState, type DecryptionActivityCategory, type DecryptionActivityResult, type DecryptionActivityRow, type FetchStageState, type InvalidationContextEntry, type InvalidationContextQueryFilters, type JsonValue, type NewTransaction, type QueryFunctionWithInvalidationContext, type ReadContractResult, type SharingTransactionActionType, type Transaction, type TransactionActionString, TransactionActionType, type TransactionRenderer, type TransactionRendererProps, type TransactionRenderers, TransactionStatus, type TransactionStatusString, type TransactionStore, type UnshieldClaim, type UnshieldClaimsSummary, type UnshieldClaimsSummaryByTokenAddress, type UseCofheDecryptForTxInput, type UseCofheDecryptForTxListInput, type UseCofheDecryptForViewListInput, type UseCofheDecrypterOptions, type UseCofheDecrypterResult, type UseCofheDecryptionActivityOptions, type UseCofheReadContractQueryOptions, type UseCofheReadContractResult, type UseCofheReadContractsQueryOptions, type UseCofheReadContractsResult, type UseCofheShareLabelsResult, type UseCofheTokenTransactionsInput, type UseCofheTokenTransactionsResult, type UseCoingeckoContractMarketChartRangeInput, type UseCoingeckoContractMarketChartRangeOptions, type UseCoingeckoUsdPriceInput, type UseCoingeckoUsdPriceOptions, type UseTransactionReceiptsByHashInput, type WaitUntilRpcAwareAndReadContractOptions, actionToString, addCofheTransaction, asCofhePublicClient, asCofheWalletClient, cofheDecryptForTxQuery, cofheDecryptForViewQuery, constructCofheDecryptForTxQueryKey, constructCofheDecryptForViewQueryKey, constructCofheReadContractQueryForInvalidation, createCofheConfig, findMatchingInvalidationContext, getCofheTokenClaimUnshieldedCallArgs, getCofheTokenShieldCallArgs, getCofheTokenUnshieldCallArgs, invalidateQueriesWithContext, isCustomTransactionActionType, maybeWaitUntilRpcAware, maybeWaitUntilRpcAwareAndReadContract, quantizeAmount, resolveReceiptBlockHash, scaleAmount, statusToString, transactionMatchesToken, tryAsCofhePublicClient, tryAsCofheWalletClient, useCofheACPScope, useCofheACPStatus, useCofheACPs, useCofheActiveACP, useCofheAllACPs, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheCreateACP, useCofheDecrypt, useCofheDecryptForTx, useCofheDecryptForTxList, useCofheDecryptForViewList, useCofheDecrypter, useCofheDecryptionActivity, useCofheEnabled, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheImportShared, useCofheIncomingShares, useCofheNavigateToCreateACP, useCofhePublicClient, useCofheReadContract, useCofheReadContractAndDecrypt, useCofheReadContracts, useCofheRemoveACP, useCofheRemoveShare, useCofheRevokeACP, useCofheSelectACP, useCofheShareLabels, useCofheShareOnChain, useCofheSimulateWriteContract, useCofheTaskManagerAddress, useCofheToken, useCofheTokenApprove, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenClaims, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenPublicBalance, useCofheTokenShield, useCofheTokenTransactions, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheTokensWithExistingEncryptedBalances, useCofheTransactions, useCofheWalletClient, useCofheWriteContract, type useCofheWriteContractOptions, useCoingeckoContractMarketChartRange, useCoingeckoUsdPrice, useCustomTokensStore, useInternalQueryClient, useInvalidationContextStore, useKnownCofheToken, useResolvedCofheToken, useTokenAllowance, useTokensWithPublicBalances, useTransactionReceiptsByHash, useTransactionStore, withInvalidationContext };
|
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
useTransactionStore,
|
|
116
116
|
withInvalidationContext,
|
|
117
117
|
zeroPlaintext
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-CPAI6WMZ.js";
|
|
119
119
|
|
|
120
120
|
// src/hooks/useCofheDecryptForViewList.ts
|
|
121
121
|
function useCofheDecryptForViewList({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }, queryOptions) {
|
|
@@ -162,9 +162,6 @@ function useCofheDecryptForViewList({ inputs, meta, context, onPoll, chainId, ac
|
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
// src/hooks/useCofheDecrypter.ts
|
|
166
|
-
import { useCallback, useMemo } from "react";
|
|
167
|
-
|
|
168
165
|
// src/hooks/useCofheDecryptForTx.ts
|
|
169
166
|
var import_ts_essentials = __toESM(require_dist());
|
|
170
167
|
function constructCofheDecryptForTxQueryKey(params) {
|
|
@@ -249,7 +246,55 @@ function useCofheDecryptForTx({ ctHash, acp, chainId, account, onPoll, timeoutMs
|
|
|
249
246
|
});
|
|
250
247
|
}
|
|
251
248
|
|
|
249
|
+
// src/hooks/useCofheDecryptForTxList.ts
|
|
250
|
+
function useCofheDecryptForTxList({ inputs, acp, chainId, account, onPoll, timeoutMs, retry404TimeoutMs, meta, context }, queryOptions) {
|
|
251
|
+
const { client } = useCofheContext();
|
|
252
|
+
const connectedChainId = useCofheChainId();
|
|
253
|
+
const decryptChainId = chainId ?? connectedChainId;
|
|
254
|
+
const withoutACP = acp === null;
|
|
255
|
+
const effectiveACP = useCofheEffectiveACP({ acp: acp ?? void 0, chainId });
|
|
256
|
+
const scopedACP = effectiveACP.scoped ? effectiveACP.acp : void 0;
|
|
257
|
+
useDropDecryptsOfInvalidACP(effectiveACP);
|
|
258
|
+
const {
|
|
259
|
+
enabled: userEnabled,
|
|
260
|
+
meta: optionMeta,
|
|
261
|
+
retry = defaultDecryptRetry,
|
|
262
|
+
staleTime = Infinity,
|
|
263
|
+
...restQueryOptions
|
|
264
|
+
} = queryOptions || {};
|
|
265
|
+
return useInternalQueries({
|
|
266
|
+
queries: inputs.map((ctHash, index) => {
|
|
267
|
+
const outOfScope = !withoutACP && isHandleOutOfScope(scopedACP, ctHash);
|
|
268
|
+
const enabled = ctHash !== void 0 && BigInt(ctHash) > 0n && !!client && (withoutACP || effectiveACP.isValid) && !outOfScope && (userEnabled ?? true);
|
|
269
|
+
const query = cofheDecryptForTxQuery({
|
|
270
|
+
client,
|
|
271
|
+
ctHash,
|
|
272
|
+
decryptChainId,
|
|
273
|
+
chainId,
|
|
274
|
+
account,
|
|
275
|
+
acp: withoutACP ? null : effectiveACP.acp,
|
|
276
|
+
scoped: effectiveACP.scoped,
|
|
277
|
+
onPoll,
|
|
278
|
+
timeoutMs,
|
|
279
|
+
retry404TimeoutMs,
|
|
280
|
+
meta: typeof meta === "function" ? ctHash !== void 0 ? meta(ctHash, index) : void 0 : meta,
|
|
281
|
+
context
|
|
282
|
+
});
|
|
283
|
+
return {
|
|
284
|
+
enabled,
|
|
285
|
+
queryKey: query.queryKey,
|
|
286
|
+
queryFn: query.queryFn,
|
|
287
|
+
meta: { ...query.meta, ...optionMeta },
|
|
288
|
+
staleTime,
|
|
289
|
+
...restQueryOptions,
|
|
290
|
+
retry
|
|
291
|
+
};
|
|
292
|
+
})
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
252
296
|
// src/hooks/useCofheDecrypter.ts
|
|
297
|
+
import { useCallback, useMemo } from "react";
|
|
253
298
|
import {
|
|
254
299
|
CofheError,
|
|
255
300
|
CofheErrorCode
|
|
@@ -705,6 +750,7 @@ export {
|
|
|
705
750
|
useCofheCreateACP,
|
|
706
751
|
useCofheDecrypt,
|
|
707
752
|
useCofheDecryptForTx,
|
|
753
|
+
useCofheDecryptForTxList,
|
|
708
754
|
useCofheDecryptForViewList,
|
|
709
755
|
useCofheDecrypter,
|
|
710
756
|
useCofheDecryptionActivity,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useCofheDecryptForViewList.ts","../src/hooks/useCofheDecrypter.ts","../src/hooks/useCofheDecryptForTx.ts","../src/index.ts","../src/hooks/useCofheDecryptionActivity.ts"],"sourcesContent":["import { useCofheContext, useInternalQueries } from '@/providers';\nimport { isHandleOutOfScope, useCofheEffectiveACP, type CofheACPInput } from './useCofheACPScope';\nimport { useCofheChainId } from './useCofheConnection';\nimport {\n cofheDecryptForViewQuery,\n defaultDecryptRetry,\n useDropDecryptsOfInvalidACP,\n zeroPlaintext,\n type CofheDecryptContext,\n} from './useCofheDecrypt';\nimport type { DecryptPollCallbackFunction, FheTypes, UnsealedItem } from '@cofhe/sdk';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport type { EncryptedReturnTypeByUtype } from '@cofhe/abi';\nimport type { CofheDecryptMeta } from '@/meta';\n\nexport type UseCofheDecryptForViewListInput<U extends FheTypes> = {\n /** The handles to decrypt, in the order the results come back; `undefined` entries stay idle. */\n inputs: ReadonlyArray<EncryptedReturnTypeByUtype<U> | undefined>;\n /** Consumer-supplied metadata for debug/activity views, one for all or one per entry. */\n meta?: CofheDecryptMeta | ((input: EncryptedReturnTypeByUtype<U>, index: number) => CofheDecryptMeta);\n /** Structural context from the originating read (address/method), for recognition. */\n context?: CofheDecryptContext;\n onPoll?: DecryptPollCallbackFunction;\n /**\n * The chain the ciphertexts live on — the connected chain by default. Gates on and decrypts\n * with THAT chain's active ACP.\n */\n chainId?: number;\n /**\n * Decrypt with this ACP (or the hash of a stored one) instead of the enclosing\n * `<CofheACPScope>` or the active ACP. The active ACP is not changed.\n */\n acp?: CofheACPInput;\n /** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */\n timeoutMs?: number;\n};\n\n/**\n * `useCofheDecrypt` for a list: one query per handle, the same keys, gate, persistence and\n * activity rows, returned in the order of `inputs`. For a list a component renders, or a total it\n * derives from every value, where the handles are known at render time. The client's\n * `decryptConcurrency` cap bounds how many requests run at once, so a long list is safe.\n *\n * A zero handle — a value never set on chain — reads as the type's zero without a request.\n */\nexport function useCofheDecryptForViewList<U extends FheTypes, TSelectedData = UnsealedItem<U>>(\n { inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptForViewListInput<U>,\n queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSelectedData>, 'queryKey' | 'queryFn'>\n): UseQueryResult<TSelectedData, Error>[] {\n const { client } = useCofheContext();\n const connectedChainId = useCofheChainId();\n const decryptChainId = chainId ?? connectedChainId;\n const effectiveACP = useCofheEffectiveACP({ acp, chainId });\n const scopedACP = effectiveACP.scoped ? effectiveACP.acp : undefined;\n useDropDecryptsOfInvalidACP(effectiveACP);\n\n const {\n enabled: userEnabled,\n meta: optionMeta,\n retry = defaultDecryptRetry,\n ...restQueryOptions\n } = queryOptions || {};\n\n return useInternalQueries({\n queries: inputs.map((input, index) => {\n const zero = !!input && BigInt(input.ctHash) === 0n;\n const outOfScope = isHandleOutOfScope(scopedACP, input?.ctHash);\n const enabled = !!input && !zero && !!client && effectiveACP.isValid && !outOfScope && (userEnabled ?? true);\n const query = cofheDecryptForViewQuery<U>({\n client,\n input,\n decryptChainId,\n chainId,\n acp: effectiveACP.acp,\n scoped: effectiveACP.scoped,\n onPoll,\n timeoutMs,\n meta: typeof meta === 'function' ? (input ? meta(input, index) : undefined) : meta,\n context,\n });\n return {\n enabled,\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: { ...query.meta, ...optionMeta },\n ...restQueryOptions,\n retry,\n // The zero handle is its own answer: present from the first render, never fetched.\n ...(zero ? { initialData: zeroPlaintext(input.utype), staleTime: Infinity } : {}),\n };\n }),\n }) as UseQueryResult<TSelectedData, Error>[];\n}\n","import { useCallback, useMemo } from 'react';\nimport { useCofheContext, useInternalQueryClient } from '@/providers';\nimport {\n isHandleOutOfScope,\n useCofheEffectiveACP,\n type CofheACPInput,\n type CofheEffectiveACP,\n} from './useCofheACPScope';\nimport { useCofheChainId } from './useCofheConnection';\nimport {\n cofheDecryptForViewQuery,\n defaultDecryptRetry,\n useDropDecryptsOfInvalidACP,\n zeroPlaintext,\n type CofheDecryptContext,\n} from './useCofheDecrypt';\nimport { cofheDecryptForTxQuery } from './useCofheDecryptForTx';\nimport {\n CofheError,\n CofheErrorCode,\n type FheTypes,\n type DecryptForTxResult,\n type DecryptPollCallbackFunction,\n type UnsealedItem,\n} from '@cofhe/sdk';\nimport type { EncryptedReturnTypeByUtype } from '@cofhe/abi';\nimport type { CofheDecryptMeta } from '@/meta';\n\n/** Per-call options of the function `useCofheDecrypter` returns. */\nexport type CofheDecryptForViewFnOptions = {\n /** Consumer-supplied metadata for debug/activity views. */\n meta?: CofheDecryptMeta;\n /** Structural context from the originating read (address/method), for recognition. */\n context?: CofheDecryptContext;\n onPoll?: DecryptPollCallbackFunction;\n /** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */\n timeoutMs?: number;\n /**\n * A cached plaintext younger than this is returned without a request. `Infinity` by default: a\n * plaintext never changes, so a handle decrypted once (by this function or by `useCofheDecrypt`)\n * is never decrypted again.\n */\n staleTime?: number;\n /** Retry policy of a failed request; by default a `CofheError` is final and anything else is retried 3 times. */\n retry?: boolean | number | ((failureCount: number, error: Error) => boolean);\n /**\n * Stops the call when it fires: a call still waiting for a concurrency slot never starts, a\n * request in flight is aborted, and the call rejects with `Aborted`. A plaintext already in the\n * cache is still returned.\n */\n signal?: AbortSignal;\n};\n\n/** Decrypts one handle; see `useCofheDecrypter`. */\nexport type CofheDecryptForViewFn = <U extends FheTypes>(\n input: EncryptedReturnTypeByUtype<U>,\n options?: CofheDecryptForViewFnOptions\n) => Promise<UnsealedItem<U>>;\n\n/** Per-call options of `decryptForTx`; see `useCofheDecrypter`. */\nexport type CofheDecryptForTxFnOptions = CofheDecryptForViewFnOptions & {\n /**\n * `null`: the contract allowed the handle publicly (`FHE.allowPublic`), so it decrypts without\n * an ACP and does not wait for one. Otherwise the hook's ACP decrypts, as for `decryptForView`.\n */\n acp?: null;\n /** The account whose stored ACPs resolve the active ACP; the connected account by default. */\n account?: string;\n /** How long a submit-time `404 ct_not_found` (handle not indexed yet) is retried; 10 seconds by default. */\n retry404TimeoutMs?: number;\n};\n\n/** Decrypts one handle into a plaintext with the network's signature; see `useCofheDecrypter`. */\nexport type CofheDecryptForTxFn = (\n ctHash: bigint | string,\n options?: CofheDecryptForTxFnOptions\n) => Promise<DecryptForTxResult>;\n\nexport type UseCofheDecrypterOptions = {\n /**\n * The chain the ciphertexts live on — the connected chain by default. Gates on and decrypts\n * with THAT chain's active ACP, e.g. for values read through a chain-pinned read.\n */\n chainId?: number;\n /**\n * Decrypt with this ACP (or the hash of a stored one) instead of the enclosing\n * `<CofheACPScope>` or the active ACP. The active ACP is not changed.\n */\n acp?: CofheACPInput;\n /** How many requests one caller runs at a time; the rest wait their turn. 4 by default. */\n concurrency?: number;\n};\n\nexport type UseCofheDecrypterResult = {\n /** Decrypts one handle through the decrypt cache; rejects without a request while `isReady` is false. */\n decryptForView: CofheDecryptForViewFn;\n /**\n * Decrypts one handle into a plaintext with the threshold network's signature, for a contract to\n * verify on chain, through the same cache as `useCofheDecryptForTx`. With `acp: null` it needs\n * only the client, not `isReady`.\n */\n decryptForTx: CofheDecryptForTxFn;\n /** A client and a valid ACP are at hand, so a call can run. */\n isReady: boolean;\n /** The ACP `decryptForView` uses, with its status: why `isReady` is false, when it is. */\n acp: CofheEffectiveACP;\n};\n\n/** The reasons a call must not be sent: no valid ACP, or a SNAPSHOT share that does not list the handle. */\nfunction assertACPDecrypts(effectiveACP: CofheEffectiveACP, ctHash: bigint | string, operation: string): void {\n const { acp, scoped, status } = effectiveACP;\n if (!effectiveACP.isValid) {\n throw new CofheError({\n code: status === 'expired' ? CofheErrorCode.ACPExpired : CofheErrorCode.ACPRequired,\n message: `${operation}: no valid ACP to decrypt with (${status})`,\n hint: 'Create or activate an ACP, or wait for the chosen one to be checked, before decrypting.',\n });\n }\n if (isHandleOutOfScope(scoped ? acp : undefined, ctHash)) {\n throw new CofheError({\n code: CofheErrorCode.ACPDenied,\n message: `${operation}: the handle is not listed in the SNAPSHOT share that would decrypt it`,\n context: { ctHash: ctHash.toString(), acpHash: acp?.hash },\n });\n }\n}\n\nfunction abortedError(operation: string, signal: AbortSignal): CofheError {\n return new CofheError({\n code: CofheErrorCode.Aborted,\n message: `${operation} aborted by the caller`,\n cause: signal.reason instanceof Error ? signal.reason : undefined,\n });\n}\n\n/**\n * Runs tasks at most `max` at a time, in call order. A task whose `signal` fires while it waits\n * for a slot leaves the queue and rejects without ever starting.\n */\nfunction createLimiter(\n max: number\n): <T>(task: () => Promise<T>, operation: string, signal?: AbortSignal) => Promise<T> {\n let active = 0;\n const waiting: Array<() => void> = [];\n return async (task, operation, signal) => {\n if (signal?.aborted) throw abortedError(operation, signal);\n if (active >= max) {\n await new Promise<void>((resume, reject) => {\n const onAbort = () => {\n const index = waiting.indexOf(start);\n if (index >= 0) waiting.splice(index, 1);\n reject(abortedError(operation, signal!));\n };\n const start = () => {\n signal?.removeEventListener('abort', onAbort);\n resume();\n };\n signal?.addEventListener('abort', onAbort, { once: true });\n waiting.push(start);\n });\n }\n active += 1;\n try {\n return await task();\n } finally {\n active -= 1;\n waiting.shift()?.();\n }\n };\n}\n\n/**\n * The imperative counterpart of `useCofheDecrypt`: a function that decrypts one handle on demand,\n * for the work a component does not render per value — a job the user starts over a list of\n * handles (a history to sum, a set of bids to reveal), from the handler that starts it.\n *\n * Each call is the same query `useCofheDecrypt` would run — same cache key, same gate, same\n * persistence, same activity row — so a handle decrypted either way is decrypted once, and\n * `decryptForView` returns a cached plaintext without a request. Calls run at most `concurrency` at a\n * time; fan out with `Promise.all` freely.\n *\n * Without a valid ACP, or with a SNAPSHOT share that does not list the handle, `decryptForView` rejects\n * with a `CofheError` and sends nothing. A zero handle resolves to the type's zero without a request.\n *\n * `decryptForTx` is the same for a proof — the plaintext with the threshold network's signature,\n * for a contract to verify — through the cache of `useCofheDecryptForTx`. A proof is a read too: a\n * handle maps to one plaintext forever, so a handle proved once is never requested again. `acp:\n * null` decrypts a publicly allowed handle without an ACP, and then needs only the client.\n */\nexport function useCofheDecrypter({\n chainId,\n acp,\n concurrency = 4,\n}: UseCofheDecrypterOptions = {}): UseCofheDecrypterResult {\n const { client } = useCofheContext();\n const queryClient = useInternalQueryClient();\n const connectedChainId = useCofheChainId();\n const decryptChainId = chainId ?? connectedChainId;\n const effectiveACP = useCofheEffectiveACP({ acp, chainId });\n useDropDecryptsOfInvalidACP(effectiveACP);\n const limit = useMemo(() => createLimiter(concurrency), [concurrency]);\n\n const isReady = !!client && effectiveACP.isValid;\n const { acp: decryptACP, scoped } = effectiveACP;\n\n const decryptForView = useCallback<CofheDecryptForViewFn>(\n async (input, options) => {\n if (!client) {\n throw new CofheError({ code: CofheErrorCode.InternalError, message: 'CoFHE client not initialized' });\n }\n if (BigInt(input.ctHash) === 0n) return zeroPlaintext(input.utype);\n assertACPDecrypts(effectiveACP, input.ctHash, 'decryptForView');\n const query = cofheDecryptForViewQuery({\n client,\n input,\n decryptChainId,\n chainId,\n acp: decryptACP,\n scoped,\n onPoll: options?.onPoll,\n timeoutMs: options?.timeoutMs,\n signal: options?.signal,\n meta: options?.meta,\n context: options?.context,\n });\n return limit(\n () =>\n queryClient.fetchQuery({\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: query.meta,\n staleTime: options?.staleTime ?? Infinity,\n retry: options?.retry ?? defaultDecryptRetry,\n }),\n 'decryptForView',\n options?.signal\n );\n },\n [client, queryClient, decryptChainId, chainId, decryptACP, scoped, effectiveACP, limit]\n );\n\n const decryptForTx = useCallback<CofheDecryptForTxFn>(\n async (ctHash, options) => {\n if (!client) {\n throw new CofheError({ code: CofheErrorCode.InternalError, message: 'CoFHE client not initialized' });\n }\n if (BigInt(ctHash) === 0n) {\n throw new CofheError({\n code: CofheErrorCode.DecryptFailed,\n message: 'decryptForTx: the zero handle has no value to prove',\n hint: 'A zero handle is a value never set on chain; nothing can be revealed from it.',\n });\n }\n const withoutACP = options?.acp === null;\n if (!withoutACP) assertACPDecrypts(effectiveACP, ctHash, 'decryptForTx');\n const query = cofheDecryptForTxQuery({\n client,\n ctHash,\n decryptChainId,\n chainId,\n account: options?.account,\n acp: withoutACP ? null : decryptACP,\n scoped,\n onPoll: options?.onPoll,\n timeoutMs: options?.timeoutMs,\n retry404TimeoutMs: options?.retry404TimeoutMs,\n signal: options?.signal,\n meta: options?.meta,\n context: options?.context,\n });\n return limit(\n () =>\n queryClient.fetchQuery({\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: query.meta,\n staleTime: options?.staleTime ?? Infinity,\n retry: options?.retry ?? defaultDecryptRetry,\n }),\n 'decryptForTx',\n options?.signal\n );\n },\n [client, queryClient, decryptChainId, chainId, decryptACP, scoped, effectiveACP, limit]\n );\n\n return { decryptForView, decryptForTx, isReady, acp: effectiveACP };\n}\n","import { useCofheContext, useInternalQuery } from '@/providers';\nimport { isHandleOutOfScope, useCofheEffectiveACP, type CofheACPInput } from './useCofheACPScope';\nimport { useCofheChainId } from './useCofheConnection';\nimport { defaultDecryptRetry, useDropDecryptsOfInvalidACP, type CofheDecryptContext } from './useCofheDecrypt';\nimport type { CofheClient, DecryptForTxResult, DecryptPollCallbackFunction } from '@cofhe/sdk';\nimport type { ACP } from '@cofhe/sdk/acps';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { assert } from 'ts-essentials';\nimport type { CofheDecryptMeta, CofheQueryMeta } from '@/meta';\nimport { anySignal } from '@/utils/abortSignal';\n\n/**\n * The cache key of one tx decrypt: a handle decrypted on one chain into a plaintext with the\n * threshold network's signature — `[prefix, chainId, ctHash, acpHash]`. `acpHash` names the ACP\n * that decrypts, or is `null` for a handle the contract allowed publicly, decrypted without one.\n * No `utype` segment: the network signs the plaintext as an integer, whatever the handle's type.\n */\nexport function constructCofheDecryptForTxQueryKey(params: {\n ctHash: string | undefined;\n chainId: number | undefined;\n acpHash: string | null | undefined;\n}): readonly unknown[] {\n return ['decryptForTx', params.chainId, params.ctHash, params.acpHash];\n}\n\n/**\n * The query one tx decrypt runs as — its key, its `queryFn` and its `meta` — shared by\n * `useCofheDecryptForTx` and `useCofheDecrypter`, so a proof fetched either way is the same cache\n * entry. A proof is a read: a handle maps to one plaintext forever and the contract verifies only\n * `(ctHash, value, signature)`, so nothing but the handle and the ACP keys it.\n */\nexport function cofheDecryptForTxQuery(params: {\n client: CofheClient;\n ctHash: bigint | string | undefined;\n /** The chain the decrypt runs on: the caller's `chainId`, else the connected chain. */\n decryptChainId: number | undefined;\n /** The caller's explicit `chainId`, set on the builder when given. */\n chainId?: number;\n /** The account whose stored ACPs resolve the active ACP, set on the builder when given. */\n account?: string;\n /**\n * The ACP that decrypts, and whether it was chosen explicitly (a hook option or a scope);\n * `null` for a publicly allowed handle (`FHE.allowPublic`), which needs none.\n */\n acp: ACP | null | undefined;\n scoped: boolean;\n onPoll?: DecryptPollCallbackFunction;\n timeoutMs?: number;\n retry404TimeoutMs?: number;\n /** The caller's abort signal; React Query's own (query cancelled) is joined to it in `queryFn`. */\n signal?: AbortSignal;\n meta?: CofheDecryptMeta;\n context?: CofheDecryptContext;\n}): {\n queryKey: readonly unknown[];\n queryFn: (context?: { signal?: AbortSignal }) => Promise<DecryptForTxResult>;\n // Also a plain record: that is what `fetchQuery` and `useQuery` type `meta` as.\n meta: Record<string, unknown> & CofheQueryMeta & { persist: boolean };\n} {\n const { client, ctHash, decryptChainId, chainId, account, acp, scoped, onPoll, timeoutMs, retry404TimeoutMs } =\n params;\n const { signal, meta, context } = params;\n const scopedACP = scoped && acp ? acp : undefined;\n return {\n queryKey: constructCofheDecryptForTxQueryKey({\n ctHash: ctHash?.toString(),\n chainId: decryptChainId,\n acpHash: acp === null ? null : acp?.hash,\n }),\n queryFn: async (queryContext) => {\n assert(ctHash !== undefined, 'a tx decrypt query only runs with a handle');\n const builder = client.decryptForTx(ctHash);\n if (chainId !== undefined) builder.setChainId(chainId);\n if (account !== undefined) builder.setAccount(account);\n if (onPoll) builder.onPoll(onPoll);\n if (timeoutMs !== undefined) builder.setTimeout(timeoutMs);\n if (retry404TimeoutMs !== undefined) builder.set404RetryTimeout(retry404TimeoutMs);\n const abort = anySignal([signal, queryContext?.signal]);\n if (abort) builder.setSignal(abort);\n const selected = acp === null ? builder.withoutACP() : scopedACP ? builder.withACP(scopedACP) : builder.withACP();\n return selected.execute();\n },\n meta: {\n // Same rule as a view decrypt: persist what the user own ACP decrypts. A publicly allowed\n // handle's proof is public data, so it persists too; one decrypted with a shared ACP must\n // not outlive the share, so it stays in memory.\n persist: acp === null || acp?.type === 'self',\n kind: 'cofheDecryptForTx',\n ctHash: ctHash?.toString(),\n chainId: context?.chainId ?? decryptChainId,\n address: context?.address,\n functionName: context?.functionName,\n consumer: meta,\n },\n };\n}\n\nexport type UseCofheDecryptForTxInput = {\n /** The handle to decrypt; the query is disabled without one, or for the zero handle. */\n ctHash?: bigint | string;\n /**\n * The ACP to decrypt with: an ACP, the hash of a stored one, the enclosing `<CofheACPScope>`\n * or the active ACP when omitted, or `null` for a handle the contract allowed publicly\n * (`FHE.allowPublic`), which needs none and so never waits for one.\n */\n acp?: CofheACPInput | null;\n /**\n * The chain the handle lives on — the connected chain by default. Gates on and decrypts\n * with THAT chain's active ACP, e.g. for a value read through a chain-pinned read.\n */\n chainId?: number;\n /** The account whose stored ACPs resolve a hash or the active ACP; the connected account by default. */\n account?: string;\n onPoll?: DecryptPollCallbackFunction;\n /** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */\n timeoutMs?: number;\n /** How long a submit-time `404 ct_not_found` (handle not indexed yet) is retried; 10 seconds by default. */\n retry404TimeoutMs?: number;\n /** Consumer-supplied metadata for debug/activity views. */\n meta?: CofheDecryptMeta;\n /** Structural context from the originating read (address/method), for recognition. */\n context?: CofheDecryptContext;\n};\n\n/**\n * Query hook around `client.decryptForTx`: the plaintext of a handle with the threshold network's\n * signature over it, for a contract to verify on chain (`FHE.verifyDecryptResult` /\n * `FHE.publishDecryptResult`). The declarative counterpart of `useCofheDecrypter().decryptForTx`:\n * mount it on the page that will send the transaction and the proof is ready before the click.\n *\n * A proof never changes, so the query is `staleTime: Infinity` by default and a handle proved\n * once (either way) is never requested again. Like `useCofheDecrypt` it waits for a valid ACP\n * rather than prompting for one — unless `acp` is `null`, when no ACP is involved at all.\n */\nexport function useCofheDecryptForTx<TSelectedData = DecryptForTxResult>(\n { ctHash, acp, chainId, account, onPoll, timeoutMs, retry404TimeoutMs, meta, context }: UseCofheDecryptForTxInput,\n queryOptions?: Omit<UseQueryOptions<DecryptForTxResult, Error, TSelectedData>, 'queryKey' | 'queryFn'>\n): UseQueryResult<TSelectedData, Error> {\n const { client } = useCofheContext();\n const connectedChainId = useCofheChainId();\n const decryptChainId = chainId ?? connectedChainId;\n const withoutACP = acp === null;\n // With `acp: null` the ACP below is not used; the hook still runs (hooks are unconditional) and\n // its drop effect is the same one `useCofheDecrypt` runs for that ACP.\n const effectiveACP = useCofheEffectiveACP({ acp: acp ?? undefined, chainId });\n const scopedACP = effectiveACP.scoped ? effectiveACP.acp : undefined;\n useDropDecryptsOfInvalidACP(effectiveACP);\n\n const {\n enabled: userEnabled,\n meta: optionMeta,\n retry = defaultDecryptRetry,\n staleTime = Infinity,\n ...restQueryOptions\n } = queryOptions || {};\n const outOfScope = !withoutACP && isHandleOutOfScope(scopedACP, ctHash);\n const enabled =\n ctHash !== undefined &&\n BigInt(ctHash) > 0n &&\n !!client &&\n (withoutACP || effectiveACP.isValid) &&\n !outOfScope &&\n (userEnabled ?? true);\n\n const query = cofheDecryptForTxQuery({\n client,\n ctHash,\n decryptChainId,\n chainId,\n account,\n acp: withoutACP ? null : effectiveACP.acp,\n scoped: effectiveACP.scoped,\n onPoll,\n timeoutMs,\n retry404TimeoutMs,\n meta,\n context,\n });\n\n return useInternalQuery({\n enabled,\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: { ...query.meta, ...optionMeta },\n staleTime,\n ...restQueryOptions,\n retry,\n });\n}\n","// Providers\nexport { CofheProvider, useCofheContext } from './providers/index';\n\n// Hooks\nexport {\n ETH_ADDRESS_LOWERCASE,\n getCofheTokenClaimUnshieldedCallArgs,\n getCofheTokenShieldCallArgs,\n getCofheTokenUnshieldCallArgs,\n useCofheActiveACP,\n useCofheACPs,\n useCofheAllACPs,\n useCofheClient,\n useCofheConnection,\n useCofheEnabled,\n useCofheTaskManagerAddress,\n useCofheEncrypt,\n useCofhePublicClient,\n useCofheRemoveACP,\n useCofheSelectACP,\n useCofheSimulateWriteContract,\n useCofheStatuses,\n useCofheTokenClaimable,\n useCofheTokenClaims,\n useCofheTokenApprove,\n useCofheTokenClaimUnshielded,\n useCofheTokenDecryptedBalance,\n useCofheTokenPublicBalance,\n useCofheTokenLists,\n useCofheToken,\n useKnownCofheToken,\n useCofheTokens,\n useCofheTokensClaimable,\n useCofheTokenShield,\n useCofheTokensWithExistingEncryptedBalances,\n useCofheTokenTransactions,\n useCofheTokenTransfer,\n useResolvedCofheToken,\n useCofheTransactions,\n addCofheTransaction,\n useCofheTokenUnshield,\n useCofheWalletClient,\n useCofheWriteContract,\n useCoingeckoContractMarketChartRange,\n useCoingeckoUsdPrice,\n useTokenAllowance,\n useTokensWithPublicBalances,\n useTransactionReceiptsByHash,\n type ClaimableAmountByTokenAddress,\n type CoingeckoMarketChartPoint,\n type Erc20Pair,\n type UnshieldClaim,\n type UnshieldClaimsSummary,\n type UnshieldClaimsSummaryByTokenAddress,\n type UseCoingeckoContractMarketChartRangeInput,\n type UseCoingeckoContractMarketChartRangeOptions,\n type UseCoingeckoUsdPriceInput,\n type UseCoingeckoUsdPriceOptions,\n type UseCofheTokenTransactionsInput,\n type UseCofheTokenTransactionsResult,\n type UseTransactionReceiptsByHashInput,\n type AddCofheTransactionInput,\n} from '@/hooks/index';\n\nexport { useCofheEncryptAndWriteContract } from '@/hooks/useCofheEncryptAndWriteContract';\nexport { useCofheReadContractAndDecrypt } from '@/hooks/useCofheReadContractAndDecrypt';\nexport {\n useCofheDecrypt,\n cofheDecryptForViewQuery,\n constructCofheDecryptForViewQueryKey,\n type CofheDecryptContext,\n} from '@/hooks/useCofheDecrypt';\nexport { useCofheDecryptForViewList, type UseCofheDecryptForViewListInput } from '@/hooks/useCofheDecryptForViewList';\nexport {\n useCofheDecrypter,\n type CofheDecryptForViewFn,\n type CofheDecryptForViewFnOptions,\n type CofheDecryptForTxFn,\n type CofheDecryptForTxFnOptions,\n type UseCofheDecrypterOptions,\n type UseCofheDecrypterResult,\n} from '@/hooks/useCofheDecrypter';\nexport {\n useCofheDecryptForTx,\n cofheDecryptForTxQuery,\n constructCofheDecryptForTxQueryKey,\n type UseCofheDecryptForTxInput,\n} from '@/hooks/useCofheDecryptForTx';\nexport {\n CofheACPScope,\n useCofheACPScope,\n useCofheACPStatus,\n type CofheACPInput,\n type CofheACPScopeValue,\n type CofheACPStatus,\n} from '@/hooks/useCofheACPScope';\nexport {\n useCofheIncomingShares,\n useCofheShareOnChain,\n useCofheImportShared,\n useCofheRemoveShare,\n useCofheRevokeACP,\n} from '@/hooks/acps/useOnChainSharing';\nexport {\n useCofheShareLabels,\n type CofheShareLabel,\n type UseCofheShareLabelsResult,\n} from '@/hooks/acps/useCofheShareLabels';\nexport {\n useCofheReadContract,\n constructCofheReadContractQueryForInvalidation,\n type UseCofheReadContractResult,\n type UseCofheReadContractQueryOptions,\n} from '@/hooks/useCofheReadContract';\nexport {\n useCofheReadContracts,\n type CofheReadContractsContract,\n type CofheReadContractsItem,\n type CofheReadContractsData,\n type CofheReadContractsEntry,\n type CofheReadContractsEntries,\n type CofheReadContractsEntryResult,\n type UseCofheReadContractsResult,\n type UseCofheReadContractsQueryOptions,\n} from '@/hooks/useCofheReadContracts';\nexport {\n type useCofheWriteContractOptions,\n type CofheWriteInvalidationTarget,\n type CofheWriteInvalidates,\n type CofheReadInvalidationDescriptor,\n} from '@/hooks/useCofheWriteContract';\n\n// Utils\nexport {\n FheTypesList,\n formatRelativeTime,\n getBlockExplorerAddressUrl,\n getBlockExplorerTokenUrl,\n getBlockExplorerTxUrl,\n getBlockExplorerUrl,\n isEthPair,\n isWrappedEthToken,\n truncateHash,\n} from './utils/index';\n\n// Stores\nexport { useCustomTokensStore } from './stores/customTokensStore';\n\nexport {\n actionToString,\n isCustomTransactionActionType,\n statusToString,\n transactionMatchesToken,\n TransactionActionType,\n TransactionStatus,\n useTransactionStore,\n type Transaction,\n type BuiltInTransactionActionType,\n type CustomTransactionActionType,\n type SharingTransactionActionType,\n type JsonValue,\n type NewTransaction,\n type TransactionActionString,\n type TransactionStatusString,\n type TransactionStore,\n} from './stores/transactionStore';\n\nexport { createCofheConfig } from './config';\nexport type { CofheReactLogger, CofheReactLoggerMethod } from './config';\n\n// Types\nexport type {\n CofheClientConfig,\n CofheContextValue,\n CofheProviderProps,\n TransactionRenderer,\n TransactionRendererProps,\n TransactionRenderers,\n} from './types/index';\n\nexport { createCofheClient } from '@cofhe/sdk/web';\n\nexport { useCofheCreateACP } from '@/hooks/acps/useCofheCreateACP';\nexport { useCofheNavigateToCreateACP } from '@/hooks/acps/useCofheNavigateToCreateACP';\nexport { useCofheAutoConnect } from '@/hooks/useCofheAutoConnect';\nexport { CofheFloatingButtonProvider, sortCofheStatuses } from './components/index';\nexport { COFHE_STATUS_IDS, CofheStatusActionIntents } from './components/CofheFloatingButton/types';\n\nexport type { CofheConfigWithReact as CofhesdkConfigWithReact } from './config';\n\nexport type { CofheStatus, CofheStatusActionIntent, CofheStatusId } from './components/CofheFloatingButton/types';\nexport type { ConfidentialToken } from './types/token';\nexport { getConfidentialDecimals, getPublicDecimals, getPublicSymbol } from './types/token';\nexport { scaleAmount, quantizeAmount } from './utils/format';\n\nexport type { CofheDecryptMeta, CofheQueryMeta } from './meta';\n\nexport { useCofheDecryptionActivity } from '@/hooks/useCofheDecryptionActivity';\nexport type {\n DecryptionActivityRow,\n DecryptionActivityResult,\n DecryptionActivityCategory,\n UseCofheDecryptionActivityOptions,\n FetchStageState,\n DecryptStageState,\n ACPState,\n} from '@/hooks/useCofheDecryptionActivity';\n\nexport { useInternalQueryClient } from './providers/index';\n\n// Type bridges for cross-repo / multi-instance viem peer dependency scenarios\nexport {\n asCofhePublicClient,\n tryAsCofhePublicClient,\n asCofheWalletClient,\n tryAsCofheWalletClient,\n} from './utils/viemClientBridge';\nexport type {\n PublicClientLike as CofhePublicClientLike,\n WalletClientLike as CofheWalletClientLike,\n} from './utils/viemClientBridge';\n\n// Block-aware cache invalidation primitives.\n//\n// These are the building blocks behind the SDK's own \"wait until the serving RPC\n// node has the mined block before returning a read\" behaviour. They are exported\n// so consumers (e.g. a wagmi-based app) can build the same reliability into their\n// own reads + post-tx invalidation, sharing THIS module's single invalidation-\n// context store — so an invalidation registered here is honoured by both the\n// SDK's confidential reads and the consumer's own block-aware queries.\nexport {\n invalidateQueriesWithContext,\n withInvalidationContext,\n findMatchingInvalidationContext,\n type InvalidationContextQueryFilters,\n type QueryFunctionWithInvalidationContext,\n} from './utils/invalidationContext';\nexport {\n maybeWaitUntilRpcAware,\n maybeWaitUntilRpcAwareAndReadContract,\n type WaitUntilRpcAwareAndReadContractOptions,\n type ReadContractResult,\n} from './utils/waitUntilRpcAwareAndReadContract';\nexport { resolveReceiptBlockHash } from './utils/resolveReceiptBlockHash';\nexport { useInvalidationContextStore, type InvalidationContextEntry } from './stores/invalidationContextStore';\n","import { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';\nimport { useInternalQueryClient } from '@/providers';\nimport { useCofheAccount, useCofheChainId } from './useCofheConnection';\nimport { useCofheActiveACP } from './useCofheACPs';\nimport type { CofheQueryMeta } from '@/meta';\n\n// ============================================================================\n// Decryption activity — the lifecycle view of confidential reads + decryptions.\n// ============================================================================\n//\n// A confidential value is a two-stage pipeline, both stages living as react-query\n// queries on the SDK's internal QueryClient:\n// A) FETCH — read the ciphertext handle on-chain (`cofheReadContract`),\n// whose data carries the `ctHash`.\n// B) DECRYPT— decrypt that handle off-chain (`decryptCiphertext`, keyed\n// by chain AND ctHash).\n//\n// This hook observes the cache, correlates the two stages by ctHash, and returns\n// one row per confidential value with a recognizable contract/method/label (from\n// each query's `meta`) — surfacing states a plain error/loading flag can't:\n// • \"blocked\" — gated off by a missing/invalid acp (never runs, never errors)\n// • \"stale\" — fetched, but the decrypt is pending far too long / never lands\n// Consumers render the rows; no query-key parsing or side registries required.\n\nconst DEFAULT_STALE_MS = 25_000;\nconst nowSec = () => Math.floor(Date.now() / 1000);\n\n/** 'idle' = a read/decrypt query exists but is disabled/never-ran (fetchStatus 'idle'), vs 'pending' (in flight). */\nexport type FetchStageState = 'ok' | 'pending' | 'idle' | 'error' | 'empty';\nexport type DecryptStageState = 'ok' | 'pending' | 'idle' | 'stale' | 'error' | 'blocked' | 'absent';\nexport type ACPState = 'valid' | 'expired' | 'unsigned' | 'none';\n/** Coarse bucket for filtering: something wrong / decrypted / nothing conclusive. */\nexport type DecryptionActivityCategory = 'error' | 'success' | 'idle';\n\nexport interface DecryptionActivityRow {\n key: string;\n /** Canonical decimal ctHash, when known. */\n ctHash?: string;\n /** 0x…-shortened ctHash for display. */\n ctHashShort?: string;\n /** The originating query metadata (contract / method / label / consumer fields). */\n meta?: CofheQueryMeta;\n /** Convenience shortcuts pulled from meta. */\n chainId?: number;\n address?: string;\n functionName?: string;\n label?: string;\n fetch: FetchStageState;\n decrypt: DecryptStageState;\n category: DecryptionActivityCategory;\n /** Why the row is blocked, e.g. \"acp none\". */\n blockedReason?: string;\n /** How long the decrypt has been pending, ms (drives \"stale\"). */\n pendingMs?: number;\n updatedAt: number;\n /** Whether re-running is possible (false for gated/idle reads with nothing enabled). */\n canRetry: boolean;\n /** Re-run this value's read and/or decrypt. */\n retry: () => void;\n}\n\nexport interface DecryptionActivityResult {\n rows: DecryptionActivityRow[];\n counts: { total: number; ok: number; pending: number; stale: number; blocked: number; error: number };\n acp: { state: ACPState; expiresInSec?: number };\n /** Wipe the whole SDK query cache; mounted reads/decryptions refetch from scratch. */\n clearCache: () => void;\n}\n\nexport interface UseCofheDecryptionActivityOptions {\n /** How long a decrypt may stay pending before it's reported \"stale\" (default 25s). */\n staleMs?: number;\n}\n\n// Minimal structural view of a cached query — enough to classify without depending\n// on react-query's concrete generic types.\ninterface QueryLike {\n queryKey: unknown;\n queryHash: string;\n meta?: CofheQueryMeta;\n state: { status: 'pending' | 'error' | 'success'; fetchStatus?: string; data?: unknown; dataUpdatedAt?: number };\n}\ninterface CacheLike {\n getAll: () => QueryLike[];\n subscribe: (cb: () => void) => () => void;\n}\ninterface ClientLike {\n getQueryCache: () => CacheLike;\n refetchQueries: (filters: { queryKey: unknown; exact?: boolean }) => Promise<unknown>;\n clear: () => void;\n}\n\nfunction normalizeCt(x: unknown): string | undefined {\n if (x === null || x === undefined) return undefined;\n try {\n return BigInt(x as string | number | bigint).toString();\n } catch {\n const s = String(x);\n return s && s !== '[object Object]' ? s : undefined;\n }\n}\n\n// A ctHash of 0 is not a real handle: reads return it for an absent/encrypted-zero\n// value and the decrypt is gated on `ctHash > 0n`, so treat it as \"no handle\".\nfunction isZeroCt(ct: string | undefined): boolean {\n if (!ct) return false;\n try {\n return BigInt(ct) === 0n;\n } catch {\n return false;\n }\n}\n\nfunction shortCt(decimal: string): string {\n try {\n const hex = BigInt(decimal).toString(16);\n return hex.length > 10 ? `0x${hex.slice(0, 6)}…${hex.slice(-4)}` : `0x${hex}`;\n } catch {\n return decimal;\n }\n}\n\nfunction extractCtHash(data: unknown): string | undefined {\n if (data === null || data === undefined) return undefined;\n if (typeof data === 'bigint') return normalizeCt(data);\n if (typeof data === 'object' && data !== null && 'ctHash' in (data as Record<string, unknown>)) {\n return normalizeCt((data as { ctHash: unknown }).ctHash);\n }\n return undefined;\n}\n\n// The read key bakes the transient activeACPHash + enabled flags into its tail,\n// so the SAME value gets a fresh cache entry each time an ACP appears/rotates.\n// Its stable identity is [prefix, chainId, address, fn, args] (indices 0-4).\nfunction stableReadKey(k: unknown[]): string {\n try {\n return JSON.stringify(k.slice(0, 5));\n } catch {\n return String(k[1]) + '|' + String(k[2]) + '|' + String(k[3]);\n }\n}\n\n// Progress of a read: ran (success/error) > in flight > idle/never-ran.\nfunction readProgress(q: QueryLike): number {\n if (q.state.status === 'success' || q.state.status === 'error') return 2;\n if (q.state.fetchStatus === 'fetching') return 1;\n return 0;\n}\nfunction isFresherRead(candidate: QueryLike, current: QueryLike): boolean {\n const pc = readProgress(candidate);\n const pk = readProgress(current);\n if (pc !== pk) return pc > pk;\n return (candidate.state.dataUpdatedAt ?? 0) > (current.state.dataUpdatedAt ?? 0);\n}\n\nfunction categoryFor(fetch: FetchStageState, decrypt: DecryptStageState): DecryptionActivityCategory {\n if (fetch === 'error' || decrypt === 'error' || decrypt === 'blocked' || decrypt === 'stale') return 'error';\n if (decrypt === 'ok') return 'success';\n return 'idle';\n}\n\n/**\n * Observe the ctHash-fetch → decrypt pipeline on the SDK's QueryClient, correlated\n * by ctHash and cross-referenced against the active acp. Must be used inside the\n * Cofhe provider.\n */\nexport function useCofheDecryptionActivity(options?: UseCofheDecryptionActivityOptions): DecryptionActivityResult {\n const staleMs = options?.staleMs ?? DEFAULT_STALE_MS;\n const queryClient = useInternalQueryClient() as unknown as ClientLike;\n const account = useCofheAccount();\n const chainId = useCofheChainId();\n const active = useCofheActiveACP();\n const acpObj = active?.acp;\n\n // Track when each decrypt first went pending, so \"stale\" is real elapsed time\n // (react-query doesn't expose a fetch-start timestamp for a never-resolved query).\n const pendingSinceRef = useRef(new Map<string, number>());\n\n // Re-render on cache changes AND on a slow tick (staleness is time-based, not\n // event-driven — a query sitting pending emits no cache events).\n //\n // Coalesce cache events to one bump per animation frame. `cache.subscribe` fires\n // synchronously on EVERY cache event (including observer option/result updates),\n // and a consumer re-render can itself emit fresh cache events — an unbounded\n // bump→render→event→bump storm that pins the main thread and starves unrelated\n // updates (e.g. a route change never commits). One bump per frame keeps the view\n // live while capping re-renders so the loop can't run away.\n const [version, bump] = useReducer((n: number) => n + 1, 0);\n useEffect(() => {\n const cache = queryClient.getQueryCache();\n let scheduled = false;\n const schedule = () => {\n if (scheduled) return;\n scheduled = true;\n const run = () => {\n scheduled = false;\n bump();\n };\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(run);\n else setTimeout(run, 16);\n };\n const unsub = cache.subscribe(schedule);\n const tick = setInterval(bump, 5_000);\n return () => {\n unsub();\n clearInterval(tick);\n };\n }, [queryClient]);\n\n const clearCache = useCallback(() => queryClient.clear(), [queryClient]);\n\n const data = useMemo(() => {\n const cache = queryClient.getQueryCache();\n const queries = cache.getAll();\n const now = Date.now();\n\n const refetch = (key: unknown) => void queryClient.refetchQueries({ queryKey: key, exact: true });\n\n const acpState: ACPState = !acpObj\n ? 'none'\n : !acpObj.issuerSignature || acpObj.issuerSignature === '0x'\n ? 'unsigned'\n : acpObj.expiration <= nowSec()\n ? 'expired'\n : 'valid';\n const acpValid = acpState === 'valid';\n\n // Index decrypt queries by ctHash (source contract + label come from meta).\n const decryptByCt = new Map<\n string,\n { state: 'ok' | 'pending' | 'idle' | 'error'; pendingMs?: number; key?: unknown; meta?: CofheQueryMeta }\n >();\n const seenPending = new Set<string>();\n for (const q of queries) {\n const k = q.queryKey;\n // [prefix, chainId, ctHash, utype, acpHash] — see constructCofheDecryptForViewQueryKey.\n if (!Array.isArray(k) || k[0] !== 'decryptCiphertext') continue;\n const ct = normalizeCt(k[2]);\n if (!ct || isZeroCt(ct)) continue;\n const base = { key: q.queryKey, meta: q.meta };\n if (q.state.status === 'success') {\n decryptByCt.set(ct, { state: 'ok', ...base });\n pendingSinceRef.current.delete(ct);\n } else if (q.state.status === 'error') {\n decryptByCt.set(ct, { state: 'error', ...base });\n pendingSinceRef.current.delete(ct);\n } else if (q.state.fetchStatus === 'fetching') {\n seenPending.add(ct);\n let since = pendingSinceRef.current.get(ct);\n if (since === undefined) {\n since = now;\n pendingSinceRef.current.set(ct, since);\n }\n decryptByCt.set(ct, { state: 'pending', pendingMs: now - since, ...base });\n } else {\n // status 'pending' but fetchStatus 'idle' → disabled / never ran.\n pendingSinceRef.current.delete(ct);\n decryptByCt.set(ct, { state: 'idle', ...base });\n }\n }\n\n const rows: DecryptionActivityRow[] = [];\n const usedCt = new Set<string>();\n\n // Collapse per-acp/enabled key rotations to one entry per value.\n const readByValue = new Map<string, QueryLike>();\n for (const q of queries) {\n const k = q.queryKey;\n if (!Array.isArray(k) || k[0] !== 'cofheReadContract') continue;\n const id = stableReadKey(k);\n const existing = readByValue.get(id);\n if (!existing || isFresherRead(q, existing)) readByValue.set(id, q);\n }\n\n const pushRow = (\n row: Omit<DecryptionActivityRow, 'category' | 'canRetry' | 'retry'> & {\n fetchKey?: unknown;\n decryptKey?: unknown;\n }\n ) => {\n const { fetchKey, decryptKey, ...rest } = row;\n const canRetry = rest.fetch !== 'idle' && (fetchKey !== undefined || decryptKey !== undefined);\n rows.push({\n ...rest,\n category: categoryFor(rest.fetch, rest.decrypt),\n canRetry,\n retry: () => {\n if (fetchKey !== undefined) refetch(fetchKey);\n if (decryptKey !== undefined) refetch(decryptKey);\n },\n });\n };\n\n // One row per confidential value; attach its decrypt stage by ctHash.\n for (const q of readByValue.values()) {\n const m = q.meta;\n const ctRaw = q.state.status === 'success' ? extractCtHash(q.state.data) : undefined;\n const ct = ctRaw && !isZeroCt(ctRaw) ? ctRaw : undefined;\n const fetchInFlight = q.state.fetchStatus === 'fetching';\n const fetchState: FetchStageState =\n q.state.status === 'error'\n ? 'error'\n : q.state.status === 'pending'\n ? fetchInFlight\n ? 'pending'\n : 'idle'\n : ct\n ? 'ok'\n : 'empty';\n\n let decrypt: DecryptStageState = 'absent';\n let blockedReason: string | undefined;\n let pendingMs: number | undefined;\n let decryptKey: unknown;\n let decryptMeta: CofheQueryMeta | undefined;\n if (ct) {\n usedCt.add(ct);\n const d = decryptByCt.get(ct);\n decryptKey = d?.key;\n decryptMeta = d?.meta;\n if (d?.state === 'ok') decrypt = 'ok';\n else if (d?.state === 'error') decrypt = 'error';\n else if (d?.state === 'idle') decrypt = 'idle';\n else if (d?.state === 'pending') {\n pendingMs = d.pendingMs;\n decrypt = (d.pendingMs ?? 0) > staleMs ? 'stale' : 'pending';\n } else {\n decrypt = acpValid ? 'absent' : 'blocked';\n if (!acpValid) blockedReason = `acp ${acpState}`;\n }\n } else if (fetchState === 'idle' && !acpValid) {\n // The read is gated off (no valid acp) — blocked before any ctHash.\n decrypt = 'blocked';\n blockedReason = `acp ${acpState}`;\n }\n\n const meta = m ?? decryptMeta;\n pushRow({\n key: q.queryHash,\n ctHash: ct,\n ctHashShort: ct ? shortCt(ct) : undefined,\n meta,\n chainId: meta?.chainId,\n address: meta?.address,\n functionName: meta?.functionName,\n label: meta?.consumer?.label,\n fetch: fetchState,\n decrypt,\n blockedReason,\n pendingMs,\n updatedAt: now,\n fetchKey: q.queryKey,\n decryptKey,\n });\n }\n\n // Orphan decrypts (a ctHash being decrypted with no fetch query in cache).\n for (const [ct, d] of decryptByCt) {\n if (usedCt.has(ct)) continue;\n const decrypt: DecryptStageState =\n d.state === 'ok'\n ? 'ok'\n : d.state === 'error'\n ? 'error'\n : d.state === 'idle'\n ? 'idle'\n : (d.pendingMs ?? 0) > staleMs\n ? 'stale'\n : 'pending';\n pushRow({\n key: `decrypt:${ct}`,\n ctHash: ct,\n ctHashShort: shortCt(ct),\n meta: d.meta,\n chainId: d.meta?.chainId,\n address: d.meta?.address,\n functionName: d.meta?.functionName,\n label: d.meta?.consumer?.label,\n fetch: 'ok',\n decrypt,\n pendingMs: d.pendingMs,\n updatedAt: now,\n decryptKey: d.key,\n });\n }\n\n // Drop ctHashes we no longer see, so the pending-since map can't grow unbounded.\n for (const ct of pendingSinceRef.current.keys()) {\n if (!seenPending.has(ct)) pendingSinceRef.current.delete(ct);\n }\n\n const counts = {\n total: rows.length,\n ok: rows.filter((r) => r.decrypt === 'ok').length,\n pending: rows.filter((r) => r.decrypt === 'pending').length,\n stale: rows.filter((r) => r.decrypt === 'stale').length,\n blocked: rows.filter((r) => r.decrypt === 'blocked').length,\n error: rows.filter((r) => r.decrypt === 'error' || r.fetch === 'error').length,\n };\n\n // Most actionable first: blocked/stale/error, then pending, then done.\n const rank: Record<DecryptStageState, number> = {\n blocked: 0,\n stale: 1,\n error: 2,\n pending: 3,\n idle: 4,\n absent: 5,\n ok: 6,\n };\n rows.sort((a, b) => rank[a.decrypt] - rank[b.decrypt]);\n\n const expiresInSec = acpObj ? acpObj.expiration - nowSec() : undefined;\n return { rows, acp: { state: acpState, expiresInSec }, counts };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [queryClient, account, chainId, acpObj, staleMs, version]);\n\n return { ...data, clearCache };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CO,SAAS,2BACd,EAAE,QAAQ,MAAM,SAAS,QAAQ,SAAS,KAAK,UAAU,GACzD,cACwC;AACxC,QAAM,EAAE,OAAO,IAAI,gBAAgB;AACnC,QAAM,mBAAmB,gBAAgB;AACzC,QAAM,iBAAiB,WAAW;AAClC,QAAM,eAAe,qBAAqB,EAAE,KAAK,QAAQ,CAAC;AAC1D,QAAM,YAAY,aAAa,SAAS,aAAa,MAAM;AAC3D,8BAA4B,YAAY;AAExC,QAAM;AAAA,IACJ,SAAS;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,GAAG;AAAA,EACL,IAAI,gBAAgB,CAAC;AAErB,SAAO,mBAAmB;AAAA,IACxB,SAAS,OAAO,IAAI,CAAC,OAAO,UAAU;AACpC,YAAM,OAAO,CAAC,C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E;AAAA,MAC3C,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,YAAY,SAAS,EAAE;AAAA,MACrD,OAAO,KAAK,OAAO,CAAC,MAAM,EAAE,YAAY,OAAO,EAAE;AAAA,MACjD,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,YAAY,SAAS,EAAE;AAAA,MACrD,OAAO,KAAK,OAAO,CAAC,MAAM,EAAE,YAAY,WAAW,EAAE,UAAU,OAAO,EAAE;AAAA,IAC1E;AAGA,UAAM,OAA0C;AAAA,MAC9C,SAAS;AAAA,MACT,OAAO;AAAA,MACP,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,IAAI;AAAA,IACN;AACA,SAAK,KAAK,CAAC,GAAG,MAAM,KAAK,EAAE,OAAO,IAAI,KAAK,EAAE,OAAO,CAAC;AAErD,UAAM,eAAe,SAAS,OAAO,aAAa,OAAO,IAAI;AAC7D,WAAO,EAAE,MAAM,KAAK,EAAE,OAAO,UAAU,aAAa,GAAG,OAAO;AAAA,EAEhE,GAAG,CAAC,aAAa,SAAS,SAAS,QAAQ,SAAS,OAAO,CAAC;AAE5D,SAAO,EAAE,GAAG,MAAM,WAAW;AAC/B;","names":["useCallback","useMemo","useCallback","useMemo"]}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useCofheDecryptForViewList.ts","../src/hooks/useCofheDecryptForTx.ts","../src/hooks/useCofheDecryptForTxList.ts","../src/hooks/useCofheDecrypter.ts","../src/index.ts","../src/hooks/useCofheDecryptionActivity.ts"],"sourcesContent":["import { useCofheContext, useInternalQueries } from '@/providers';\nimport { isHandleOutOfScope, useCofheEffectiveACP, type CofheACPInput } from './useCofheACPScope';\nimport { useCofheChainId } from './useCofheConnection';\nimport {\n cofheDecryptForViewQuery,\n defaultDecryptRetry,\n useDropDecryptsOfInvalidACP,\n zeroPlaintext,\n type CofheDecryptContext,\n} from './useCofheDecrypt';\nimport type { DecryptPollCallbackFunction, FheTypes, UnsealedItem } from '@cofhe/sdk';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport type { EncryptedReturnTypeByUtype } from '@cofhe/abi';\nimport type { CofheDecryptMeta } from '@/meta';\n\nexport type UseCofheDecryptForViewListInput<U extends FheTypes> = {\n /** The handles to decrypt, in the order the results come back; `undefined` entries stay idle. */\n inputs: ReadonlyArray<EncryptedReturnTypeByUtype<U> | undefined>;\n /** Consumer-supplied metadata for debug/activity views, one for all or one per entry. */\n meta?: CofheDecryptMeta | ((input: EncryptedReturnTypeByUtype<U>, index: number) => CofheDecryptMeta);\n /** Structural context from the originating read (address/method), for recognition. */\n context?: CofheDecryptContext;\n onPoll?: DecryptPollCallbackFunction;\n /**\n * The chain the ciphertexts live on — the connected chain by default. Gates on and decrypts\n * with THAT chain's active ACP.\n */\n chainId?: number;\n /**\n * Decrypt with this ACP (or the hash of a stored one) instead of the enclosing\n * `<CofheACPScope>` or the active ACP. The active ACP is not changed.\n */\n acp?: CofheACPInput;\n /** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */\n timeoutMs?: number;\n};\n\n/**\n * `useCofheDecrypt` for a list: one query per handle, the same keys, gate, persistence and\n * activity rows, returned in the order of `inputs`. For a list a component renders, or a total it\n * derives from every value, where the handles are known at render time. The client's\n * `decryptConcurrency` cap bounds how many requests run at once, so a long list is safe.\n *\n * A zero handle — a value never set on chain — reads as the type's zero without a request.\n */\nexport function useCofheDecryptForViewList<U extends FheTypes, TSelectedData = UnsealedItem<U>>(\n { inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptForViewListInput<U>,\n queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSelectedData>, 'queryKey' | 'queryFn'>\n): UseQueryResult<TSelectedData, Error>[] {\n const { client } = useCofheContext();\n const connectedChainId = useCofheChainId();\n const decryptChainId = chainId ?? connectedChainId;\n const effectiveACP = useCofheEffectiveACP({ acp, chainId });\n const scopedACP = effectiveACP.scoped ? effectiveACP.acp : undefined;\n useDropDecryptsOfInvalidACP(effectiveACP);\n\n const {\n enabled: userEnabled,\n meta: optionMeta,\n retry = defaultDecryptRetry,\n ...restQueryOptions\n } = queryOptions || {};\n\n return useInternalQueries({\n queries: inputs.map((input, index) => {\n const zero = !!input && BigInt(input.ctHash) === 0n;\n const outOfScope = isHandleOutOfScope(scopedACP, input?.ctHash);\n const enabled = !!input && !zero && !!client && effectiveACP.isValid && !outOfScope && (userEnabled ?? true);\n const query = cofheDecryptForViewQuery<U>({\n client,\n input,\n decryptChainId,\n chainId,\n acp: effectiveACP.acp,\n scoped: effectiveACP.scoped,\n onPoll,\n timeoutMs,\n meta: typeof meta === 'function' ? (input ? meta(input, index) : undefined) : meta,\n context,\n });\n return {\n enabled,\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: { ...query.meta, ...optionMeta },\n ...restQueryOptions,\n retry,\n // The zero handle is its own answer: present from the first render, never fetched.\n ...(zero ? { initialData: zeroPlaintext(input.utype), staleTime: Infinity } : {}),\n };\n }),\n }) as UseQueryResult<TSelectedData, Error>[];\n}\n","import { useCofheContext, useInternalQuery } from '@/providers';\nimport { isHandleOutOfScope, useCofheEffectiveACP, type CofheACPInput } from './useCofheACPScope';\nimport { useCofheChainId } from './useCofheConnection';\nimport { defaultDecryptRetry, useDropDecryptsOfInvalidACP, type CofheDecryptContext } from './useCofheDecrypt';\nimport type { CofheClient, DecryptForTxResult, DecryptPollCallbackFunction } from '@cofhe/sdk';\nimport type { ACP } from '@cofhe/sdk/acps';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { assert } from 'ts-essentials';\nimport type { CofheDecryptMeta, CofheQueryMeta } from '@/meta';\nimport { anySignal } from '@/utils/abortSignal';\n\n/**\n * The cache key of one tx decrypt: a handle decrypted on one chain into a plaintext with the\n * threshold network's signature — `[prefix, chainId, ctHash, acpHash]`. `acpHash` names the ACP\n * that decrypts, or is `null` for a handle the contract allowed publicly, decrypted without one.\n * No `utype` segment: the network signs the plaintext as an integer, whatever the handle's type.\n */\nexport function constructCofheDecryptForTxQueryKey(params: {\n ctHash: string | undefined;\n chainId: number | undefined;\n acpHash: string | null | undefined;\n}): readonly unknown[] {\n return ['decryptForTx', params.chainId, params.ctHash, params.acpHash];\n}\n\n/**\n * The query one tx decrypt runs as — its key, its `queryFn` and its `meta` — shared by\n * `useCofheDecryptForTx` and `useCofheDecrypter`, so a proof fetched either way is the same cache\n * entry. A proof is a read: a handle maps to one plaintext forever and the contract verifies only\n * `(ctHash, value, signature)`, so nothing but the handle and the ACP keys it.\n */\nexport function cofheDecryptForTxQuery(params: {\n client: CofheClient;\n ctHash: bigint | string | undefined;\n /** The chain the decrypt runs on: the caller's `chainId`, else the connected chain. */\n decryptChainId: number | undefined;\n /** The caller's explicit `chainId`, set on the builder when given. */\n chainId?: number;\n /** The account whose stored ACPs resolve the active ACP, set on the builder when given. */\n account?: string;\n /**\n * The ACP that decrypts, and whether it was chosen explicitly (a hook option or a scope);\n * `null` for a publicly allowed handle (`FHE.allowPublic`), which needs none.\n */\n acp: ACP | null | undefined;\n scoped: boolean;\n onPoll?: DecryptPollCallbackFunction;\n timeoutMs?: number;\n retry404TimeoutMs?: number;\n /** The caller's abort signal; React Query's own (query cancelled) is joined to it in `queryFn`. */\n signal?: AbortSignal;\n meta?: CofheDecryptMeta;\n context?: CofheDecryptContext;\n}): {\n queryKey: readonly unknown[];\n queryFn: (context?: { signal?: AbortSignal }) => Promise<DecryptForTxResult>;\n // Also a plain record: that is what `fetchQuery` and `useQuery` type `meta` as.\n meta: Record<string, unknown> & CofheQueryMeta & { persist: boolean };\n} {\n const { client, ctHash, decryptChainId, chainId, account, acp, scoped, onPoll, timeoutMs, retry404TimeoutMs } =\n params;\n const { signal, meta, context } = params;\n const scopedACP = scoped && acp ? acp : undefined;\n return {\n queryKey: constructCofheDecryptForTxQueryKey({\n ctHash: ctHash?.toString(),\n chainId: decryptChainId,\n acpHash: acp === null ? null : acp?.hash,\n }),\n queryFn: async (queryContext) => {\n assert(ctHash !== undefined, 'a tx decrypt query only runs with a handle');\n const builder = client.decryptForTx(ctHash);\n if (chainId !== undefined) builder.setChainId(chainId);\n if (account !== undefined) builder.setAccount(account);\n if (onPoll) builder.onPoll(onPoll);\n if (timeoutMs !== undefined) builder.setTimeout(timeoutMs);\n if (retry404TimeoutMs !== undefined) builder.set404RetryTimeout(retry404TimeoutMs);\n const abort = anySignal([signal, queryContext?.signal]);\n if (abort) builder.setSignal(abort);\n const selected = acp === null ? builder.withoutACP() : scopedACP ? builder.withACP(scopedACP) : builder.withACP();\n return selected.execute();\n },\n meta: {\n // Same rule as a view decrypt: persist what the user own ACP decrypts. A publicly allowed\n // handle's proof is public data, so it persists too; one decrypted with a shared ACP must\n // not outlive the share, so it stays in memory.\n persist: acp === null || acp?.type === 'self',\n kind: 'cofheDecryptForTx',\n ctHash: ctHash?.toString(),\n chainId: context?.chainId ?? decryptChainId,\n address: context?.address,\n functionName: context?.functionName,\n consumer: meta,\n },\n };\n}\n\nexport type UseCofheDecryptForTxInput = {\n /** The handle to decrypt; the query is disabled without one, or for the zero handle. */\n ctHash?: bigint | string;\n /**\n * The ACP to decrypt with: an ACP, the hash of a stored one, the enclosing `<CofheACPScope>`\n * or the active ACP when omitted, or `null` for a handle the contract allowed publicly\n * (`FHE.allowPublic`), which needs none and so never waits for one.\n */\n acp?: CofheACPInput | null;\n /**\n * The chain the handle lives on — the connected chain by default. Gates on and decrypts\n * with THAT chain's active ACP, e.g. for a value read through a chain-pinned read.\n */\n chainId?: number;\n /** The account whose stored ACPs resolve a hash or the active ACP; the connected account by default. */\n account?: string;\n onPoll?: DecryptPollCallbackFunction;\n /** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */\n timeoutMs?: number;\n /** How long a submit-time `404 ct_not_found` (handle not indexed yet) is retried; 10 seconds by default. */\n retry404TimeoutMs?: number;\n /** Consumer-supplied metadata for debug/activity views. */\n meta?: CofheDecryptMeta;\n /** Structural context from the originating read (address/method), for recognition. */\n context?: CofheDecryptContext;\n};\n\n/**\n * Query hook around `client.decryptForTx`: the plaintext of a handle with the threshold network's\n * signature over it, for a contract to verify on chain (`FHE.verifyDecryptResult` /\n * `FHE.publishDecryptResult`). The declarative counterpart of `useCofheDecrypter().decryptForTx`:\n * mount it on the page that will send the transaction and the proof is ready before the click.\n *\n * A proof never changes, so the query is `staleTime: Infinity` by default and a handle proved\n * once (either way) is never requested again. Like `useCofheDecrypt` it waits for a valid ACP\n * rather than prompting for one — unless `acp` is `null`, when no ACP is involved at all.\n */\nexport function useCofheDecryptForTx<TSelectedData = DecryptForTxResult>(\n { ctHash, acp, chainId, account, onPoll, timeoutMs, retry404TimeoutMs, meta, context }: UseCofheDecryptForTxInput,\n queryOptions?: Omit<UseQueryOptions<DecryptForTxResult, Error, TSelectedData>, 'queryKey' | 'queryFn'>\n): UseQueryResult<TSelectedData, Error> {\n const { client } = useCofheContext();\n const connectedChainId = useCofheChainId();\n const decryptChainId = chainId ?? connectedChainId;\n const withoutACP = acp === null;\n // With `acp: null` the ACP below is not used; the hook still runs (hooks are unconditional) and\n // its drop effect is the same one `useCofheDecrypt` runs for that ACP.\n const effectiveACP = useCofheEffectiveACP({ acp: acp ?? undefined, chainId });\n const scopedACP = effectiveACP.scoped ? effectiveACP.acp : undefined;\n useDropDecryptsOfInvalidACP(effectiveACP);\n\n const {\n enabled: userEnabled,\n meta: optionMeta,\n retry = defaultDecryptRetry,\n staleTime = Infinity,\n ...restQueryOptions\n } = queryOptions || {};\n const outOfScope = !withoutACP && isHandleOutOfScope(scopedACP, ctHash);\n const enabled =\n ctHash !== undefined &&\n BigInt(ctHash) > 0n &&\n !!client &&\n (withoutACP || effectiveACP.isValid) &&\n !outOfScope &&\n (userEnabled ?? true);\n\n const query = cofheDecryptForTxQuery({\n client,\n ctHash,\n decryptChainId,\n chainId,\n account,\n acp: withoutACP ? null : effectiveACP.acp,\n scoped: effectiveACP.scoped,\n onPoll,\n timeoutMs,\n retry404TimeoutMs,\n meta,\n context,\n });\n\n return useInternalQuery({\n enabled,\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: { ...query.meta, ...optionMeta },\n staleTime,\n ...restQueryOptions,\n retry,\n });\n}\n","import { useCofheContext, useInternalQueries } from '@/providers';\nimport { isHandleOutOfScope, useCofheEffectiveACP, type CofheACPInput } from './useCofheACPScope';\nimport { useCofheChainId } from './useCofheConnection';\nimport { defaultDecryptRetry, useDropDecryptsOfInvalidACP, type CofheDecryptContext } from './useCofheDecrypt';\nimport { cofheDecryptForTxQuery } from './useCofheDecryptForTx';\nimport type { DecryptForTxResult, DecryptPollCallbackFunction } from '@cofhe/sdk';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport type { CofheDecryptMeta } from '@/meta';\n\nexport type UseCofheDecryptForTxListInput = {\n /** The handles to prove, in the order the results come back; `undefined` entries and the zero handle stay idle. */\n inputs: ReadonlyArray<bigint | string | undefined>;\n /**\n * The ACP to decrypt with: an ACP, the hash of a stored one, the enclosing `<CofheACPScope>`\n * or the active ACP when omitted, or `null` for handles the contract allowed publicly\n * (`FHE.allowPublic`), which need none and so never wait for one.\n */\n acp?: CofheACPInput | null;\n /** The chain the handles live on — the connected chain by default. */\n chainId?: number;\n /** The account whose stored ACPs resolve a hash or the active ACP; the connected account by default. */\n account?: string;\n onPoll?: DecryptPollCallbackFunction;\n /** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */\n timeoutMs?: number;\n /** How long a submit-time `404 ct_not_found` (handle not indexed yet) is retried; 10 seconds by default. */\n retry404TimeoutMs?: number;\n /** Consumer-supplied metadata for debug/activity views, one for all or one per entry. */\n meta?: CofheDecryptMeta | ((ctHash: bigint | string, index: number) => CofheDecryptMeta);\n /** Structural context from the originating read (address/method), for recognition. */\n context?: CofheDecryptContext;\n};\n\n/**\n * `useCofheDecryptForTx` for a list: one proof query per handle, the same keys, gate and\n * persistence, returned in the order of `inputs`. For a page that will send one transaction per\n * item, or one transaction over all of them, with the handles known at render time; the proofs\n * are ready before the click. The client's `decryptConcurrency` cap bounds how many requests run\n * at once.\n */\nexport function useCofheDecryptForTxList<TSelectedData = DecryptForTxResult>(\n { inputs, acp, chainId, account, onPoll, timeoutMs, retry404TimeoutMs, meta, context }: UseCofheDecryptForTxListInput,\n queryOptions?: Omit<UseQueryOptions<DecryptForTxResult, Error, TSelectedData>, 'queryKey' | 'queryFn'>\n): UseQueryResult<TSelectedData, Error>[] {\n const { client } = useCofheContext();\n const connectedChainId = useCofheChainId();\n const decryptChainId = chainId ?? connectedChainId;\n const withoutACP = acp === null;\n const effectiveACP = useCofheEffectiveACP({ acp: acp ?? undefined, chainId });\n const scopedACP = effectiveACP.scoped ? effectiveACP.acp : undefined;\n useDropDecryptsOfInvalidACP(effectiveACP);\n\n const {\n enabled: userEnabled,\n meta: optionMeta,\n retry = defaultDecryptRetry,\n staleTime = Infinity,\n ...restQueryOptions\n } = queryOptions || {};\n\n return useInternalQueries({\n queries: inputs.map((ctHash, index) => {\n const outOfScope = !withoutACP && isHandleOutOfScope(scopedACP, ctHash);\n const enabled =\n ctHash !== undefined &&\n BigInt(ctHash) > 0n &&\n !!client &&\n (withoutACP || effectiveACP.isValid) &&\n !outOfScope &&\n (userEnabled ?? true);\n const query = cofheDecryptForTxQuery({\n client,\n ctHash,\n decryptChainId,\n chainId,\n account,\n acp: withoutACP ? null : effectiveACP.acp,\n scoped: effectiveACP.scoped,\n onPoll,\n timeoutMs,\n retry404TimeoutMs,\n meta: typeof meta === 'function' ? (ctHash !== undefined ? meta(ctHash, index) : undefined) : meta,\n context,\n });\n return {\n enabled,\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: { ...query.meta, ...optionMeta },\n staleTime,\n ...restQueryOptions,\n retry,\n };\n }),\n }) as UseQueryResult<TSelectedData, Error>[];\n}\n","import { useCallback, useMemo } from 'react';\nimport { useCofheContext, useInternalQueryClient } from '@/providers';\nimport {\n isHandleOutOfScope,\n useCofheEffectiveACP,\n type CofheACPInput,\n type CofheEffectiveACP,\n} from './useCofheACPScope';\nimport { useCofheChainId } from './useCofheConnection';\nimport {\n cofheDecryptForViewQuery,\n defaultDecryptRetry,\n useDropDecryptsOfInvalidACP,\n zeroPlaintext,\n type CofheDecryptContext,\n} from './useCofheDecrypt';\nimport { cofheDecryptForTxQuery } from './useCofheDecryptForTx';\nimport {\n CofheError,\n CofheErrorCode,\n type FheTypes,\n type DecryptForTxResult,\n type DecryptPollCallbackFunction,\n type UnsealedItem,\n} from '@cofhe/sdk';\nimport type { EncryptedReturnTypeByUtype } from '@cofhe/abi';\nimport type { CofheDecryptMeta } from '@/meta';\n\n/** Per-call options of the function `useCofheDecrypter` returns. */\nexport type CofheDecryptForViewFnOptions = {\n /** Consumer-supplied metadata for debug/activity views. */\n meta?: CofheDecryptMeta;\n /** Structural context from the originating read (address/method), for recognition. */\n context?: CofheDecryptContext;\n onPoll?: DecryptPollCallbackFunction;\n /** The decrypt's whole budget in milliseconds, submit retries and polling together (5 minutes by default). */\n timeoutMs?: number;\n /**\n * A cached plaintext younger than this is returned without a request. `Infinity` by default: a\n * plaintext never changes, so a handle decrypted once (by this function or by `useCofheDecrypt`)\n * is never decrypted again.\n */\n staleTime?: number;\n /** Retry policy of a failed request; by default a `CofheError` is final and anything else is retried 3 times. */\n retry?: boolean | number | ((failureCount: number, error: Error) => boolean);\n /**\n * Stops the call when it fires: a call still waiting for a concurrency slot never starts, a\n * request in flight is aborted, and the call rejects with `Aborted`. A plaintext already in the\n * cache is still returned.\n */\n signal?: AbortSignal;\n};\n\n/** Decrypts one handle; see `useCofheDecrypter`. */\nexport type CofheDecryptForViewFn = <U extends FheTypes>(\n input: EncryptedReturnTypeByUtype<U>,\n options?: CofheDecryptForViewFnOptions\n) => Promise<UnsealedItem<U>>;\n\n/** Per-call options of `decryptForTx`; see `useCofheDecrypter`. */\nexport type CofheDecryptForTxFnOptions = CofheDecryptForViewFnOptions & {\n /**\n * `null`: the contract allowed the handle publicly (`FHE.allowPublic`), so it decrypts without\n * an ACP and does not wait for one. Otherwise the hook's ACP decrypts, as for `decryptForView`.\n */\n acp?: null;\n /** The account whose stored ACPs resolve the active ACP; the connected account by default. */\n account?: string;\n /** How long a submit-time `404 ct_not_found` (handle not indexed yet) is retried; 10 seconds by default. */\n retry404TimeoutMs?: number;\n};\n\n/** Decrypts one handle into a plaintext with the network's signature; see `useCofheDecrypter`. */\nexport type CofheDecryptForTxFn = (\n ctHash: bigint | string,\n options?: CofheDecryptForTxFnOptions\n) => Promise<DecryptForTxResult>;\n\nexport type UseCofheDecrypterOptions = {\n /**\n * The chain the ciphertexts live on — the connected chain by default. Gates on and decrypts\n * with THAT chain's active ACP, e.g. for values read through a chain-pinned read.\n */\n chainId?: number;\n /**\n * Decrypt with this ACP (or the hash of a stored one) instead of the enclosing\n * `<CofheACPScope>` or the active ACP. The active ACP is not changed.\n */\n acp?: CofheACPInput;\n /** How many requests one caller runs at a time; the rest wait their turn. 4 by default. */\n concurrency?: number;\n};\n\nexport type UseCofheDecrypterResult = {\n /** Decrypts one handle through the decrypt cache; rejects without a request while `isReady` is false. */\n decryptForView: CofheDecryptForViewFn;\n /**\n * Decrypts one handle into a plaintext with the threshold network's signature, for a contract to\n * verify on chain, through the same cache as `useCofheDecryptForTx`. With `acp: null` it needs\n * only the client, not `isReady`.\n */\n decryptForTx: CofheDecryptForTxFn;\n /** A client and a valid ACP are at hand, so a call can run. */\n isReady: boolean;\n /** The ACP `decryptForView` uses, with its status: why `isReady` is false, when it is. */\n acp: CofheEffectiveACP;\n};\n\n/** The reasons a call must not be sent: no valid ACP, or a SNAPSHOT share that does not list the handle. */\nfunction assertACPDecrypts(effectiveACP: CofheEffectiveACP, ctHash: bigint | string, operation: string): void {\n const { acp, scoped, status } = effectiveACP;\n if (!effectiveACP.isValid) {\n throw new CofheError({\n code: status === 'expired' ? CofheErrorCode.ACPExpired : CofheErrorCode.ACPRequired,\n message: `${operation}: no valid ACP to decrypt with (${status})`,\n hint: 'Create or activate an ACP, or wait for the chosen one to be checked, before decrypting.',\n });\n }\n if (isHandleOutOfScope(scoped ? acp : undefined, ctHash)) {\n throw new CofheError({\n code: CofheErrorCode.ACPDenied,\n message: `${operation}: the handle is not listed in the SNAPSHOT share that would decrypt it`,\n context: { ctHash: ctHash.toString(), acpHash: acp?.hash },\n });\n }\n}\n\nfunction abortedError(operation: string, signal: AbortSignal): CofheError {\n return new CofheError({\n code: CofheErrorCode.Aborted,\n message: `${operation} aborted by the caller`,\n cause: signal.reason instanceof Error ? signal.reason : undefined,\n });\n}\n\n/**\n * Runs tasks at most `max` at a time, in call order. A task whose `signal` fires while it waits\n * for a slot leaves the queue and rejects without ever starting.\n */\nfunction createLimiter(\n max: number\n): <T>(task: () => Promise<T>, operation: string, signal?: AbortSignal) => Promise<T> {\n let active = 0;\n const waiting: Array<() => void> = [];\n return async (task, operation, signal) => {\n if (signal?.aborted) throw abortedError(operation, signal);\n if (active >= max) {\n await new Promise<void>((resume, reject) => {\n const onAbort = () => {\n const index = waiting.indexOf(start);\n if (index >= 0) waiting.splice(index, 1);\n reject(abortedError(operation, signal!));\n };\n const start = () => {\n signal?.removeEventListener('abort', onAbort);\n resume();\n };\n signal?.addEventListener('abort', onAbort, { once: true });\n waiting.push(start);\n });\n }\n active += 1;\n try {\n return await task();\n } finally {\n active -= 1;\n waiting.shift()?.();\n }\n };\n}\n\n/**\n * The imperative counterpart of `useCofheDecrypt`: a function that decrypts one handle on demand,\n * for the work a component does not render per value — a job the user starts over a list of\n * handles (a history to sum, a set of bids to reveal), from the handler that starts it.\n *\n * Each call is the same query `useCofheDecrypt` would run — same cache key, same gate, same\n * persistence, same activity row — so a handle decrypted either way is decrypted once, and\n * `decryptForView` returns a cached plaintext without a request. Calls run at most `concurrency` at a\n * time; fan out with `Promise.all` freely.\n *\n * Without a valid ACP, or with a SNAPSHOT share that does not list the handle, `decryptForView` rejects\n * with a `CofheError` and sends nothing. A zero handle resolves to the type's zero without a request.\n *\n * `decryptForTx` is the same for a proof — the plaintext with the threshold network's signature,\n * for a contract to verify — through the cache of `useCofheDecryptForTx`. A proof is a read too: a\n * handle maps to one plaintext forever, so a handle proved once is never requested again. `acp:\n * null` decrypts a publicly allowed handle without an ACP, and then needs only the client.\n */\nexport function useCofheDecrypter({\n chainId,\n acp,\n concurrency = 4,\n}: UseCofheDecrypterOptions = {}): UseCofheDecrypterResult {\n const { client } = useCofheContext();\n const queryClient = useInternalQueryClient();\n const connectedChainId = useCofheChainId();\n const decryptChainId = chainId ?? connectedChainId;\n const effectiveACP = useCofheEffectiveACP({ acp, chainId });\n useDropDecryptsOfInvalidACP(effectiveACP);\n const limit = useMemo(() => createLimiter(concurrency), [concurrency]);\n\n const isReady = !!client && effectiveACP.isValid;\n const { acp: decryptACP, scoped } = effectiveACP;\n\n const decryptForView = useCallback<CofheDecryptForViewFn>(\n async (input, options) => {\n if (!client) {\n throw new CofheError({ code: CofheErrorCode.InternalError, message: 'CoFHE client not initialized' });\n }\n if (BigInt(input.ctHash) === 0n) return zeroPlaintext(input.utype);\n assertACPDecrypts(effectiveACP, input.ctHash, 'decryptForView');\n const query = cofheDecryptForViewQuery({\n client,\n input,\n decryptChainId,\n chainId,\n acp: decryptACP,\n scoped,\n onPoll: options?.onPoll,\n timeoutMs: options?.timeoutMs,\n signal: options?.signal,\n meta: options?.meta,\n context: options?.context,\n });\n return limit(\n () =>\n queryClient.fetchQuery({\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: query.meta,\n staleTime: options?.staleTime ?? Infinity,\n retry: options?.retry ?? defaultDecryptRetry,\n }),\n 'decryptForView',\n options?.signal\n );\n },\n [client, queryClient, decryptChainId, chainId, decryptACP, scoped, effectiveACP, limit]\n );\n\n const decryptForTx = useCallback<CofheDecryptForTxFn>(\n async (ctHash, options) => {\n if (!client) {\n throw new CofheError({ code: CofheErrorCode.InternalError, message: 'CoFHE client not initialized' });\n }\n if (BigInt(ctHash) === 0n) {\n throw new CofheError({\n code: CofheErrorCode.DecryptFailed,\n message: 'decryptForTx: the zero handle has no value to prove',\n hint: 'A zero handle is a value never set on chain; nothing can be revealed from it.',\n });\n }\n const withoutACP = options?.acp === null;\n if (!withoutACP) assertACPDecrypts(effectiveACP, ctHash, 'decryptForTx');\n const query = cofheDecryptForTxQuery({\n client,\n ctHash,\n decryptChainId,\n chainId,\n account: options?.account,\n acp: withoutACP ? null : decryptACP,\n scoped,\n onPoll: options?.onPoll,\n timeoutMs: options?.timeoutMs,\n retry404TimeoutMs: options?.retry404TimeoutMs,\n signal: options?.signal,\n meta: options?.meta,\n context: options?.context,\n });\n return limit(\n () =>\n queryClient.fetchQuery({\n queryKey: query.queryKey,\n queryFn: query.queryFn,\n meta: query.meta,\n staleTime: options?.staleTime ?? Infinity,\n retry: options?.retry ?? defaultDecryptRetry,\n }),\n 'decryptForTx',\n options?.signal\n );\n },\n [client, queryClient, decryptChainId, chainId, decryptACP, scoped, effectiveACP, limit]\n );\n\n return { decryptForView, decryptForTx, isReady, acp: effectiveACP };\n}\n","// Providers\nexport { CofheProvider, useCofheContext } from './providers/index';\n\n// Hooks\nexport {\n ETH_ADDRESS_LOWERCASE,\n getCofheTokenClaimUnshieldedCallArgs,\n getCofheTokenShieldCallArgs,\n getCofheTokenUnshieldCallArgs,\n useCofheActiveACP,\n useCofheACPs,\n useCofheAllACPs,\n useCofheClient,\n useCofheConnection,\n useCofheEnabled,\n useCofheTaskManagerAddress,\n useCofheEncrypt,\n useCofhePublicClient,\n useCofheRemoveACP,\n useCofheSelectACP,\n useCofheSimulateWriteContract,\n useCofheStatuses,\n useCofheTokenClaimable,\n useCofheTokenClaims,\n useCofheTokenApprove,\n useCofheTokenClaimUnshielded,\n useCofheTokenDecryptedBalance,\n useCofheTokenPublicBalance,\n useCofheTokenLists,\n useCofheToken,\n useKnownCofheToken,\n useCofheTokens,\n useCofheTokensClaimable,\n useCofheTokenShield,\n useCofheTokensWithExistingEncryptedBalances,\n useCofheTokenTransactions,\n useCofheTokenTransfer,\n useResolvedCofheToken,\n useCofheTransactions,\n addCofheTransaction,\n useCofheTokenUnshield,\n useCofheWalletClient,\n useCofheWriteContract,\n useCoingeckoContractMarketChartRange,\n useCoingeckoUsdPrice,\n useTokenAllowance,\n useTokensWithPublicBalances,\n useTransactionReceiptsByHash,\n type ClaimableAmountByTokenAddress,\n type CoingeckoMarketChartPoint,\n type Erc20Pair,\n type UnshieldClaim,\n type UnshieldClaimsSummary,\n type UnshieldClaimsSummaryByTokenAddress,\n type UseCoingeckoContractMarketChartRangeInput,\n type UseCoingeckoContractMarketChartRangeOptions,\n type UseCoingeckoUsdPriceInput,\n type UseCoingeckoUsdPriceOptions,\n type UseCofheTokenTransactionsInput,\n type UseCofheTokenTransactionsResult,\n type UseTransactionReceiptsByHashInput,\n type AddCofheTransactionInput,\n} from '@/hooks/index';\n\nexport { useCofheEncryptAndWriteContract } from '@/hooks/useCofheEncryptAndWriteContract';\nexport { useCofheReadContractAndDecrypt } from '@/hooks/useCofheReadContractAndDecrypt';\nexport {\n useCofheDecrypt,\n cofheDecryptForViewQuery,\n constructCofheDecryptForViewQueryKey,\n type CofheDecryptContext,\n} from '@/hooks/useCofheDecrypt';\nexport { useCofheDecryptForViewList, type UseCofheDecryptForViewListInput } from '@/hooks/useCofheDecryptForViewList';\nexport { useCofheDecryptForTxList, type UseCofheDecryptForTxListInput } from '@/hooks/useCofheDecryptForTxList';\nexport {\n useCofheDecrypter,\n type CofheDecryptForViewFn,\n type CofheDecryptForViewFnOptions,\n type CofheDecryptForTxFn,\n type CofheDecryptForTxFnOptions,\n type UseCofheDecrypterOptions,\n type UseCofheDecrypterResult,\n} from '@/hooks/useCofheDecrypter';\nexport {\n useCofheDecryptForTx,\n cofheDecryptForTxQuery,\n constructCofheDecryptForTxQueryKey,\n type UseCofheDecryptForTxInput,\n} from '@/hooks/useCofheDecryptForTx';\nexport {\n CofheACPScope,\n useCofheACPScope,\n useCofheACPStatus,\n type CofheACPInput,\n type CofheACPScopeValue,\n type CofheACPStatus,\n} from '@/hooks/useCofheACPScope';\nexport {\n useCofheIncomingShares,\n useCofheShareOnChain,\n useCofheImportShared,\n useCofheRemoveShare,\n useCofheRevokeACP,\n} from '@/hooks/acps/useOnChainSharing';\nexport {\n useCofheShareLabels,\n type CofheShareLabel,\n type UseCofheShareLabelsResult,\n} from '@/hooks/acps/useCofheShareLabels';\nexport {\n useCofheReadContract,\n constructCofheReadContractQueryForInvalidation,\n type UseCofheReadContractResult,\n type UseCofheReadContractQueryOptions,\n} from '@/hooks/useCofheReadContract';\nexport {\n useCofheReadContracts,\n type CofheReadContractsContract,\n type CofheReadContractsItem,\n type CofheReadContractsData,\n type CofheReadContractsEntry,\n type CofheReadContractsEntries,\n type CofheReadContractsEntryResult,\n type UseCofheReadContractsResult,\n type UseCofheReadContractsQueryOptions,\n} from '@/hooks/useCofheReadContracts';\nexport {\n type useCofheWriteContractOptions,\n type CofheWriteInvalidationTarget,\n type CofheWriteInvalidates,\n type CofheReadInvalidationDescriptor,\n} from '@/hooks/useCofheWriteContract';\n\n// Utils\nexport {\n FheTypesList,\n formatRelativeTime,\n getBlockExplorerAddressUrl,\n getBlockExplorerTokenUrl,\n getBlockExplorerTxUrl,\n getBlockExplorerUrl,\n isEthPair,\n isWrappedEthToken,\n truncateHash,\n} from './utils/index';\n\n// Stores\nexport { useCustomTokensStore } from './stores/customTokensStore';\n\nexport {\n actionToString,\n isCustomTransactionActionType,\n statusToString,\n transactionMatchesToken,\n TransactionActionType,\n TransactionStatus,\n useTransactionStore,\n type Transaction,\n type BuiltInTransactionActionType,\n type CustomTransactionActionType,\n type SharingTransactionActionType,\n type JsonValue,\n type NewTransaction,\n type TransactionActionString,\n type TransactionStatusString,\n type TransactionStore,\n} from './stores/transactionStore';\n\nexport { createCofheConfig } from './config';\nexport type { CofheReactLogger, CofheReactLoggerMethod } from './config';\n\n// Types\nexport type {\n CofheClientConfig,\n CofheContextValue,\n CofheProviderProps,\n TransactionRenderer,\n TransactionRendererProps,\n TransactionRenderers,\n} from './types/index';\n\nexport { createCofheClient } from '@cofhe/sdk/web';\n\nexport { useCofheCreateACP } from '@/hooks/acps/useCofheCreateACP';\nexport { useCofheNavigateToCreateACP } from '@/hooks/acps/useCofheNavigateToCreateACP';\nexport { useCofheAutoConnect } from '@/hooks/useCofheAutoConnect';\nexport { CofheFloatingButtonProvider, sortCofheStatuses } from './components/index';\nexport { COFHE_STATUS_IDS, CofheStatusActionIntents } from './components/CofheFloatingButton/types';\n\nexport type { CofheConfigWithReact as CofhesdkConfigWithReact } from './config';\n\nexport type { CofheStatus, CofheStatusActionIntent, CofheStatusId } from './components/CofheFloatingButton/types';\nexport type { ConfidentialToken } from './types/token';\nexport { getConfidentialDecimals, getPublicDecimals, getPublicSymbol } from './types/token';\nexport { scaleAmount, quantizeAmount } from './utils/format';\n\nexport type { CofheDecryptMeta, CofheQueryMeta } from './meta';\n\nexport { useCofheDecryptionActivity } from '@/hooks/useCofheDecryptionActivity';\nexport type {\n DecryptionActivityRow,\n DecryptionActivityResult,\n DecryptionActivityCategory,\n UseCofheDecryptionActivityOptions,\n FetchStageState,\n DecryptStageState,\n ACPState,\n} from '@/hooks/useCofheDecryptionActivity';\n\nexport { useInternalQueryClient } from './providers/index';\n\n// Type bridges for cross-repo / multi-instance viem peer dependency scenarios\nexport {\n asCofhePublicClient,\n tryAsCofhePublicClient,\n asCofheWalletClient,\n tryAsCofheWalletClient,\n} from './utils/viemClientBridge';\nexport type {\n PublicClientLike as CofhePublicClientLike,\n WalletClientLike as CofheWalletClientLike,\n} from './utils/viemClientBridge';\n\n// Block-aware cache invalidation primitives.\n//\n// These are the building blocks behind the SDK's own \"wait until the serving RPC\n// node has the mined block before returning a read\" behaviour. They are exported\n// so consumers (e.g. a wagmi-based app) can build the same reliability into their\n// own reads + post-tx invalidation, sharing THIS module's single invalidation-\n// context store — so an invalidation registered here is honoured by both the\n// SDK's confidential reads and the consumer's own block-aware queries.\nexport {\n invalidateQueriesWithContext,\n withInvalidationContext,\n findMatchingInvalidationContext,\n type InvalidationContextQueryFilters,\n type QueryFunctionWithInvalidationContext,\n} from './utils/invalidationContext';\nexport {\n maybeWaitUntilRpcAware,\n maybeWaitUntilRpcAwareAndReadContract,\n type WaitUntilRpcAwareAndReadContractOptions,\n type ReadContractResult,\n} from './utils/waitUntilRpcAwareAndReadContract';\nexport { resolveReceiptBlockHash } from './utils/resolveReceiptBlockHash';\nexport { useInvalidationContextStore, type InvalidationContextEntry } from './stores/invalidationContextStore';\n","import { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';\nimport { useInternalQueryClient } from '@/providers';\nimport { useCofheAccount, useCofheChainId } from './useCofheConnection';\nimport { useCofheActiveACP } from './useCofheACPs';\nimport type { CofheQueryMeta } from '@/meta';\n\n// ============================================================================\n// Decryption activity — the lifecycle view of confidential reads + decryptions.\n// ============================================================================\n//\n// A confidential value is a two-stage pipeline, both stages living as react-query\n// queries on the SDK's internal QueryClient:\n// A) FETCH — read the ciphertext handle on-chain (`cofheReadContract`),\n// whose data carries the `ctHash`.\n// B) DECRYPT— decrypt that handle off-chain (`decryptCiphertext`, keyed\n// by chain AND ctHash).\n//\n// This hook observes the cache, correlates the two stages by ctHash, and returns\n// one row per confidential value with a recognizable contract/method/label (from\n// each query's `meta`) — surfacing states a plain error/loading flag can't:\n// • \"blocked\" — gated off by a missing/invalid acp (never runs, never errors)\n// • \"stale\" — fetched, but the decrypt is pending far too long / never lands\n// Consumers render the rows; no query-key parsing or side registries required.\n\nconst DEFAULT_STALE_MS = 25_000;\nconst nowSec = () => Math.floor(Date.now() / 1000);\n\n/** 'idle' = a read/decrypt query exists but is disabled/never-ran (fetchStatus 'idle'), vs 'pending' (in flight). */\nexport type FetchStageState = 'ok' | 'pending' | 'idle' | 'error' | 'empty';\nexport type DecryptStageState = 'ok' | 'pending' | 'idle' | 'stale' | 'error' | 'blocked' | 'absent';\nexport type ACPState = 'valid' | 'expired' | 'unsigned' | 'none';\n/** Coarse bucket for filtering: something wrong / decrypted / nothing conclusive. */\nexport type DecryptionActivityCategory = 'error' | 'success' | 'idle';\n\nexport interface DecryptionActivityRow {\n key: string;\n /** Canonical decimal ctHash, when known. */\n ctHash?: string;\n /** 0x…-shortened ctHash for display. */\n ctHashShort?: string;\n /** The originating query metadata (contract / method / label / consumer fields). */\n meta?: CofheQueryMeta;\n /** Convenience shortcuts pulled from meta. */\n chainId?: number;\n address?: string;\n functionName?: string;\n label?: string;\n fetch: FetchStageState;\n decrypt: DecryptStageState;\n category: DecryptionActivityCategory;\n /** Why the row is blocked, e.g. \"acp none\". */\n blockedReason?: string;\n /** How long the decrypt has been pending, ms (drives \"stale\"). */\n pendingMs?: number;\n updatedAt: number;\n /** Whether re-running is possible (false for gated/idle reads with nothing enabled). */\n canRetry: boolean;\n /** Re-run this value's read and/or decrypt. */\n retry: () => void;\n}\n\nexport interface DecryptionActivityResult {\n rows: DecryptionActivityRow[];\n counts: { total: number; ok: number; pending: number; stale: number; blocked: number; error: number };\n acp: { state: ACPState; expiresInSec?: number };\n /** Wipe the whole SDK query cache; mounted reads/decryptions refetch from scratch. */\n clearCache: () => void;\n}\n\nexport interface UseCofheDecryptionActivityOptions {\n /** How long a decrypt may stay pending before it's reported \"stale\" (default 25s). */\n staleMs?: number;\n}\n\n// Minimal structural view of a cached query — enough to classify without depending\n// on react-query's concrete generic types.\ninterface QueryLike {\n queryKey: unknown;\n queryHash: string;\n meta?: CofheQueryMeta;\n state: { status: 'pending' | 'error' | 'success'; fetchStatus?: string; data?: unknown; dataUpdatedAt?: number };\n}\ninterface CacheLike {\n getAll: () => QueryLike[];\n subscribe: (cb: () => void) => () => void;\n}\ninterface ClientLike {\n getQueryCache: () => CacheLike;\n refetchQueries: (filters: { queryKey: unknown; exact?: boolean }) => Promise<unknown>;\n clear: () => void;\n}\n\nfunction normalizeCt(x: unknown): string | undefined {\n if (x === null || x === undefined) return undefined;\n try {\n return BigInt(x as string | number | bigint).toString();\n } catch {\n const s = String(x);\n return s && s !== '[object Object]' ? s : undefined;\n }\n}\n\n// A ctHash of 0 is not a real handle: reads return it for an absent/encrypted-zero\n// value and the decrypt is gated on `ctHash > 0n`, so treat it as \"no handle\".\nfunction isZeroCt(ct: string | undefined): boolean {\n if (!ct) return false;\n try {\n return BigInt(ct) === 0n;\n } catch {\n return false;\n }\n}\n\nfunction shortCt(decimal: string): string {\n try {\n const hex = BigInt(decimal).toString(16);\n return hex.length > 10 ? `0x${hex.slice(0, 6)}…${hex.slice(-4)}` : `0x${hex}`;\n } catch {\n return decimal;\n }\n}\n\nfunction extractCtHash(data: unknown): string | undefined {\n if (data === null || data === undefined) return undefined;\n if (typeof data === 'bigint') return normalizeCt(data);\n if (typeof data === 'object' && data !== null && 'ctHash' in (data as Record<string, unknown>)) {\n return normalizeCt((data as { ctHash: unknown }).ctHash);\n }\n return undefined;\n}\n\n// The read key bakes the transient activeACPHash + enabled flags into its tail,\n// so the SAME value gets a fresh cache entry each time an ACP appears/rotates.\n// Its stable identity is [prefix, chainId, address, fn, args] (indices 0-4).\nfunction stableReadKey(k: unknown[]): string {\n try {\n return JSON.stringify(k.slice(0, 5));\n } catch {\n return String(k[1]) + '|' + String(k[2]) + '|' + String(k[3]);\n }\n}\n\n// Progress of a read: ran (success/error) > in flight > idle/never-ran.\nfunction readProgress(q: QueryLike): number {\n if (q.state.status === 'success' || q.state.status === 'error') return 2;\n if (q.state.fetchStatus === 'fetching') return 1;\n return 0;\n}\nfunction isFresherRead(candidate: QueryLike, current: QueryLike): boolean {\n const pc = readProgress(candidate);\n const pk = readProgress(current);\n if (pc !== pk) return pc > pk;\n return (candidate.state.dataUpdatedAt ?? 0) > (current.state.dataUpdatedAt ?? 0);\n}\n\nfunction categoryFor(fetch: FetchStageState, decrypt: DecryptStageState): DecryptionActivityCategory {\n if (fetch === 'error' || decrypt === 'error' || decrypt === 'blocked' || decrypt === 'stale') return 'error';\n if (decrypt === 'ok') return 'success';\n return 'idle';\n}\n\n/**\n * Observe the ctHash-fetch → decrypt pipeline on the SDK's QueryClient, correlated\n * by ctHash and cross-referenced against the active acp. Must be used inside the\n * Cofhe provider.\n */\nexport function useCofheDecryptionActivity(options?: UseCofheDecryptionActivityOptions): DecryptionActivityResult {\n const staleMs = options?.staleMs ?? DEFAULT_STALE_MS;\n const queryClient = useInternalQueryClient() as unknown as ClientLike;\n const account = useCofheAccount();\n const chainId = useCofheChainId();\n const active = useCofheActiveACP();\n const acpObj = active?.acp;\n\n // Track when each decrypt first went pending, so \"stale\" is real elapsed time\n // (react-query doesn't expose a fetch-start timestamp for a never-resolved query).\n const pendingSinceRef = useRef(new Map<string, number>());\n\n // Re-render on cache changes AND on a slow tick (staleness is time-based, not\n // event-driven — a query sitting pending emits no cache events).\n //\n // Coalesce cache events to one bump per animation frame. `cache.subscribe` fires\n // synchronously on EVERY cache event (including observer option/result updates),\n // and a consumer re-render can itself emit fresh cache events — an unbounded\n // bump→render→event→bump storm that pins the main thread and starves unrelated\n // updates (e.g. a route change never commits). One bump per frame keeps the view\n // live while capping re-renders so the loop can't run away.\n const [version, bump] = useReducer((n: number) => n + 1, 0);\n useEffect(() => {\n const cache = queryClient.getQueryCache();\n let scheduled = false;\n const schedule = () => {\n if (scheduled) return;\n scheduled = true;\n const run = () => {\n scheduled = false;\n bump();\n };\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(run);\n else setTimeout(run, 16);\n };\n const unsub = cache.subscribe(schedule);\n const tick = setInterval(bump, 5_000);\n return () => {\n unsub();\n clearInterval(tick);\n };\n }, [queryClient]);\n\n const clearCache = useCallback(() => queryClient.clear(), [queryClient]);\n\n const data = useMemo(() => {\n const cache = queryClient.getQueryCache();\n const queries = cache.getAll();\n const now = Date.now();\n\n const refetch = (key: unknown) => void queryClient.refetchQueries({ queryKey: key, exact: true });\n\n const acpState: ACPState = !acpObj\n ? 'none'\n : !acpObj.issuerSignature || acpObj.issuerSignature === '0x'\n ? 'unsigned'\n : acpObj.expiration <= nowSec()\n ? 'expired'\n : 'valid';\n const acpValid = acpState === 'valid';\n\n // Index decrypt queries by ctHash (source contract + label come from meta).\n const decryptByCt = new Map<\n string,\n { state: 'ok' | 'pending' | 'idle' | 'error'; pendingMs?: number; key?: unknown; meta?: CofheQueryMeta }\n >();\n const seenPending = new Set<string>();\n for (const q of queries) {\n const k = q.queryKey;\n // [prefix, chainId, ctHash, utype, acpHash] — see constructCofheDecryptForViewQueryKey.\n if (!Array.isArray(k) || k[0] !== 'decryptCiphertext') continue;\n const ct = normalizeCt(k[2]);\n if (!ct || isZeroCt(ct)) continue;\n const base = { key: q.queryKey, meta: q.meta };\n if (q.state.status === 'success') {\n decryptByCt.set(ct, { state: 'ok', ...base });\n pendingSinceRef.current.delete(ct);\n } else if (q.state.status === 'error') {\n decryptByCt.set(ct, { state: 'error', ...base });\n pendingSinceRef.current.delete(ct);\n } else if (q.state.fetchStatus === 'fetching') {\n seenPending.add(ct);\n let since = pendingSinceRef.current.get(ct);\n if (since === undefined) {\n since = now;\n pendingSinceRef.current.set(ct, since);\n }\n decryptByCt.set(ct, { state: 'pending', pendingMs: now - since, ...base });\n } else {\n // status 'pending' but fetchStatus 'idle' → disabled / never ran.\n pendingSinceRef.current.delete(ct);\n decryptByCt.set(ct, { state: 'idle', ...base });\n }\n }\n\n const rows: DecryptionActivityRow[] = [];\n const usedCt = new Set<string>();\n\n // Collapse per-acp/enabled key rotations to one entry per value.\n const readByValue = new Map<string, QueryLike>();\n for (const q of queries) {\n const k = q.queryKey;\n if (!Array.isArray(k) || k[0] !== 'cofheReadContract') continue;\n const id = stableReadKey(k);\n const existing = readByValue.get(id);\n if (!existing || isFresherRead(q, existing)) readByValue.set(id, q);\n }\n\n const pushRow = (\n row: Omit<DecryptionActivityRow, 'category' | 'canRetry' | 'retry'> & {\n fetchKey?: unknown;\n decryptKey?: unknown;\n }\n ) => {\n const { fetchKey, decryptKey, ...rest } = row;\n const canRetry = rest.fetch !== 'idle' && (fetchKey !== undefined || decryptKey !== undefined);\n rows.push({\n ...rest,\n category: categoryFor(rest.fetch, rest.decrypt),\n canRetry,\n retry: () => {\n if (fetchKey !== undefined) refetch(fetchKey);\n if (decryptKey !== undefined) refetch(decryptKey);\n },\n });\n };\n\n // One row per confidential value; attach its decrypt stage by ctHash.\n for (const q of readByValue.values()) {\n const m = q.meta;\n const ctRaw = q.state.status === 'success' ? extractCtHash(q.state.data) : undefined;\n const ct = ctRaw && !isZeroCt(ctRaw) ? ctRaw : undefined;\n const fetchInFlight = q.state.fetchStatus === 'fetching';\n const fetchState: FetchStageState =\n q.state.status === 'error'\n ? 'error'\n : q.state.status === 'pending'\n ? fetchInFlight\n ? 'pending'\n : 'idle'\n : ct\n ? 'ok'\n : 'empty';\n\n let decrypt: DecryptStageState = 'absent';\n let blockedReason: string | undefined;\n let pendingMs: number | undefined;\n let decryptKey: unknown;\n let decryptMeta: CofheQueryMeta | undefined;\n if (ct) {\n usedCt.add(ct);\n const d = decryptByCt.get(ct);\n decryptKey = d?.key;\n decryptMeta = d?.meta;\n if (d?.state === 'ok') decrypt = 'ok';\n else if (d?.state === 'error') decrypt = 'error';\n else if (d?.state === 'idle') decrypt = 'idle';\n else if (d?.state === 'pending') {\n pendingMs = d.pendingMs;\n decrypt = (d.pendingMs ?? 0) > staleMs ? 'stale' : 'pending';\n } else {\n decrypt = acpValid ? 'absent' : 'blocked';\n if (!acpValid) blockedReason = `acp ${acpState}`;\n }\n } else if (fetchState === 'idle' && !acpValid) {\n // The read is gated off (no valid acp) — blocked before any ctHash.\n decrypt = 'blocked';\n blockedReason = `acp ${acpState}`;\n }\n\n const meta = m ?? decryptMeta;\n pushRow({\n key: q.queryHash,\n ctHash: ct,\n ctHashShort: ct ? shortCt(ct) : undefined,\n meta,\n chainId: meta?.chainId,\n address: meta?.address,\n functionName: meta?.functionName,\n label: meta?.consumer?.label,\n fetch: fetchState,\n decrypt,\n blockedReason,\n pendingMs,\n updatedAt: now,\n fetchKey: q.queryKey,\n decryptKey,\n });\n }\n\n // Orphan decrypts (a ctHash being decrypted with no fetch query in cache).\n for (const [ct, d] of decryptByCt) {\n if (usedCt.has(ct)) continue;\n const decrypt: DecryptStageState =\n d.state === 'ok'\n ? 'ok'\n : d.state === 'error'\n ? 'error'\n : d.state === 'idle'\n ? 'idle'\n : (d.pendingMs ?? 0) > staleMs\n ? 'stale'\n : 'pending';\n pushRow({\n key: `decrypt:${ct}`,\n ctHash: ct,\n ctHashShort: shortCt(ct),\n meta: d.meta,\n chainId: d.meta?.chainId,\n address: d.meta?.address,\n functionName: d.meta?.functionName,\n label: d.meta?.consumer?.label,\n fetch: 'ok',\n decrypt,\n pendingMs: d.pendingMs,\n updatedAt: now,\n decryptKey: d.key,\n });\n }\n\n // Drop ctHashes we no longer see, so the pending-since map can't grow unbounded.\n for (const ct of pendingSinceRef.current.keys()) {\n if (!seenPending.has(ct)) pendingSinceRef.current.delete(ct);\n }\n\n const counts = {\n total: rows.length,\n ok: rows.filter((r) => r.decrypt === 'ok').length,\n pending: rows.filter((r) => r.decrypt === 'pending').length,\n stale: rows.filter((r) => r.decrypt === 'stale').length,\n blocked: rows.filter((r) => r.decrypt === 'blocked').length,\n error: rows.filter((r) => r.decrypt === 'error' || r.fetch === 'error').length,\n };\n\n // Most actionable first: blocked/stale/error, then pending, then done.\n const rank: Record<DecryptStageState, number> = {\n blocked: 0,\n stale: 1,\n error: 2,\n pending: 3,\n idle: 4,\n absent: 5,\n ok: 6,\n };\n rows.sort((a, b) => rank[a.decrypt] - rank[b.decrypt]);\n\n const expiresInSec = acpObj ? acpObj.expiration - nowSec() : undefined;\n return { rows, acp: { state: acpState, expiresInSec }, counts };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [queryClient, account, chainId, acpObj, staleMs, version]);\n\n return { ...data, clearCache };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CO,SAAS,2BACd,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back","useMemo"]}
|
package/dist/ui-base.cjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk3O3XFKDNcjs = require('./chunk-3O3XFKDN.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -21,5 +21,5 @@ var _chunkBBZDUNBDcjs = require('./chunk-BBZDUNBD.cjs');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.COFHE_STATUS_IDS =
|
|
24
|
+
exports.COFHE_STATUS_IDS = _chunk3O3XFKDNcjs.COFHE_STATUS_IDS; exports.CofheEncryptInput = _chunk3O3XFKDNcjs.CofheEncryptInput; exports.CofheFloatingButtonProvider = _chunk3O3XFKDNcjs.CofheFloatingButtonProvider; exports.CofheFloatingButtonWithProvider = _chunk3O3XFKDNcjs.CofheFloatingButtonWithProvider; exports.CofheStatusActionIntents = _chunk3O3XFKDNcjs.CofheStatusActionIntents; exports.FheTypesList = _chunk3O3XFKDNcjs.FheTypesList; exports.MainPage = _chunk3O3XFKDNcjs.MainPage; exports.SettingsPage = _chunk3O3XFKDNcjs.SettingsPage; exports.sortCofheStatuses = _chunk3O3XFKDNcjs.sortCofheStatuses; exports.useCofheStatuses = _chunk3O3XFKDNcjs.useCofheStatuses;
|
|
25
25
|
//# sourceMappingURL=ui-base.cjs.map
|
package/dist/ui-base.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cofhe/react",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.6",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"tailwind-merge": "2.6.0",
|
|
66
66
|
"zod": "4.1.12",
|
|
67
67
|
"zustand": "5.0.13",
|
|
68
|
-
"@cofhe/abi": "1.1.0-alpha.
|
|
69
|
-
"@cofhe/sdk": "1.1.0-alpha.
|
|
68
|
+
"@cofhe/abi": "1.1.0-alpha.6",
|
|
69
|
+
"@cofhe/sdk": "1.1.0-alpha.6"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@tanstack/react-query": "^5.90.20",
|
|
File without changes
|