@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
|
@@ -1,59 +1,599 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../../../chunk-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import '../../../chunk-
|
|
6
|
-
import '../../../chunk-
|
|
7
|
-
import '../../../chunk-
|
|
8
|
-
import
|
|
9
|
-
import '../../../chunk-
|
|
10
|
-
import '../../../chunk-
|
|
1
|
+
import { useMemoAirdropFactoryClient, airdropQueryKey, airdropKeys, airdropQueryKeyPrefix } from '../../../chunk-EYDA6Q6C.js';
|
|
2
|
+
import '../../../chunk-X7WBPCEU.js';
|
|
3
|
+
import '../../../chunk-VW356KR3.js';
|
|
4
|
+
import '../../../chunk-ZWXJTBZO.js';
|
|
5
|
+
import '../../../chunk-NWFMBLSQ.js';
|
|
6
|
+
import '../../../chunk-4RAAATVY.js';
|
|
7
|
+
import '../../../chunk-A4DCEE33.js';
|
|
8
|
+
import '../../../chunk-ZA673I3O.js';
|
|
9
|
+
import '../../../chunk-KWFFIJYX.js';
|
|
10
|
+
import { MissingClientError } from '../../../chunk-QBJ7O2B4.js';
|
|
11
11
|
import '../../../chunk-Q2GP5UDC.js';
|
|
12
|
-
import {
|
|
13
|
-
import { useQuery } from '@tanstack/react-query';
|
|
14
|
-
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
12
|
+
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
15
13
|
|
|
16
|
-
function
|
|
17
|
-
const { params,
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
function usePredictEcdsaAirdropAddress(args) {
|
|
15
|
+
const { params, mode, deployer, userSalt, ...base } = args;
|
|
16
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
17
|
+
return useQuery({
|
|
18
|
+
...args.query,
|
|
19
|
+
queryKey: airdropQueryKey({
|
|
20
|
+
chainId,
|
|
21
|
+
address: resolvedAddress,
|
|
22
|
+
fn: "predictEcdsaAirdropAddress",
|
|
23
|
+
args: [mode, deployer, userSalt]
|
|
24
|
+
}),
|
|
25
|
+
queryFn: () => client.predictEcdsaAirdropAddress({ params, mode, deployer, userSalt }),
|
|
26
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function usePredictMerkleAirdropAddress(args) {
|
|
30
|
+
const { params, mode, deployer, userSalt, ...base } = args;
|
|
31
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
32
|
+
return useQuery({
|
|
33
|
+
...args.query,
|
|
34
|
+
queryKey: airdropQueryKey({
|
|
35
|
+
chainId,
|
|
36
|
+
address: resolvedAddress,
|
|
37
|
+
fn: "predictMerkleAirdropAddress",
|
|
38
|
+
args: [mode, deployer, userSalt]
|
|
39
|
+
}),
|
|
40
|
+
queryFn: () => client.predictMerkleAirdropAddress({ params, mode, deployer, userSalt }),
|
|
41
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function useClearCompliancePolicy(options = {}) {
|
|
45
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
46
|
+
const queryClient = useQueryClient();
|
|
47
|
+
return useMutation({
|
|
48
|
+
mutationFn: async (args) => {
|
|
49
|
+
if (!client) {
|
|
50
|
+
throw resolutionError ?? new MissingClientError("useClearCompliancePolicy", "factory");
|
|
51
|
+
}
|
|
52
|
+
return client.clearCompliancePolicy(args.creator, args.account);
|
|
53
|
+
},
|
|
54
|
+
onSuccess: (_hash, variables) => {
|
|
55
|
+
const scope = { chainId, address: resolvedAddress };
|
|
56
|
+
void queryClient.invalidateQueries({
|
|
57
|
+
queryKey: airdropKeys.compliancePolicy(scope, variables.creator)
|
|
58
|
+
});
|
|
59
|
+
void queryClient.invalidateQueries({
|
|
60
|
+
queryKey: airdropQueryKey({
|
|
61
|
+
...scope,
|
|
62
|
+
fn: "effectiveDelegateToCompliance",
|
|
63
|
+
args: [variables.creator]
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function useClearUpgradeabilityPolicy(options = {}) {
|
|
70
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
71
|
+
const queryClient = useQueryClient();
|
|
72
|
+
return useMutation({
|
|
73
|
+
mutationFn: async (args) => {
|
|
74
|
+
if (!client) {
|
|
75
|
+
throw resolutionError ?? new MissingClientError("useClearUpgradeabilityPolicy", "factory");
|
|
76
|
+
}
|
|
77
|
+
return client.clearUpgradeabilityPolicy(args.creator, args.account);
|
|
78
|
+
},
|
|
79
|
+
onSuccess: (_hash, variables) => {
|
|
80
|
+
const scope = { chainId, address: resolvedAddress };
|
|
81
|
+
void queryClient.invalidateQueries({
|
|
82
|
+
queryKey: airdropQueryKey({
|
|
83
|
+
...scope,
|
|
84
|
+
fn: "effectiveUpgradeable",
|
|
85
|
+
args: [variables.creator]
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
void queryClient.invalidateQueries({
|
|
89
|
+
queryKey: airdropKeys.upgradeabilityPolicy(scope, variables.creator)
|
|
90
|
+
});
|
|
91
|
+
void queryClient.invalidateQueries({
|
|
92
|
+
queryKey: airdropKeys.preflightCreateAll(scope)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function useDisableCustomFee(options = {}) {
|
|
98
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
99
|
+
const queryClient = useQueryClient();
|
|
100
|
+
return useMutation({
|
|
101
|
+
mutationFn: async ({ creator, account }) => {
|
|
102
|
+
if (!client) {
|
|
103
|
+
throw resolutionError ?? new MissingClientError("useDisableCustomFee", "factory");
|
|
104
|
+
}
|
|
105
|
+
return client.disableCustomFee(creator, account);
|
|
106
|
+
},
|
|
107
|
+
onSuccess: (_hash, variables) => {
|
|
108
|
+
void queryClient.invalidateQueries({
|
|
109
|
+
queryKey: airdropKeys.customFee({ chainId, address: resolvedAddress }, variables.creator)
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function useEcdsaInitCodeHash(args) {
|
|
115
|
+
const { params, mode, ...base } = args;
|
|
116
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
117
|
+
return useQuery({
|
|
118
|
+
...args.query,
|
|
119
|
+
// `params` is omitted for the same reason the predict hooks omit it: the
|
|
120
|
+
// ABI demands it but the factory ignores it, so only `mode` (plus the
|
|
121
|
+
// implementation pointer, which is what this read reports) moves the
|
|
122
|
+
// result. If a future factory version makes params hash-affecting, this
|
|
123
|
+
// key has to grow with it.
|
|
124
|
+
queryKey: airdropQueryKey({
|
|
125
|
+
chainId,
|
|
126
|
+
address: resolvedAddress,
|
|
127
|
+
fn: "getEcdsaInitCodeHash",
|
|
128
|
+
args: [mode]
|
|
129
|
+
}),
|
|
130
|
+
queryFn: () => client.getEcdsaInitCodeHash({ params, mode }),
|
|
131
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function useFactoryComplianceDelegate(args = {}) {
|
|
135
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
|
|
136
|
+
return useQuery({
|
|
137
|
+
...args.query,
|
|
138
|
+
queryKey: airdropQueryKey({
|
|
139
|
+
chainId,
|
|
140
|
+
address: resolvedAddress,
|
|
141
|
+
fn: "complianceDelegate",
|
|
142
|
+
args: []
|
|
143
|
+
}),
|
|
144
|
+
queryFn: () => client.complianceDelegate(),
|
|
145
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function useFactoryCompliancePolicy(args = {}) {
|
|
149
|
+
const { creator, ...base } = args;
|
|
150
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
151
|
+
return useQuery({
|
|
152
|
+
...args.query,
|
|
153
|
+
queryKey: airdropKeys.compliancePolicy({ chainId, address: resolvedAddress }, creator),
|
|
154
|
+
queryFn: async () => {
|
|
155
|
+
const [policy, effective] = await Promise.all([
|
|
156
|
+
client.getCompliancePolicy(creator),
|
|
157
|
+
client.effectiveDelegateToCompliance(creator)
|
|
158
|
+
]);
|
|
159
|
+
return {
|
|
160
|
+
overridden: policy.overridden,
|
|
161
|
+
delegateToCompliance: policy.delegateToCompliance,
|
|
162
|
+
effective
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
enabled: Boolean(client && creator && (args.query?.enabled ?? true))
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function useFactoryCustomFee(args = {}) {
|
|
169
|
+
const { creator, ...base } = args;
|
|
170
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
171
|
+
return useQuery({
|
|
172
|
+
...args.query,
|
|
173
|
+
queryKey: airdropKeys.customFee({ chainId, address: resolvedAddress }, creator),
|
|
174
|
+
queryFn: () => client.getCustomFee(creator),
|
|
175
|
+
enabled: Boolean(client && creator && (args.query?.enabled ?? true))
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function useFactoryGrantRole(options = {}) {
|
|
179
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
180
|
+
const queryClient = useQueryClient();
|
|
181
|
+
return useMutation({
|
|
182
|
+
mutationFn: async (args) => {
|
|
183
|
+
if (!client) {
|
|
184
|
+
throw resolutionError ?? new MissingClientError("useFactoryGrantRole", "factory");
|
|
185
|
+
}
|
|
186
|
+
return client.grantRole(args);
|
|
187
|
+
},
|
|
188
|
+
onSuccess: (_hash, variables) => {
|
|
189
|
+
const scope = { chainId, address: resolvedAddress };
|
|
190
|
+
void queryClient.invalidateQueries({
|
|
191
|
+
queryKey: airdropKeys.factoryHasRole(scope, variables.role, variables.holder)
|
|
192
|
+
});
|
|
193
|
+
void queryClient.invalidateQueries({
|
|
194
|
+
queryKey: airdropKeys.factoryRoleMembers(scope, variables.role)
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function useFactoryHasRole(args = {}) {
|
|
200
|
+
const { role, holder, ...base } = args;
|
|
201
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
202
|
+
return useQuery({
|
|
203
|
+
...args.query,
|
|
204
|
+
queryKey: airdropKeys.factoryHasRole({ chainId, address: resolvedAddress }, role, holder),
|
|
205
|
+
queryFn: () => client.hasRole({ role, holder }),
|
|
206
|
+
enabled: Boolean(client && role && holder && (args.query?.enabled ?? true))
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function useFactoryImplementations(args = {}) {
|
|
210
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
|
|
211
|
+
return useQuery({
|
|
212
|
+
...args.query,
|
|
213
|
+
queryKey: airdropKeys.implementations({ chainId, address: resolvedAddress }),
|
|
214
|
+
queryFn: async () => {
|
|
215
|
+
const [ecdsa, merkle, complianceManager] = await Promise.all([
|
|
216
|
+
client.ecdsaImplementation(),
|
|
217
|
+
client.merkleImplementation(),
|
|
218
|
+
client.complianceManagerImpl()
|
|
219
|
+
]);
|
|
220
|
+
return { ecdsa, merkle, complianceManager };
|
|
221
|
+
},
|
|
222
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function useFactoryRenounceRole(options = {}) {
|
|
226
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
227
|
+
const queryClient = useQueryClient();
|
|
228
|
+
return useMutation({
|
|
229
|
+
mutationFn: async (args) => {
|
|
230
|
+
if (!client) {
|
|
231
|
+
throw resolutionError ?? new MissingClientError("useFactoryRenounceRole", "factory");
|
|
232
|
+
}
|
|
233
|
+
return client.renounceRole(args);
|
|
234
|
+
},
|
|
235
|
+
onSuccess: (_hash, variables) => {
|
|
236
|
+
const scope = { chainId, address: resolvedAddress };
|
|
237
|
+
void queryClient.invalidateQueries({ queryKey: airdropKeys.factoryHasRoleAll(scope) });
|
|
238
|
+
void queryClient.invalidateQueries({
|
|
239
|
+
queryKey: airdropKeys.factoryRoleMembers(scope, variables.role)
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function useFactoryRevokeRole(options = {}) {
|
|
245
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
246
|
+
const queryClient = useQueryClient();
|
|
247
|
+
return useMutation({
|
|
248
|
+
mutationFn: async (args) => {
|
|
249
|
+
if (!client) {
|
|
250
|
+
throw resolutionError ?? new MissingClientError("useFactoryRevokeRole", "factory");
|
|
251
|
+
}
|
|
252
|
+
return client.revokeRole(args);
|
|
253
|
+
},
|
|
254
|
+
onSuccess: (_hash, variables) => {
|
|
255
|
+
const scope = { chainId, address: resolvedAddress };
|
|
256
|
+
void queryClient.invalidateQueries({
|
|
257
|
+
queryKey: airdropKeys.factoryHasRole(scope, variables.role, variables.holder)
|
|
258
|
+
});
|
|
259
|
+
void queryClient.invalidateQueries({
|
|
260
|
+
queryKey: airdropKeys.factoryRoleMembers(scope, variables.role)
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function useFactoryRoleConstants(args = {}) {
|
|
266
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
|
|
267
|
+
return useQuery({
|
|
268
|
+
// A default, not a lock: `query.staleTime` still wins if a consumer wants refetching.
|
|
269
|
+
staleTime: Infinity,
|
|
270
|
+
...args.query,
|
|
271
|
+
// `fn` label is unique to this hook, so it stays inline rather than in keys.ts.
|
|
272
|
+
queryKey: airdropQueryKey({
|
|
273
|
+
chainId,
|
|
274
|
+
address: resolvedAddress,
|
|
275
|
+
fn: "factoryRoleConstants",
|
|
276
|
+
args: []
|
|
277
|
+
}),
|
|
278
|
+
queryFn: async () => {
|
|
279
|
+
const [
|
|
280
|
+
FEE_MANAGER_ROLE,
|
|
281
|
+
IMPL_MANAGER_ROLE,
|
|
282
|
+
COMPLIANCE_WIRING_ROLE,
|
|
283
|
+
UPGRADE_MANAGER_ROLE,
|
|
284
|
+
DEFAULT_ADMIN_ROLE
|
|
285
|
+
] = await Promise.all([
|
|
286
|
+
client.FEE_MANAGER_ROLE(),
|
|
287
|
+
client.IMPL_MANAGER_ROLE(),
|
|
288
|
+
client.COMPLIANCE_WIRING_ROLE(),
|
|
289
|
+
client.UPGRADE_MANAGER_ROLE(),
|
|
290
|
+
client.DEFAULT_ADMIN_ROLE()
|
|
291
|
+
]);
|
|
292
|
+
return {
|
|
293
|
+
FEE_MANAGER_ROLE,
|
|
294
|
+
IMPL_MANAGER_ROLE,
|
|
295
|
+
COMPLIANCE_WIRING_ROLE,
|
|
296
|
+
UPGRADE_MANAGER_ROLE,
|
|
297
|
+
DEFAULT_ADMIN_ROLE
|
|
298
|
+
};
|
|
299
|
+
},
|
|
300
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function useFactoryRoleMembers(args = {}) {
|
|
304
|
+
const { role, ...base } = args;
|
|
305
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
306
|
+
return useQuery({
|
|
307
|
+
...args.query,
|
|
308
|
+
queryKey: airdropKeys.factoryRoleMembers({ chainId, address: resolvedAddress }, role),
|
|
309
|
+
queryFn: async () => {
|
|
310
|
+
const [members, count] = await Promise.all([
|
|
311
|
+
client.getRoleMembers(role),
|
|
312
|
+
client.getRoleMemberCount(role)
|
|
313
|
+
]);
|
|
314
|
+
return { members, count };
|
|
315
|
+
},
|
|
316
|
+
enabled: Boolean(client && role && (args.query?.enabled ?? true))
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function useFactoryUpgradeabilityPolicy(args = {}) {
|
|
320
|
+
const { creator, ...base } = args;
|
|
321
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
322
|
+
return useQuery({
|
|
323
|
+
...args.query,
|
|
324
|
+
queryKey: airdropKeys.upgradeabilityPolicy({ chainId, address: resolvedAddress }, creator),
|
|
325
|
+
queryFn: async () => {
|
|
326
|
+
const [defaultUpgradeable, policy, effective] = await Promise.all([
|
|
327
|
+
client.defaultUpgradeable(),
|
|
328
|
+
client.getUpgradeabilityPolicy(creator),
|
|
329
|
+
client.effectiveUpgradeable(creator)
|
|
330
|
+
]);
|
|
331
|
+
return {
|
|
332
|
+
defaultUpgradeable,
|
|
333
|
+
overridden: policy.overridden,
|
|
334
|
+
allowed: policy.allowed,
|
|
335
|
+
effective
|
|
336
|
+
};
|
|
337
|
+
},
|
|
338
|
+
enabled: Boolean(client && creator && (args.query?.enabled ?? true))
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function useMerkleInitCodeHash(args) {
|
|
342
|
+
const { params, mode, ...base } = args;
|
|
343
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
344
|
+
return useQuery({
|
|
345
|
+
...args.query,
|
|
346
|
+
// `params` omitted deliberately — see useEcdsaInitCodeHash for why.
|
|
347
|
+
queryKey: airdropQueryKey({
|
|
348
|
+
chainId,
|
|
33
349
|
address: resolvedAddress,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
}, [resolvedPublicClient, walletClient, resolvedAddress, resolvedChainId]);
|
|
38
|
-
return useQuery({
|
|
39
|
-
queryKey: buildQueryKey(
|
|
40
|
-
"factory:predictAirdropAddress",
|
|
41
|
-
resolvedChainId,
|
|
42
|
-
resolvedAddress,
|
|
43
|
-
params,
|
|
44
|
-
userSalt,
|
|
45
|
-
deployer,
|
|
46
|
-
gasFee
|
|
47
|
-
),
|
|
48
|
-
queryFn: () => client.predictAirdropAddress({
|
|
49
|
-
params,
|
|
50
|
-
userSalt,
|
|
51
|
-
deployer,
|
|
52
|
-
gasFee
|
|
350
|
+
fn: "getMerkleInitCodeHash",
|
|
351
|
+
args: [mode]
|
|
53
352
|
}),
|
|
54
|
-
|
|
55
|
-
|
|
353
|
+
queryFn: () => client.getMerkleInitCodeHash({ params, mode }),
|
|
354
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function useSetComplianceDelegate(options = {}) {
|
|
358
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
359
|
+
const queryClient = useQueryClient();
|
|
360
|
+
return useMutation({
|
|
361
|
+
mutationFn: async (args) => {
|
|
362
|
+
if (!client) {
|
|
363
|
+
throw resolutionError ?? new MissingClientError("useSetComplianceDelegate", "factory");
|
|
364
|
+
}
|
|
365
|
+
return client.setComplianceDelegate(args.delegate, args.account);
|
|
366
|
+
},
|
|
367
|
+
onSuccess: () => {
|
|
368
|
+
void queryClient.invalidateQueries({
|
|
369
|
+
queryKey: airdropQueryKey({
|
|
370
|
+
chainId,
|
|
371
|
+
address: resolvedAddress,
|
|
372
|
+
fn: "complianceDelegate",
|
|
373
|
+
args: []
|
|
374
|
+
})
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function useSetComplianceManagerImpl(options = {}) {
|
|
380
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
381
|
+
const queryClient = useQueryClient();
|
|
382
|
+
return useMutation({
|
|
383
|
+
mutationFn: async (args) => {
|
|
384
|
+
if (!client) {
|
|
385
|
+
throw resolutionError ?? new MissingClientError("useSetComplianceManagerImpl", "factory");
|
|
386
|
+
}
|
|
387
|
+
return client.setComplianceManagerImpl(args.implementation, args.account);
|
|
388
|
+
},
|
|
389
|
+
onSuccess: () => {
|
|
390
|
+
void queryClient.invalidateQueries({
|
|
391
|
+
queryKey: airdropKeys.implementations({ chainId, address: resolvedAddress })
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
function useSetCompliancePolicy(options = {}) {
|
|
397
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
398
|
+
const queryClient = useQueryClient();
|
|
399
|
+
return useMutation({
|
|
400
|
+
mutationFn: async (args) => {
|
|
401
|
+
if (!client) {
|
|
402
|
+
throw resolutionError ?? new MissingClientError("useSetCompliancePolicy", "factory");
|
|
403
|
+
}
|
|
404
|
+
return client.setCompliancePolicy(args.creator, args.delegateToCompliance, args.account);
|
|
405
|
+
},
|
|
406
|
+
onSuccess: (_hash, variables) => {
|
|
407
|
+
const scope = { chainId, address: resolvedAddress };
|
|
408
|
+
void queryClient.invalidateQueries({
|
|
409
|
+
queryKey: airdropKeys.compliancePolicy(scope, variables.creator)
|
|
410
|
+
});
|
|
411
|
+
void queryClient.invalidateQueries({
|
|
412
|
+
queryKey: airdropQueryKey({
|
|
413
|
+
...scope,
|
|
414
|
+
fn: "effectiveDelegateToCompliance",
|
|
415
|
+
args: [variables.creator]
|
|
416
|
+
})
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function useSetCustomFee(options = {}) {
|
|
422
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
423
|
+
const queryClient = useQueryClient();
|
|
424
|
+
return useMutation({
|
|
425
|
+
mutationFn: async ({ creator, gasFee, account }) => {
|
|
426
|
+
if (!client) {
|
|
427
|
+
throw resolutionError ?? new MissingClientError("useSetCustomFee", "factory");
|
|
428
|
+
}
|
|
429
|
+
return client.setCustomFee(creator, gasFee, account);
|
|
430
|
+
},
|
|
431
|
+
onSuccess: (_hash, variables) => {
|
|
432
|
+
void queryClient.invalidateQueries({
|
|
433
|
+
queryKey: airdropKeys.customFee({ chainId, address: resolvedAddress }, variables.creator)
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
function useSetDefaultDelegateToCompliance(options = {}) {
|
|
439
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
440
|
+
const queryClient = useQueryClient();
|
|
441
|
+
return useMutation({
|
|
442
|
+
mutationFn: async (args) => {
|
|
443
|
+
if (!client) {
|
|
444
|
+
throw resolutionError ?? new MissingClientError("useSetDefaultDelegateToCompliance", "factory");
|
|
445
|
+
}
|
|
446
|
+
return client.setDefaultDelegateToCompliance(args.on, args.account);
|
|
447
|
+
},
|
|
448
|
+
onSuccess: () => {
|
|
449
|
+
void queryClient.invalidateQueries({
|
|
450
|
+
queryKey: airdropQueryKeyPrefix({
|
|
451
|
+
chainId,
|
|
452
|
+
address: resolvedAddress,
|
|
453
|
+
fn: "effectiveDelegateToCompliance"
|
|
454
|
+
})
|
|
455
|
+
});
|
|
456
|
+
void queryClient.invalidateQueries({
|
|
457
|
+
queryKey: airdropKeys.compliancePolicyAll({ chainId, address: resolvedAddress })
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
function useSetDefaultGasFee(options = {}) {
|
|
463
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
464
|
+
const queryClient = useQueryClient();
|
|
465
|
+
return useMutation({
|
|
466
|
+
mutationFn: async ({ gasFee, account }) => {
|
|
467
|
+
if (!client) {
|
|
468
|
+
throw resolutionError ?? new MissingClientError("useSetDefaultGasFee", "factory");
|
|
469
|
+
}
|
|
470
|
+
return client.setDefaultGasFee(gasFee, account);
|
|
471
|
+
},
|
|
472
|
+
onSuccess: () => {
|
|
473
|
+
void queryClient.invalidateQueries({
|
|
474
|
+
queryKey: airdropKeys.fees({ chainId, address: resolvedAddress })
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function useSetDefaultUpgradeable(options = {}) {
|
|
480
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
481
|
+
const queryClient = useQueryClient();
|
|
482
|
+
return useMutation({
|
|
483
|
+
mutationFn: async (args) => {
|
|
484
|
+
if (!client) {
|
|
485
|
+
throw resolutionError ?? new MissingClientError("useSetDefaultUpgradeable", "factory");
|
|
486
|
+
}
|
|
487
|
+
return client.setDefaultUpgradeable(args.allowed, args.account);
|
|
488
|
+
},
|
|
489
|
+
onSuccess: () => {
|
|
490
|
+
const scope = { chainId, address: resolvedAddress };
|
|
491
|
+
void queryClient.invalidateQueries({
|
|
492
|
+
queryKey: airdropQueryKeyPrefix({ ...scope, fn: "effectiveUpgradeable" })
|
|
493
|
+
});
|
|
494
|
+
void queryClient.invalidateQueries({
|
|
495
|
+
queryKey: airdropKeys.upgradeabilityPolicyAll(scope)
|
|
496
|
+
});
|
|
497
|
+
void queryClient.invalidateQueries({
|
|
498
|
+
queryKey: airdropKeys.preflightCreateAll(scope)
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
function useSetEcdsaImplementation(options = {}) {
|
|
504
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
505
|
+
const queryClient = useQueryClient();
|
|
506
|
+
return useMutation({
|
|
507
|
+
mutationFn: async ({ implementation, account }) => {
|
|
508
|
+
if (!client) {
|
|
509
|
+
throw resolutionError ?? new MissingClientError("useSetEcdsaImplementation", "factory");
|
|
510
|
+
}
|
|
511
|
+
return client.setEcdsaImplementation(implementation, account);
|
|
512
|
+
},
|
|
513
|
+
onSuccess: () => {
|
|
514
|
+
const scope = { chainId, address: resolvedAddress };
|
|
515
|
+
void queryClient.invalidateQueries({ queryKey: airdropKeys.implementations(scope) });
|
|
516
|
+
void queryClient.invalidateQueries({
|
|
517
|
+
queryKey: airdropQueryKeyPrefix({ ...scope, fn: "getEcdsaInitCodeHash" })
|
|
518
|
+
});
|
|
519
|
+
void queryClient.invalidateQueries({
|
|
520
|
+
queryKey: airdropQueryKeyPrefix({ ...scope, fn: "predictEcdsaAirdropAddress" })
|
|
521
|
+
});
|
|
522
|
+
void queryClient.invalidateQueries({
|
|
523
|
+
queryKey: airdropKeys.preflightCreateAll(scope)
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
function useSetFeeCollector(options = {}) {
|
|
529
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
530
|
+
const queryClient = useQueryClient();
|
|
531
|
+
return useMutation({
|
|
532
|
+
mutationFn: async ({ feeCollector, account }) => {
|
|
533
|
+
if (!client) {
|
|
534
|
+
throw resolutionError ?? new MissingClientError("useSetFeeCollector", "factory");
|
|
535
|
+
}
|
|
536
|
+
return client.setFeeCollector(feeCollector, account);
|
|
537
|
+
},
|
|
538
|
+
onSuccess: () => {
|
|
539
|
+
void queryClient.invalidateQueries({
|
|
540
|
+
queryKey: airdropKeys.fees({ chainId, address: resolvedAddress })
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
function useSetMerkleImplementation(options = {}) {
|
|
546
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
547
|
+
const queryClient = useQueryClient();
|
|
548
|
+
return useMutation({
|
|
549
|
+
mutationFn: async ({ implementation, account }) => {
|
|
550
|
+
if (!client) {
|
|
551
|
+
throw resolutionError ?? new MissingClientError("useSetMerkleImplementation", "factory");
|
|
552
|
+
}
|
|
553
|
+
return client.setMerkleImplementation(implementation, account);
|
|
554
|
+
},
|
|
555
|
+
onSuccess: () => {
|
|
556
|
+
const scope = { chainId, address: resolvedAddress };
|
|
557
|
+
void queryClient.invalidateQueries({ queryKey: airdropKeys.implementations(scope) });
|
|
558
|
+
void queryClient.invalidateQueries({
|
|
559
|
+
queryKey: airdropQueryKeyPrefix({ ...scope, fn: "getMerkleInitCodeHash" })
|
|
560
|
+
});
|
|
561
|
+
void queryClient.invalidateQueries({
|
|
562
|
+
queryKey: airdropQueryKeyPrefix({ ...scope, fn: "predictMerkleAirdropAddress" })
|
|
563
|
+
});
|
|
564
|
+
void queryClient.invalidateQueries({
|
|
565
|
+
queryKey: airdropKeys.preflightCreateAll(scope)
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
function useSetUpgradeabilityPolicy(options = {}) {
|
|
571
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
572
|
+
const queryClient = useQueryClient();
|
|
573
|
+
return useMutation({
|
|
574
|
+
mutationFn: async (args) => {
|
|
575
|
+
if (!client) {
|
|
576
|
+
throw resolutionError ?? new MissingClientError("useSetUpgradeabilityPolicy", "factory");
|
|
577
|
+
}
|
|
578
|
+
return client.setUpgradeabilityPolicy(args.creator, args.allowed, args.account);
|
|
579
|
+
},
|
|
580
|
+
onSuccess: (_hash, variables) => {
|
|
581
|
+
const scope = { chainId, address: resolvedAddress };
|
|
582
|
+
void queryClient.invalidateQueries({
|
|
583
|
+
queryKey: airdropQueryKey({
|
|
584
|
+
...scope,
|
|
585
|
+
fn: "effectiveUpgradeable",
|
|
586
|
+
args: [variables.creator]
|
|
587
|
+
})
|
|
588
|
+
});
|
|
589
|
+
void queryClient.invalidateQueries({
|
|
590
|
+
queryKey: airdropKeys.upgradeabilityPolicy(scope, variables.creator)
|
|
591
|
+
});
|
|
592
|
+
void queryClient.invalidateQueries({
|
|
593
|
+
queryKey: airdropKeys.preflightCreateAll(scope)
|
|
594
|
+
});
|
|
595
|
+
}
|
|
56
596
|
});
|
|
57
597
|
}
|
|
58
598
|
|
|
59
|
-
export {
|
|
599
|
+
export { useClearCompliancePolicy, useClearUpgradeabilityPolicy, useDisableCustomFee, useEcdsaInitCodeHash, useFactoryComplianceDelegate, useFactoryCompliancePolicy, useFactoryCustomFee, useFactoryGrantRole, useFactoryHasRole, useFactoryImplementations, useFactoryRenounceRole, useFactoryRevokeRole, useFactoryRoleConstants, useFactoryRoleMembers, useFactoryUpgradeabilityPolicy, useMerkleInitCodeHash, usePredictEcdsaAirdropAddress, usePredictMerkleAirdropAddress, useSetComplianceDelegate, useSetComplianceManagerImpl, useSetCompliancePolicy, useSetCustomFee, useSetDefaultDelegateToCompliance, useSetDefaultGasFee, useSetDefaultUpgradeable, useSetEcdsaImplementation, useSetFeeCollector, useSetMerkleImplementation, useSetUpgradeabilityPolicy };
|
|
@@ -0,0 +1,28 @@
|
|
|
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 AirdropClientOptions } from "../../react/_shared.js";
|
|
5
|
+
/** @alpha */
|
|
6
|
+
export interface ClearCompliancePolicyArgs extends WriteAccountOverride {
|
|
7
|
+
/** The creator whose override is dropped - not the admin sending the transaction. */
|
|
8
|
+
creator: Address;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Drop a creator's {@link useSetCompliancePolicy} override, reverting them to
|
|
12
|
+
* the factory default. Requires `COMPLIANCE_WIRING_ROLE`.
|
|
13
|
+
*
|
|
14
|
+
* The cleared state is `overridden: false, delegateToCompliance: false`, so
|
|
15
|
+
* `effectiveDelegateToCompliance` then follows the factory default set by
|
|
16
|
+
* {@link useSetDefaultDelegateToCompliance} rather than staying at whatever
|
|
17
|
+
* the override had been.
|
|
18
|
+
*
|
|
19
|
+
* **Invalidates:** `fn "compliancePolicy"` and
|
|
20
|
+
* `fn "effectiveDelegateToCompliance"`, both keyed on `args.creator`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const clearPolicy = useClearCompliancePolicy();
|
|
24
|
+
* await clearPolicy.mutateAsync({ creator });
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare function useClearCompliancePolicy(options?: AirdropClientOptions): UseMutationResult<Hex, Error, ClearCompliancePolicyArgs>;
|