@cofhe/react 1.1.0-alpha.4 → 1.1.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -117,8 +117,8 @@
117
117
 
118
118
  var _chunkBBZDUNBDcjs = require('./chunk-BBZDUNBD.cjs');
119
119
 
120
- // src/hooks/useCofheDecrypts.ts
121
- function useCofheDecrypts({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }, queryOptions) {
120
+ // src/hooks/useCofheDecryptForViewList.ts
121
+ function useCofheDecryptForViewList({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }, queryOptions) {
122
122
  const { client } = _chunkBBZDUNBDcjs.useCofheContext.call(void 0, );
123
123
  const connectedChainId = _chunkBBZDUNBDcjs.useCofheChainId.call(void 0, );
124
124
  const decryptChainId = _nullishCoalesce(chainId, () => ( connectedChainId));
@@ -757,5 +757,5 @@ function useCofheDecryptionActivity(options) {
757
757
 
758
758
 
759
759
 
760
- exports.COFHE_STATUS_IDS = _chunkBBZDUNBDcjs.COFHE_STATUS_IDS; exports.CofheACPScope = _chunkBBZDUNBDcjs.CofheACPScope; exports.CofheFloatingButtonProvider = _chunkBBZDUNBDcjs.CofheFloatingButtonProvider; exports.CofheProvider = _chunkBBZDUNBDcjs.CofheProvider; exports.CofheStatusActionIntents = _chunkBBZDUNBDcjs.CofheStatusActionIntents; exports.ETH_ADDRESS_LOWERCASE = _chunkBBZDUNBDcjs.ETH_ADDRESS_LOWERCASE; exports.FheTypesList = _chunkBBZDUNBDcjs.FheTypesList; exports.TransactionActionType = _chunkBBZDUNBDcjs.TransactionActionType; exports.TransactionStatus = _chunkBBZDUNBDcjs.TransactionStatus; exports.actionToString = _chunkBBZDUNBDcjs.actionToString; exports.addCofheTransaction = _chunkBBZDUNBDcjs.addCofheTransaction; exports.asCofhePublicClient = _chunkBBZDUNBDcjs.asCofhePublicClient; exports.asCofheWalletClient = _chunkBBZDUNBDcjs.asCofheWalletClient; exports.cofheDecryptForTxQuery = cofheDecryptForTxQuery; exports.cofheDecryptForViewQuery = _chunkBBZDUNBDcjs.cofheDecryptForViewQuery; exports.constructCofheDecryptForTxQueryKey = constructCofheDecryptForTxQueryKey; exports.constructCofheDecryptForViewQueryKey = _chunkBBZDUNBDcjs.constructCofheDecryptForViewQueryKey; exports.constructCofheReadContractQueryForInvalidation = _chunkBBZDUNBDcjs.constructCofheReadContractQueryForInvalidation; exports.createCofheClient = _web.createCofheClient; exports.createCofheConfig = _chunkBBZDUNBDcjs.createCofheConfig; exports.findMatchingInvalidationContext = _chunkBBZDUNBDcjs.findMatchingInvalidationContext; exports.formatRelativeTime = _chunkBBZDUNBDcjs.formatRelativeTime; exports.getBlockExplorerAddressUrl = _chunkBBZDUNBDcjs.getBlockExplorerAddressUrl; exports.getBlockExplorerTokenUrl = _chunkBBZDUNBDcjs.getBlockExplorerTokenUrl; exports.getBlockExplorerTxUrl = _chunkBBZDUNBDcjs.getBlockExplorerTxUrl; exports.getBlockExplorerUrl = _chunkBBZDUNBDcjs.getBlockExplorerUrl; exports.getCofheTokenClaimUnshieldedCallArgs = _chunkBBZDUNBDcjs.getCofheTokenClaimUnshieldedCallArgs; exports.getCofheTokenShieldCallArgs = _chunkBBZDUNBDcjs.getCofheTokenShieldCallArgs; exports.getCofheTokenUnshieldCallArgs = _chunkBBZDUNBDcjs.getCofheTokenUnshieldCallArgs; exports.getConfidentialDecimals = _chunkBBZDUNBDcjs.getConfidentialDecimals; exports.getPublicDecimals = _chunkBBZDUNBDcjs.getPublicDecimals; exports.getPublicSymbol = _chunkBBZDUNBDcjs.getPublicSymbol; exports.invalidateQueriesWithContext = _chunkBBZDUNBDcjs.invalidateQueriesWithContext; exports.isCustomTransactionActionType = _chunkBBZDUNBDcjs.isCustomTransactionActionType; exports.isEthPair = _chunkBBZDUNBDcjs.isEthPair; exports.isWrappedEthToken = _chunkBBZDUNBDcjs.isWrappedEthToken; exports.maybeWaitUntilRpcAware = _chunkBBZDUNBDcjs.maybeWaitUntilRpcAware; exports.maybeWaitUntilRpcAwareAndReadContract = _chunkBBZDUNBDcjs.maybeWaitUntilRpcAwareAndReadContract; exports.quantizeAmount = _chunkBBZDUNBDcjs.quantizeAmount; exports.resolveReceiptBlockHash = _chunkBBZDUNBDcjs.resolveReceiptBlockHash; exports.scaleAmount = _chunkBBZDUNBDcjs.scaleAmount; exports.sortCofheStatuses = _chunkBBZDUNBDcjs.sortCofheStatuses; exports.statusToString = _chunkBBZDUNBDcjs.statusToString; exports.transactionMatchesToken = _chunkBBZDUNBDcjs.transactionMatchesToken; exports.truncateHash = _chunkBBZDUNBDcjs.truncateHash; exports.tryAsCofhePublicClient = _chunkBBZDUNBDcjs.tryAsCofhePublicClient; exports.tryAsCofheWalletClient = _chunkBBZDUNBDcjs.tryAsCofheWalletClient; exports.useCofheACPScope = _chunkBBZDUNBDcjs.useCofheACPScope; exports.useCofheACPStatus = _chunkBBZDUNBDcjs.useCofheACPStatus; exports.useCofheACPs = _chunkBBZDUNBDcjs.useCofheACPs; exports.useCofheActiveACP = _chunkBBZDUNBDcjs.useCofheActiveACP; exports.useCofheAllACPs = _chunkBBZDUNBDcjs.useCofheAllACPs; exports.useCofheAutoConnect = _chunkBBZDUNBDcjs.useCofheAutoConnect; exports.useCofheClient = _chunkBBZDUNBDcjs.useCofheClient; exports.useCofheConnection = _chunkBBZDUNBDcjs.useCofheConnection; exports.useCofheContext = _chunkBBZDUNBDcjs.useCofheContext; exports.useCofheCreateACP = _chunkBBZDUNBDcjs.useCofheCreateACP; exports.useCofheDecrypt = _chunkBBZDUNBDcjs.useCofheDecrypt; exports.useCofheDecryptForTx = useCofheDecryptForTx; exports.useCofheDecrypter = useCofheDecrypter; exports.useCofheDecryptionActivity = useCofheDecryptionActivity; exports.useCofheDecrypts = useCofheDecrypts; exports.useCofheEnabled = _chunkBBZDUNBDcjs.useCofheEnabled; exports.useCofheEncrypt = _chunkBBZDUNBDcjs.useCofheEncrypt; exports.useCofheEncryptAndWriteContract = _chunkBBZDUNBDcjs.useCofheEncryptAndWriteContract; exports.useCofheImportShared = _chunkBBZDUNBDcjs.useCofheImportShared; exports.useCofheIncomingShares = _chunkBBZDUNBDcjs.useCofheIncomingShares; exports.useCofheNavigateToCreateACP = _chunkBBZDUNBDcjs.useCofheNavigateToCreateACP; exports.useCofhePublicClient = _chunkBBZDUNBDcjs.useCofhePublicClient; exports.useCofheReadContract = _chunkBBZDUNBDcjs.useCofheReadContract; exports.useCofheReadContractAndDecrypt = _chunkBBZDUNBDcjs.useCofheReadContractAndDecrypt; exports.useCofheReadContracts = _chunkBBZDUNBDcjs.useCofheReadContracts; exports.useCofheRemoveACP = _chunkBBZDUNBDcjs.useCofheRemoveACP; exports.useCofheRemoveShare = _chunkBBZDUNBDcjs.useCofheRemoveShare; exports.useCofheRevokeACP = _chunkBBZDUNBDcjs.useCofheRevokeACP; exports.useCofheSelectACP = _chunkBBZDUNBDcjs.useCofheSelectACP; exports.useCofheShareLabels = _chunkBBZDUNBDcjs.useCofheShareLabels; exports.useCofheShareOnChain = _chunkBBZDUNBDcjs.useCofheShareOnChain; exports.useCofheSimulateWriteContract = _chunkBBZDUNBDcjs.useCofheSimulateWriteContract; exports.useCofheStatuses = _chunkBBZDUNBDcjs.useCofheStatuses; exports.useCofheTaskManagerAddress = _chunkBBZDUNBDcjs.useCofheTaskManagerAddress; exports.useCofheToken = _chunkBBZDUNBDcjs.useCofheToken; exports.useCofheTokenApprove = _chunkBBZDUNBDcjs.useCofheTokenApprove; exports.useCofheTokenClaimUnshielded = _chunkBBZDUNBDcjs.useCofheTokenClaimUnshielded; exports.useCofheTokenClaimable = _chunkBBZDUNBDcjs.useCofheTokenClaimable; exports.useCofheTokenClaims = _chunkBBZDUNBDcjs.useCofheTokenClaims; exports.useCofheTokenDecryptedBalance = _chunkBBZDUNBDcjs.useCofheTokenDecryptedBalance; exports.useCofheTokenLists = _chunkBBZDUNBDcjs.useCofheTokenLists; exports.useCofheTokenPublicBalance = _chunkBBZDUNBDcjs.useCofheTokenPublicBalance; exports.useCofheTokenShield = _chunkBBZDUNBDcjs.useCofheTokenShield; exports.useCofheTokenTransactions = _chunkBBZDUNBDcjs.useCofheTokenTransactions; exports.useCofheTokenTransfer = _chunkBBZDUNBDcjs.useCofheTokenTransfer; exports.useCofheTokenUnshield = _chunkBBZDUNBDcjs.useCofheTokenUnshield; exports.useCofheTokens = _chunkBBZDUNBDcjs.useCofheTokens; exports.useCofheTokensClaimable = _chunkBBZDUNBDcjs.useCofheTokensClaimable; exports.useCofheTokensWithExistingEncryptedBalances = _chunkBBZDUNBDcjs.useCofheTokensWithExistingEncryptedBalances; exports.useCofheTransactions = _chunkBBZDUNBDcjs.useCofheTransactions; exports.useCofheWalletClient = _chunkBBZDUNBDcjs.useCofheWalletClient; exports.useCofheWriteContract = _chunkBBZDUNBDcjs.useCofheWriteContract; exports.useCoingeckoContractMarketChartRange = _chunkBBZDUNBDcjs.useCoingeckoContractMarketChartRange; exports.useCoingeckoUsdPrice = _chunkBBZDUNBDcjs.useCoingeckoUsdPrice; exports.useCustomTokensStore = _chunkBBZDUNBDcjs.useCustomTokensStore; exports.useInternalQueryClient = _chunkBBZDUNBDcjs.useInternalQueryClient; exports.useInvalidationContextStore = _chunkBBZDUNBDcjs.useInvalidationContextStore; exports.useKnownCofheToken = _chunkBBZDUNBDcjs.useKnownCofheToken; exports.useResolvedCofheToken = _chunkBBZDUNBDcjs.useResolvedCofheToken; exports.useTokenAllowance = _chunkBBZDUNBDcjs.useTokenAllowance; exports.useTokensWithPublicBalances = _chunkBBZDUNBDcjs.useTokensWithPublicBalances; exports.useTransactionReceiptsByHash = _chunkBBZDUNBDcjs.useTransactionReceiptsByHash; exports.useTransactionStore = _chunkBBZDUNBDcjs.useTransactionStore; exports.withInvalidationContext = _chunkBBZDUNBDcjs.withInvalidationContext;
760
+ exports.COFHE_STATUS_IDS = _chunkBBZDUNBDcjs.COFHE_STATUS_IDS; exports.CofheACPScope = _chunkBBZDUNBDcjs.CofheACPScope; exports.CofheFloatingButtonProvider = _chunkBBZDUNBDcjs.CofheFloatingButtonProvider; exports.CofheProvider = _chunkBBZDUNBDcjs.CofheProvider; exports.CofheStatusActionIntents = _chunkBBZDUNBDcjs.CofheStatusActionIntents; exports.ETH_ADDRESS_LOWERCASE = _chunkBBZDUNBDcjs.ETH_ADDRESS_LOWERCASE; exports.FheTypesList = _chunkBBZDUNBDcjs.FheTypesList; exports.TransactionActionType = _chunkBBZDUNBDcjs.TransactionActionType; exports.TransactionStatus = _chunkBBZDUNBDcjs.TransactionStatus; exports.actionToString = _chunkBBZDUNBDcjs.actionToString; exports.addCofheTransaction = _chunkBBZDUNBDcjs.addCofheTransaction; exports.asCofhePublicClient = _chunkBBZDUNBDcjs.asCofhePublicClient; exports.asCofheWalletClient = _chunkBBZDUNBDcjs.asCofheWalletClient; exports.cofheDecryptForTxQuery = cofheDecryptForTxQuery; exports.cofheDecryptForViewQuery = _chunkBBZDUNBDcjs.cofheDecryptForViewQuery; exports.constructCofheDecryptForTxQueryKey = constructCofheDecryptForTxQueryKey; exports.constructCofheDecryptForViewQueryKey = _chunkBBZDUNBDcjs.constructCofheDecryptForViewQueryKey; exports.constructCofheReadContractQueryForInvalidation = _chunkBBZDUNBDcjs.constructCofheReadContractQueryForInvalidation; exports.createCofheClient = _web.createCofheClient; exports.createCofheConfig = _chunkBBZDUNBDcjs.createCofheConfig; exports.findMatchingInvalidationContext = _chunkBBZDUNBDcjs.findMatchingInvalidationContext; exports.formatRelativeTime = _chunkBBZDUNBDcjs.formatRelativeTime; exports.getBlockExplorerAddressUrl = _chunkBBZDUNBDcjs.getBlockExplorerAddressUrl; exports.getBlockExplorerTokenUrl = _chunkBBZDUNBDcjs.getBlockExplorerTokenUrl; exports.getBlockExplorerTxUrl = _chunkBBZDUNBDcjs.getBlockExplorerTxUrl; exports.getBlockExplorerUrl = _chunkBBZDUNBDcjs.getBlockExplorerUrl; exports.getCofheTokenClaimUnshieldedCallArgs = _chunkBBZDUNBDcjs.getCofheTokenClaimUnshieldedCallArgs; exports.getCofheTokenShieldCallArgs = _chunkBBZDUNBDcjs.getCofheTokenShieldCallArgs; exports.getCofheTokenUnshieldCallArgs = _chunkBBZDUNBDcjs.getCofheTokenUnshieldCallArgs; exports.getConfidentialDecimals = _chunkBBZDUNBDcjs.getConfidentialDecimals; exports.getPublicDecimals = _chunkBBZDUNBDcjs.getPublicDecimals; exports.getPublicSymbol = _chunkBBZDUNBDcjs.getPublicSymbol; exports.invalidateQueriesWithContext = _chunkBBZDUNBDcjs.invalidateQueriesWithContext; exports.isCustomTransactionActionType = _chunkBBZDUNBDcjs.isCustomTransactionActionType; exports.isEthPair = _chunkBBZDUNBDcjs.isEthPair; exports.isWrappedEthToken = _chunkBBZDUNBDcjs.isWrappedEthToken; exports.maybeWaitUntilRpcAware = _chunkBBZDUNBDcjs.maybeWaitUntilRpcAware; exports.maybeWaitUntilRpcAwareAndReadContract = _chunkBBZDUNBDcjs.maybeWaitUntilRpcAwareAndReadContract; exports.quantizeAmount = _chunkBBZDUNBDcjs.quantizeAmount; exports.resolveReceiptBlockHash = _chunkBBZDUNBDcjs.resolveReceiptBlockHash; exports.scaleAmount = _chunkBBZDUNBDcjs.scaleAmount; exports.sortCofheStatuses = _chunkBBZDUNBDcjs.sortCofheStatuses; exports.statusToString = _chunkBBZDUNBDcjs.statusToString; exports.transactionMatchesToken = _chunkBBZDUNBDcjs.transactionMatchesToken; exports.truncateHash = _chunkBBZDUNBDcjs.truncateHash; exports.tryAsCofhePublicClient = _chunkBBZDUNBDcjs.tryAsCofhePublicClient; exports.tryAsCofheWalletClient = _chunkBBZDUNBDcjs.tryAsCofheWalletClient; exports.useCofheACPScope = _chunkBBZDUNBDcjs.useCofheACPScope; exports.useCofheACPStatus = _chunkBBZDUNBDcjs.useCofheACPStatus; exports.useCofheACPs = _chunkBBZDUNBDcjs.useCofheACPs; exports.useCofheActiveACP = _chunkBBZDUNBDcjs.useCofheActiveACP; exports.useCofheAllACPs = _chunkBBZDUNBDcjs.useCofheAllACPs; exports.useCofheAutoConnect = _chunkBBZDUNBDcjs.useCofheAutoConnect; exports.useCofheClient = _chunkBBZDUNBDcjs.useCofheClient; exports.useCofheConnection = _chunkBBZDUNBDcjs.useCofheConnection; exports.useCofheContext = _chunkBBZDUNBDcjs.useCofheContext; exports.useCofheCreateACP = _chunkBBZDUNBDcjs.useCofheCreateACP; exports.useCofheDecrypt = _chunkBBZDUNBDcjs.useCofheDecrypt; exports.useCofheDecryptForTx = useCofheDecryptForTx; exports.useCofheDecryptForViewList = useCofheDecryptForViewList; exports.useCofheDecrypter = useCofheDecrypter; exports.useCofheDecryptionActivity = useCofheDecryptionActivity; exports.useCofheEnabled = _chunkBBZDUNBDcjs.useCofheEnabled; exports.useCofheEncrypt = _chunkBBZDUNBDcjs.useCofheEncrypt; exports.useCofheEncryptAndWriteContract = _chunkBBZDUNBDcjs.useCofheEncryptAndWriteContract; exports.useCofheImportShared = _chunkBBZDUNBDcjs.useCofheImportShared; exports.useCofheIncomingShares = _chunkBBZDUNBDcjs.useCofheIncomingShares; exports.useCofheNavigateToCreateACP = _chunkBBZDUNBDcjs.useCofheNavigateToCreateACP; exports.useCofhePublicClient = _chunkBBZDUNBDcjs.useCofhePublicClient; exports.useCofheReadContract = _chunkBBZDUNBDcjs.useCofheReadContract; exports.useCofheReadContractAndDecrypt = _chunkBBZDUNBDcjs.useCofheReadContractAndDecrypt; exports.useCofheReadContracts = _chunkBBZDUNBDcjs.useCofheReadContracts; exports.useCofheRemoveACP = _chunkBBZDUNBDcjs.useCofheRemoveACP; exports.useCofheRemoveShare = _chunkBBZDUNBDcjs.useCofheRemoveShare; exports.useCofheRevokeACP = _chunkBBZDUNBDcjs.useCofheRevokeACP; exports.useCofheSelectACP = _chunkBBZDUNBDcjs.useCofheSelectACP; exports.useCofheShareLabels = _chunkBBZDUNBDcjs.useCofheShareLabels; exports.useCofheShareOnChain = _chunkBBZDUNBDcjs.useCofheShareOnChain; exports.useCofheSimulateWriteContract = _chunkBBZDUNBDcjs.useCofheSimulateWriteContract; exports.useCofheStatuses = _chunkBBZDUNBDcjs.useCofheStatuses; exports.useCofheTaskManagerAddress = _chunkBBZDUNBDcjs.useCofheTaskManagerAddress; exports.useCofheToken = _chunkBBZDUNBDcjs.useCofheToken; exports.useCofheTokenApprove = _chunkBBZDUNBDcjs.useCofheTokenApprove; exports.useCofheTokenClaimUnshielded = _chunkBBZDUNBDcjs.useCofheTokenClaimUnshielded; exports.useCofheTokenClaimable = _chunkBBZDUNBDcjs.useCofheTokenClaimable; exports.useCofheTokenClaims = _chunkBBZDUNBDcjs.useCofheTokenClaims; exports.useCofheTokenDecryptedBalance = _chunkBBZDUNBDcjs.useCofheTokenDecryptedBalance; exports.useCofheTokenLists = _chunkBBZDUNBDcjs.useCofheTokenLists; exports.useCofheTokenPublicBalance = _chunkBBZDUNBDcjs.useCofheTokenPublicBalance; exports.useCofheTokenShield = _chunkBBZDUNBDcjs.useCofheTokenShield; exports.useCofheTokenTransactions = _chunkBBZDUNBDcjs.useCofheTokenTransactions; exports.useCofheTokenTransfer = _chunkBBZDUNBDcjs.useCofheTokenTransfer; exports.useCofheTokenUnshield = _chunkBBZDUNBDcjs.useCofheTokenUnshield; exports.useCofheTokens = _chunkBBZDUNBDcjs.useCofheTokens; exports.useCofheTokensClaimable = _chunkBBZDUNBDcjs.useCofheTokensClaimable; exports.useCofheTokensWithExistingEncryptedBalances = _chunkBBZDUNBDcjs.useCofheTokensWithExistingEncryptedBalances; exports.useCofheTransactions = _chunkBBZDUNBDcjs.useCofheTransactions; exports.useCofheWalletClient = _chunkBBZDUNBDcjs.useCofheWalletClient; exports.useCofheWriteContract = _chunkBBZDUNBDcjs.useCofheWriteContract; exports.useCoingeckoContractMarketChartRange = _chunkBBZDUNBDcjs.useCoingeckoContractMarketChartRange; exports.useCoingeckoUsdPrice = _chunkBBZDUNBDcjs.useCoingeckoUsdPrice; exports.useCustomTokensStore = _chunkBBZDUNBDcjs.useCustomTokensStore; exports.useInternalQueryClient = _chunkBBZDUNBDcjs.useInternalQueryClient; exports.useInvalidationContextStore = _chunkBBZDUNBDcjs.useInvalidationContextStore; exports.useKnownCofheToken = _chunkBBZDUNBDcjs.useKnownCofheToken; exports.useResolvedCofheToken = _chunkBBZDUNBDcjs.useResolvedCofheToken; exports.useTokenAllowance = _chunkBBZDUNBDcjs.useTokenAllowance; exports.useTokensWithPublicBalances = _chunkBBZDUNBDcjs.useTokensWithPublicBalances; exports.useTransactionReceiptsByHash = _chunkBBZDUNBDcjs.useTransactionReceiptsByHash; exports.useTransactionStore = _chunkBBZDUNBDcjs.useTransactionStore; exports.withInvalidationContext = _chunkBBZDUNBDcjs.withInvalidationContext;
761
761
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/cofhesdk/cofhesdk/packages/react/dist/index.cjs","../src/hooks/useCofheDecrypts.ts","../src/hooks/useCofheDecrypter.ts","../src/hooks/useCofheDecryptForTx.ts","../src/index.ts","../src/hooks/useCofheDecryptionActivity.ts"],"names":["useMemo"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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;AACE,UAAA;AACA,UAAA;AACM,UAAA;AACN,UAAA;AACA,UAAA;AACD,QAAA;AACH,QAAA;AACA,wBAAA;AACF,MAAA;AACF,IAAA;AACS,IAAA;AACX,EAAA;AAEM,EAAA;AACG,IAAA;AACA,MAAA;AACG,QAAA;AACR,MAAA;AACI,MAAA;AACI,QAAA;AACE,UAAA;AACN,UAAA;AACM,UAAA;AACP,QAAA;AACH,MAAA;AACM,MAAA;AACD,MAAA;AACC,MAAA;AACJ,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACK,QAAA;AACL,QAAA;AACQ,QAAA;AACR,QAAA;AACA,QAAA;AACQ,QAAA;AACF,QAAA;AACN,QAAA;AACD,MAAA;AACM,MAAA;AAEH,QAAA;AACE,UAAA;AACA,UAAA;AACM,UAAA;AACN,UAAA;AACA,UAAA;AACD,QAAA;AACH,QAAA;AACA,wBAAA;AACF,MAAA;AACF,IAAA;AACS,IAAA;AACX,EAAA;AAES,EAAA;AACX;AFmHgB;AACA;AI/NP;AJiOO;AACA;AKtZP;AAwBH;AACS;AAmEN;AACG,EAAA;AACN,EAAA;AACK,IAAA;AACD,EAAA;AACI,IAAA;AACE,IAAA;AACd,EAAA;AACF;AAIS;AACE,EAAA;AACL,EAAA;AACK,IAAA;AACD,EAAA;AACC,IAAA;AACT,EAAA;AACF;AAES;AACH,EAAA;AACU,IAAA;AACD,IAAA;AACL,EAAA;AACC,IAAA;AACT,EAAA;AACF;AAES;AACM,EAAA;AACF,EAAA;AACA,EAAA;AACF,IAAA;AACT,EAAA;AACO,EAAA;AACT;AAKS;AACH,EAAA;AACU,IAAA;AACN,EAAA;AACC,IAAA;AACT,EAAA;AACF;AAGS;AACK,EAAA;AACA,EAAA;AACL,EAAA;AACT;AACS;AACI,EAAA;AACA,EAAA;AACI,EAAA;AACP,EAAA;AACV;AAES;AACO,EAAA;AACV,EAAA;AACG,EAAA;AACT;AAOgB;AACR,EAAA;AACA,EAAA;AACA,EAAA;AACA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;AACA,QAAA;AACF,MAAA;AAEM,MAAA;AACE,MAAA;AACC,QAAA;AACC,QAAA;AACR,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACO,QAAA;AACA,QAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACD,MAAA;AACH,IAAA;AAGY,IAAA;AACN,MAAA;AACE,MAAA;AAUE,MAAA;AACD,QAAA;AACG,QAAA;AACR,QAAA;AACQ,QAAA;AACR,QAAA;AACA,QAAA;AACA,QAAA;AACO,QAAA;AACA,QAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACD,MAAA;AACH,IAAA;AAGW,IAAA;AACJ,MAAA;AACP,IAAA;AAEM,IAAA;AACG,MAAA;AACE,MAAA;AACA,MAAA;AACF,MAAA;AACE,MAAA;AACF,MAAA;AACT,IAAA;AAGM,IAAA;AACK,MAAA;AACF,MAAA;AACA,MAAA;AACE,MAAA;AACH,MAAA;AACE,MAAA;AACJ,MAAA;AACN,IAAA;AACW,IAAA;AAEL,IAAA;AACG,IAAA;AAEP,EAAA;AAEQ,EAAA;AACd;ALqOgB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/cofhesdk/cofhesdk/packages/react/dist/index.cjs","sourcesContent":[null,"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 UseCofheDecryptsInput<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 useCofheDecrypts<U extends FheTypes, TSelectedData = UnsealedItem<U>>(\n { inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptsInput<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 { useCofheDecrypts, type UseCofheDecryptsInput } from '@/hooks/useCofheDecrypts';\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"]}
1
+ {"version":3,"sources":["/home/runner/work/cofhesdk/cofhesdk/packages/react/dist/index.cjs","../src/hooks/useCofheDecryptForViewList.ts","../src/hooks/useCofheDecrypter.ts","../src/hooks/useCofheDecryptForTx.ts","../src/index.ts","../src/hooks/useCofheDecryptionActivity.ts"],"names":["useMemo"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;AC1EO,SAAS,0BAAA,CACd,EAAE,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,MAAA,EAAQ,OAAA,EAAS,GAAA,EAAK,UA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A;AACG,QAAA;AACR,MAAA;AACI,MAAA;AACI,QAAA;AACE,UAAA;AACN,UAAA;AACM,UAAA;AACP,QAAA;AACH,MAAA;AACM,MAAA;AACD,MAAA;AACC,MAAA;AACJ,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACK,QAAA;AACL,QAAA;AACQ,QAAA;AACR,QAAA;AACA,QAAA;AACQ,QAAA;AACF,QAAA;AACN,QAAA;AACD,MAAA;AACM,MAAA;AAEH,QAAA;AACE,UAAA;AACA,UAAA;AACM,UAAA;AACN,UAAA;AACA,UAAA;AACD,QAAA;AACH,QAAA;AACA,wBAAA;AACF,MAAA;AACF,IAAA;AACS,IAAA;AACX,EAAA;AAES,EAAA;AACX;AFmHgB;AACA;AI/NP;AJiOO;AACA;AKtZP;AAwBH;AACS;AAmEN;AACG,EAAA;AACN,EAAA;AACK,IAAA;AACD,EAAA;AACI,IAAA;AACE,IAAA;AACd,EAAA;AACF;AAIS;AACE,EAAA;AACL,EAAA;AACK,IAAA;AACD,EAAA;AACC,IAAA;AACT,EAAA;AACF;AAES;AACH,EAAA;AACU,IAAA;AACD,IAAA;AACL,EAAA;AACC,IAAA;AACT,EAAA;AACF;AAES;AACM,EAAA;AACF,EAAA;AACA,EAAA;AACF,IAAA;AACT,EAAA;AACO,EAAA;AACT;AAKS;AACH,EAAA;AACU,IAAA;AACN,EAAA;AACC,IAAA;AACT,EAAA;AACF;AAGS;AACK,EAAA;AACA,EAAA;AACL,EAAA;AACT;AACS;AACI,EAAA;AACA,EAAA;AACI,EAAA;AACP,EAAA;AACV;AAES;AACO,EAAA;AACV,EAAA;AACG,EAAA;AACT;AAOgB;AACR,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AAIA,EAAA;AAWC,EAAA;AACG,EAAA;AACF,IAAA;AACF,IAAA;AACE,IAAA;AACA,MAAA;AACJ,MAAA;AACM,MAAA;AACJ,QAAA;AACK,QAAA;AACP,MAAA;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;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACD,MAAA;AACH,IAAA;AAGY,IAAA;AACN,MAAA;AACE,MAAA;AAUE,MAAA;AACD,QAAA;AACG,QAAA;AACR,QAAA;AACQ,QAAA;AACR,QAAA;AACA,QAAA;AACA,QAAA;AACO,QAAA;AACA,QAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACD,MAAA;AACH,IAAA;AAGW,IAAA;AACJ,MAAA;AACP,IAAA;AAEM,IAAA;AACG,MAAA;AACE,MAAA;AACA,MAAA;AACF,MAAA;AACE,MAAA;AACF,MAAA;AACT,IAAA;AAGM,IAAA;AACK,MAAA;AACF,MAAA;AACA,MAAA;AACE,MAAA;AACH,MAAA;AACE,MAAA;AACJ,MAAA;AACN,IAAA;AACW,IAAA;AAEL,IAAA;AACG,IAAA;AAEP,EAAA;AAEQ,EAAA;AACd;ALqOgB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/cofhesdk/cofhesdk/packages/react/dist/index.cjs","sourcesContent":[null,"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"]}
package/dist/index.d.cts CHANGED
@@ -16424,7 +16424,7 @@ declare function useCofheDecrypt<U extends FheTypes, TSeletedData = UnsealedItem
16424
16424
  timeoutMs?: number;
16425
16425
  }, queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSeletedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSeletedData, Error>;
16426
16426
 
16427
- type UseCofheDecryptsInput<U extends FheTypes> = {
16427
+ type UseCofheDecryptForViewListInput<U extends FheTypes> = {
16428
16428
  /** The handles to decrypt, in the order the results come back; `undefined` entries stay idle. */
16429
16429
  inputs: ReadonlyArray<EncryptedReturnTypeByUtype<U> | undefined>;
16430
16430
  /** Consumer-supplied metadata for debug/activity views, one for all or one per entry. */
@@ -16453,7 +16453,7 @@ type UseCofheDecryptsInput<U extends FheTypes> = {
16453
16453
  *
16454
16454
  * A zero handle — a value never set on chain — reads as the type's zero without a request.
16455
16455
  */
16456
- declare function useCofheDecrypts<U extends FheTypes, TSelectedData = UnsealedItem<U>>({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptsInput<U>, queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSelectedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSelectedData, Error>[];
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
16458
  /** Per-call options of the function `useCofheDecrypter` returns. */
16459
16459
  type CofheDecryptForViewFnOptions = {
@@ -16759,4 +16759,4 @@ type ResolveReceiptBlockHashOptions = {
16759
16759
  };
16760
16760
  declare function resolveReceiptBlockHash(receipt: TransactionReceipt, publicClient: PublicClient, options?: ResolveReceiptBlockHashOptions): Promise<TransactionReceipt>;
16761
16761
 
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 UseCofheDecrypterOptions, type UseCofheDecrypterResult, type UseCofheDecryptionActivityOptions, type UseCofheDecryptsInput, 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, useCofheDecrypter, useCofheDecryptionActivity, useCofheDecrypts, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -16424,7 +16424,7 @@ declare function useCofheDecrypt<U extends FheTypes, TSeletedData = UnsealedItem
16424
16424
  timeoutMs?: number;
16425
16425
  }, queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSeletedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSeletedData, Error>;
16426
16426
 
16427
- type UseCofheDecryptsInput<U extends FheTypes> = {
16427
+ type UseCofheDecryptForViewListInput<U extends FheTypes> = {
16428
16428
  /** The handles to decrypt, in the order the results come back; `undefined` entries stay idle. */
16429
16429
  inputs: ReadonlyArray<EncryptedReturnTypeByUtype<U> | undefined>;
16430
16430
  /** Consumer-supplied metadata for debug/activity views, one for all or one per entry. */
@@ -16453,7 +16453,7 @@ type UseCofheDecryptsInput<U extends FheTypes> = {
16453
16453
  *
16454
16454
  * A zero handle — a value never set on chain — reads as the type's zero without a request.
16455
16455
  */
16456
- declare function useCofheDecrypts<U extends FheTypes, TSelectedData = UnsealedItem<U>>({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptsInput<U>, queryOptions?: Omit<UseQueryOptions<UnsealedItem<U>, Error, TSelectedData>, 'queryKey' | 'queryFn'>): UseQueryResult<TSelectedData, Error>[];
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
16458
  /** Per-call options of the function `useCofheDecrypter` returns. */
16459
16459
  type CofheDecryptForViewFnOptions = {
@@ -16759,4 +16759,4 @@ type ResolveReceiptBlockHashOptions = {
16759
16759
  };
16760
16760
  declare function resolveReceiptBlockHash(receipt: TransactionReceipt, publicClient: PublicClient, options?: ResolveReceiptBlockHashOptions): Promise<TransactionReceipt>;
16761
16761
 
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 UseCofheDecrypterOptions, type UseCofheDecrypterResult, type UseCofheDecryptionActivityOptions, type UseCofheDecryptsInput, 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, useCofheDecrypter, useCofheDecryptionActivity, useCofheDecrypts, 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 };
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 };
package/dist/index.js CHANGED
@@ -117,8 +117,8 @@ import {
117
117
  zeroPlaintext
118
118
  } from "./chunk-6AIHOKTV.js";
119
119
 
120
- // src/hooks/useCofheDecrypts.ts
121
- function useCofheDecrypts({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }, queryOptions) {
120
+ // src/hooks/useCofheDecryptForViewList.ts
121
+ function useCofheDecryptForViewList({ inputs, meta, context, onPoll, chainId, acp, timeoutMs }, queryOptions) {
122
122
  const { client } = useCofheContext();
123
123
  const connectedChainId = useCofheChainId();
124
124
  const decryptChainId = chainId ?? connectedChainId;
@@ -705,9 +705,9 @@ export {
705
705
  useCofheCreateACP,
706
706
  useCofheDecrypt,
707
707
  useCofheDecryptForTx,
708
+ useCofheDecryptForViewList,
708
709
  useCofheDecrypter,
709
710
  useCofheDecryptionActivity,
710
- useCofheDecrypts,
711
711
  useCofheEnabled,
712
712
  useCofheEncrypt,
713
713
  useCofheEncryptAndWriteContract,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useCofheDecrypts.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 UseCofheDecryptsInput<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 useCofheDecrypts<U extends FheTypes, TSelectedData = UnsealedItem<U>>(\n { inputs, meta, context, onPoll, chainId, acp, timeoutMs }: UseCofheDecryptsInput<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 { useCofheDecrypts, type UseCofheDecryptsInput } from '@/hooks/useCofheDecrypts';\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,iBACd,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,CAAC,SAAS,OAAO,MAAM,MAAM,MAAM;AACjD,YAAM,aAAa,mBAAmB,WAAW,OAAO,MAAM;AAC9D,YAAM,UAAU,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,UAAU,aAAa,WAAW,CAAC,eAAe,eAAe;AACvG,YAAM,QAAQ,yBAA4B;AAAA,QACxC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK,aAAa;AAAA,QAClB,QAAQ,aAAa;AAAA,QACrB;AAAA,QACA;AAAA,QACA,MAAM,OAAO,SAAS,aAAc,Q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AA,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/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,YA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AChB,CAAC;AAAA,IACH;AAGA,eAAW,MAAM,gBAAgB,QAAQ,KAAK,GAAG;AAC/C,UAAI,CAAC,YAAY,IAAI,EAAE,EAAG,iBAAgB,QAAQ,OAAO,EAAE;AAAA,IAC7D;AAEA,UAAM,SAAS;AAAA,MACb,OAAO,KAAK;AAAA,MACZ,IAAI,KAAK,OAAO,CAAC,MAAM,EAAE,YAAY,IAAI,EAAE;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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofhe/react",
3
- "version": "1.1.0-alpha.4",
3
+ "version": "1.1.0-alpha.5",
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.4",
69
- "@cofhe/sdk": "1.1.0-alpha.4"
68
+ "@cofhe/abi": "1.1.0-alpha.5",
69
+ "@cofhe/sdk": "1.1.0-alpha.5"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@tanstack/react-query": "^5.90.20",