@tokenops/sdk 2.0.0-alpha.1 → 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.
Files changed (145) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +5 -5
  3. package/dist/{chunk-JZLGCTGK.cjs → chunk-3YHBO2DL.cjs} +2 -2
  4. package/dist/{chunk-H5POPGOZ.js → chunk-44YJPMQC.js} +1 -1
  5. package/dist/{chunk-DZHYSUGY.js → chunk-A4DCEE33.js} +11 -5
  6. package/dist/{chunk-M4IT6DNJ.cjs → chunk-AREQJHKA.cjs} +108 -3
  7. package/dist/chunk-EBLBPUPI.cjs +255 -0
  8. package/dist/chunk-EYDA6Q6C.js +245 -0
  9. package/dist/{chunk-XAYGD4E4.cjs → chunk-FEDX7B6T.cjs} +3 -3
  10. package/dist/{chunk-JQYC66TO.cjs → chunk-FHWSBGWE.cjs} +5 -5
  11. package/dist/{chunk-5576FRT3.cjs → chunk-FT5H2Q7Y.cjs} +11 -5
  12. package/dist/{chunk-456VDDA3.js → chunk-GADGBQJO.js} +78 -25
  13. package/dist/{chunk-6NAVMWZQ.js → chunk-IGO5XSPS.js} +2 -2
  14. package/dist/{chunk-CTED3MTR.cjs → chunk-IUKKNJ2R.cjs} +82 -29
  15. package/dist/{chunk-FGEB7RMY.cjs → chunk-MM5BV5CS.cjs} +4 -4
  16. package/dist/{chunk-335Z2W67.js → chunk-PYYSB5ZN.js} +1 -1
  17. package/dist/{chunk-PUX5VXDB.cjs → chunk-PZZK3O3S.cjs} +1040 -42
  18. package/dist/{chunk-74QFZ5MK.js → chunk-SPLNGUFF.js} +1 -1
  19. package/dist/{chunk-6PXXGACR.cjs → chunk-UHHMVBLU.cjs} +2 -2
  20. package/dist/{chunk-O5676ZWY.js → chunk-VW356KR3.js} +108 -5
  21. package/dist/{chunk-EAJ7SYHE.js → chunk-WJMEBBU7.js} +1 -1
  22. package/dist/{chunk-GKKDAW44.js → chunk-X7WBPCEU.js} +1026 -32
  23. package/dist/core/addresses.d.ts +4 -4
  24. package/dist/core/errors.d.ts +1 -1
  25. package/dist/fhe/types.d.ts +2 -2
  26. package/dist/fhe-airdrop/abis/merkle.d.ts +24 -12
  27. package/dist/fhe-airdrop/advanced/index.cjs +4 -4
  28. package/dist/fhe-airdrop/advanced/index.js +1 -1
  29. package/dist/fhe-airdrop/advanced/react/index.cjs +590 -9
  30. package/dist/fhe-airdrop/advanced/react/index.d.cts +34 -0
  31. package/dist/fhe-airdrop/advanced/react/index.d.ts +34 -0
  32. package/dist/fhe-airdrop/advanced/react/index.js +561 -7
  33. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
  34. package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
  35. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +25 -0
  36. package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
  37. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
  38. package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
  39. package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
  40. package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
  41. package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
  42. package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
  43. package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +36 -0
  44. package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +35 -0
  45. package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
  46. package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +47 -0
  47. package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
  48. package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
  49. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
  50. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
  51. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
  52. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +28 -0
  53. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
  54. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +28 -0
  55. package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
  56. package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
  57. package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
  58. package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
  59. package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
  60. package/dist/fhe-airdrop/airdrop-base.d.ts +8 -0
  61. package/dist/fhe-airdrop/campaign.d.ts +61 -20
  62. package/dist/fhe-airdrop/constants.d.ts +1 -1
  63. package/dist/fhe-airdrop/errors.d.ts +28 -0
  64. package/dist/fhe-airdrop/guards.d.ts +46 -2
  65. package/dist/fhe-airdrop/index.cjs +74 -971
  66. package/dist/fhe-airdrop/index.d.cts +2 -2
  67. package/dist/fhe-airdrop/index.d.ts +2 -2
  68. package/dist/fhe-airdrop/index.js +8 -927
  69. package/dist/fhe-airdrop/merkle-tree.d.ts +32 -38
  70. package/dist/fhe-airdrop/merkle.d.ts +52 -31
  71. package/dist/fhe-airdrop/react/_shared.d.ts +13 -0
  72. package/dist/fhe-airdrop/react/index.cjs +934 -84
  73. package/dist/fhe-airdrop/react/index.d.cts +49 -3
  74. package/dist/fhe-airdrop/react/index.d.ts +49 -3
  75. package/dist/fhe-airdrop/react/index.js +825 -22
  76. package/dist/fhe-airdrop/react/keys.d.ts +90 -0
  77. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
  78. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
  79. package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
  80. package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
  81. package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
  82. package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
  83. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
  84. package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
  85. package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +35 -0
  86. package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
  87. package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +33 -0
  88. package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
  89. package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
  90. package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
  91. package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
  92. package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
  93. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
  94. package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
  95. package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
  96. package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
  97. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
  98. package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
  99. package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
  100. package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
  101. package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
  102. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
  103. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
  104. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
  105. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +4 -3
  106. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
  107. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
  108. package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
  109. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
  110. package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
  111. package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
  112. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
  113. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +7 -19
  114. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
  115. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
  116. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
  117. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +67 -0
  118. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
  119. package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
  120. package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
  121. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
  122. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +42 -0
  123. package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
  124. package/dist/fhe-airdrop/types.d.ts +14 -1
  125. package/dist/fhe-disperse/index.cjs +21 -21
  126. package/dist/fhe-disperse/index.js +2 -2
  127. package/dist/fhe-disperse/react/index.cjs +22 -22
  128. package/dist/fhe-disperse/react/index.js +3 -3
  129. package/dist/fhe-vesting/advanced/index.cjs +5 -5
  130. package/dist/fhe-vesting/advanced/index.js +3 -3
  131. package/dist/fhe-vesting/advanced/react/index.cjs +7 -7
  132. package/dist/fhe-vesting/advanced/react/index.js +4 -4
  133. package/dist/fhe-vesting/index.cjs +8 -8
  134. package/dist/fhe-vesting/index.js +2 -2
  135. package/dist/fhe-vesting/react/index.cjs +114 -114
  136. package/dist/fhe-vesting/react/index.js +3 -3
  137. package/dist/index.cjs +18 -18
  138. package/dist/index.js +1 -1
  139. package/dist/testnet-faucet/index.cjs +14 -14
  140. package/dist/testnet-faucet/index.js +2 -2
  141. package/dist/testnet-faucet/react/index.cjs +8 -8
  142. package/dist/testnet-faucet/react/index.js +3 -3
  143. package/package.json +1 -1
  144. package/dist/chunk-NCVX3K2N.cjs +0 -161
  145. package/dist/chunk-VP2B4WM2.js +0 -154
