@tokenops/sdk 1.0.0
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/CHANGELOG.md +207 -0
- package/CONTRIBUTING.md +113 -0
- package/LICENSE +32 -0
- package/README.md +677 -0
- package/SECURITY.md +59 -0
- package/dist/chunk-52TC6BF7.js +2755 -0
- package/dist/chunk-56UI7LUR.cjs +516 -0
- package/dist/chunk-5SA2HF2W.cjs +1635 -0
- package/dist/chunk-5SGMJADP.cjs +139 -0
- package/dist/chunk-62DF53UQ.cjs +749 -0
- package/dist/chunk-66IHPTOK.cjs +20 -0
- package/dist/chunk-6ECAHP5O.cjs +1496 -0
- package/dist/chunk-72YGZEQE.js +742 -0
- package/dist/chunk-7VELUOMI.js +35 -0
- package/dist/chunk-BE2AIZ3K.js +23 -0
- package/dist/chunk-CMRETRZO.js +46 -0
- package/dist/chunk-COPFW5Z4.js +82 -0
- package/dist/chunk-CQIPRNS7.cjs +25 -0
- package/dist/chunk-ECT3NL2L.js +124 -0
- package/dist/chunk-FWHYQZ5E.cjs +37 -0
- package/dist/chunk-FYQ2UW4T.js +37 -0
- package/dist/chunk-HGXNRR25.js +105 -0
- package/dist/chunk-HTOMTEA3.cjs +3406 -0
- package/dist/chunk-ITQ7WKVC.cjs +101 -0
- package/dist/chunk-IVE3QEGD.js +478 -0
- package/dist/chunk-JFLEEXKP.js +325 -0
- package/dist/chunk-JFR5J4FL.cjs +128 -0
- package/dist/chunk-K6MFFDBJ.cjs +109 -0
- package/dist/chunk-KWFFIJYX.js +11 -0
- package/dist/chunk-NS44KBV5.cjs +89 -0
- package/dist/chunk-OLDGMKW2.cjs +93 -0
- package/dist/chunk-Q2GP5UDC.js +29 -0
- package/dist/chunk-Q7ARQSUH.cjs +42 -0
- package/dist/chunk-QCA7O2Q5.cjs +49 -0
- package/dist/chunk-QIHZVLIK.js +3388 -0
- package/dist/chunk-SUOG3BQS.cjs +2772 -0
- package/dist/chunk-T5LVV3KY.cjs +44 -0
- package/dist/chunk-UOG4PJL5.js +1488 -0
- package/dist/chunk-VDXVNZCO.cjs +329 -0
- package/dist/chunk-VJKZWYYJ.cjs +32 -0
- package/dist/chunk-WRCUDSUJ.js +96 -0
- package/dist/chunk-XSNLAS5M.js +135 -0
- package/dist/chunk-XXXDQSHE.js +1628 -0
- package/dist/chunk-ZHFLRKFY.js +41 -0
- package/dist/chunk-ZXCOJY2Z.js +87 -0
- package/dist/core/addresses.d.ts +59 -0
- package/dist/core/brands.d.ts +87 -0
- package/dist/core/chains.d.ts +102 -0
- package/dist/core/errors.d.ts +687 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/normalise.d.ts +27 -0
- package/dist/core/preflight.d.ts +25 -0
- package/dist/core/revert-mapper.d.ts +74 -0
- package/dist/core/telemetry.d.ts +50 -0
- package/dist/core/types.d.ts +10 -0
- package/dist/core/version.d.ts +15 -0
- package/dist/core/zama-error-mapper.d.ts +27 -0
- package/dist/fhe/acl.d.ts +73 -0
- package/dist/fhe/erc7984-abi.d.ts +53 -0
- package/dist/fhe/index.cjs +599 -0
- package/dist/fhe/index.d.cts +11 -0
- package/dist/fhe/index.d.ts +11 -0
- package/dist/fhe/index.js +394 -0
- package/dist/fhe/mock-encryptor.d.ts +90 -0
- package/dist/fhe/mock-erc7984.d.ts +134 -0
- package/dist/fhe/operators.d.ts +190 -0
- package/dist/fhe/react/index.cjs +102 -0
- package/dist/fhe/react/index.d.cts +10 -0
- package/dist/fhe/react/index.d.ts +10 -0
- package/dist/fhe/react/index.js +85 -0
- package/dist/fhe/react/use-decrypted-handle.d.ts +102 -0
- package/dist/fhe/scale-ratio.d.ts +168 -0
- package/dist/fhe/sepolia-encryptor-web.d.ts +101 -0
- package/dist/fhe/sepolia-encryptor.d.ts +132 -0
- package/dist/fhe/types.d.ts +62 -0
- package/dist/fhe-airdrop/abis/cloneable.d.ts +781 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +714 -0
- package/dist/fhe-airdrop/abis/index.d.ts +2 -0
- package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +53 -0
- package/dist/fhe-airdrop/advanced/index.cjs +21 -0
- package/dist/fhe-airdrop/advanced/index.d.cts +13 -0
- package/dist/fhe-airdrop/advanced/index.d.ts +13 -0
- package/dist/fhe-airdrop/advanced/index.js +8 -0
- package/dist/fhe-airdrop/advanced/react/index.cjs +61 -0
- package/dist/fhe-airdrop/advanced/react/index.d.cts +5 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +5 -0
- package/dist/fhe-airdrop/advanced/react/index.js +59 -0
- package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +49 -0
- package/dist/fhe-airdrop/airdrop.d.ts +308 -0
- package/dist/fhe-airdrop/encryption.d.ts +109 -0
- package/dist/fhe-airdrop/errors.d.ts +60 -0
- package/dist/fhe-airdrop/factory.d.ts +281 -0
- package/dist/fhe-airdrop/index.cjs +227 -0
- package/dist/fhe-airdrop/index.d.cts +10 -0
- package/dist/fhe-airdrop/index.d.ts +10 -0
- package/dist/fhe-airdrop/index.js +10 -0
- package/dist/fhe-airdrop/react/_shared.d.ts +107 -0
- package/dist/fhe-airdrop/react/index.cjs +638 -0
- package/dist/fhe-airdrop/react/index.d.cts +90 -0
- package/dist/fhe-airdrop/react/index.d.ts +90 -0
- package/dist/fhe-airdrop/react/index.js +430 -0
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +31 -0
- package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +7 -0
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +25 -0
- package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +10 -0
- package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +16 -0
- package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +6 -0
- package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +8 -0
- package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +10 -0
- package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +17 -0
- package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +10 -0
- package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +15 -0
- package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +11 -0
- package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +17 -0
- package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +17 -0
- package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +16 -0
- package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +15 -0
- package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +11 -0
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +16 -0
- package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +7 -0
- package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +7 -0
- package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +14 -0
- package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +9 -0
- package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +8 -0
- package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +22 -0
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +50 -0
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +15 -0
- package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +10 -0
- package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -0
- package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +15 -0
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +14 -0
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +14 -0
- package/dist/fhe-airdrop/react/useClaim.d.ts +29 -0
- package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +11 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +33 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +40 -0
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +29 -0
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +31 -0
- package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +14 -0
- package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +16 -0
- package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +17 -0
- package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +10 -0
- package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +11 -0
- package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +17 -0
- package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +25 -0
- package/dist/fhe-airdrop/react/useGetClaimAmount.d.ts +30 -0
- package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +16 -0
- package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +15 -0
- package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +14 -0
- package/dist/fhe-airdrop/react/useSetPaused.d.ts +14 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +31 -0
- package/dist/fhe-airdrop/react/useWithdraw.d.ts +12 -0
- package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +13 -0
- package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +13 -0
- package/dist/fhe-airdrop/types.d.ts +21 -0
- package/dist/fhe-disperse/abis/index.d.ts +2 -0
- package/dist/fhe-disperse/abis/singleton.d.ts +1297 -0
- package/dist/fhe-disperse/abis/wallet.d.ts +111 -0
- package/dist/fhe-disperse/encryption.d.ts +77 -0
- package/dist/fhe-disperse/errors.d.ts +39 -0
- package/dist/fhe-disperse/index.cjs +248 -0
- package/dist/fhe-disperse/index.d.cts +14 -0
- package/dist/fhe-disperse/index.d.ts +14 -0
- package/dist/fhe-disperse/index.js +11 -0
- package/dist/fhe-disperse/react/_shared.d.ts +104 -0
- package/dist/fhe-disperse/react/index.cjs +752 -0
- package/dist/fhe-disperse/react/index.d.cts +82 -0
- package/dist/fhe-disperse/react/index.d.ts +82 -0
- package/dist/fhe-disperse/react/index.js +522 -0
- package/dist/fhe-disperse/react/useAccessEncryptedFeeReserve.d.ts +35 -0
- package/dist/fhe-disperse/react/useApproveTokenOnWallets.d.ts +25 -0
- package/dist/fhe-disperse/react/useBatchDiscloseHandlesToParty.d.ts +16 -0
- package/dist/fhe-disperse/react/useCalculateFee.d.ts +26 -0
- package/dist/fhe-disperse/react/useDeploymentBlockNumber.d.ts +11 -0
- package/dist/fhe-disperse/react/useDisableCustomFee.d.ts +20 -0
- package/dist/fhe-disperse/react/useDiscloseHandleToParty.d.ts +20 -0
- package/dist/fhe-disperse/react/useDisperse.d.ts +28 -0
- package/dist/fhe-disperse/react/useGetBatchLimits.d.ts +12 -0
- package/dist/fhe-disperse/react/useGetFeeConfig.d.ts +15 -0
- package/dist/fhe-disperse/react/useGetFees.d.ts +19 -0
- package/dist/fhe-disperse/react/useGetWallets.d.ts +19 -0
- package/dist/fhe-disperse/react/useGrantRole.d.ts +24 -0
- package/dist/fhe-disperse/react/useHasApprovedSubwallets.d.ts +25 -0
- package/dist/fhe-disperse/react/useHasRole.d.ts +22 -0
- package/dist/fhe-disperse/react/useIsPaused.d.ts +11 -0
- package/dist/fhe-disperse/react/useIsRegistered.d.ts +15 -0
- package/dist/fhe-disperse/react/usePause.d.ts +18 -0
- package/dist/fhe-disperse/react/usePredictWallets.d.ts +19 -0
- package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +37 -0
- package/dist/fhe-disperse/react/useRecoverERC20FromWallets.d.ts +21 -0
- package/dist/fhe-disperse/react/useRecoverFromWallets.d.ts +21 -0
- package/dist/fhe-disperse/react/useRegister.d.ts +40 -0
- package/dist/fhe-disperse/react/useRescueConfidentialTokens.d.ts +21 -0
- package/dist/fhe-disperse/react/useRescueERC20.d.ts +21 -0
- package/dist/fhe-disperse/react/useRevokeRole.d.ts +24 -0
- package/dist/fhe-disperse/react/useRevokeTokenOnWallets.d.ts +24 -0
- package/dist/fhe-disperse/react/useSetCustomFee.d.ts +24 -0
- package/dist/fhe-disperse/react/useSetFeeConfig.d.ts +23 -0
- package/dist/fhe-disperse/react/useSetMaxBatchSizeDirect.d.ts +20 -0
- package/dist/fhe-disperse/react/useSetMaxBatchSizeHolding.d.ts +20 -0
- package/dist/fhe-disperse/react/useSetMaxBatchSizeTokenFee.d.ts +20 -0
- package/dist/fhe-disperse/react/useSingletonBatchDiscloseHandlesToParty.d.ts +13 -0
- package/dist/fhe-disperse/react/useSingletonBatchLimits.d.ts +12 -0
- package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +26 -0
- package/dist/fhe-disperse/react/useSingletonDeploymentBlockNumber.d.ts +11 -0
- package/dist/fhe-disperse/react/useSingletonDisableCustomFee.d.ts +21 -0
- package/dist/fhe-disperse/react/useSingletonDiscloseHandleToParty.d.ts +17 -0
- package/dist/fhe-disperse/react/useSingletonFees.d.ts +19 -0
- package/dist/fhe-disperse/react/useSingletonGrantRole.d.ts +26 -0
- package/dist/fhe-disperse/react/useSingletonHasApprovedSubwallets.d.ts +25 -0
- package/dist/fhe-disperse/react/useSingletonHasRole.d.ts +23 -0
- package/dist/fhe-disperse/react/useSingletonIsPaused.d.ts +11 -0
- package/dist/fhe-disperse/react/useSingletonIsRegistered.d.ts +15 -0
- package/dist/fhe-disperse/react/useSingletonPause.d.ts +19 -0
- package/dist/fhe-disperse/react/useSingletonPredictWallets.d.ts +19 -0
- package/dist/fhe-disperse/react/useSingletonRevokeRole.d.ts +26 -0
- package/dist/fhe-disperse/react/useSingletonSetCustomFee.d.ts +25 -0
- package/dist/fhe-disperse/react/useSingletonUnpause.d.ts +18 -0
- package/dist/fhe-disperse/react/useSingletonWalletImplementation.d.ts +12 -0
- package/dist/fhe-disperse/react/useSingletonWallets.d.ts +19 -0
- package/dist/fhe-disperse/react/useSingletonWithdrawGasFee.d.ts +21 -0
- package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +50 -0
- package/dist/fhe-disperse/react/useUnpause.d.ts +17 -0
- package/dist/fhe-disperse/react/useWalletImplementation.d.ts +12 -0
- package/dist/fhe-disperse/react/useWithdrawGasFee.d.ts +26 -0
- package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +70 -0
- package/dist/fhe-disperse/singleton.d.ts +442 -0
- package/dist/fhe-disperse/subtotals.d.ts +14 -0
- package/dist/fhe-disperse/types.d.ts +332 -0
- package/dist/fhe-disperse/validate.d.ts +78 -0
- package/dist/fhe-vesting/abis/factory.d.ts +676 -0
- package/dist/fhe-vesting/abis/index.d.ts +3 -0
- package/dist/fhe-vesting/abis/manager.d.ts +1797 -0
- package/dist/fhe-vesting/advanced/factory-advanced.d.ts +52 -0
- package/dist/fhe-vesting/advanced/index.cjs +21 -0
- package/dist/fhe-vesting/advanced/index.d.cts +12 -0
- package/dist/fhe-vesting/advanced/index.d.ts +12 -0
- package/dist/fhe-vesting/advanced/index.js +8 -0
- package/dist/fhe-vesting/advanced/react/index.cjs +75 -0
- package/dist/fhe-vesting/advanced/react/index.d.cts +5 -0
- package/dist/fhe-vesting/advanced/react/index.d.ts +5 -0
- package/dist/fhe-vesting/advanced/react/index.js +73 -0
- package/dist/fhe-vesting/advanced/react/usePredictManagerAddress.d.ts +41 -0
- package/dist/fhe-vesting/encryption.d.ts +104 -0
- package/dist/fhe-vesting/errors.d.ts +183 -0
- package/dist/fhe-vesting/factory.d.ts +207 -0
- package/dist/fhe-vesting/index.cjs +269 -0
- package/dist/fhe-vesting/index.d.cts +9 -0
- package/dist/fhe-vesting/index.d.ts +9 -0
- package/dist/fhe-vesting/index.js +12 -0
- package/dist/fhe-vesting/manager.d.ts +808 -0
- package/dist/fhe-vesting/react/_shared.d.ts +122 -0
- package/dist/fhe-vesting/react/index.cjs +1054 -0
- package/dist/fhe-vesting/react/index.d.cts +123 -0
- package/dist/fhe-vesting/react/index.d.ts +123 -0
- package/dist/fhe-vesting/react/index.js +771 -0
- package/dist/fhe-vesting/react/useAcceptVestingTransfer.d.ts +12 -0
- package/dist/fhe-vesting/react/useAccessClaimableAmount.d.ts +14 -0
- package/dist/fhe-vesting/react/useAccessSettledAmount.d.ts +15 -0
- package/dist/fhe-vesting/react/useAccessTotalAllocation.d.ts +14 -0
- package/dist/fhe-vesting/react/useAccessVestedAmount.d.ts +26 -0
- package/dist/fhe-vesting/react/useAdminBatchDiscloseToParty.d.ts +16 -0
- package/dist/fhe-vesting/react/useAdminClaim.d.ts +9 -0
- package/dist/fhe-vesting/react/useAdminDiscloseToParty.d.ts +8 -0
- package/dist/fhe-vesting/react/useAdminGetClaimableAmount.d.ts +13 -0
- package/dist/fhe-vesting/react/useAdminGetSettledAmount.d.ts +13 -0
- package/dist/fhe-vesting/react/useAdminGetTokenBalance.d.ts +13 -0
- package/dist/fhe-vesting/react/useAdminGetTotalAllocation.d.ts +13 -0
- package/dist/fhe-vesting/react/useAdminGetVestedAmount.d.ts +15 -0
- package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +8 -0
- package/dist/fhe-vesting/react/useAllRecipients.d.ts +8 -0
- package/dist/fhe-vesting/react/useAllRecipientsLength.d.ts +6 -0
- package/dist/fhe-vesting/react/useAllRecipientsSliced.d.ts +13 -0
- package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +24 -0
- package/dist/fhe-vesting/react/useBatchDiscloseHandlesToParty.d.ts +13 -0
- package/dist/fhe-vesting/react/useBatchDiscloseToParty.d.ts +18 -0
- package/dist/fhe-vesting/react/useBatchRevokeVesting.d.ts +12 -0
- package/dist/fhe-vesting/react/useCancelVestingTransfer.d.ts +12 -0
- package/dist/fhe-vesting/react/useClaim.d.ts +19 -0
- package/dist/fhe-vesting/react/useConfidentialVestingFactoryImplementation.d.ts +11 -0
- package/dist/fhe-vesting/react/useCreateManager.d.ts +32 -0
- package/dist/fhe-vesting/react/useCreateManagerAndGetAddress.d.ts +31 -0
- package/dist/fhe-vesting/react/useCreateVesting.d.ts +38 -0
- package/dist/fhe-vesting/react/useDirectVestingTransfer.d.ts +13 -0
- package/dist/fhe-vesting/react/useDisableCustomFee.d.ts +14 -0
- package/dist/fhe-vesting/react/useDiscloseHandleToParty.d.ts +14 -0
- package/dist/fhe-vesting/react/useDiscloseToParty.d.ts +14 -0
- package/dist/fhe-vesting/react/useFactoryCustomFee.d.ts +17 -0
- package/dist/fhe-vesting/react/useFactoryDefaultFeeType.d.ts +11 -0
- package/dist/fhe-vesting/react/useFactoryDefaultGasFee.d.ts +10 -0
- package/dist/fhe-vesting/react/useFactoryDefaultTokenFee.d.ts +10 -0
- package/dist/fhe-vesting/react/useFactoryFeeCollector.d.ts +10 -0
- package/dist/fhe-vesting/react/useFactoryInitCodeHash.d.ts +18 -0
- package/dist/fhe-vesting/react/useGetClaimableAmount.d.ts +13 -0
- package/dist/fhe-vesting/react/useGetSettledAmount.d.ts +14 -0
- package/dist/fhe-vesting/react/useGetTotalAllocation.d.ts +13 -0
- package/dist/fhe-vesting/react/useGetVestedAmount.d.ts +25 -0
- package/dist/fhe-vesting/react/useGrantRole.d.ts +15 -0
- package/dist/fhe-vesting/react/useHasRole.d.ts +14 -0
- package/dist/fhe-vesting/react/useInitiateVestingTransfer.d.ts +12 -0
- package/dist/fhe-vesting/react/useIsRecipient.d.ts +10 -0
- package/dist/fhe-vesting/react/useManagerBatchDiscloseHandlesToParty.d.ts +15 -0
- package/dist/fhe-vesting/react/useManagerDeploymentBlockNumber.d.ts +7 -0
- package/dist/fhe-vesting/react/useManagerDiscloseHandleToParty.d.ts +16 -0
- package/dist/fhe-vesting/react/useManagerFactoryCustomFee.d.ts +17 -0
- package/dist/fhe-vesting/react/useManagerFactoryDefaultGasFee.d.ts +10 -0
- package/dist/fhe-vesting/react/useManagerFactoryDisableCustomFee.d.ts +15 -0
- package/dist/fhe-vesting/react/useManagerFactoryFeeCollector.d.ts +10 -0
- package/dist/fhe-vesting/react/useManagerFactoryInitCodeHash.d.ts +18 -0
- package/dist/fhe-vesting/react/useManagerFactorySetCustomFee.d.ts +19 -0
- package/dist/fhe-vesting/react/useManagerFactorySetDefaultGasFee.d.ts +13 -0
- package/dist/fhe-vesting/react/useManagerFactorySetFeeCollector.d.ts +14 -0
- package/dist/fhe-vesting/react/useManagerFee.d.ts +7 -0
- package/dist/fhe-vesting/react/useManagerFeeInfo.d.ts +18 -0
- package/dist/fhe-vesting/react/useManagerFeeType.d.ts +7 -0
- package/dist/fhe-vesting/react/useManagerGrantRole.d.ts +17 -0
- package/dist/fhe-vesting/react/useManagerHasRole.d.ts +15 -0
- package/dist/fhe-vesting/react/useManagerIsPausable.d.ts +6 -0
- package/dist/fhe-vesting/react/useManagerIsSplitEnabled.d.ts +6 -0
- package/dist/fhe-vesting/react/useManagerMaxBatchSize.d.ts +6 -0
- package/dist/fhe-vesting/react/useManagerMaxRevokeBatchSize.d.ts +6 -0
- package/dist/fhe-vesting/react/useManagerPause.d.ts +13 -0
- package/dist/fhe-vesting/react/useManagerPaused.d.ts +6 -0
- package/dist/fhe-vesting/react/useManagerRevokeRole.d.ts +17 -0
- package/dist/fhe-vesting/react/useManagerToken.d.ts +11 -0
- package/dist/fhe-vesting/react/useManagerUnpause.d.ts +12 -0
- package/dist/fhe-vesting/react/useManagerWithdrawGasFee.d.ts +14 -0
- package/dist/fhe-vesting/react/useManagerWithdrawOtherConfidentialToken.d.ts +14 -0
- package/dist/fhe-vesting/react/useManagerWithdrawOtherToken.d.ts +14 -0
- package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +11 -0
- package/dist/fhe-vesting/react/usePartialClaim.d.ts +15 -0
- package/dist/fhe-vesting/react/usePause.d.ts +12 -0
- package/dist/fhe-vesting/react/usePendingVestingTransfer.d.ts +20 -0
- package/dist/fhe-vesting/react/useRecipientVestings.d.ts +11 -0
- package/dist/fhe-vesting/react/useRecipientVestingsLength.d.ts +10 -0
- package/dist/fhe-vesting/react/useRecipientVestingsSliced.d.ts +12 -0
- package/dist/fhe-vesting/react/useRenounceRole.d.ts +16 -0
- package/dist/fhe-vesting/react/useResetGasFee.d.ts +10 -0
- package/dist/fhe-vesting/react/useResetTokenFee.d.ts +10 -0
- package/dist/fhe-vesting/react/useRevokeRole.d.ts +15 -0
- package/dist/fhe-vesting/react/useRevokeVesting.d.ts +15 -0
- package/dist/fhe-vesting/react/useRoleConstants.d.ts +19 -0
- package/dist/fhe-vesting/react/useSetCustomFee.d.ts +18 -0
- package/dist/fhe-vesting/react/useSetDefaultFeeType.d.ts +14 -0
- package/dist/fhe-vesting/react/useSetDefaultGasFee.d.ts +12 -0
- package/dist/fhe-vesting/react/useSetDefaultTokenFee.d.ts +13 -0
- package/dist/fhe-vesting/react/useSetFeeCollector.d.ts +13 -0
- package/dist/fhe-vesting/react/useSetMaxBatchSize.d.ts +12 -0
- package/dist/fhe-vesting/react/useSetMaxRevokeBatchSize.d.ts +12 -0
- package/dist/fhe-vesting/react/useSplitVesting.d.ts +28 -0
- package/dist/fhe-vesting/react/useTransferFeeCollectorRole.d.ts +12 -0
- package/dist/fhe-vesting/react/useUnpause.d.ts +11 -0
- package/dist/fhe-vesting/react/useVestingClaim.d.ts +19 -0
- package/dist/fhe-vesting/react/useVestingInfo.d.ts +25 -0
- package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +17 -0
- package/dist/fhe-vesting/react/useWithdrawGasFee.d.ts +13 -0
- package/dist/fhe-vesting/react/useWithdrawOtherConfidentialToken.d.ts +13 -0
- package/dist/fhe-vesting/react/useWithdrawOtherToken.d.ts +13 -0
- package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +18 -0
- package/dist/fhe-vesting/types.d.ts +72 -0
- package/dist/index.cjs +237 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -0
- package/dist/telemetry/console.d.ts +29 -0
- package/dist/telemetry/index.cjs +113 -0
- package/dist/telemetry/index.d.cts +3 -0
- package/dist/telemetry/index.d.ts +3 -0
- package/dist/telemetry/index.js +102 -0
- package/dist/telemetry/tokenops.d.ts +15 -0
- package/package.json +316 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/fhe/erc7984-abi.ts
|
|
2
|
+
var erc7984OperatorAbi = [
|
|
3
|
+
{
|
|
4
|
+
inputs: [
|
|
5
|
+
{ internalType: "address", name: "holder", type: "address" },
|
|
6
|
+
{ internalType: "address", name: "spender", type: "address" }
|
|
7
|
+
],
|
|
8
|
+
name: "isOperator",
|
|
9
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
10
|
+
stateMutability: "view",
|
|
11
|
+
type: "function"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
inputs: [
|
|
15
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
16
|
+
{ internalType: "uint48", name: "until", type: "uint48" }
|
|
17
|
+
],
|
|
18
|
+
name: "setOperator",
|
|
19
|
+
outputs: [],
|
|
20
|
+
stateMutability: "nonpayable",
|
|
21
|
+
type: "function"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
anonymous: false,
|
|
25
|
+
inputs: [
|
|
26
|
+
{ indexed: true, internalType: "address", name: "holder", type: "address" },
|
|
27
|
+
{ indexed: true, internalType: "address", name: "operator", type: "address" },
|
|
28
|
+
{ indexed: false, internalType: "uint48", name: "until", type: "uint48" }
|
|
29
|
+
],
|
|
30
|
+
name: "OperatorSet",
|
|
31
|
+
type: "event"
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export { erc7984OperatorAbi };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TokenOpsValidationError } from './chunk-IVE3QEGD.js';
|
|
2
|
+
import { isAddress, getAddress } from 'viem';
|
|
3
|
+
|
|
4
|
+
function normaliseAddress(input) {
|
|
5
|
+
if (typeof input !== "string") {
|
|
6
|
+
throw new TokenOpsValidationError("normaliseAddress: input is not a string", {
|
|
7
|
+
method: "normaliseAddress",
|
|
8
|
+
args: { input: typeof input }
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (!isAddress(input, { strict: false })) {
|
|
12
|
+
throw new TokenOpsValidationError(
|
|
13
|
+
`normaliseAddress: '${input}' is not a valid 0x-prefixed 20-byte hex address`,
|
|
14
|
+
{
|
|
15
|
+
method: "normaliseAddress",
|
|
16
|
+
args: { input }
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return getAddress(input);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { normaliseAddress };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-72YGZEQE.js';
|
|
2
|
+
|
|
3
|
+
// src/fhe-vesting/advanced/factory-advanced.ts
|
|
4
|
+
var ConfidentialVestingFactoryAdvancedClient = class extends ConfidentialVestingFactoryClient {
|
|
5
|
+
/**
|
|
6
|
+
* Compute the deterministic CREATE2 clone address as the factory would have
|
|
7
|
+
* computed it at `args.blockNumber`.
|
|
8
|
+
*
|
|
9
|
+
* **Block-dependent.** See class TSDoc — predict at block N, mine at N+1,
|
|
10
|
+
* the addresses differ.
|
|
11
|
+
*
|
|
12
|
+
* For the common "deploy a clone and learn its address" flow, prefer the
|
|
13
|
+
* headline `factory.createManager`, which parses the address from the tx
|
|
14
|
+
* receipt's `ManagerCreated` event.
|
|
15
|
+
*/
|
|
16
|
+
async predictManagerAddress(args) {
|
|
17
|
+
const hasOptions = args.splitEnabled !== void 0 || args.pausableEnabled !== void 0;
|
|
18
|
+
if (hasOptions) {
|
|
19
|
+
return this.publicClient.readContract({
|
|
20
|
+
address: this.address,
|
|
21
|
+
abi: confidentialVestingFactoryAbi,
|
|
22
|
+
functionName: "predictManagerAddressWithOptions",
|
|
23
|
+
args: [
|
|
24
|
+
args.token,
|
|
25
|
+
args.userSalt,
|
|
26
|
+
args.deployer,
|
|
27
|
+
args.splitEnabled ?? true,
|
|
28
|
+
args.pausableEnabled ?? true
|
|
29
|
+
],
|
|
30
|
+
blockNumber: args.blockNumber
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return this.publicClient.readContract({
|
|
34
|
+
address: this.address,
|
|
35
|
+
abi: confidentialVestingFactoryAbi,
|
|
36
|
+
functionName: "predictManagerAddress",
|
|
37
|
+
args: [args.token, args.userSalt, args.deployer],
|
|
38
|
+
blockNumber: args.blockNumber
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function createConfidentialVestingFactoryAdvancedClient(config) {
|
|
43
|
+
return new ConfidentialVestingFactoryAdvancedClient(config);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { ConfidentialVestingFactoryAdvancedClient, createConfidentialVestingFactoryAdvancedClient };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
|
|
2
|
+
import { sepolia, mainnet } from 'viem/chains';
|
|
3
|
+
|
|
4
|
+
var DEPLOYED_ADDRESSES = {
|
|
5
|
+
fheVesting: {
|
|
6
|
+
confidentialVestingFactory: {
|
|
7
|
+
[sepolia.id]: "0xA87701CE9A52D43681600583a99c85b50DbE3150"
|
|
8
|
+
// mainnet omitted — not deployed.
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
fheAirdrop: {
|
|
12
|
+
confidentialAirdropFactory: {
|
|
13
|
+
[sepolia.id]: "0xbE6A3B78B36684fFee48De77d47Bc3393F5Acd4c"
|
|
14
|
+
// mainnet omitted — not deployed.
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
fheDisperse: {
|
|
18
|
+
disperseConfidentialSingleton: {
|
|
19
|
+
[mainnet.id]: "0x4fC0d28cBe4B82D512Ad0B42F6787480Cc98cC70",
|
|
20
|
+
[sepolia.id]: "0x710dD9885Cc9986EfD234E7719483147a6d8DBb4"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
function getDeployedAddress(product, contract, chainId) {
|
|
25
|
+
const productEntry = DEPLOYED_ADDRESSES[product];
|
|
26
|
+
const contractEntry = productEntry[contract];
|
|
27
|
+
return contractEntry?.[chainId] ?? void 0;
|
|
28
|
+
}
|
|
29
|
+
function requireDeployedAddress(product, contract, chainId) {
|
|
30
|
+
const productEntry = DEPLOYED_ADDRESSES[product];
|
|
31
|
+
const contractEntry = productEntry[contract];
|
|
32
|
+
const entry = contractEntry?.[chainId];
|
|
33
|
+
if (entry) return entry;
|
|
34
|
+
throw new DeploymentAddressUnavailableError({
|
|
35
|
+
reason: entry === null ? "registry-not-deployed" : "registry-unknown-chain",
|
|
36
|
+
product: String(product),
|
|
37
|
+
contract: String(contract),
|
|
38
|
+
chainId
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function getFheVestingFactoryAddress(chainId) {
|
|
42
|
+
return getDeployedAddress("fheVesting", "confidentialVestingFactory", chainId);
|
|
43
|
+
}
|
|
44
|
+
function requireFheVestingFactoryAddress(chainId) {
|
|
45
|
+
return requireDeployedAddress("fheVesting", "confidentialVestingFactory", chainId);
|
|
46
|
+
}
|
|
47
|
+
function getFheAirdropFactoryAddress(chainId) {
|
|
48
|
+
return getDeployedAddress("fheAirdrop", "confidentialAirdropFactory", chainId);
|
|
49
|
+
}
|
|
50
|
+
function requireFheAirdropFactoryAddress(chainId) {
|
|
51
|
+
return requireDeployedAddress("fheAirdrop", "confidentialAirdropFactory", chainId);
|
|
52
|
+
}
|
|
53
|
+
function getFheDisperseSingletonAddress(chainId) {
|
|
54
|
+
return getDeployedAddress("fheDisperse", "disperseConfidentialSingleton", chainId);
|
|
55
|
+
}
|
|
56
|
+
function requireFheDisperseSingletonAddress(chainId) {
|
|
57
|
+
return requireDeployedAddress("fheDisperse", "disperseConfidentialSingleton", chainId);
|
|
58
|
+
}
|
|
59
|
+
function chainsWithKnownRegistryEntry(product) {
|
|
60
|
+
const productEntry = DEPLOYED_ADDRESSES[product];
|
|
61
|
+
const ids = /* @__PURE__ */ new Set();
|
|
62
|
+
for (const contractEntry of Object.values(productEntry)) {
|
|
63
|
+
for (const key of Object.keys(contractEntry)) {
|
|
64
|
+
ids.add(Number(key));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return [...ids].sort((a, b) => a - b);
|
|
68
|
+
}
|
|
69
|
+
function chainsWithDeployment(product) {
|
|
70
|
+
const productEntry = DEPLOYED_ADDRESSES[product];
|
|
71
|
+
const contracts = Object.values(productEntry);
|
|
72
|
+
if (contracts.length === 0) return [];
|
|
73
|
+
const candidates = new Set(Object.keys(contracts[0]).map(Number));
|
|
74
|
+
return [...candidates].filter(
|
|
75
|
+
(chainId) => contracts.every((entry) => {
|
|
76
|
+
const value = entry[chainId];
|
|
77
|
+
return value !== null && value !== void 0;
|
|
78
|
+
})
|
|
79
|
+
).sort((a, b) => a - b);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { DEPLOYED_ADDRESSES, chainsWithDeployment, chainsWithKnownRegistryEntry, getDeployedAddress, getFheAirdropFactoryAddress, getFheDisperseSingletonAddress, getFheVestingFactoryAddress, requireFheAirdropFactoryAddress, requireFheDisperseSingletonAddress, requireFheVestingFactoryAddress };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
|
|
4
|
+
var viem = require('viem');
|
|
5
|
+
|
|
6
|
+
function normaliseAddress(input) {
|
|
7
|
+
if (typeof input !== "string") {
|
|
8
|
+
throw new chunk56UI7LUR_cjs.TokenOpsValidationError("normaliseAddress: input is not a string", {
|
|
9
|
+
method: "normaliseAddress",
|
|
10
|
+
args: { input: typeof input }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
if (!viem.isAddress(input, { strict: false })) {
|
|
14
|
+
throw new chunk56UI7LUR_cjs.TokenOpsValidationError(
|
|
15
|
+
`normaliseAddress: '${input}' is not a valid 0x-prefixed 20-byte hex address`,
|
|
16
|
+
{
|
|
17
|
+
method: "normaliseAddress",
|
|
18
|
+
args: { input }
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return viem.getAddress(input);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.normaliseAddress = normaliseAddress;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { createConfidentialVestingManagerClient, resolveEncryptor } from './chunk-52TC6BF7.js';
|
|
2
|
+
import { createConfidentialVestingFactoryClient } from './chunk-72YGZEQE.js';
|
|
3
|
+
import { getFheVestingFactoryAddress } from './chunk-COPFW5Z4.js';
|
|
4
|
+
import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
|
|
5
|
+
import { useMemo, useRef, useEffect } from 'react';
|
|
6
|
+
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
7
|
+
|
|
8
|
+
var FHE_VESTING_KEY = "tokenops-sdk";
|
|
9
|
+
var FHE_VESTING_NAMESPACE = "fhe-vesting";
|
|
10
|
+
function useHookFiredEvent(hookName, telemetry, hasWallet, chainId) {
|
|
11
|
+
const firedRef = useRef(false);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (firedRef.current || !telemetry) return;
|
|
14
|
+
firedRef.current = true;
|
|
15
|
+
telemetry.event("fhe-vesting.react.hook.fired", {
|
|
16
|
+
hookName,
|
|
17
|
+
surface: "react",
|
|
18
|
+
hasWallet,
|
|
19
|
+
chainId: chainId ?? null
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
}
|
|
23
|
+
function tryResolveFactoryAddress(override, chainId) {
|
|
24
|
+
if (override) return override;
|
|
25
|
+
if (chainId === void 0) return void 0;
|
|
26
|
+
return getFheVestingFactoryAddress(chainId);
|
|
27
|
+
}
|
|
28
|
+
function useMemoFactoryClient(opts = {}) {
|
|
29
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
30
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
31
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
32
|
+
const resolvedAddress = tryResolveFactoryAddress(opts.address, chainId);
|
|
33
|
+
const resolutionError = computeFactoryResolutionError(opts.address, chainId);
|
|
34
|
+
const telemetry = opts.telemetry;
|
|
35
|
+
useHookFiredEvent("manager-factory", telemetry, !!walletClient, chainId);
|
|
36
|
+
const client = useMemo(() => {
|
|
37
|
+
if (!publicClient) return void 0;
|
|
38
|
+
if (!resolvedAddress) return void 0;
|
|
39
|
+
return createConfidentialVestingFactoryClient({
|
|
40
|
+
publicClient,
|
|
41
|
+
...walletClient ? { walletClient } : {},
|
|
42
|
+
address: resolvedAddress,
|
|
43
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
44
|
+
...telemetry ? { telemetry } : {}
|
|
45
|
+
});
|
|
46
|
+
}, [publicClient, walletClient, resolvedAddress, chainId, telemetry]);
|
|
47
|
+
return {
|
|
48
|
+
client,
|
|
49
|
+
resolutionError,
|
|
50
|
+
publicClient,
|
|
51
|
+
walletClient: walletClient ?? void 0,
|
|
52
|
+
chainId,
|
|
53
|
+
resolvedAddress
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function computeFactoryResolutionError(override, chainId) {
|
|
57
|
+
if (override) return void 0;
|
|
58
|
+
if (chainId === void 0) {
|
|
59
|
+
return new DeploymentAddressUnavailableError({
|
|
60
|
+
reason: "chain-id-missing",
|
|
61
|
+
product: "fheVesting",
|
|
62
|
+
contract: "confidentialVestingFactory",
|
|
63
|
+
clientLabel: "ConfidentialVestingFactoryClient"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const resolved = getFheVestingFactoryAddress(chainId);
|
|
67
|
+
if (!resolved) {
|
|
68
|
+
return new DeploymentAddressUnavailableError({
|
|
69
|
+
reason: "registry-not-deployed",
|
|
70
|
+
product: "fheVesting",
|
|
71
|
+
contract: "confidentialVestingFactory",
|
|
72
|
+
chainId,
|
|
73
|
+
clientLabel: "ConfidentialVestingFactoryClient"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
function useMemoManagerClient(opts) {
|
|
79
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
80
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
81
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
82
|
+
useHookFiredEvent("manager", opts.telemetry, !!walletClient, chainId);
|
|
83
|
+
const encryptorSourceRef = useRef(opts.encryptor);
|
|
84
|
+
encryptorSourceRef.current = opts.encryptor;
|
|
85
|
+
const telemetry = opts.telemetry;
|
|
86
|
+
const client = useMemo(() => {
|
|
87
|
+
if (!publicClient) return void 0;
|
|
88
|
+
if (!opts.address) return void 0;
|
|
89
|
+
return createConfidentialVestingManagerClient({
|
|
90
|
+
publicClient,
|
|
91
|
+
...walletClient ? { walletClient } : {},
|
|
92
|
+
address: opts.address,
|
|
93
|
+
// Lazy — invoked per-encryption inside the headless client. Picks up
|
|
94
|
+
// whichever EncryptorSource the consumer last passed in.
|
|
95
|
+
encryptor: () => resolveEncryptor(encryptorSourceRef.current),
|
|
96
|
+
...opts.aclAddress ? { aclAddress: opts.aclAddress } : {},
|
|
97
|
+
...telemetry ? { telemetry } : {}
|
|
98
|
+
});
|
|
99
|
+
}, [publicClient, walletClient, opts.address, opts.aclAddress, telemetry]);
|
|
100
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
101
|
+
}
|
|
102
|
+
function buildQueryKey(method, chainId, address, ...args) {
|
|
103
|
+
return [
|
|
104
|
+
FHE_VESTING_KEY,
|
|
105
|
+
FHE_VESTING_NAMESPACE,
|
|
106
|
+
method,
|
|
107
|
+
chainId ?? null,
|
|
108
|
+
address ? address.toLowerCase() : null,
|
|
109
|
+
...args.map(normalizeKeyArg)
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
function normalizeKeyArg(value) {
|
|
113
|
+
if (typeof value === "bigint") return value.toString();
|
|
114
|
+
if (Array.isArray(value)) return value.map(normalizeKeyArg);
|
|
115
|
+
if (value && typeof value === "object") {
|
|
116
|
+
return Object.fromEntries(
|
|
117
|
+
Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { buildQueryKey, useMemoFactoryClient, useMemoManagerClient };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/fhe/erc7984-abi.ts
|
|
4
|
+
var erc7984OperatorAbi = [
|
|
5
|
+
{
|
|
6
|
+
inputs: [
|
|
7
|
+
{ internalType: "address", name: "holder", type: "address" },
|
|
8
|
+
{ internalType: "address", name: "spender", type: "address" }
|
|
9
|
+
],
|
|
10
|
+
name: "isOperator",
|
|
11
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
12
|
+
stateMutability: "view",
|
|
13
|
+
type: "function"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
inputs: [
|
|
17
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
18
|
+
{ internalType: "uint48", name: "until", type: "uint48" }
|
|
19
|
+
],
|
|
20
|
+
name: "setOperator",
|
|
21
|
+
outputs: [],
|
|
22
|
+
stateMutability: "nonpayable",
|
|
23
|
+
type: "function"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
anonymous: false,
|
|
27
|
+
inputs: [
|
|
28
|
+
{ indexed: true, internalType: "address", name: "holder", type: "address" },
|
|
29
|
+
{ indexed: true, internalType: "address", name: "operator", type: "address" },
|
|
30
|
+
{ indexed: false, internalType: "uint48", name: "until", type: "uint48" }
|
|
31
|
+
],
|
|
32
|
+
name: "OperatorSet",
|
|
33
|
+
type: "event"
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
exports.erc7984OperatorAbi = erc7984OperatorAbi;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
|
|
2
|
+
import { parseAbiItem } from 'viem';
|
|
3
|
+
|
|
4
|
+
var FHEVM_ACL_ADDRESS_BY_CHAIN = {
|
|
5
|
+
31337: "0x50157CFfD6bBFA2DECe204a89ec419c23ef5755D",
|
|
6
|
+
11155111: "0xf0Ffdc93b7E186bC2f8CB3dAA75D86d1930A433D",
|
|
7
|
+
1: "0xcA2E8f1F656CD25C01F05d0b243Ab1ecd4a8ffb6"
|
|
8
|
+
};
|
|
9
|
+
var ACL_ALLOWED_EVENT = parseAbiItem(
|
|
10
|
+
"event Allowed(address indexed caller, address indexed account, bytes32 handle)"
|
|
11
|
+
);
|
|
12
|
+
function getFhevmAclAddress(chainId) {
|
|
13
|
+
return FHEVM_ACL_ADDRESS_BY_CHAIN[chainId];
|
|
14
|
+
}
|
|
15
|
+
function requireFhevmAclAddress(chainId, clientLabel) {
|
|
16
|
+
if (chainId === void 0) {
|
|
17
|
+
throw new DeploymentAddressUnavailableError({
|
|
18
|
+
reason: "chain-id-missing",
|
|
19
|
+
product: "fhevm",
|
|
20
|
+
contract: "acl",
|
|
21
|
+
clientLabel,
|
|
22
|
+
overrideName: "aclAddress"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const addr = FHEVM_ACL_ADDRESS_BY_CHAIN[chainId];
|
|
26
|
+
if (addr) return addr;
|
|
27
|
+
throw new DeploymentAddressUnavailableError({
|
|
28
|
+
reason: "registry-unknown-chain",
|
|
29
|
+
product: "fhevm",
|
|
30
|
+
contract: "acl",
|
|
31
|
+
chainId,
|
|
32
|
+
clientLabel,
|
|
33
|
+
overrideName: "aclAddress"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { ACL_ALLOWED_EVENT, FHEVM_ACL_ADDRESS_BY_CHAIN, getFhevmAclAddress, requireFhevmAclAddress };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createConfidentialAirdropClient } from './chunk-XXXDQSHE.js';
|
|
2
|
+
import { createConfidentialAirdropFactoryClient, resolveEncryptor } from './chunk-UOG4PJL5.js';
|
|
3
|
+
import { getFheAirdropFactoryAddress } from './chunk-COPFW5Z4.js';
|
|
4
|
+
import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
|
|
5
|
+
import { useRef, useMemo } from 'react';
|
|
6
|
+
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
7
|
+
|
|
8
|
+
var FHE_AIRDROP_KEY = "tokenops-sdk";
|
|
9
|
+
var FHE_AIRDROP_NAMESPACE = "fhe-airdrop";
|
|
10
|
+
function tryResolveFactoryAddress(override, chainId) {
|
|
11
|
+
if (override) return override;
|
|
12
|
+
if (chainId === void 0) return void 0;
|
|
13
|
+
return getFheAirdropFactoryAddress(chainId);
|
|
14
|
+
}
|
|
15
|
+
function useMemoFactoryClient(opts = {}) {
|
|
16
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
17
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
18
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
19
|
+
const resolvedAddress = tryResolveFactoryAddress(opts.address, chainId);
|
|
20
|
+
const resolutionError = computeFactoryResolutionError(opts.address, chainId);
|
|
21
|
+
const encryptorSourceRef = useRef(opts.encryptor);
|
|
22
|
+
encryptorSourceRef.current = opts.encryptor;
|
|
23
|
+
const client = useMemo(() => {
|
|
24
|
+
if (!publicClient) return void 0;
|
|
25
|
+
if (!resolvedAddress) return void 0;
|
|
26
|
+
return createConfidentialAirdropFactoryClient({
|
|
27
|
+
publicClient,
|
|
28
|
+
...walletClient ? { walletClient } : {},
|
|
29
|
+
address: resolvedAddress,
|
|
30
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
31
|
+
// Lazy — invoked per-encryption inside the headless client. Picks up
|
|
32
|
+
// whichever EncryptorSource the consumer last passed in.
|
|
33
|
+
encryptor: () => resolveEncryptor(encryptorSourceRef.current)
|
|
34
|
+
});
|
|
35
|
+
}, [publicClient, walletClient, resolvedAddress, chainId]);
|
|
36
|
+
return {
|
|
37
|
+
client,
|
|
38
|
+
resolutionError,
|
|
39
|
+
publicClient,
|
|
40
|
+
walletClient: walletClient ?? void 0,
|
|
41
|
+
chainId,
|
|
42
|
+
resolvedAddress
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function computeFactoryResolutionError(override, chainId) {
|
|
46
|
+
if (override) return void 0;
|
|
47
|
+
if (chainId === void 0) {
|
|
48
|
+
return new DeploymentAddressUnavailableError({
|
|
49
|
+
reason: "chain-id-missing",
|
|
50
|
+
product: "fheAirdrop",
|
|
51
|
+
contract: "confidentialAirdropFactory",
|
|
52
|
+
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const resolved = getFheAirdropFactoryAddress(chainId);
|
|
56
|
+
if (!resolved) {
|
|
57
|
+
return new DeploymentAddressUnavailableError({
|
|
58
|
+
reason: "registry-not-deployed",
|
|
59
|
+
product: "fheAirdrop",
|
|
60
|
+
contract: "confidentialAirdropFactory",
|
|
61
|
+
chainId,
|
|
62
|
+
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
function useMemoAirdropClient(opts) {
|
|
68
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
69
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
70
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
71
|
+
const client = useMemo(() => {
|
|
72
|
+
if (!publicClient) return void 0;
|
|
73
|
+
if (!opts.address) return void 0;
|
|
74
|
+
return createConfidentialAirdropClient({
|
|
75
|
+
publicClient,
|
|
76
|
+
...walletClient ? { walletClient } : {},
|
|
77
|
+
address: opts.address,
|
|
78
|
+
...opts.aclAddress ? { aclAddress: opts.aclAddress } : {}
|
|
79
|
+
});
|
|
80
|
+
}, [publicClient, walletClient, opts.address, opts.aclAddress]);
|
|
81
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
82
|
+
}
|
|
83
|
+
function buildQueryKey(method, chainId, address, ...args) {
|
|
84
|
+
return [
|
|
85
|
+
FHE_AIRDROP_KEY,
|
|
86
|
+
FHE_AIRDROP_NAMESPACE,
|
|
87
|
+
method,
|
|
88
|
+
chainId ?? null,
|
|
89
|
+
address ? address.toLowerCase() : null,
|
|
90
|
+
...args.map(normalizeKeyArg)
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
function normalizeKeyArg(value) {
|
|
94
|
+
if (typeof value === "bigint") return value.toString();
|
|
95
|
+
if (Array.isArray(value)) return value.map(normalizeKeyArg);
|
|
96
|
+
if (value && typeof value === "object") {
|
|
97
|
+
return Object.fromEntries(
|
|
98
|
+
Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { buildQueryKey, useMemoAirdropClient, useMemoFactoryClient };
|