@tokenops/sdk 1.6.0 → 2.0.0-alpha.2
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 +77 -8
- package/CONTRIBUTING.md +4 -2
- package/README.md +146 -90
- package/SUPPORT.md +47 -0
- package/dist/{chunk-BD4LZBVF.cjs → chunk-3QHNYEQD.cjs} +18 -17
- package/dist/{chunk-YFIWCYHC.cjs → chunk-3YHBO2DL.cjs} +56 -54
- package/dist/{chunk-QET3Q4JP.js → chunk-44YJPMQC.js} +8 -6
- package/dist/{chunk-6WSNS3UV.js → chunk-4RAAATVY.js} +2 -4
- package/dist/{chunk-4KJ66YRH.js → chunk-4TSDNZQ3.js} +2 -2
- package/dist/chunk-66IHPTOK.cjs +20 -0
- package/dist/{chunk-2RNW4MIJ.cjs → chunk-67OV5CX2.cjs} +0 -18
- package/dist/{chunk-PD7ME2BT.js → chunk-6GNR22OV.js} +2 -1
- package/dist/{chunk-WOEETTH7.cjs → chunk-7AFPOE7N.cjs} +6 -6
- package/dist/{chunk-QKKBBH7I.js → chunk-A4DCEE33.js} +34 -7
- package/dist/chunk-AREQJHKA.cjs +713 -0
- package/dist/{chunk-U57COLUE.js → chunk-AXIPOR3C.js} +2 -2
- package/dist/chunk-EBLBPUPI.cjs +255 -0
- package/dist/chunk-EYDA6Q6C.js +245 -0
- package/dist/{chunk-SYHNZSZZ.cjs → chunk-FAXIIH5R.cjs} +3 -3
- package/dist/{chunk-AYGRYDBX.cjs → chunk-FEDX7B6T.cjs} +37 -35
- package/dist/{chunk-CBRL2PJA.cjs → chunk-FHWSBGWE.cjs} +12 -12
- package/dist/{chunk-WUXUWTFW.cjs → chunk-FT5H2Q7Y.cjs} +37 -7
- package/dist/chunk-GADGBQJO.js +423 -0
- package/dist/{chunk-VHSNYUYV.js → chunk-IGO5XSPS.js} +5 -5
- package/dist/chunk-IUKKNJ2R.cjs +433 -0
- package/dist/{chunk-VR3FREBX.cjs → chunk-JK4XMMKM.cjs} +3 -3
- package/dist/{chunk-4ZCXK4VI.cjs → chunk-KFRDLKMA.cjs} +14 -14
- package/dist/chunk-KWFFIJYX.js +11 -0
- package/dist/{chunk-7G7UOQV4.cjs → chunk-MM5BV5CS.cjs} +4 -4
- package/dist/{chunk-43RFBQ73.cjs → chunk-MVDQMV25.cjs} +29 -32
- package/dist/chunk-NWFMBLSQ.js +4 -0
- package/dist/{chunk-HETNKZEE.js → chunk-PYYSB5ZN.js} +1 -1
- package/dist/chunk-PZZK3O3S.cjs +9843 -0
- package/dist/{chunk-DRSPMIZ7.js → chunk-QBJ7O2B4.js} +1 -11
- package/dist/{chunk-WTK6JDSI.js → chunk-SPLNGUFF.js} +6 -4
- package/dist/{chunk-UJS4N2XM.cjs → chunk-TEBM66WA.cjs} +12 -12
- package/dist/{chunk-TN65XNTI.js → chunk-TWT3STIX.js} +8 -6
- package/dist/chunk-UG5RKLU2.cjs +6 -0
- package/dist/{chunk-EUKPOXWR.cjs → chunk-UHHMVBLU.cjs} +17 -15
- package/dist/chunk-VW356KR3.js +688 -0
- package/dist/{chunk-BK7YIVLK.cjs → chunk-WJLECC22.cjs} +75 -73
- package/dist/{chunk-V5D7BHW3.js → chunk-WJMEBBU7.js} +6 -4
- package/dist/{chunk-NFW7AUEX.js → chunk-WMACINXO.js} +1 -1
- package/dist/chunk-X7WBPCEU.js +9817 -0
- package/dist/{chunk-46T67CE2.js → chunk-ZA673I3O.js} +1 -1
- package/dist/{chunk-YPYCWLYP.js → chunk-ZWXJTBZO.js} +1 -1
- package/dist/core/addresses.d.ts +14 -2
- package/dist/core/brands.d.ts +8 -2
- package/dist/core/errors.d.ts +71 -10
- package/dist/core/preflight.d.ts +1 -0
- package/dist/fhe/erc7984-abi.d.ts +1 -0
- package/dist/fhe/index.cjs +64 -63
- package/dist/fhe/index.js +7 -6
- package/dist/fhe/operators.d.ts +22 -5
- package/dist/fhe/react/index.cjs +13 -12
- package/dist/fhe/react/index.js +6 -5
- package/dist/fhe/types.d.ts +8 -2
- package/dist/fhe-airdrop/abis/{cloneable.d.ts → airdrop-base.d.ts} +254 -396
- package/dist/fhe-airdrop/abis/compliance.d.ts +422 -0
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +1316 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +1319 -190
- package/dist/fhe-airdrop/abis/index.d.ts +5 -2
- package/dist/fhe-airdrop/abis/merkle.d.ts +1250 -0
- package/dist/fhe-airdrop/advanced/index.cjs +11 -12
- package/dist/fhe-airdrop/advanced/index.d.cts +34 -11
- package/dist/fhe-airdrop/advanced/index.d.ts +34 -11
- package/dist/fhe-airdrop/advanced/index.js +3 -8
- package/dist/fhe-airdrop/advanced/react/index.cjs +619 -51
- package/dist/fhe-airdrop/advanced/react/index.d.cts +43 -3
- package/dist/fhe-airdrop/advanced/react/index.d.ts +43 -3
- package/dist/fhe-airdrop/advanced/react/index.js +592 -52
- package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +35 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +47 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
- package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/usePredictEcdsaAirdropAddress.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/usePredictMerkleAirdropAddress.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
- package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +608 -0
- package/dist/fhe-airdrop/campaign.d.ts +338 -0
- package/dist/fhe-airdrop/compliance.d.ts +302 -0
- package/dist/fhe-airdrop/constants.d.ts +33 -0
- package/dist/fhe-airdrop/ecdsa.d.ts +263 -0
- package/dist/fhe-airdrop/encryption.d.ts +92 -14
- package/dist/fhe-airdrop/errors.d.ts +273 -15
- package/dist/fhe-airdrop/factory.d.ts +533 -274
- package/dist/fhe-airdrop/guards.d.ts +317 -0
- package/dist/fhe-airdrop/index.cjs +233 -73
- package/dist/fhe-airdrop/index.d.cts +46 -8
- package/dist/fhe-airdrop/index.d.ts +46 -8
- package/dist/fhe-airdrop/index.js +11 -7
- package/dist/fhe-airdrop/merkle-tree.d.ts +97 -0
- package/dist/fhe-airdrop/merkle.d.ts +201 -0
- package/dist/fhe-airdrop/react/_shared.d.ts +156 -70
- package/dist/fhe-airdrop/react/index.cjs +1174 -384
- package/dist/fhe-airdrop/react/index.d.cts +99 -74
- package/dist/fhe-airdrop/react/index.d.ts +99 -74
- package/dist/fhe-airdrop/react/index.js +993 -303
- package/dist/fhe-airdrop/react/keys.d.ts +90 -0
- package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
- package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
- package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +10 -5
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +29 -10
- package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +15 -6
- package/dist/fhe-airdrop/react/useAirdropPause.d.ts +30 -0
- package/dist/fhe-airdrop/react/useAirdropPaused.d.ts +17 -0
- package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +27 -9
- package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
- package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -4
- package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
- package/dist/fhe-airdrop/react/useAirdropWindow.d.ts +37 -0
- package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
- package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
- package/dist/fhe-airdrop/react/useClaimedAmount.d.ts +29 -0
- package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
- package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
- package/dist/fhe-airdrop/react/useComplianceManager.d.ts +16 -0
- package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
- package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
- package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
- package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
- package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
- package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +28 -0
- package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +25 -0
- package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +24 -0
- package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
- package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
- package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
- package/dist/fhe-airdrop/react/useEffectiveUpgradeable.d.ts +20 -0
- package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
- package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +17 -12
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +28 -0
- package/dist/fhe-airdrop/react/useFactoryRegistry.d.ts +35 -0
- package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +35 -0
- package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +35 -0
- package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
- package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
- package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +22 -0
- package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
- package/dist/fhe-airdrop/react/useMerkleRoot.d.ts +15 -0
- package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
- package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -35
- package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
- package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
- package/dist/fhe-airdrop/react/useSetMerkleRoot.d.ts +22 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +32 -21
- package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +23 -0
- package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
- package/dist/fhe-airdrop/roles.d.ts +147 -0
- package/dist/fhe-airdrop/types.d.ts +78 -63
- package/dist/fhe-disperse/index.cjs +70 -68
- package/dist/fhe-disperse/index.js +10 -8
- package/dist/fhe-disperse/react/index.cjs +94 -92
- package/dist/fhe-disperse/react/index.js +13 -11
- package/dist/fhe-vesting/advanced/index.cjs +10 -8
- package/dist/fhe-vesting/advanced/index.js +8 -6
- package/dist/fhe-vesting/advanced/react/index.cjs +16 -14
- package/dist/fhe-vesting/advanced/react/index.js +13 -11
- package/dist/fhe-vesting/index.cjs +74 -72
- package/dist/fhe-vesting/index.js +11 -9
- package/dist/fhe-vesting/react/index.cjs +228 -226
- package/dist/fhe-vesting/react/index.js +15 -13
- package/dist/index.cjs +100 -87
- package/dist/index.js +3 -2
- package/dist/testnet-faucet/index.cjs +57 -55
- package/dist/testnet-faucet/index.js +7 -5
- package/dist/testnet-faucet/react/index.cjs +55 -53
- package/dist/testnet-faucet/react/index.js +9 -7
- package/package.json +6 -2
- package/dist/chunk-CNP4L3GF.js +0 -105
- package/dist/chunk-KSDSXJ34.js +0 -41
- package/dist/chunk-LBWRFZR3.cjs +0 -1681
- package/dist/chunk-OL6SHN3D.cjs +0 -44
- package/dist/chunk-S2XD75JM.js +0 -1637
- package/dist/chunk-SPGSO5SO.cjs +0 -1644
- package/dist/chunk-UE5XK2SY.js +0 -1673
- package/dist/chunk-WO72UBQD.cjs +0 -109
- package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +0 -53
- package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +0 -49
- package/dist/fhe-airdrop/airdrop.d.ts +0 -317
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +0 -37
- package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +0 -6
- package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +0 -8
- package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +0 -11
- package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +0 -9
- package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +0 -8
- package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +0 -22
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +0 -51
- package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +0 -14
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +0 -14
- package/dist/fhe-airdrop/react/useClaim.d.ts +0 -39
- package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +0 -11
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +0 -41
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +0 -48
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +0 -29
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +0 -31
- package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +0 -14
- package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +0 -10
- package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +0 -11
- package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +0 -17
- package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +0 -33
- package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +0 -16
- package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +0 -14
- package/dist/fhe-airdrop/react/useSetPaused.d.ts +0 -14
- package/dist/fhe-airdrop/react/useWithdraw.d.ts +0 -12
- package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +0 -13
- package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +0 -13
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
3
|
+
/** @alpha */
|
|
4
|
+
export type UseIsMerkleRootMutableArgs = AirdropInstanceHookOptions<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* Whether this `MerkleConfidentialAirdrop` instance permits root rotation at
|
|
7
|
+
* all. This is the read that decides whether a UI offers `useSetMerkleRoot` -
|
|
8
|
+
* on a `false` instance the rotation reverts with `FeatureDisabledError`
|
|
9
|
+
* (`feature: "merkleRootRotation"`) rather than failing a role check.
|
|
10
|
+
*
|
|
11
|
+
* **Fixed at create time, never toggled** - hence `staleTime: Infinity` and
|
|
12
|
+
* hence deliberately NOT bundled with {@link useMerkleRoot}, which rotates.
|
|
13
|
+
* Bundling would refetch an immutable value on every rotation and would force
|
|
14
|
+
* `useSetMerkleRoot`'s single-key invalidation to become coarser.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { data: canRotate } = useIsMerkleRootMutable({ address: merkleAirdropAddress });
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare function useIsMerkleRootMutable(args: UseIsMerkleRootMutableArgs): UseQueryResult<boolean, Error>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import { type EcdsaAirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface UseIsSignatureValidArgs extends EcdsaAirdropInstanceHookOptions<boolean> {
|
|
6
|
+
/** The address the signature was made out to. The digest binds `msg.sender`, so the read is simulated FROM this address. */
|
|
7
|
+
recipient?: Address;
|
|
8
|
+
/** The external encrypted allocation handle. No input proof: a view never calls `FHE.fromExternal`. */
|
|
9
|
+
encryptedAmountHandle?: Hex;
|
|
10
|
+
/** The off-chain claim id bound into the signature. */
|
|
11
|
+
dedupId?: Hex;
|
|
12
|
+
/** Unix seconds the signature expires at. */
|
|
13
|
+
deadline?: bigint;
|
|
14
|
+
/** The `SIGNER_ROLE` holder that authorized the claim. */
|
|
15
|
+
signer?: Address;
|
|
16
|
+
/** The EIP-712 signature from `signClaimAuthorization`. */
|
|
17
|
+
signature?: Hex;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Whether an ECDSA claim authorization would be accepted right now for `recipient`,
|
|
21
|
+
* without spending an FHE op or a transaction.
|
|
22
|
+
*
|
|
23
|
+
* Never reverts - `false` covers every failure mode (paused, outside the claim window,
|
|
24
|
+
* past `deadline`, `signer` lacking `SIGNER_ROLE`, an invalid signature, a consumed
|
|
25
|
+
* digest, or an already-deduped claim). `recipient` is load-bearing and part of the
|
|
26
|
+
* cache key: the read is an `eth_call` FROM that address, so passing the wrong one
|
|
27
|
+
* returns `false` for a signature that would otherwise succeed.
|
|
28
|
+
*
|
|
29
|
+
* Stays disabled until all six signature fields are defined, so a UI can call it
|
|
30
|
+
* unconditionally while a form fills in.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* A successful {@link useEcdsaClaim} / {@link useEcdsaClaimAndUnwrap} flips this to
|
|
34
|
+
* `false` by consuming the digest, but neither claim hook invalidates it - refetch it
|
|
35
|
+
* yourself after a claim rather than trusting a cached `true`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* const { data: claimable } = useIsSignatureValid({
|
|
39
|
+
* address: airdropAddress,
|
|
40
|
+
* dedupMode: "perAddress",
|
|
41
|
+
* recipient, encryptedAmountHandle, dedupId, deadline, signer, signature,
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* @alpha
|
|
45
|
+
*/
|
|
46
|
+
export declare function useIsSignatureValid(args: UseIsSignatureValidArgs): UseQueryResult<boolean, Error>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { MerkleClaimArgs } from "../merkle.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Claim the outstanding amount for a proof-bearing entry on a
|
|
7
|
+
* `MerkleConfidentialAirdrop` instance.
|
|
8
|
+
*
|
|
9
|
+
* **Invalidates:** `useClaimedAmount` for `entry.account` on this instance — the read
|
|
10
|
+
* whose cumulative-delivered value a successful claim changes. The contract advances
|
|
11
|
+
* `claimedAmount[account]`, keyed on the entry's claim identity and NOT on whoever sent
|
|
12
|
+
* the transaction, so a relayed claim must invalidate the recipient's cache entry rather
|
|
13
|
+
* than the relayer's. Other accounts' cached reads, and every other instance's cache,
|
|
14
|
+
* are left untouched.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const claim = useMerkleClaim({ address: airdropAddress });
|
|
18
|
+
* await claim.mutateAsync({ entry }); // relayers pass a relayed entry unchanged
|
|
19
|
+
*
|
|
20
|
+
* @alpha
|
|
21
|
+
*/
|
|
22
|
+
export declare function useMerkleClaim(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, MerkleClaimArgs>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { MerkleClaimArgs } from "../merkle.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Claim a proof-bearing Merkle entry and route the allocation straight into the
|
|
7
|
+
* wrapper's unwrap, making `to` the underlying ERC-20 beneficiary.
|
|
8
|
+
*
|
|
9
|
+
* **Self-only, unlike {@link useMerkleClaim}.** This entrypoint takes no claim identity:
|
|
10
|
+
* the leaf, the accounting and the input proof are all `msg.sender`, so an entry whose
|
|
11
|
+
* `account` is not the submitter is refused before the write. Gate the button on
|
|
12
|
+
* `submitter === entry.account` and fall back to `useMerkleClaim` for relayed claims.
|
|
13
|
+
* Also requires an unwrappable campaign - see `useAirdropConfig().unwrappable`.
|
|
14
|
+
*
|
|
15
|
+
* **Invalidates:** `useClaimedAmount` for the SENDING account on this instance. The
|
|
16
|
+
* contract advances `claimedAmount[msg.sender]` here, so the key is built from the
|
|
17
|
+
* sender resolved in `onMutate` (`variables.account ?? walletClient.account`) and NOT
|
|
18
|
+
* from `entry.account` the way {@link useMerkleClaim} does it. The two identities are
|
|
19
|
+
* equal on this path by construction - the client refuses a mismatch - but the
|
|
20
|
+
* divergence is deliberate: `claim` records the explicit claim identity, this records
|
|
21
|
+
* the caller. Do not unify them.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const unwrapClaim = useMerkleClaimAndUnwrap({ address: airdropAddress });
|
|
25
|
+
* await unwrapClaim.mutateAsync({ entry, to: erc20Beneficiary });
|
|
26
|
+
*
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
29
|
+
export declare function useMerkleClaimAndUnwrap(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, MerkleClaimArgs>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export type UseMerkleRootArgs = AirdropInstanceHookOptions<Hex>;
|
|
6
|
+
/**
|
|
7
|
+
* Read a `MerkleConfidentialAirdrop` instance's currently published root.
|
|
8
|
+
* Proofs presented to `useMerkleClaim` must verify against this exact value.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const { data: root } = useMerkleRoot({ address: merkleAirdropAddress });
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export declare function useMerkleRoot(args: UseMerkleRootArgs): UseQueryResult<Hex, Error>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import { type PlanMerkleCampaignArgs, type PlannedCampaign } from "../campaign.js";
|
|
3
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Variables for {@link usePlanMerkleCampaign} — the create arguments the campaign
|
|
6
|
+
* is planned against. The factory client and the encryptor come from the hook
|
|
7
|
+
* options instead.
|
|
8
|
+
*
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export type UsePlanMerkleCampaignArgs = Omit<PlanMerkleCampaignArgs, "factory" | "encryptor">;
|
|
12
|
+
/**
|
|
13
|
+
* Build a campaign for a Merkle instance that does not exist yet, so its root
|
|
14
|
+
* can be baked in at create time — the **immutable-root** path.
|
|
15
|
+
*
|
|
16
|
+
* That path is otherwise circular: the root must be known before
|
|
17
|
+
* `createMerkleAirdrop`, the root depends on every ciphertext, and every
|
|
18
|
+
* ciphertext binds to an instance address the create has not produced. This
|
|
19
|
+
* hook breaks it with the factory's CREATE2 prediction oracle, then feeds
|
|
20
|
+
* `root` to {@link useCreateMerkleAirdrop} (or
|
|
21
|
+
* {@link useCreateAndFundMerkleAirdrop}) with the SAME `mode`, `creator` and
|
|
22
|
+
* `userSalt`. `initCodeHashAfter` is what `preflightCreateAirdrop`'s
|
|
23
|
+
* `expectedInitCodeHash` wants.
|
|
24
|
+
*
|
|
25
|
+
* **Surface {@link PredictionDriftError}, never swallow it.** It means the
|
|
26
|
+
* factory's Merkle implementation pointer moved mid-build, so every entry is
|
|
27
|
+
* bound to an address the create will not produce. There is no on-chain repair
|
|
28
|
+
* on an immutable-root instance — the only remedy is a fresh plan.
|
|
29
|
+
*
|
|
30
|
+
* **The returned `entries` ARE the campaign — persist them.** The chain keeps
|
|
31
|
+
* only the root, so a recipient without their own
|
|
32
|
+
* `(handle, inputProof, merkleProof)` triple can never claim. Also pick a
|
|
33
|
+
* fresh `userSalt` per campaign: two campaigns sharing
|
|
34
|
+
* `(variant, mode, creator, userSalt)` predict the same address however
|
|
35
|
+
* different their params.
|
|
36
|
+
*
|
|
37
|
+
* **Invalidates:** nothing. Two init-code-hash reads and a prediction — no
|
|
38
|
+
* state moves until the create lands.
|
|
39
|
+
*
|
|
40
|
+
* @throws {@link DeploymentAddressUnavailableError} when no factory is deployed for the connected chain.
|
|
41
|
+
* @throws {@link PredictionDriftError} when the factory's Merkle implementation pointer moved mid-build.
|
|
42
|
+
* @throws {@link InvalidArgumentError} on a duplicate, zero-address or out-of-`uint64`-range roster entry.
|
|
43
|
+
* @throws {@link MissingEncryptorError} when `encryptor` resolves to `undefined`.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const plan = usePlanMerkleCampaign({ encryptor: () => sdk.relayer });
|
|
47
|
+
* const { root, entries, predictedAddress } = await plan.mutateAsync({
|
|
48
|
+
* params, mode: "clone", creator, userSalt, recipients,
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export declare function usePlanMerkleCampaign(options?: AirdropClientOptions): UseMutationResult<PlannedCampaign, Error, UsePlanMerkleCampaignArgs>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import type { PreflightResult } from "../../core/preflight.js";
|
|
4
|
+
import type { DedupMode } from "../constants.js";
|
|
5
|
+
import type { AirdropVariant } from "../errors.js";
|
|
6
|
+
import { type EcdsaClaimPreflightSignature } from "../guards.js";
|
|
7
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
8
|
+
/** @alpha */
|
|
9
|
+
export interface UsePreflightClaimArgs extends AirdropInstanceHookOptions<PreflightResult> {
|
|
10
|
+
/** Which variant this instance is - picks the client the preflight reads through. */
|
|
11
|
+
variant: AirdropVariant;
|
|
12
|
+
/** ECDSA campaigns only; ignored on `variant: "merkle"`. Defaults to `"none"`. */
|
|
13
|
+
dedupMode?: DedupMode;
|
|
14
|
+
/** The account that will SEND the claim and therefore pays the exact-equality gas fee. On a relayed Merkle claim this is the relayer. */
|
|
15
|
+
claimant?: Address;
|
|
16
|
+
/** Merkle campaigns only: the claim identity, when it is not the submitter. Defaults to `claimant`. */
|
|
17
|
+
account?: Address;
|
|
18
|
+
/** The payout destination, if one will be passed. */
|
|
19
|
+
to?: Address;
|
|
20
|
+
/** Set for `claimAndUnwrap`, which is always submitted for the caller. */
|
|
21
|
+
entrypoint?: "claim" | "claimAndUnwrap";
|
|
22
|
+
/** ECDSA campaigns only: adds the authorisation check to the report. */
|
|
23
|
+
signature?: EcdsaClaimPreflightSignature;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Report what would stop a claim right now - chain support, the pause flag, both ends of
|
|
27
|
+
* the claim window, whether `claimant` can cover the exact-equality gas fee, the Merkle
|
|
28
|
+
* argument-relation rules when `account`/`entrypoint` are given, and for an ECDSA
|
|
29
|
+
* campaign given `signature`, whether the authorisation is valid and unconsumed.
|
|
30
|
+
*
|
|
31
|
+
* **`ready: true` does not mean the claimant has anything to claim.** The allocation is
|
|
32
|
+
* encrypted, so an SDK-side "nothing to claim" would require decrypting it; this checks
|
|
33
|
+
* only what is decidable without the ciphertext. Use it to disable a button, not to
|
|
34
|
+
* promise a payout.
|
|
35
|
+
*
|
|
36
|
+
* Every field below `variant` feeds the blockers and is therefore part of the cache key.
|
|
37
|
+
* The fee check reads `claimant`'s live ETH balance, so keep `staleTime` short - the
|
|
38
|
+
* default 0 is right for a claim button.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const { data } = usePreflightClaim({ address: airdropAddress, variant: "merkle", claimant });
|
|
42
|
+
* <button disabled={!data?.ready}>Claim</button>
|
|
43
|
+
*
|
|
44
|
+
* @alpha
|
|
45
|
+
*/
|
|
46
|
+
export declare function usePreflightClaim(args: UsePreflightClaimArgs): UseQueryResult<PreflightResult, Error>;
|
|
@@ -1,51 +1,67 @@
|
|
|
1
1
|
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import type { PreflightResult } from "../../core/preflight.js";
|
|
4
|
+
import type { DeploymentMode } from "../constants.js";
|
|
5
|
+
import type { EcdsaAirdropParams, MerkleAirdropParams } from "../types.js";
|
|
6
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
7
|
+
/** The variant-independent half of {@link UsePreflightCreateAirdropArgs}. */
|
|
8
|
+
/** @alpha */
|
|
9
|
+
export interface PreflightCreateAirdropCommon extends AirdropHookOptions<PreflightResult> {
|
|
10
|
+
mode?: DeploymentMode;
|
|
11
|
+
/** The account that will send `create*`. CREATE2 salts are per-deployer. */
|
|
9
12
|
creator?: Address;
|
|
10
|
-
/**
|
|
11
|
-
* The `userSalt` planned for the create call. Optional — when supplied, the
|
|
12
|
-
* report also carries `predictedAirdrop` and `alreadyDeployed`.
|
|
13
|
-
*/
|
|
14
13
|
userSalt?: Hex;
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* informational `isFactoryOperator` state.
|
|
15
|
+
* Pass `plan.initCodeHashAfter` to turn the implementation-drift check on.
|
|
16
|
+
* Omitting it skips that one check.
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
expectedInitCodeHash?: Hex;
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
24
|
-
* `
|
|
25
|
-
*
|
|
26
|
-
*
|
|
21
|
+
* `variant` and `params` are correlated, mirroring the headless
|
|
22
|
+
* `PreflightCreateArgs` discriminated union rather than widening to a
|
|
23
|
+
* cross-product (CLAUDE.md Pitfall #2). The all-undefined member is what lets
|
|
24
|
+
* a component call the hook unconditionally while a create form fills in.
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export type UsePreflightCreateAirdropArgs = PreflightCreateAirdropCommon & ({
|
|
29
|
+
variant?: undefined;
|
|
30
|
+
params?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
variant: "ecdsa";
|
|
33
|
+
params?: EcdsaAirdropParams;
|
|
34
|
+
} | {
|
|
35
|
+
variant: "merkle";
|
|
36
|
+
params?: MerkleAirdropParams;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Read-only preflight for `useCreateEcdsaAirdrop` / `useCreateMerkleAirdrop`.
|
|
40
|
+
* Runs every create-time guardrail the write path enforces - chain support,
|
|
41
|
+
* the Merkle/UUPS refusal, the creator's effective upgradeability policy for
|
|
42
|
+
* `mode: "uups"`, the stock-wrapper probe when `params.common.unwrappable` is
|
|
43
|
+
* set, a salt collision on the predicted address, and implementation drift
|
|
44
|
+
* when `expectedInitCodeHash` is supplied.
|
|
27
45
|
*
|
|
28
|
-
* The
|
|
29
|
-
* `
|
|
30
|
-
*
|
|
31
|
-
* branch on `error.code`).
|
|
46
|
+
* **The point is disabling the submit button, not catching after the fact.**
|
|
47
|
+
* `blockers` carries the same typed errors `create*` would have thrown, so a
|
|
48
|
+
* UI branches on `error.code` here exactly as it does in `onError`.
|
|
32
49
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* `userSalt` is set — whether a clone already exists at the predicted CREATE2
|
|
37
|
-
* address. The creator's confidential token balance is NOT checked
|
|
38
|
-
* (encrypted; an underfunded create-and-fund silently moves an encrypted
|
|
39
|
-
* zero) — see the headless method's TSDoc.
|
|
50
|
+
* Disabled until `variant`, `params`, `mode`, `creator` and `userSalt` are all
|
|
51
|
+
* set. Refetch after the user changes their target mode or the factory's
|
|
52
|
+
* implementation pointer moves.
|
|
40
53
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* `
|
|
54
|
+
* @remarks
|
|
55
|
+
* Named `…Airdrop` rather than `…Create` so a consumer importing both this and
|
|
56
|
+
* `/fhe-vesting/react`'s `usePreflightCreateVesting` has no collision.
|
|
44
57
|
*
|
|
45
58
|
* @example
|
|
46
59
|
* const { data: report } = usePreflightCreateAirdrop({
|
|
47
|
-
* params, creator, userSalt,
|
|
60
|
+
* variant: "merkle", params, mode: "clone", creator, userSalt,
|
|
61
|
+
* expectedInitCodeHash: plan.initCodeHashAfter,
|
|
48
62
|
* });
|
|
49
|
-
*
|
|
63
|
+
* const canSubmit = report?.ready === true;
|
|
64
|
+
*
|
|
65
|
+
* @alpha
|
|
50
66
|
*/
|
|
51
|
-
export declare function usePreflightCreateAirdrop(args?: UsePreflightCreateAirdropArgs): UseQueryResult<
|
|
67
|
+
export declare function usePreflightCreateAirdrop(args?: UsePreflightCreateAirdropArgs): UseQueryResult<PreflightResult, Error>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/** @alpha */
|
|
6
|
+
export interface RescueERC20Args extends WriteAccountOverride {
|
|
7
|
+
/** The stranded plain ERC-20. Never the campaign's own token, which is ERC-7984. */
|
|
8
|
+
token: Address;
|
|
9
|
+
/** Where the swept balance goes. */
|
|
10
|
+
recipient: Address;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Sweep a plain ERC-20 that was sent to an airdrop instance by mistake.
|
|
14
|
+
* Requires `RESCUER_ROLE`.
|
|
15
|
+
*
|
|
16
|
+
* The campaign's own token is ERC-7984, not ERC-20, so the distribution pool
|
|
17
|
+
* cannot be reached through this path at all — use
|
|
18
|
+
* {@link useWithdrawConfidential} (`TREASURY_ROLE`) for the pool, and
|
|
19
|
+
* {@link useRescueOtherConfidentialToken} for a stranded ERC-7984.
|
|
20
|
+
*
|
|
21
|
+
* **Invalidates:** nothing. This subpath has no read hook over arbitrary
|
|
22
|
+
* ERC-20 balances held by the instance.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const rescue = useRescueERC20({ address: airdropAddress });
|
|
26
|
+
* await rescue.mutateAsync({ token: strandedErc20, recipient: treasuryAddress });
|
|
27
|
+
*
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export declare function useRescueERC20(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, RescueERC20Args>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/** @alpha */
|
|
6
|
+
export interface RescueOtherConfidentialTokenArgs extends WriteAccountOverride {
|
|
7
|
+
/**
|
|
8
|
+
* The stranded ERC-7984. Passing the campaign's own token reverts
|
|
9
|
+
* `CannotRescueAirdropToken`.
|
|
10
|
+
*/
|
|
11
|
+
token: Address;
|
|
12
|
+
/** Where the swept balance goes. */
|
|
13
|
+
recipient: Address;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Sweep a *different* ERC-7984 token that was sent to an airdrop instance by
|
|
17
|
+
* mistake. Requires `RESCUER_ROLE`.
|
|
18
|
+
*
|
|
19
|
+
* Passing the campaign's own token reverts `CannotRescueAirdropToken` — the
|
|
20
|
+
* guard that stops a rescuer draining the distribution pool without
|
|
21
|
+
* `TREASURY_ROLE`. Compare `token` against `useAirdropConfig().data?.token`
|
|
22
|
+
* before submitting so the user is told before paying gas, and route pool
|
|
23
|
+
* sweeps through {@link useWithdrawConfidential} instead.
|
|
24
|
+
*
|
|
25
|
+
* **Invalidates:** nothing. This subpath has no read hook over third-party
|
|
26
|
+
* confidential balances held by the instance.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const rescue = useRescueOtherConfidentialToken({ address: airdropAddress });
|
|
30
|
+
* await rescue.mutateAsync({ token: strandedErc7984, recipient: treasuryAddress });
|
|
31
|
+
*
|
|
32
|
+
* @alpha
|
|
33
|
+
*/
|
|
34
|
+
export declare function useRescueOtherConfidentialToken(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, RescueOtherConfidentialTokenArgs>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/** @alpha */
|
|
6
|
+
export interface RevokeComplianceDelegateArgs extends WriteAccountOverride {
|
|
7
|
+
/** The client delegate to revoke. Must currently be active, and must not be the platform delegate. */
|
|
8
|
+
delegate: Address;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Revoke a client delegate's user-decryption delegation. `options.address` is
|
|
12
|
+
* the CLONE. Requires `DELEGATION_ADMIN_ROLE` on it.
|
|
13
|
+
*
|
|
14
|
+
* **Cannot revoke the platform compliance delegate** - that slot is
|
|
15
|
+
* irrevocable by construction, and targeting it reverts. Only the addresses in
|
|
16
|
+
* {@link useComplianceInfo}'s `clientDelegates` are revocable.
|
|
17
|
+
*
|
|
18
|
+
* The same gateway lag applies on the way out: the revocation is effective
|
|
19
|
+
* on-chain immediately, but a revoked delegate may still complete a delegated
|
|
20
|
+
* decrypt for a short window afterwards.
|
|
21
|
+
*
|
|
22
|
+
* **Invalidates:** this clone's {@link useComplianceInfo} entry and its
|
|
23
|
+
* {@link useIsActiveDelegate} entry for exactly `delegate`, both keyed on the
|
|
24
|
+
* clone address.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Not in the same block as {@link useAddComplianceDelegate} for the same
|
|
28
|
+
* delegate - the FHEVM ACL refuses both writes at one height with an opaque
|
|
29
|
+
* revert.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const revoke = useRevokeComplianceDelegate({ address: managerAddress });
|
|
33
|
+
* await revoke.mutateAsync({ delegate: formerOfficer });
|
|
34
|
+
*
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export declare function useRevokeComplianceDelegate(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, RevokeComplianceDelegateArgs>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
3
|
+
import { type CampaignSubmitterOption, type RotatedCampaign } from "../campaign.js";
|
|
4
|
+
import type { CampaignRecipient } from "../types.js";
|
|
5
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
6
|
+
/**
|
|
7
|
+
* Variables for {@link useRotateMerkleRoot}.
|
|
8
|
+
*
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export interface UseRotateMerkleRootArgs extends CampaignSubmitterOption, WriteAccountOverride {
|
|
12
|
+
/** The FULL updated roster, carrying each account's new CUMULATIVE total — never the delta since the last root. */
|
|
13
|
+
recipients: readonly CampaignRecipient[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Rebuild a campaign against updated totals and publish the new root in one
|
|
17
|
+
* call.
|
|
18
|
+
*
|
|
19
|
+
* **`recipients` must carry CUMULATIVE totals, not deltas.** `claimedAmount`
|
|
20
|
+
* survives a rotation and a claim pays
|
|
21
|
+
* `newTotal - min(newTotal, alreadyDelivered)`, so passing increments pays the
|
|
22
|
+
* increment minus everything already delivered — encrypted zero for most
|
|
23
|
+
* rosters. A total below what an account already received pays nothing; a
|
|
24
|
+
* rotation cannot claw back.
|
|
25
|
+
*
|
|
26
|
+
* The root is published LAST, so a failed rebuild leaves the previous campaign
|
|
27
|
+
* intact and claimable. Once it lands the old proofs stop verifying:
|
|
28
|
+
* **distribute the new entries to every recipient**, including those whose
|
|
29
|
+
* total did not change, or they are stuck.
|
|
30
|
+
*
|
|
31
|
+
* Requires `MERKLE_ADMIN_ROLE` and an instance created with
|
|
32
|
+
* `isMerkleRootMutable: true`. Distinct from {@link useSetMerkleRoot}, which
|
|
33
|
+
* publishes a root you already built.
|
|
34
|
+
*
|
|
35
|
+
* **Invalidates:** this instance's `useMerkleRoot` entry only. Explicitly NOT
|
|
36
|
+
* `useClaimedAmount`: a rotation changes no account's delivered total (it is
|
|
37
|
+
* keyed by account, not by root), so invalidating it would fan out a pointless
|
|
38
|
+
* RPC per mounted recipient row.
|
|
39
|
+
*
|
|
40
|
+
* @throws {@link FeatureDisabledError} when the instance was created with `isMerkleRootMutable: false`.
|
|
41
|
+
* @throws {@link InvalidArgumentError} on a duplicate, zero-address or out-of-`uint64`-range roster entry.
|
|
42
|
+
* @throws {@link MissingEncryptorError} when `encryptor` resolves to `undefined`.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const rotate = useRotateMerkleRoot({ address: airdrop, encryptor: () => sdk.relayer });
|
|
46
|
+
* const { root, entries, hash } = await rotate.mutateAsync({
|
|
47
|
+
* recipients: [{ recipient: alice, cumulativeTotal: 1_500_000n }], // was 1_000_000n
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* @alpha
|
|
51
|
+
*/
|
|
52
|
+
export declare function useRotateMerkleRoot(options: AirdropInstanceClientOptions): UseMutationResult<RotatedCampaign, Error, UseRotateMerkleRootArgs>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Rotate the published root on a `MerkleConfidentialAirdrop` instance.
|
|
7
|
+
* Requires `MERKLE_ADMIN_ROLE`.
|
|
8
|
+
*
|
|
9
|
+
* **Invalidates:** only this instance's `useMerkleRoot` entry — a rotation
|
|
10
|
+
* on one campaign must never blow away another campaign's cached root
|
|
11
|
+
* (CLAUDE.md-adjacent requirement for this subpath: precise, not
|
|
12
|
+
* namespace-wide, invalidation).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const setRoot = useSetMerkleRoot({ address: airdropAddress });
|
|
16
|
+
* await setRoot.mutateAsync({ newRoot });
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export declare function useSetMerkleRoot(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, {
|
|
21
|
+
newRoot: Hex;
|
|
22
|
+
} & WriteAccountOverride>;
|
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type { Signature } from "../../core/brands.js";
|
|
4
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
5
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
6
|
+
/** @alpha */
|
|
7
|
+
export interface SignClaimAuthorizationArgs extends WriteAccountOverride {
|
|
8
|
+
/** The account the signature entitles. Bound into the digest. */
|
|
7
9
|
recipient: Address;
|
|
8
|
-
/**
|
|
10
|
+
/** The 32-byte encrypted-amount handle the recipient will present with this signature. */
|
|
9
11
|
encryptedAmountHandle: Hex;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/** Replay-scoping id, interpreted per the instance's deploy-time `dedupMode`. */
|
|
13
|
+
dedupId: Hex;
|
|
14
|
+
/** Unix seconds after which the signature is worthless. */
|
|
15
|
+
deadline: bigint;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
|
-
* Sign a `Claim(address recipient, bytes32 encryptedAmount
|
|
17
|
-
*
|
|
18
|
-
* hold `
|
|
19
|
-
*
|
|
18
|
+
* Sign a v2 `Claim(address recipient, bytes32 encryptedAmount, bytes32
|
|
19
|
+
* dedupId, uint256 deadline)` authorization for an `ECDSAConfidentialAirdrop`
|
|
20
|
+
* instance. The signer must hold `SIGNER_ROLE` on that instance.
|
|
21
|
+
*
|
|
22
|
+
* `airdrop` and `chainId` come from the hook's own options, so a component
|
|
23
|
+
* supplies only the claim fields.
|
|
20
24
|
*
|
|
21
|
-
*
|
|
25
|
+
* **Under `perDedupId` and `none` the contract enforces no per-recipient
|
|
26
|
+
* ceiling.** Every mode consumes the EIP-712 digest, so the exact signature
|
|
27
|
+
* bytes cannot be replayed - but under `perDedupId` the same ciphertext
|
|
28
|
+
* signed for two different `dedupId`s is claimable twice, and under `none`
|
|
29
|
+
* every distinct signature is independently claimable with no on-chain
|
|
30
|
+
* ceiling at all. The signing UI is then the ONLY bound on total payout. See
|
|
31
|
+
* {@link signClaimAuthorization}.
|
|
32
|
+
*
|
|
33
|
+
* **Invalidates:** nothing. The signature is produced off-chain and lands no
|
|
34
|
+
* transaction, so no cached read moves until the recipient claims.
|
|
22
35
|
*
|
|
23
36
|
* @example
|
|
24
|
-
* const sign = useSignClaimAuthorization();
|
|
25
|
-
* const signature = await sign.mutateAsync({
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* encryptedAmountHandle: encrypted.handle,
|
|
29
|
-
* });
|
|
37
|
+
* const sign = useSignClaimAuthorization({ address: airdropAddress });
|
|
38
|
+
* const signature = await sign.mutateAsync({ recipient, encryptedAmountHandle, dedupId, deadline });
|
|
39
|
+
*
|
|
40
|
+
* @alpha
|
|
30
41
|
*/
|
|
31
|
-
export declare function useSignClaimAuthorization(options
|
|
42
|
+
export declare function useSignClaimAuthorization(options: AirdropInstanceClientOptions): UseMutationResult<Signature, Error, SignClaimAuthorizationArgs>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Sweep an airdrop instance's entire remaining confidential balance to
|
|
7
|
+
* `recipient`. Requires `TREASURY_ROLE`. The amount is not a parameter and
|
|
8
|
+
* never appears in plaintext anywhere — the contract reads its own encrypted
|
|
9
|
+
* balance and moves all of it.
|
|
10
|
+
*
|
|
11
|
+
* **Invalidates:** nothing. No read hook in this subpath's list exposes the
|
|
12
|
+
* confidential pool balance (see {@link useFundAirdrop}'s TSDoc for the same
|
|
13
|
+
* reasoning), so there is no cached query left stale by a withdrawal.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const withdraw = useWithdrawConfidential({ address: airdropAddress });
|
|
17
|
+
* await withdraw.mutateAsync({ recipient: treasuryAddress });
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare function useWithdrawConfidential(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, {
|
|
22
|
+
recipient: Address;
|
|
23
|
+
} & WriteAccountOverride>;
|