@@ -9,3 +9,37 @@
9
9
  */
10
10
  export { usePredictEcdsaAirdropAddress, type UsePredictEcdsaAirdropAddressArgs, } from "./usePredictEcdsaAirdropAddress.js";
11
11
  export { usePredictMerkleAirdropAddress, type UsePredictMerkleAirdropAddressArgs, } from "./usePredictMerkleAirdropAddress.js";
12
+ export { useClearCompliancePolicy, type ClearCompliancePolicyArgs, } from "./useClearCompliancePolicy.js";
13
+ export { useClearUpgradeabilityPolicy, type ClearUpgradeabilityPolicyArgs, } from "./useClearUpgradeabilityPolicy.js";
14
+ export { useDisableCustomFee, type DisableCustomFeeArgs } from "./useDisableCustomFee.js";
15
+ export { useEcdsaInitCodeHash, type UseEcdsaInitCodeHashArgs } from "./useEcdsaInitCodeHash.js";
16
+ export { useFactoryComplianceDelegate, type UseFactoryComplianceDelegateArgs, } from "./useFactoryComplianceDelegate.js";
17
+ export { useFactoryCompliancePolicy, type FactoryCompliancePolicy, type UseFactoryCompliancePolicyArgs, } from "./useFactoryCompliancePolicy.js";
18
+ export { useFactoryCustomFee, type UseFactoryCustomFeeArgs } from "./useFactoryCustomFee.js";
19
+ export { useFactoryGrantRole, type FactoryGrantRoleArgs } from "./useFactoryGrantRole.js";
20
+ export { useFactoryHasRole, type UseFactoryHasRoleArgs } from "./useFactoryHasRole.js";
21
+ export { useFactoryImplementations, type FactoryImplementations, type UseFactoryImplementationsArgs, } from "./useFactoryImplementations.js";
22
+ export { useFactoryRenounceRole, type FactoryRenounceRoleArgs } from "./useFactoryRenounceRole.js";
23
+ export { useFactoryRevokeRole, type FactoryRevokeRoleArgs } from "./useFactoryRevokeRole.js";
24
+ export { useFactoryRoleConstants, type FactoryRoleConstants, type UseFactoryRoleConstantsArgs, } from "./useFactoryRoleConstants.js";
25
+ export { useFactoryRoleMembers, type FactoryRoleMembership, type UseFactoryRoleMembersArgs, } from "./useFactoryRoleMembers.js";
26
+ export { useFactoryUpgradeabilityPolicy, type FactoryUpgradeabilityPolicy, type UseFactoryUpgradeabilityPolicyArgs, } from "./useFactoryUpgradeabilityPolicy.js";
27
+ export { useMerkleInitCodeHash, type UseMerkleInitCodeHashArgs } from "./useMerkleInitCodeHash.js";
28
+ export { useSetComplianceDelegate, type SetComplianceDelegateArgs, } from "./useSetComplianceDelegate.js";
29
+ export { useSetComplianceManagerImpl, type SetComplianceManagerImplArgs, } from "./useSetComplianceManagerImpl.js";
30
+ export { useSetCompliancePolicy, type SetCompliancePolicyArgs } from "./useSetCompliancePolicy.js";
31
+ export { useSetCustomFee, type SetCustomFeeArgs } from "./useSetCustomFee.js";
32
+ export { useSetDefaultDelegateToCompliance, type SetDefaultDelegateToComplianceArgs, } from "./useSetDefaultDelegateToCompliance.js";
33
+ export { useSetDefaultGasFee, type SetDefaultGasFeeArgs } from "./useSetDefaultGasFee.js";
34
+ export { useSetDefaultUpgradeable, type SetDefaultUpgradeableArgs, } from "./useSetDefaultUpgradeable.js";
35
+ export { useSetEcdsaImplementation, type SetEcdsaImplementationArgs, } from "./useSetEcdsaImplementation.js";
36
+ export { useSetFeeCollector, type SetFeeCollectorArgs } from "./useSetFeeCollector.js";
37
+ export { useSetMerkleImplementation, type SetMerkleImplementationArgs, } from "./useSetMerkleImplementation.js";
38
+ export { useSetUpgradeabilityPolicy, type SetUpgradeabilityPolicyArgs, } from "./useSetUpgradeabilityPolicy.js";
39
+ export type { AirdropClientOptions, AirdropHookOptions } from "../../react/_shared.js";
40
+ export type { WriteAccountOverride } from "../../airdrop-base.js";
41
+ export type { CustomFee } from "../../factory.js";
42
+ export type { DeploymentMode } from "../../constants.js";
43
+ export type { CommonAirdropParams, EcdsaAirdropParams, MerkleAirdropParams } from "../../types.js";
44
+ export type { DedupMode } from "../../constants.js";
45
+ export type { EncryptorSource } from "../../encryption.js";
@@ -1,15 +1,15 @@
1
- import { useMemoAirdropFactoryClient, airdropQueryKey } from '../../../chunk-VP2B4WM2.js';
2
- import '../../../chunk-GKKDAW44.js';
3
- import '../../../chunk-O5676ZWY.js';
1
+ import { useMemoAirdropFactoryClient, airdropQueryKey, airdropKeys, airdropQueryKeyPrefix } from '../../../chunk-EYDA6Q6C.js';
2
+ import '../../../chunk-X7WBPCEU.js';
3
+ import '../../../chunk-VW356KR3.js';
4
4
  import '../../../chunk-ZWXJTBZO.js';
