@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,45 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* One role's membership on a compliance-manager clone - the set and its size,
|
|
6
|
+
* read together.
|
|
7
|
+
*
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export interface ComplianceRoleMembership {
|
|
11
|
+
/** Every account currently holding the role, in `EnumerableSet` order. Treat it as a set: the order is not stable across grants and revokes. */
|
|
12
|
+
members: readonly Address[];
|
|
13
|
+
/** How many accounts hold it. */
|
|
14
|
+
count: bigint;
|
|
15
|
+
}
|
|
16
|
+
/** @alpha */
|
|
17
|
+
export interface UseComplianceRoleMembersArgs extends AirdropInstanceHookOptions<ComplianceRoleMembership> {
|
|
18
|
+
/** The role whose members to list - from {@link useComplianceRoleConstants}, not hand-hashed. */
|
|
19
|
+
role?: Hex;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* List who holds `role` on a compliance-manager clone, with the member count.
|
|
23
|
+
* `address` is the CLONE.
|
|
24
|
+
*
|
|
25
|
+
* With `DELEGATION_ADMIN_ROLE` this answers "who may add or revoke a
|
|
26
|
+
* delegate?" - the administrative counterpart to
|
|
27
|
+
* {@link useComplianceInfo}'s `clientDelegates`, which answers "who may
|
|
28
|
+
* currently decrypt?".
|
|
29
|
+
*
|
|
30
|
+
* Unlike an airdrop instance, this contract enforces no "never empty" floor:
|
|
31
|
+
* emptying `DEFAULT_ADMIN_ROLE` here freezes the clone's delegate set
|
|
32
|
+
* permanently, so surface `count` before offering the last revoke.
|
|
33
|
+
* Unpaginated - role sets here are operator-sized.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Invalidated by {@link useComplianceGrantRole},
|
|
37
|
+
* {@link useComplianceRevokeRole} and {@link useComplianceRenounceRole}.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const { data } = useComplianceRoleMembers({ address: managerAddress, role: roles?.DEFAULT_ADMIN_ROLE });
|
|
41
|
+
* const wouldFreezeClone = data?.count === 1n;
|
|
42
|
+
*
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
45
|
+
export declare function useComplianceRoleMembers(args: UseComplianceRoleMembersArgs): UseQueryResult<ComplianceRoleMembership, Error>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
3
|
+
import type { FundInput } from "../factory.js";
|
|
4
|
+
import type { CreateAirdropArgs, CreateAirdropResult, EcdsaAirdropParams } from "../types.js";
|
|
5
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
6
|
+
/**
|
|
7
|
+
* Variables for {@link useCreateAndFundEcdsaAirdrop} — the create arguments plus
|
|
8
|
+
* exactly one of `amount` / `encryptedInput`.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export type UseCreateAndFundEcdsaAirdropArgs = CreateAirdropArgs<EcdsaAirdropParams> & FundInput & WriteAccountOverride;
|
|
13
|
+
/**
|
|
14
|
+
* Deploy an ECDSA-authorised airdrop instance and seed its pool in one
|
|
15
|
+
* transaction.
|
|
16
|
+
*
|
|
17
|
+
* Prerequisite: the funder must already have approved the factory as an
|
|
18
|
+
* ERC-7984 operator on the token (`token.setOperator(factoryAddress, deadline)`) —
|
|
19
|
+
* the factory pulls the pool via `confidentialTransferFrom`. Pass `amount`
|
|
20
|
+
* (plaintext, encrypted against the hook-level `encryptor`) or a pre-built
|
|
21
|
+
* `encryptedInput`, never both.
|
|
22
|
+
*
|
|
23
|
+
* Returns `CreateAirdropResult` unflattened — `{ hash, airdrop,
|
|
24
|
+
* complianceManager }`; the caller needs the instance address to do anything
|
|
25
|
+
* with the campaign afterwards.
|
|
26
|
+
*
|
|
27
|
+
* **A successful receipt does not prove the pool was funded.** An ERC-7984
|
|
28
|
+
* transfer moves an encrypted zero instead of reverting when the funder is
|
|
29
|
+
* short, because reverting would leak the balance.
|
|
30
|
+
*
|
|
31
|
+
* **Invalidates:** the factory's registry reads (`useFactoryRegistry`) for
|
|
32
|
+
* this factory address, whatever page was cached — a new instance moves
|
|
33
|
+
* `airdropCount()` / `airdrops()`. Nothing else: the new instance has no
|
|
34
|
+
* cached reads yet, and no read hook here exposes the confidential pool
|
|
35
|
+
* balance.
|
|
36
|
+
*
|
|
37
|
+
* **Never log `amount`.** It is the one plaintext confidential value this
|
|
38
|
+
* hook sees — keep it out of telemetry, `onError` context and console.
|
|
39
|
+
*
|
|
40
|
+
* @throws {@link DeploymentAddressUnavailableError} when no factory is deployed for the connected chain.
|
|
41
|
+
* @throws {@link MissingEncryptorError} when `amount` is given and no encryptor resolves.
|
|
42
|
+
* @throws {@link SaltCollisionError} when this `(mode, deployer, userSalt)` tuple already deployed an instance.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const createAndFund = useCreateAndFundEcdsaAirdrop({ encryptor: () => sdk.relayer });
|
|
46
|
+
* const { airdrop } = await createAndFund.mutateAsync({
|
|
47
|
+
* params: { common, signer, dedupMode: "perAddress" },
|
|
48
|
+
* mode: "clone",
|
|
49
|
+
* userSalt,
|
|
50
|
+
* amount: 1_000_000n,
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* @alpha
|
|
54
|
+
*/
|
|
55
|
+
export declare function useCreateAndFundEcdsaAirdrop(options?: AirdropClientOptions): UseMutationResult<CreateAirdropResult, Error, UseCreateAndFundEcdsaAirdropArgs>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
3
|
+
import type { FundInput } from "../factory.js";
|
|
4
|
+
import type { CreateAirdropArgs, CreateAirdropResult, MerkleAirdropParams } from "../types.js";
|
|
5
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
6
|
+
/**
|
|
7
|
+
* Variables for {@link useCreateAndFundMerkleAirdrop} — the create arguments plus
|
|
8
|
+
* exactly one of `amount` / `encryptedInput`.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export type UseCreateAndFundMerkleAirdropArgs = CreateAirdropArgs<MerkleAirdropParams> & FundInput & WriteAccountOverride;
|
|
13
|
+
/**
|
|
14
|
+
* Deploy a Merkle-proof airdrop instance and seed its pool in one transaction.
|
|
15
|
+
*
|
|
16
|
+
* Prerequisite: the funder must already have approved the factory as an
|
|
17
|
+
* ERC-7984 operator on the token (`token.setOperator(factoryAddress, deadline)`).
|
|
18
|
+
* Pass `amount` (plaintext, encrypted against the hook-level `encryptor`) or a
|
|
19
|
+
* pre-built `encryptedInput`, never both.
|
|
20
|
+
*
|
|
21
|
+
* `mode: "uups"` is rejected before the wallet is even looked up, so the
|
|
22
|
+
* mutation rejects without prompting for a signature. Returns
|
|
23
|
+
* `CreateAirdropResult` unflattened — `{ hash, airdrop, complianceManager }`.
|
|
24
|
+
*
|
|
25
|
+
* **A successful receipt does not prove the pool was funded.** An ERC-7984
|
|
26
|
+
* transfer moves an encrypted zero instead of reverting when the funder is
|
|
27
|
+
* short, because reverting would leak the balance.
|
|
28
|
+
*
|
|
29
|
+
* **Invalidates:** the factory's registry reads (`useFactoryRegistry`) for
|
|
30
|
+
* this factory address, whatever page was cached — a new instance moves
|
|
31
|
+
* `airdropCount()` / `airdrops()`. Nothing else.
|
|
32
|
+
*
|
|
33
|
+
* **Never log `amount`.** It is the one plaintext confidential value this
|
|
34
|
+
* hook sees — keep it out of telemetry, `onError` context and console.
|
|
35
|
+
*
|
|
36
|
+
* @throws {@link MerkleUupsUnsupportedError} when `mode` is `"uups"`.
|
|
37
|
+
* @throws {@link DeploymentAddressUnavailableError} when no factory is deployed for the connected chain.
|
|
38
|
+
* @throws {@link MissingEncryptorError} when `amount` is given and no encryptor resolves.
|
|
39
|
+
* @throws {@link SaltCollisionError} when this `(mode, deployer, userSalt)` tuple already deployed an instance.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const createAndFund = useCreateAndFundMerkleAirdrop({ encryptor: () => sdk.relayer });
|
|
43
|
+
* const { airdrop } = await createAndFund.mutateAsync({
|
|
44
|
+
* params: { common, merkleRoot: plan.root, isMerkleRootMutable: false },
|
|
45
|
+
* mode: "clone",
|
|
46
|
+
* userSalt,
|
|
47
|
+
* amount: 1_000_000n,
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* @alpha
|
|
51
|
+
*/
|
|
52
|
+
export declare function useCreateAndFundMerkleAirdrop(options?: AirdropClientOptions): UseMutationResult<CreateAirdropResult, Error, UseCreateAndFundMerkleAirdropArgs>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { CreateAirdropArgs, CreateAirdropResult, EcdsaAirdropParams } from "../types.js";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Deploy an ECDSA-authorised airdrop instance via the factory.
|
|
7
|
+
*
|
|
8
|
+
* Returns the headless client's `CreateAirdropResult` unchanged — `{ hash,
|
|
9
|
+
* airdrop, complianceManager }` — never flattened to just a hash: a caller
|
|
10
|
+
* needs the deployed instance address to do anything with the campaign
|
|
11
|
+
* afterwards.
|
|
12
|
+
*
|
|
13
|
+
* **Invalidates:** the factory's registry reads (`useFactoryRegistry`) for
|
|
14
|
+
* this factory address, since a new instance changes `airdropCount()` /
|
|
15
|
+
* `airdrops()`. Nothing else — the new instance has no cached reads yet, and
|
|
16
|
+
* no other factory or instance state changed.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const create = useCreateEcdsaAirdrop();
|
|
20
|
+
* const { airdrop, complianceManager } = await create.mutateAsync({
|
|
21
|
+
* params: { common, signer, dedupMode: "perAddress" },
|
|
22
|
+
* mode: "clone",
|
|
23
|
+
* userSalt,
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare function useCreateEcdsaAirdrop(options?: AirdropClientOptions): UseMutationResult<CreateAirdropResult, Error, CreateAirdropArgs<EcdsaAirdropParams> & WriteAccountOverride>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
3
|
+
import type { CreateAirdropArgs, CreateAirdropResult, MerkleAirdropParams } from "../types.js";
|
|
4
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Deploy a Merkle-proof airdrop instance via the factory.
|
|
7
|
+
*
|
|
8
|
+
* Returns the headless client's `CreateAirdropResult` unchanged — `{ hash,
|
|
9
|
+
* airdrop, complianceManager }`.
|
|
10
|
+
*
|
|
11
|
+
* **Invalidates:** the factory's registry reads (`useFactoryRegistry`) for
|
|
12
|
+
* this factory address — a new instance changes `airdropCount()` /
|
|
13
|
+
* `airdrops()`. Nothing else.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const create = useCreateMerkleAirdrop();
|
|
17
|
+
* const { airdrop } = await create.mutateAsync({
|
|
18
|
+
* params: { common, merkleRoot, isMerkleRootMutable: true },
|
|
19
|
+
* mode: "clone",
|
|
20
|
+
* userSalt,
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export declare function useCreateMerkleAirdrop(options?: AirdropClientOptions): UseMutationResult<CreateAirdropResult, Error, CreateAirdropArgs<MerkleAirdropParams> & WriteAccountOverride>;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 UseDiscloseHandleToPartyArgs extends WriteAccountOverride {
|
|
7
|
+
/** An existing `euint64` handle - a public pointer, not a value. */
|
|
8
|
+
handle: Hex;
|
|
9
|
+
/** The address granted decrypt access on `handle`. */
|
|
10
|
+
party: Address;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Grants `party` decrypt access to a handle you already hold - typically one
|
|
14
|
+
* returned by `useAdminGetCurrentBalance` or a claim preview, forwarded to an
|
|
15
|
+
* auditor without ever revealing plaintext.
|
|
16
|
+
*
|
|
17
|
+
* Unlike the `admin*Disclose*` hooks this produces no new handle, so it
|
|
18
|
+
* returns the transaction hash rather than an `EncryptedViewResult`; there is
|
|
19
|
+
* no ACL event to parse.
|
|
20
|
+
*
|
|
21
|
+
* Two gates apply on-chain: the caller must itself be allowed on `handle`
|
|
22
|
+
* (bypassed by `DISCLOSURE_ADMIN_ROLE`), and the *instance* must be allowed on
|
|
23
|
+
* it, so a handle minted by an unrelated contract cannot be laundered through
|
|
24
|
+
* this campaign. A failure of the first surfaces as `FheHandleNotAllowedError`.
|
|
25
|
+
*
|
|
26
|
+
* **Invalidates:** nothing. ACL is append-only and no read hook in this
|
|
27
|
+
* subpath caches who is allowed on a handle.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const disclose = useDiscloseHandleToParty({ address: airdropAddress });
|
|
31
|
+
* await disclose.mutateAsync({ handle, party: auditorAddress });
|
|
32
|
+
*
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare function useDiscloseHandleToParty(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, UseDiscloseHandleToPartyArgs>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { EcdsaClaimArgs } from "../ecdsa.js";
|
|
4
|
+
import { type EcdsaAirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Claim a signed encrypted allocation on an `ECDSAConfidentialAirdrop`
|
|
7
|
+
* instance.
|
|
8
|
+
*
|
|
9
|
+
* `dedupMode` must be supplied — the contract has no on-chain getter for it
|
|
10
|
+
* (see {@link EcdsaAirdropClientConfig.dedupMode}); pass the same value used
|
|
11
|
+
* at `createEcdsaAirdrop` time.
|
|
12
|
+
*
|
|
13
|
+
* **Invalidates:** the `fn "isSignatureValid"` PREFIX for this instance. A successful
|
|
14
|
+
* claim consumes the EIP-712 digest, so every cached signature check on this instance
|
|
15
|
+
* is now stale in the dangerous direction - it still answers `true` for a signature
|
|
16
|
+
* that can no longer be claimed. Per-claim dedup state itself remains unqueryable.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const claim = useEcdsaClaim({ address: airdropAddress, dedupMode: "perAddress" });
|
|
20
|
+
* await claim.mutateAsync({ encryptedInput, dedupId, deadline, signer, signature });
|
|
21
|
+
*
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare function useEcdsaClaim(options: EcdsaAirdropInstanceClientOptions): UseMutationResult<Hex, Error, EcdsaClaimArgs>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { EcdsaClaimArgs } from "../ecdsa.js";
|
|
4
|
+
import { type EcdsaAirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Claim a signed encrypted allocation and route it straight into the wrapper's unwrap,
|
|
7
|
+
* making `to` the underlying ERC-20 beneficiary.
|
|
8
|
+
*
|
|
9
|
+
* Reverts {@link FeatureDisabledError} on a non-unwrappable campaign - gate the button
|
|
10
|
+
* on `useAirdropConfig().unwrappable`. Consumes the same replay guards and EIP-712
|
|
11
|
+
* digest as {@link useEcdsaClaim}.
|
|
12
|
+
*
|
|
13
|
+
* `dedupMode` must be supplied - the contract has no on-chain getter for it; pass the
|
|
14
|
+
* same value used at `createEcdsaAirdrop` time.
|
|
15
|
+
*
|
|
16
|
+
* **Invalidates:** nothing, mirroring {@link useEcdsaClaim}. Replay consumption is not
|
|
17
|
+
* queryable, so no cached read in this subpath tracks the state a successful claim
|
|
18
|
+
* changes. `useIsSignatureValid` DOES flip to `false` once the digest is consumed, but
|
|
19
|
+
* it is not invalidated from here - refetch it yourself after a claim.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const unwrapClaim = useEcdsaClaimAndUnwrap({ address: airdropAddress, dedupMode: "perAddress" });
|
|
23
|
+
* await unwrapClaim.mutateAsync({ encryptedInput, dedupId, deadline, signer, signature, to });
|
|
24
|
+
*
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
export declare function useEcdsaClaimAndUnwrap(options: EcdsaAirdropInstanceClientOptions): UseMutationResult<Hex, Error, EcdsaClaimArgs>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { Eip712Domain } from "../ecdsa.js";
|
|
4
|
+
import { type EcdsaAirdropInstanceHookOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* One `ECDSAConfidentialAirdrop` instance's live EIP-712 identity, read
|
|
7
|
+
* straight off the deployment.
|
|
8
|
+
*
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export interface EcdsaDomain {
|
|
12
|
+
/** The on-chain `CLAIM_TYPEHASH`. Compare against the module `CLAIM_TYPEHASH` constant. */
|
|
13
|
+
claimTypehash: Hex;
|
|
14
|
+
/** `_domainSeparatorV4()`, bound to `(chainId, address(this))`. */
|
|
15
|
+
domainSeparator: Hex;
|
|
16
|
+
/** The ERC-5267 domain, field by field - what {@link EcdsaDomain.domainSeparator} hashes. */
|
|
17
|
+
domain: Eip712Domain;
|
|
18
|
+
}
|
|
19
|
+
/** @alpha */
|
|
20
|
+
export type UseEcdsaDomainArgs = EcdsaAirdropInstanceHookOptions<EcdsaDomain>;
|
|
21
|
+
/**
|
|
22
|
+
* Read an ECDSA instance's `CLAIM_TYPEHASH`, domain separator and ERC-5267
|
|
23
|
+
* domain in one round trip - the three deployment-verification reads nobody
|
|
24
|
+
* wants one at a time (same call as {@link useAirdropWindow}).
|
|
25
|
+
*
|
|
26
|
+
* **This is the round-trip confirmation, not the common path.** For building
|
|
27
|
+
* a signature, use the module-level `CLAIM_TYPEHASH` / `EIP712_DOMAIN_NAME` /
|
|
28
|
+
* `EIP712_DOMAIN_VERSION` constants and skip the RPC. Use this hook to
|
|
29
|
+
* confirm a deployed instance really was initialized with the domain you
|
|
30
|
+
* expect, on the chain you think it is on, before a signing service starts
|
|
31
|
+
* issuing signatures against it.
|
|
32
|
+
*
|
|
33
|
+
* All three are bytecode/deploy constants, so `staleTime: Infinity`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* const { data } = useEcdsaDomain({ address: airdropAddress, dedupMode: "perAddress" });
|
|
37
|
+
* const built = data?.claimTypehash === CLAIM_TYPEHASH;
|
|
38
|
+
*
|
|
39
|
+
* @alpha
|
|
40
|
+
*/
|
|
41
|
+
export declare function useEcdsaDomain(args: UseEcdsaDomainArgs): UseQueryResult<EcdsaDomain, Error>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface UseEffectiveDelegateToComplianceArgs extends AirdropHookOptions<boolean> {
|
|
6
|
+
/** The creator whose effective delegate-to-compliance policy to read. */
|
|
7
|
+
creator?: Address;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Whether `creator`'s NEXT `create*` will wire the platform compliance
|
|
11
|
+
* delegate into the instance's compliance-manager clone - their
|
|
12
|
+
* `setCompliancePolicy` override when they have one, else the factory
|
|
13
|
+
* default. Read it to tell a creator up front that a platform delegate will
|
|
14
|
+
* hold delegated rights on the campaign they are about to deploy.
|
|
15
|
+
*
|
|
16
|
+
* The creator-facing mirror of {@link useEffectiveUpgradeable}: same args
|
|
17
|
+
* shape, same gating, same subpath - even though the setters that move it
|
|
18
|
+
* (`setCompliancePolicy` / `clearCompliancePolicy` /
|
|
19
|
+
* `setDefaultDelegateToCompliance`) are factory-admin surface.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const { data: willDelegate } = useEffectiveDelegateToCompliance({ creator: deployerAddress });
|
|
23
|
+
*
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export declare function useEffectiveDelegateToCompliance(args?: UseEffectiveDelegateToComplianceArgs): UseQueryResult<boolean, Error>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface UseEffectiveUpgradeableArgs extends AirdropHookOptions<boolean> {
|
|
6
|
+
/** The creator whose effective upgradeability policy to read. */
|
|
7
|
+
creator?: Address;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Whether `creator`'s NEXT `create*` may deploy `mode: "uups"` — the factory
|
|
11
|
+
* default, overridden per-creator via `setUpgradeabilityPolicy`. Read this
|
|
12
|
+
* before offering a UUPS deploy option in a UI; the factory refuses the
|
|
13
|
+
* create outright when this is `false` (`UpgradeabilityNotAllowedError`).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const { data: canUseUups } = useEffectiveUpgradeable({ creator: deployerAddress });
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export declare function useEffectiveUpgradeable(args?: UseEffectiveUpgradeableArgs): UseQueryResult<boolean, Error>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type CampaignSubmitterOption, type EncryptedCampaignLeaf } from "../campaign.js";
|
|
4
|
+
import { type EncryptorSource } from "../encryption.js";
|
|
5
|
+
import type { CampaignRecipient } from "../types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Hook-level config for {@link useEncryptCampaignAmounts}. No chain client is
|
|
8
|
+
* involved — encryption is relayer work — so only the encryptor is needed.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export interface UseEncryptCampaignAmountsOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Eager or lazy encryptor. Wire it lazily so the live React context is read
|
|
15
|
+
* at submit time rather than captured at mount (CLAUDE.md Pitfall #3):
|
|
16
|
+
* `const sdk = useZamaSDK()` once, then `encryptor: () => sdk.relayer`.
|
|
17
|
+
*/
|
|
18
|
+
encryptor?: EncryptorSource;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Variables for {@link useEncryptCampaignAmounts}.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export interface UseEncryptCampaignAmountsArgs extends CampaignSubmitterOption {
|
|
26
|
+
/** The LIVE `MerkleConfidentialAirdrop` instance every input is bound to. Not the factory, not the implementation. */
|
|
27
|
+
instance: Address;
|
|
28
|
+
/** CUMULATIVE totals per account, never per-drop tranches. */
|
|
29
|
+
recipients: readonly CampaignRecipient[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Encrypt a plaintext roster into per-recipient handles, without building a
|
|
33
|
+
* tree. Use it to persist the ciphertexts before committing to a root; if you
|
|
34
|
+
* just want a campaign, {@link useBuildMerkleCampaign} does both stages.
|
|
35
|
+
*
|
|
36
|
+
* A mutation rather than a query on purpose: encryption is randomised, so the
|
|
37
|
+
* same roster yields different handles every call and there is no legitimate
|
|
38
|
+
* cache identity to key. **Persist what resolves** — nothing here is
|
|
39
|
+
* recoverable or reproducible.
|
|
40
|
+
*
|
|
41
|
+
* `submitter` decides the shape and the relayer cost. Omitted: one request per
|
|
42
|
+
* recipient, issued concurrently, each input bound to that recipient, so only
|
|
43
|
+
* they can claim — chunk the roster yourself if your relayer rate-limits. Set:
|
|
44
|
+
* a single batched request bound to that one address, one shared `inputProof`
|
|
45
|
+
* for the whole roster, and only that address can submit.
|
|
46
|
+
*
|
|
47
|
+
* **Invalidates:** nothing. Pure off-chain relayer work — no contract state
|
|
48
|
+
* moves, so no cached read goes stale.
|
|
49
|
+
*
|
|
50
|
+
* @throws {@link InvalidArgumentError} on a duplicate, zero-address or out-of-`uint64`-range roster entry, or a zero `instance`.
|
|
51
|
+
* @throws {@link MissingEncryptorError} when `encryptor` resolves to `undefined`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* const encrypt = useEncryptCampaignAmounts({ encryptor: () => sdk.relayer });
|
|
55
|
+
* const leaves = await encrypt.mutateAsync({ instance: airdrop, recipients });
|
|
56
|
+
*
|
|
57
|
+
* @alpha
|
|
58
|
+
*/
|
|
59
|
+
export declare function useEncryptCampaignAmounts(options?: UseEncryptCampaignAmountsOptions): UseMutationResult<readonly EncryptedCampaignLeaf[], Error, UseEncryptCampaignAmountsArgs>;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
newEndTime: number;
|
|
6
|
-
account?: Account | Address;
|
|
7
|
-
}
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
6
|
+
* Move an airdrop instance's claim-window end time forward. Requires
|
|
7
|
+
* `WINDOW_ADMIN_ROLE`, and only succeeds on an instance created with
|
|
8
|
+
* `canExtendClaimWindow: true`.
|
|
9
|
+
*
|
|
10
|
+
* **Invalidates:** only this instance's `useAirdropWindow` entry — `endTime`
|
|
11
|
+
* is one of the five fields that hook bundles.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* @example
|
|
14
|
+
* const extend = useExtendClaimWindow({ address: airdropAddress });
|
|
15
|
+
* await extend.mutateAsync({ newEndTime: Math.floor(Date.now() / 1000) + 86_400 });
|
|
16
|
+
*
|
|
17
|
+
* @alpha
|
|
15
18
|
*/
|
|
16
|
-
export declare function useExtendClaimWindow(options:
|
|
19
|
+
export declare function useExtendClaimWindow(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, {
|
|
20
|
+
newEndTime: number;
|
|
21
|
+
} & WriteAccountOverride>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* The factory's chain-wide fee configuration.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export interface FactoryFees {
|
|
10
|
+
/** Where withdrawn gas fees go. */
|
|
11
|
+
feeCollector: Address;
|
|
12
|
+
/** Wei charged per claim on a fee-charging campaign, absent a per-creator custom fee. */
|
|
13
|
+
defaultGasFee: bigint;
|
|
14
|
+
}
|
|
15
|
+
/** @alpha */
|
|
16
|
+
export type UseFactoryFeesArgs = AirdropHookOptions<FactoryFees>;
|
|
17
|
+
/**
|
|
18
|
+
* Read the airdrop factory's default fee configuration — `feeCollector` and
|
|
19
|
+
* `defaultGasFee` in one round trip. For a specific creator's override, read
|
|
20
|
+
* `factory.getCustomFee(creator)` from the headless client directly (not
|
|
21
|
+
* wrapped here — see the module's scope-discipline note).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const { data: fees } = useFactoryFees();
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare function useFactoryFees(args?: UseFactoryFeesArgs): UseQueryResult<FactoryFees, Error>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* One page of the factory's deployment registry.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export interface FactoryRegistryPage {
|
|
10
|
+
/** Total instances the factory has deployed — the upper bound for paging. */
|
|
11
|
+
count: bigint;
|
|
12
|
+
/** Instance addresses in `[offset, offset + limit)` deployment order. */
|
|
13
|
+
items: readonly Address[];
|
|
14
|
+
}
|
|
15
|
+
/** @alpha */
|
|
16
|
+
export interface UseFactoryRegistryArgs extends AirdropHookOptions<FactoryRegistryPage> {
|
|
17
|
+
/** Zero-based index to start the page at. Defaults to `0n`. */
|
|
18
|
+
offset?: bigint;
|
|
19
|
+
/** Page size. Defaults to `50n`. */
|
|
20
|
+
limit?: bigint;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Page through every instance the factory has deployed, plus the total
|
|
24
|
+
* count — the two reads a "list my campaigns" admin view needs together.
|
|
25
|
+
*
|
|
26
|
+
* The contract clamps to the tail rather than reverting on an out-of-range
|
|
27
|
+
* `offset`, so `items` may come back shorter than `limit` — page until it
|
|
28
|
+
* does, not until a read throws.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const { data } = useFactoryRegistry({ offset: 0n, limit: 20n });
|
|
32
|
+
*
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare function useFactoryRegistry(args?: UseFactoryRegistryArgs): UseQueryResult<FactoryRegistryPage, Error>;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { FundInput } from "../factory.js";
|
|
5
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
6
|
+
/**
|
|
7
|
+
* Top up an already-deployed instance's pool through the factory.
|
|
8
|
+
*
|
|
9
|
+
* Takes exactly one of `amount` (plaintext — the SDK encrypts it against the
|
|
10
|
+
* hook-level `encryptor`, or a per-call `encryptor` override) or
|
|
11
|
+
* `encryptedInput` (already built ciphertext) — see {@link FundInput}. The
|
|
12
|
+
* lazy `encryptor` on the hook config (CLAUDE.md Pitfall #3) is threaded
|
|
13
|
+
* through to the underlying `ConfidentialAirdropFactoryClient`, which itself
|
|
14
|
+
* falls back from a per-call override to this hook-level default and throws
|
|
15
|
+
* `MissingEncryptorError` only if neither resolves — no encryptor
|
|
16
|
+
* indirection needs duplicating here.
|
|
17
|
+
*
|
|
18
|
+
* **Invalidates:** nothing. No read hook in this subpath's list exposes the
|
|
19
|
+
* confidential pool balance (`adminGetCurrentBalance` is disclosure-gated
|
|
20
|
+
* and intentionally not wrapped here), so there is no cached query this
|
|
21
|
+
* write could leave stale.
|
|
22
|
+
*
|
|
23
|
+
* **Never log `amount`.** It is the one plaintext confidential value this
|
|
24
|
+
* hook ever sees — do not pass it to telemetry, `onError` context, or a
|
|
25
|
+
* console statement.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const fund = useFundAirdrop({ encryptor: () => sdk.relayer });
|
|
29
|
+
* await fund.mutateAsync({ airdrop: airdropAddress, amount: 1_000_000n });
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export declare function useFundAirdrop(options?: AirdropClientOptions): UseMutationResult<Hex, Error, {
|
|
34
|
+
airdrop: Address;
|
|
35
|
+
} & FundInput & WriteAccountOverride>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import { type InstanceRoleAssignment, type RoleGrantOutcome } from "../roles.js";
|
|
3
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface GrantInstanceRolesArgs {
|
|
6
|
+
assignment: InstanceRoleAssignment;
|
|
7
|
+
/** Defaults to `true` — the creator's own `DEFAULT_ADMIN_ROLE` is revoked once the new admin is granted. */
|
|
8
|
+
revokeFromCreator?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Split an airdrop instance's roles after create — one `grantRole` /
|
|
12
|
+
* `revokeRole` transaction per requested assignment, submitted in the order
|
|
13
|
+
* `planInstanceRoleSplit` computes.
|
|
14
|
+
*
|
|
15
|
+
* **Returns `RoleGrantOutcome[]` unchanged — do not collapse it.** Each step
|
|
16
|
+
* is its own transaction and can independently fail; flattening the array
|
|
17
|
+
* into a single success/failure bit destroys exactly the partial-failure
|
|
18
|
+
* legibility `grantInstanceRoles` was designed to preserve (see `roles.ts`).
|
|
19
|
+
* Inspect `outcomes.filter(o => o.error)` for what didn't land.
|
|
20
|
+
*
|
|
21
|
+
* **Invalidates:** every `useAirdropHasRole` entry for this instance
|
|
22
|
+
* (regardless of which role/holder pair), since a role split can touch
|
|
23
|
+
* several roles across several accounts in one call and the SDK does not
|
|
24
|
+
* duplicate the on-chain role-constant lookup client-side to invalidate more
|
|
25
|
+
* narrowly. Scoped to this instance only — other campaigns' role caches are
|
|
26
|
+
* untouched.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const grant = useGrantInstanceRoles({ address: airdropAddress });
|
|
30
|
+
* const outcomes = await grant.mutateAsync({ assignment: { pauser, treasury } });
|
|
31
|
+
* const failed = outcomes.filter((o) => o.error);
|
|
32
|
+
*
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare function useGrantInstanceRoles(options: AirdropInstanceClientOptions): UseMutationResult<RoleGrantOutcome[], Error, GrantInstanceRolesArgs>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface UseIsActiveDelegateArgs extends AirdropInstanceHookOptions<boolean> {
|
|
6
|
+
/** The address to check. Stays disabled until it is defined. */
|
|
7
|
+
delegate?: Address;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Whether `delegate` currently holds user-decryption delegation over this
|
|
11
|
+
* compliance-manager clone's airdrop. `address` is the CLONE.
|
|
12
|
+
*
|
|
13
|
+
* Authoritative: it reads the ACL expiration directly rather than the
|
|
14
|
+
* contract's `EnumerableSet` mirror, so unlike
|
|
15
|
+
* {@link useComplianceInfo}'s `clientDelegates` it also answers `true` for
|
|
16
|
+
* the irrevocable platform compliance delegate.
|
|
17
|
+
*
|
|
18
|
+
* **On-chain truth only.** A `true` here does not mean the Zama gateway will
|
|
19
|
+
* serve a delegated decrypt yet - it observes ACL changes out of band, with a
|
|
20
|
+
* lag the SDK's own guidance puts at 1-2 minutes. A UI that renders
|
|
21
|
+
* "delegated" off this value must still treat `isAclPropagationError` as a
|
|
22
|
+
* retry-with-backoff signal rather than a failure.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const { data: canDecrypt } = useIsActiveDelegate({ address: managerAddress, delegate: officer });
|
|
26
|
+
*
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
29
|
+
export declare function useIsActiveDelegate(args: UseIsActiveDelegateArgs): UseQueryResult<boolean, Error>;
|