5
5
  import '../../../chunk-NWFMBLSQ.js';
6
6
  import '../../../chunk-4RAAATVY.js';
7
- import '../../../chunk-DZHYSUGY.js';
7
+ import '../../../chunk-A4DCEE33.js';
8
8
  import '../../../chunk-ZA673I3O.js';
9
9
  import '../../../chunk-KWFFIJYX.js';
10
- import '../../../chunk-QBJ7O2B4.js';
10
+ import { MissingClientError } from '../../../chunk-QBJ7O2B4.js';
11
11
  import '../../../chunk-Q2GP5UDC.js';
12
- import { useQuery } from '@tanstack/react-query';
12
+ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
13
13
 
14
14
  function usePredictEcdsaAirdropAddress(args) {
15
15
  const { params, mode, deployer, userSalt, ...base } = args;
@@ -41,5 +41,559 @@ function usePredictMerkleAirdropAddress(args) {
41
41
  enabled: Boolean(client && (args.query?.enabled ?? true))
42
42
  });
43
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,
349
+ address: resolvedAddress,
350
+ fn: "getMerkleInitCodeHash",
351
+ args: [mode]
352
+ }),
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
+ }
596
+ });
597
+ }
44
598
 
45
- export { usePredictEcdsaAirdropAddress, usePredictMerkleAirdropAddress };
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>;
@@ -0,0 +1,26 @@
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 ClearUpgradeabilityPolicyArgs 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 useSetUpgradeabilityPolicy} override, reverting
12
+ * them to the factory default. Requires `UPGRADE_MANAGER_ROLE`.
13
+ *
14
+ * **Invalidates:** `fn "effectiveUpgradeable"` and `fn "upgradeabilityPolicy"`, both
15
+ * keyed on `args.creator`, plus the `fn "preflightCreate"` PREFIX. Reverting to the
16
+ * default flips `effectiveUpgradeable` exactly as setting an override does, and
17
+ * `preflightCreate` reads it to decide whether a `mode: "uups"` create is refused - so
18
+ * omitting the prefix here would leave a create form showing a stale allow/deny.
19
+ *
20
+ * @example
21
+ * const clearPolicy = useClearUpgradeabilityPolicy();
22
+ * await clearPolicy.mutateAsync({ creator });
23
+ *
24
+ * @alpha
25
+ */
26
+ export declare function useClearUpgradeabilityPolicy(options?: AirdropClientOptions): UseMutationResult<Hex, Error, ClearUpgradeabilityPolicyArgs>;