@tokenops/sdk 2.0.0-alpha.2 → 2.0.0-alpha.4

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 (160) hide show
  1. package/CHANGELOG.md +92 -3
  2. package/README.md +76 -34
  3. package/SUPPORT.md +1 -1
  4. package/dist/{chunk-PYYSB5ZN.js → chunk-2ND7US2I.js} +1 -1
  5. package/dist/{chunk-EYDA6Q6C.js → chunk-3ZSPRHR3.js} +63 -12
  6. package/dist/{chunk-X7WBPCEU.js → chunk-67Q6KSVV.js} +4578 -3383
  7. package/dist/{chunk-UHHMVBLU.cjs → chunk-6AYJRUGP.cjs} +7 -50
  8. package/dist/{chunk-FEDX7B6T.cjs → chunk-6FUHF73F.cjs} +5 -5
  9. package/dist/{chunk-NWFMBLSQ.js → chunk-7KY4K4PH.js} +1 -1
  10. package/dist/{chunk-FHWSBGWE.cjs → chunk-ARZ5C3FS.cjs} +7 -7
  11. package/dist/{chunk-SPLNGUFF.js → chunk-AX6MQAWU.js} +2 -2
  12. package/dist/{chunk-IGO5XSPS.js → chunk-BSXEX2SH.js} +3 -3
  13. package/dist/{chunk-44YJPMQC.js → chunk-CHGY6B7L.js} +34 -81
  14. package/dist/{chunk-IUKKNJ2R.cjs → chunk-DFK5GCJP.cjs} +55 -72
  15. package/dist/{chunk-PZZK3O3S.cjs → chunk-E4IV4M4E.cjs} +4598 -3403
  16. package/dist/{chunk-A4DCEE33.js → chunk-GHGF65LN.js} +16 -12
  17. package/dist/{chunk-TWT3STIX.js → chunk-K3R27WX4.js} +8 -46
  18. package/dist/{chunk-GADGBQJO.js → chunk-KJUNBOJQ.js} +52 -71
  19. package/dist/{chunk-MM5BV5CS.cjs → chunk-PO3A2AQX.cjs} +4 -4
  20. package/dist/{chunk-EBLBPUPI.cjs → chunk-QHDMPT7I.cjs} +72 -19
  21. package/dist/{chunk-3YHBO2DL.cjs → chunk-S47IBDTA.cjs} +36 -83
  22. package/dist/{chunk-UG5RKLU2.cjs → chunk-SUYBAF27.cjs} +1 -1
  23. package/dist/{chunk-WJMEBBU7.js → chunk-TWU7L5H7.js} +5 -48
  24. package/dist/{chunk-WJLECC22.cjs → chunk-UUSSWOPR.cjs} +9 -47
  25. package/dist/{chunk-AREQJHKA.cjs → chunk-VHKMWWBA.cjs} +428 -22
  26. package/dist/{chunk-FT5H2Q7Y.cjs → chunk-YAL6JSAZ.cjs} +16 -12
  27. package/dist/{chunk-VW356KR3.js → chunk-YMWMIWBP.js} +421 -25
  28. package/dist/core/addresses.d.ts +4 -4
  29. package/dist/core/errors.d.ts +1 -1
  30. package/dist/core/index.d.ts +1 -0
  31. package/dist/core/pending.d.ts +57 -0
  32. package/dist/core/version.d.ts +1 -1
  33. package/dist/fhe/operators.d.ts +6 -5
  34. package/dist/fhe/types.d.ts +1 -1
  35. package/dist/fhe-airdrop/abis/airdrop-base.d.ts +97 -1
  36. package/dist/fhe-airdrop/abis/ecdsa.d.ts +117 -1
  37. package/dist/fhe-airdrop/abis/factory.d.ts +332 -1
  38. package/dist/fhe-airdrop/abis/merkle.d.ts +116 -1
  39. package/dist/fhe-airdrop/advanced/index.cjs +8 -4
  40. package/dist/fhe-airdrop/advanced/index.d.cts +1 -0
  41. package/dist/fhe-airdrop/advanced/index.d.ts +1 -0
  42. package/dist/fhe-airdrop/advanced/index.js +1 -1
  43. package/dist/fhe-airdrop/advanced/react/index.cjs +145 -137
  44. package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -0
  45. package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -0
  46. package/dist/fhe-airdrop/advanced/react/index.js +85 -78
  47. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +3 -1
  48. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +4 -1
  49. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +2 -4
  50. package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +4 -3
  51. package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +9 -7
  52. package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +6 -5
  53. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +7 -7
  54. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +3 -1
  55. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +2 -1
  56. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +4 -1
  57. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +5 -4
  58. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +7 -3
  59. package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +37 -0
  60. package/dist/fhe-airdrop/airdrop-base.d.ts +142 -18
  61. package/dist/fhe-airdrop/campaign.d.ts +37 -73
  62. package/dist/fhe-airdrop/compliance-clone.d.ts +21 -0
  63. package/dist/fhe-airdrop/constants.d.ts +11 -1
  64. package/dist/fhe-airdrop/ecdsa.d.ts +79 -26
  65. package/dist/fhe-airdrop/encryption.d.ts +19 -6
  66. package/dist/fhe-airdrop/errors.d.ts +136 -2
  67. package/dist/fhe-airdrop/factory-params.d.ts +2361 -0
  68. package/dist/fhe-airdrop/factory.d.ts +189 -75
  69. package/dist/fhe-airdrop/guards.d.ts +183 -19
  70. package/dist/fhe-airdrop/index.cjs +88 -56
  71. package/dist/fhe-airdrop/index.d.cts +12 -10
  72. package/dist/fhe-airdrop/index.d.ts +12 -10
  73. package/dist/fhe-airdrop/index.js +5 -5
  74. package/dist/fhe-airdrop/merkle-tree.d.ts +9 -9
  75. package/dist/fhe-airdrop/merkle.d.ts +32 -11
  76. package/dist/fhe-airdrop/react/_shared.d.ts +12 -6
  77. package/dist/fhe-airdrop/react/index.cjs +336 -240
  78. package/dist/fhe-airdrop/react/index.d.cts +19 -9
  79. package/dist/fhe-airdrop/react/index.d.ts +19 -9
  80. package/dist/fhe-airdrop/react/index.js +158 -97
  81. package/dist/fhe-airdrop/react/keys.d.ts +54 -7
  82. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +6 -3
  83. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +2 -2
  84. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +8 -3
  85. package/dist/fhe-airdrop/react/useAirdropPause.d.ts +5 -0
  86. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +4 -6
  87. package/dist/fhe-airdrop/react/useComplianceManager.d.ts +2 -2
  88. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +1 -2
  89. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +16 -11
  90. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +23 -7
  91. package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +13 -8
  92. package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +27 -7
  93. package/dist/fhe-airdrop/react/useDedupMode.d.ts +16 -0
  94. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +4 -3
  95. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +6 -4
  96. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +15 -8
  97. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +1 -1
  98. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +5 -7
  99. package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +4 -1
  100. package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
  101. package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +3 -4
  102. package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +2 -1
  103. package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
  104. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +5 -4
  105. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +4 -1
  106. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +14 -3
  107. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +18 -3
  108. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +1 -1
  109. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +34 -13
  110. package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
  111. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +3 -3
  112. package/dist/fhe-airdrop/react/useRescueNativeToken.d.ts +23 -0
  113. package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
  114. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +5 -2
  115. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +4 -0
  116. package/dist/fhe-airdrop/react/useTokenOf.d.ts +29 -0
  117. package/dist/fhe-airdrop/react/useUnwrapRequest.d.ts +25 -0
  118. package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +4 -0
  119. package/dist/fhe-airdrop/roles.d.ts +82 -7
  120. package/dist/fhe-airdrop/types.d.ts +122 -14
  121. package/dist/fhe-disperse/errors.d.ts +3 -3
  122. package/dist/fhe-disperse/index.cjs +22 -22
  123. package/dist/fhe-disperse/index.d.cts +2 -1
  124. package/dist/fhe-disperse/index.d.ts +2 -1
  125. package/dist/fhe-disperse/index.js +3 -3
  126. package/dist/fhe-disperse/react/index.cjs +27 -25
  127. package/dist/fhe-disperse/react/index.d.cts +2 -1
  128. package/dist/fhe-disperse/react/index.d.ts +2 -1
  129. package/dist/fhe-disperse/react/index.js +8 -6
  130. package/dist/fhe-disperse/react/useDisperse.d.ts +6 -2
  131. package/dist/fhe-disperse/react/useRegister.d.ts +9 -3
  132. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +7 -2
  133. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +7 -2
  134. package/dist/fhe-disperse/singleton.d.ts +33 -19
  135. package/dist/fhe-disperse/types.d.ts +48 -8
  136. package/dist/fhe-vesting/advanced/index.cjs +6 -6
  137. package/dist/fhe-vesting/advanced/index.js +4 -4
  138. package/dist/fhe-vesting/advanced/react/index.cjs +9 -9
  139. package/dist/fhe-vesting/advanced/react/index.js +6 -6
  140. package/dist/fhe-vesting/factory.d.ts +31 -8
  141. package/dist/fhe-vesting/index.cjs +23 -23
  142. package/dist/fhe-vesting/index.d.cts +3 -2
  143. package/dist/fhe-vesting/index.d.ts +3 -2
  144. package/dist/fhe-vesting/index.js +4 -4
  145. package/dist/fhe-vesting/manager.d.ts +27 -2
  146. package/dist/fhe-vesting/react/index.cjs +126 -126
  147. package/dist/fhe-vesting/react/index.d.cts +3 -2
  148. package/dist/fhe-vesting/react/index.d.ts +3 -2
  149. package/dist/fhe-vesting/react/index.js +5 -5
  150. package/dist/fhe-vesting/react/useCreateManager.d.ts +16 -9
  151. package/dist/fhe-vesting/react/useCreateManagerAndGetAddress.d.ts +9 -5
  152. package/dist/fhe-vesting/react/useSplitVesting.d.ts +9 -3
  153. package/dist/index.cjs +18 -18
  154. package/dist/index.js +1 -1
  155. package/dist/testnet-faucet/faucet.d.ts +3 -0
  156. package/dist/testnet-faucet/index.cjs +15 -15
  157. package/dist/testnet-faucet/index.js +3 -3
  158. package/dist/testnet-faucet/react/index.cjs +9 -9
  159. package/dist/testnet-faucet/react/index.js +4 -4
  160. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { useMemoAirdropFactoryClient, airdropQueryKey, airdropKeys, airdropQueryKeyPrefix } from '../../../chunk-EYDA6Q6C.js';
2
- import '../../../chunk-X7WBPCEU.js';
3
- import '../../../chunk-VW356KR3.js';
1
+ import { useMemoAirdropFactoryClient, airdropKeys, airdropQueryKey } from '../../../chunk-3ZSPRHR3.js';
2
+ import '../../../chunk-67Q6KSVV.js';
3
+ import '../../../chunk-YMWMIWBP.js';
4
4
  import '../../../chunk-ZWXJTBZO.js';
5
- import '../../../chunk-NWFMBLSQ.js';
5
+ import '../../../chunk-7KY4K4PH.js';
6
6
  import '../../../chunk-4RAAATVY.js';
7
- import '../../../chunk-A4DCEE33.js';
7
+ import '../../../chunk-GHGF65LN.js';
8
8
  import '../../../chunk-ZA673I3O.js';
9
9
  import '../../../chunk-KWFFIJYX.js';
10
10
  import { MissingClientError } from '../../../chunk-QBJ7O2B4.js';
@@ -16,12 +16,12 @@ function usePredictEcdsaAirdropAddress(args) {
16
16
  const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
17
17
  return useQuery({
18
18
  ...args.query,
19
- queryKey: airdropQueryKey({
20
- chainId,
21
- address: resolvedAddress,
22
- fn: "predictEcdsaAirdropAddress",
23
- args: [mode, deployer, userSalt]
24
- }),
19
+ queryKey: airdropKeys.predictEcdsaAddress(
20
+ { chainId, address: resolvedAddress },
21
+ mode,
22
+ deployer,
23
+ userSalt
24
+ ),
25
25
  queryFn: () => client.predictEcdsaAirdropAddress({ params, mode, deployer, userSalt }),
26
26
  enabled: Boolean(client && (args.query?.enabled ?? true))
27
27
  });
@@ -31,12 +31,12 @@ function usePredictMerkleAirdropAddress(args) {
31
31
  const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
32
32
  return useQuery({
33
33
  ...args.query,
34
- queryKey: airdropQueryKey({
35
- chainId,
36
- address: resolvedAddress,
37
- fn: "predictMerkleAirdropAddress",
38
- args: [mode, deployer, userSalt]
39
- }),
34
+ queryKey: airdropKeys.predictMerkleAddress(
35
+ { chainId, address: resolvedAddress },
36
+ mode,
37
+ deployer,
38
+ userSalt
39
+ ),
40
40
  queryFn: () => client.predictMerkleAirdropAddress({ params, mode, deployer, userSalt }),
41
41
  enabled: Boolean(client && (args.query?.enabled ?? true))
42
42
  });
@@ -57,12 +57,9 @@ function useClearCompliancePolicy(options = {}) {
57
57
  queryKey: airdropKeys.compliancePolicy(scope, variables.creator)
58
58
  });
59
59
  void queryClient.invalidateQueries({
60
- queryKey: airdropQueryKey({
61
- ...scope,
62
- fn: "effectiveDelegateToCompliance",
63
- args: [variables.creator]
64
- })
60
+ queryKey: airdropKeys.effectiveDelegateToCompliance(scope, variables.creator)
65
61
  });
62
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.preflightCreateAll(scope) });
66
63
  }
67
64
  });
68
65
  }
@@ -79,11 +76,7 @@ function useClearUpgradeabilityPolicy(options = {}) {
79
76
  onSuccess: (_hash, variables) => {
80
77
  const scope = { chainId, address: resolvedAddress };
81
78
  void queryClient.invalidateQueries({
82
- queryKey: airdropQueryKey({
83
- ...scope,
84
- fn: "effectiveUpgradeable",
85
- args: [variables.creator]
86
- })
79
+ queryKey: airdropKeys.effectiveUpgradeable(scope, variables.creator)
87
80
  });
88
81
  void queryClient.invalidateQueries({
89
82
  queryKey: airdropKeys.upgradeabilityPolicy(scope, variables.creator)
@@ -105,9 +98,15 @@ function useDisableCustomFee(options = {}) {
105
98
  return client.disableCustomFee(creator, account);
106
99
  },
107
100
  onSuccess: (_hash, variables) => {
101
+ void queryClient.invalidateQueries({
102
+ queryKey: airdropKeys.resolvedGasFeeAll({ chainId, address: resolvedAddress })
103
+ });
108
104
  void queryClient.invalidateQueries({
109
105
  queryKey: airdropKeys.customFee({ chainId, address: resolvedAddress }, variables.creator)
110
106
  });
107
+ void queryClient.invalidateQueries({
108
+ queryKey: airdropKeys.preflightCreateAll({ chainId, address: resolvedAddress })
109
+ });
111
110
  }
112
111
  });
113
112
  }
@@ -121,12 +120,7 @@ function useEcdsaInitCodeHash(args) {
121
120
  // implementation pointer, which is what this read reports) moves the
122
121
  // result. If a future factory version makes params hash-affecting, this
123
122
  // key has to grow with it.
124
- queryKey: airdropQueryKey({
125
- chainId,
126
- address: resolvedAddress,
127
- fn: "getEcdsaInitCodeHash",
128
- args: [mode]
129
- }),
123
+ queryKey: airdropKeys.ecdsaInitCodeHash({ chainId, address: resolvedAddress }, mode),
130
124
  queryFn: () => client.getEcdsaInitCodeHash({ params, mode }),
131
125
  enabled: Boolean(client && (args.query?.enabled ?? true))
132
126
  });
@@ -135,12 +129,7 @@ function useFactoryComplianceDelegate(args = {}) {
135
129
  const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
136
130
  return useQuery({
137
131
  ...args.query,
138
- queryKey: airdropQueryKey({
139
- chainId,
140
- address: resolvedAddress,
141
- fn: "complianceDelegate",
142
- args: []
143
- }),
132
+ queryKey: airdropKeys.complianceDelegate({ chainId, address: resolvedAddress }),
144
133
  queryFn: () => client.complianceDelegate(),
145
134
  enabled: Boolean(client && (args.query?.enabled ?? true))
146
135
  });
@@ -344,12 +333,7 @@ function useMerkleInitCodeHash(args) {
344
333
  return useQuery({
345
334
  ...args.query,
346
335
  // `params` omitted deliberately — see useEcdsaInitCodeHash for why.
347
- queryKey: airdropQueryKey({
348
- chainId,
349
- address: resolvedAddress,
350
- fn: "getMerkleInitCodeHash",
351
- args: [mode]
352
- }),
336
+ queryKey: airdropKeys.merkleInitCodeHash({ chainId, address: resolvedAddress }, mode),
353
337
  queryFn: () => client.getMerkleInitCodeHash({ params, mode }),
354
338
  enabled: Boolean(client && (args.query?.enabled ?? true))
355
339
  });
@@ -366,12 +350,10 @@ function useSetComplianceDelegate(options = {}) {
366
350
  },
367
351
  onSuccess: () => {
368
352
  void queryClient.invalidateQueries({
369
- queryKey: airdropQueryKey({
370
- chainId,
371
- address: resolvedAddress,
372
- fn: "complianceDelegate",
373
- args: []
374
- })
353
+ queryKey: airdropKeys.complianceDelegate({ chainId, address: resolvedAddress })
354
+ });
355
+ void queryClient.invalidateQueries({
356
+ queryKey: airdropKeys.preflightCreateAll({ chainId, address: resolvedAddress })
375
357
  });
376
358
  }
377
359
  });
@@ -390,6 +372,9 @@ function useSetComplianceManagerImpl(options = {}) {
390
372
  void queryClient.invalidateQueries({
391
373
  queryKey: airdropKeys.implementations({ chainId, address: resolvedAddress })
392
374
  });
375
+ void queryClient.invalidateQueries({
376
+ queryKey: airdropKeys.preflightCreateAll({ chainId, address: resolvedAddress })
377
+ });
393
378
  }
394
379
  });
395
380
  }
@@ -409,12 +394,9 @@ function useSetCompliancePolicy(options = {}) {
409
394
  queryKey: airdropKeys.compliancePolicy(scope, variables.creator)
410
395
  });
411
396
  void queryClient.invalidateQueries({
412
- queryKey: airdropQueryKey({
413
- ...scope,
414
- fn: "effectiveDelegateToCompliance",
415
- args: [variables.creator]
416
- })
397
+ queryKey: airdropKeys.effectiveDelegateToCompliance(scope, variables.creator)
417
398
  });
399
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.preflightCreateAll(scope) });
418
400
  }
419
401
  });
420
402
  }
@@ -429,9 +411,15 @@ function useSetCustomFee(options = {}) {
429
411
  return client.setCustomFee(creator, gasFee, account);
430
412
  },
431
413
  onSuccess: (_hash, variables) => {
414
+ void queryClient.invalidateQueries({
415
+ queryKey: airdropKeys.resolvedGasFeeAll({ chainId, address: resolvedAddress })
416
+ });
432
417
  void queryClient.invalidateQueries({
433
418
  queryKey: airdropKeys.customFee({ chainId, address: resolvedAddress }, variables.creator)
434
419
  });
420
+ void queryClient.invalidateQueries({
421
+ queryKey: airdropKeys.preflightCreateAll({ chainId, address: resolvedAddress })
422
+ });
435
423
  }
436
424
  });
437
425
  }
@@ -447,15 +435,17 @@ function useSetDefaultDelegateToCompliance(options = {}) {
447
435
  },
448
436
  onSuccess: () => {
449
437
  void queryClient.invalidateQueries({
450
- queryKey: airdropQueryKeyPrefix({
438
+ queryKey: airdropKeys.effectiveDelegateToComplianceAll({
451
439
  chainId,
452
- address: resolvedAddress,
453
- fn: "effectiveDelegateToCompliance"
440
+ address: resolvedAddress
454
441
  })
455
442
  });
456
443
  void queryClient.invalidateQueries({
457
444
  queryKey: airdropKeys.compliancePolicyAll({ chainId, address: resolvedAddress })
458
445
  });
446
+ void queryClient.invalidateQueries({
447
+ queryKey: airdropKeys.preflightCreateAll({ chainId, address: resolvedAddress })
448
+ });
459
449
  }
460
450
  });
461
451
  }
@@ -470,9 +460,38 @@ function useSetDefaultGasFee(options = {}) {
470
460
  return client.setDefaultGasFee(gasFee, account);
471
461
  },
472
462
  onSuccess: () => {
463
+ void queryClient.invalidateQueries({
464
+ queryKey: airdropKeys.resolvedGasFeeAll({ chainId, address: resolvedAddress })
465
+ });
473
466
  void queryClient.invalidateQueries({
474
467
  queryKey: airdropKeys.fees({ chainId, address: resolvedAddress })
475
468
  });
469
+ void queryClient.invalidateQueries({
470
+ queryKey: airdropKeys.preflightCreateAll({ chainId, address: resolvedAddress })
471
+ });
472
+ }
473
+ });
474
+ }
475
+ function useSetMaxGasFee(options = {}) {
476
+ const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
477
+ const queryClient = useQueryClient();
478
+ return useMutation({
479
+ mutationFn: async ({ maxGasFee, account }) => {
480
+ if (!client) {
481
+ throw resolutionError ?? new MissingClientError("useSetMaxGasFee", "factory");
482
+ }
483
+ return client.setMaxGasFee(maxGasFee, account);
484
+ },
485
+ onSuccess: () => {
486
+ void queryClient.invalidateQueries({
487
+ queryKey: airdropKeys.fees({ chainId, address: resolvedAddress })
488
+ });
489
+ void queryClient.invalidateQueries({
490
+ queryKey: airdropKeys.resolvedGasFeeAll({ chainId, address: resolvedAddress })
491
+ });
492
+ void queryClient.invalidateQueries({
493
+ queryKey: airdropKeys.preflightCreateAll({ chainId, address: resolvedAddress })
494
+ });
476
495
  }
477
496
  });
478
497
  }
@@ -489,7 +508,7 @@ function useSetDefaultUpgradeable(options = {}) {
489
508
  onSuccess: () => {
490
509
  const scope = { chainId, address: resolvedAddress };
491
510
  void queryClient.invalidateQueries({
492
- queryKey: airdropQueryKeyPrefix({ ...scope, fn: "effectiveUpgradeable" })
511
+ queryKey: airdropKeys.effectiveUpgradeableAll(scope)
493
512
  });
494
513
  void queryClient.invalidateQueries({
495
514
  queryKey: airdropKeys.upgradeabilityPolicyAll(scope)
@@ -513,12 +532,8 @@ function useSetEcdsaImplementation(options = {}) {
513
532
  onSuccess: () => {
514
533
  const scope = { chainId, address: resolvedAddress };
515
534
  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
- });
535
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.ecdsaInitCodeHashAll(scope) });
536
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.predictEcdsaAddressAll(scope) });
522
537
  void queryClient.invalidateQueries({
523
538
  queryKey: airdropKeys.preflightCreateAll(scope)
524
539
  });
@@ -555,12 +570,8 @@ function useSetMerkleImplementation(options = {}) {
555
570
  onSuccess: () => {
556
571
  const scope = { chainId, address: resolvedAddress };
557
572
  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
- });
573
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.merkleInitCodeHashAll(scope) });
574
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.predictMerkleAddressAll(scope) });
564
575
  void queryClient.invalidateQueries({
565
576
  queryKey: airdropKeys.preflightCreateAll(scope)
566
577
  });
@@ -580,11 +591,7 @@ function useSetUpgradeabilityPolicy(options = {}) {
580
591
  onSuccess: (_hash, variables) => {
581
592
  const scope = { chainId, address: resolvedAddress };
582
593
  void queryClient.invalidateQueries({
583
- queryKey: airdropQueryKey({
584
- ...scope,
585
- fn: "effectiveUpgradeable",
586
- args: [variables.creator]
587
- })
594
+ queryKey: airdropKeys.effectiveUpgradeable(scope, variables.creator)
588
595
  });
589
596
  void queryClient.invalidateQueries({
590
597
  queryKey: airdropKeys.upgradeabilityPolicy(scope, variables.creator)
@@ -596,4 +603,4 @@ function useSetUpgradeabilityPolicy(options = {}) {
596
603
  });
597
604
  }
598
605
 
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 };
606
+ 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, useSetMaxGasFee, useSetMerkleImplementation, useSetUpgradeabilityPolicy };
@@ -17,7 +17,9 @@ export interface ClearCompliancePolicyArgs extends WriteAccountOverride {
17
17
  * the override had been.
18
18
  *
19
19
  * **Invalidates:** `fn "compliancePolicy"` and
20
- * `fn "effectiveDelegateToCompliance"`, both keyed on `args.creator`.
20
+ * `fn "effectiveDelegateToCompliance"`, both keyed on `args.creator`, and every
21
+ * cached {@link usePreflightCreateAirdrop} report on this factory, whose
22
+ * `commitments.complianceDelegate` this write moves.
21
23
  *
22
24
  * @example
23
25
  * const clearPolicy = useClearCompliancePolicy();
@@ -14,7 +14,10 @@ export interface DisableCustomFeeArgs extends WriteAccountOverride {
14
14
  * Requires `FEE_MANAGER_ROLE`.
15
15
  *
16
16
  * **Invalidates:** `useFactoryCustomFee({ creator })` for the TARGET creator -
17
- * `variables.creator`, never the sending admin.
17
+ * `variables.creator`, never the sending admin. Also every `useResolveGasFee`
18
+ * entry: dropping the override sends this creator back to the default. Also every
19
+ * cached {@link usePreflightCreateAirdrop} report on this factory, whose
20
+ * fee blockers (the `maxGasFee` ceiling and `GasFeeNotAcceptedError`) this write moves.
18
21
  *
19
22
  * @example
20
23
  * const disableCustomFee = useDisableCustomFee();
@@ -7,10 +7,8 @@ export type UseFactoryComplianceDelegateArgs = AirdropHookOptions<Address>;
7
7
  * The platform-designated compliance delegate the FACTORY wires into every
8
8
  * new compliance-manager clone.
9
9
  *
10
- * Deliberately unbundled: its being set is what gates
11
- * {@link useSetDefaultDelegateToCompliance} with `on: true` (that write
12
- * reverts `ZeroComplianceDelegate` against the zero address), so an admin
13
- * panel reads it alone to decide whether to enable the toggle at all.
10
+ * Never zero: the constructor seeds it and `setComplianceDelegate` rejects zero. Read it
11
+ * to show which platform delegate policy-ON creates will wire.
14
12
  *
15
13
  * **Not** `ComplianceManagerClient.complianceDelegate()`. That method has the
16
14
  * same name on a different contract and returns the delegate one already-
@@ -16,9 +16,10 @@ export interface FactoryRenounceRoleArgs extends WriteAccountOverride {
16
16
  * resolved sending account. To remove a role from somebody else use
17
17
  * {@link useFactoryRevokeRole}.
18
18
  *
19
- * **No floor stops a sole admin renouncing here**, unlike an airdrop instance's
20
- * `LastAdmin` guard. A sole `DEFAULT_ADMIN_ROLE` holder renouncing freezes role
21
- * administration permanently; grant a successor first.
19
+ * **A sole `DEFAULT_ADMIN_ROLE` holder cannot renounce** (audit-14): the factory
20
+ * carries the same `LastAdmin` floor the instances do, so the call reverts
21
+ * instead of freezing role administration permanently. Grant the successor
22
+ * first, then renounce.
22
23
  *
23
24
  * **Invalidates:** every {@link useFactoryHasRole} entry for this factory
24
25
  * (prefix, all role/holder pairs), plus its {@link useFactoryRoleMembers} entry
@@ -14,13 +14,15 @@ export interface FactoryRevokeRoleArgs extends WriteAccountOverride {
14
14
  *
15
15
  * Requires `DEFAULT_ADMIN_ROLE`, which administers all five factory roles.
16
16
  *
17
- * **The factory declares no "never empty" floor.** Revoking the last
18
- * `DEFAULT_ADMIN_ROLE` holder succeeds and permanently freezes role
19
- * administration - no role can ever be granted or revoked again, including
20
- * putting an admin back. The four operational roles keep working for whoever
21
- * already holds them, with no way to rotate them. On the live deployment all
22
- * five roles sit on one key, so show {@link useFactoryRoleMembers}'s `count`
23
- * next to the button and grant the successor first.
17
+ * **`DEFAULT_ADMIN_ROLE` is floored at one live member** (audit-14). Revoking
18
+ * the last holder reverts `LastAdmin` rather than succeeding and freezing role
19
+ * administration, which is what it used to do. Granting the role to the zero
20
+ * address reverts `ZeroAdminGrant`, so the floor cannot be satisfied with a
21
+ * member nobody controls either.
22
+ *
23
+ * On the live deployment all five roles sit on one key, so a handover is two
24
+ * steps: grant the successor, then revoke. Show {@link useFactoryRoleMembers}'s
25
+ * `count` next to the button and disable it at `1n`.
24
26
  *
25
27
  * **Invalidates:** this factory's {@link useFactoryHasRole} entry for exactly
26
28
  * `(role, holder)` and its {@link useFactoryRoleMembers} entry for `role`.
@@ -26,10 +26,11 @@ export interface UseFactoryRoleMembersArgs extends AirdropHookOptions<FactoryRol
26
26
  * trusting a fixed string that describes one deployment at one moment.
27
27
  *
28
28
  * `count` is bundled with the list rather than split into its own hook because
29
- * it is what a UI needs in the same render to decide whether a revoke is safe -
30
- * the factory declares no "never empty" floor, so revoking the last
31
- * `DEFAULT_ADMIN_ROLE` holder succeeds and permanently freezes all role
32
- * administration.
29
+ * it is what a UI needs in the same render to decide whether a revoke will be
30
+ * accepted: since audit-14 the factory floors `DEFAULT_ADMIN_ROLE` at one live
31
+ * member, so revoking or renouncing the last holder reverts `LastAdmin`.
32
+ * Disable the button at `count === 1n` rather than letting the user burn gas
33
+ * discovering it.
33
34
  *
34
35
  * Unpaginated: factory role sets are operator-sized, not user-sized.
35
36
  *
@@ -40,7 +41,7 @@ export interface UseFactoryRoleMembersArgs extends AirdropHookOptions<FactoryRol
40
41
  *
41
42
  * @example
42
43
  * const { data } = useFactoryRoleMembers({ role: roles?.DEFAULT_ADMIN_ROLE });
43
- * const lastAdmin = data?.count === 1n;
44
+ * const lastAdmin = data?.count === 1n; // revoke/renounce would revert LastAdmin
44
45
  *
45
46
  * @alpha
46
47
  */
@@ -11,18 +11,18 @@ export interface SetComplianceDelegateArgs extends WriteAccountOverride {
11
11
  * Set the platform-designated compliance delegate that every new
12
12
  * compliance-manager clone wires in. Requires `COMPLIANCE_WIRING_ROLE`.
13
13
  *
14
- * **Ordering is load-bearing.** Call this before
15
- * {@link useSetDefaultDelegateToCompliance} with `on: true` - turning
16
- * delegation on while no delegate is set reverts `ZeroComplianceDelegate`. An
17
- * admin panel must sequence the two writes, and read
18
- * {@link useFactoryComplianceDelegate} to decide whether the toggle is even
19
- * offerable.
14
+ * The factory's constructor seeded a non-zero delegate with delegation ON, so this only
15
+ * rotates it: it can never be cleared, and the zero address always reverts
16
+ * `ZeroComplianceDelegate`. There is no ordering against
17
+ * {@link useSetDefaultDelegateToCompliance}.
20
18
  *
21
19
  * Applies to FUTURE clones only; it cannot retro-wire managers that already
22
20
  * exist.
23
21
  *
24
22
  * **Invalidates:** the factory's `fn "complianceDelegate"` entry
25
- * ({@link useFactoryComplianceDelegate}).
23
+ * ({@link useFactoryComplianceDelegate}), and every cached
24
+ * {@link usePreflightCreateAirdrop} report on this factory, whose
25
+ * `commitments.complianceDelegate` this write moves.
26
26
  *
27
27
  * @example
28
28
  * const setDelegate = useSetComplianceDelegate();
@@ -16,7 +16,9 @@ export interface SetComplianceManagerImplArgs extends WriteAccountOverride {
16
16
  * fleet-wide upgrade.
17
17
  *
18
18
  * **Invalidates:** the factory's `fn "implementations"` entry, which carries
19
- * `complianceManagerImpl` alongside the ECDSA/Merkle pointers.
19
+ * `complianceManagerImpl` alongside the ECDSA/Merkle pointers, and every cached
20
+ * {@link usePreflightCreateAirdrop} report on this factory, whose
21
+ * `commitments.complianceManagerImpl` this write moves.
20
22
  *
21
23
  * @example
22
24
  * const setImpl = useSetComplianceManagerImpl();
@@ -17,7 +17,8 @@ export interface SetCompliancePolicyArgs extends WriteAccountOverride {
17
17
  * `fn "effectiveDelegateToCompliance"`, both keyed on `args.creator` - the
18
18
  * TARGET creator, never the sending admin. Keying on the sender would leave
19
19
  * the panel's view of the creator it just edited stale while invalidating an
20
- * entry nobody rendered.
20
+ * entry nobody rendered. Also every cached {@link usePreflightCreateAirdrop}
21
+ * report on this factory, whose `commitments.complianceDelegate` this write moves.
21
22
  *
22
23
  * @example
23
24
  * const setPolicy = useSetCompliancePolicy();
@@ -17,7 +17,10 @@ export interface SetCustomFeeArgs extends WriteAccountOverride {
17
17
  * **Invalidates:** `useFactoryCustomFee({ creator })` for the TARGET creator -
18
18
  * `variables.creator`, never the sending admin. `account` is the submitter and
19
19
  * has no cache entry of its own here, so keying the invalidation off it would
20
- * refresh the wrong row and leave the edited one stale.
20
+ * refresh the wrong row and leave the edited one stale. Also every
21
+ * `useResolveGasFee` entry, since an override is what that hook resolves, and every
22
+ * cached {@link usePreflightCreateAirdrop} report on this factory, whose
23
+ * fee blockers (the `maxGasFee` ceiling and `GasFeeNotAcceptedError`) this write moves.
21
24
  *
22
25
  * @example
23
26
  * const setCustomFee = useSetCustomFee();
@@ -11,16 +11,17 @@ export interface SetDefaultDelegateToComplianceArgs extends WriteAccountOverride
11
11
  * Set the factory-wide default for whether new instances delegate compliance
12
12
  * disclosure to the platform delegate. Requires `COMPLIANCE_WIRING_ROLE`.
13
13
  *
14
- * **Ordering is load-bearing.** `on: true` reverts `ZeroComplianceDelegate`
15
- * unless {@link useSetComplianceDelegate} has already set a delegate - read
16
- * {@link useFactoryComplianceDelegate} first and sequence the two writes.
14
+ * The default starts ON at factory construction; `on: false` is the deliberate
15
+ * global opt-out. A per-creator {@link useSetCompliancePolicy} override still wins.
17
16
  *
18
17
  * **Invalidates:** the `fn "effectiveDelegateToCompliance"` PREFIX and the
19
18
  * `fn "compliancePolicy"` PREFIX - every cached creator at once, because this
20
19
  * write is chain-wide: any creator without an override moves with the
21
20
  * default, and {@link useFactoryCompliancePolicy}'s bundle carries the
22
21
  * resolved `effective` field. Contrast {@link useSetCompliancePolicy}, which
23
- * stays keyed on the one creator it targets.
22
+ * stays keyed on the one creator it targets. Also every cached
23
+ * {@link usePreflightCreateAirdrop} report on this factory, whose
24
+ * `commitments.complianceDelegate` this write moves.
24
25
  *
25
26
  * @example
26
27
  * const setDefault = useSetDefaultDelegateToCompliance();
@@ -15,9 +15,13 @@ export interface SetDefaultGasFeeArgs extends WriteAccountOverride {
15
15
  * instance's `gasFee()` is baked in at create time, so no deployed campaign's
16
16
  * fee changes.
17
17
  *
18
- * **Invalidates:** this factory's `useFactoryFees` entry (fn `"fees"`) only.
19
- * Deliberately NOT any instance's fn `"gasFee"` key - those are immutable
20
- * per instance and invalidating them would refetch unchanged values.
18
+ * **Invalidates:** this factory's `useFactoryFees` entry (fn `"fees"`) and every
19
+ * `useResolveGasFee` entry - the default is what resolves for every creator
20
+ * without an override, so all of them move at once. Deliberately NOT any
21
+ * instance's fn `"gasFee"` key: those are frozen at create and invalidating
22
+ * them would refetch unchanged values. Also every cached
23
+ * {@link usePreflightCreateAirdrop} report on this factory, whose
24
+ * fee blockers (the `maxGasFee` ceiling and `GasFeeNotAcceptedError`) this write moves.
21
25
  *
22
26
  * @example
23
27
  * const setDefaultFee = useSetDefaultGasFee();
@@ -0,0 +1,37 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { Hex } from "viem";
3
+ import type { WriteAccountOverride } from "../../airdrop-base.js";
4
+ import { type AirdropClientOptions } from "../../react/_shared.js";
5
+ /** @alpha */
6
+ export interface SetMaxGasFeeArgs extends WriteAccountOverride {
7
+ /** The factory-wide ceiling in wei, `uint96` on-chain. `0n` admits only a zero fee. */
8
+ maxGasFee: bigint;
9
+ }
10
+ /**
11
+ * Set the factory's ceiling on every fee `setDefaultGasFee` / `setCustomFee` may
12
+ * configure, and on the fee resolved at create.
13
+ *
14
+ * Requires `DEFAULT_ADMIN_ROLE`, deliberately not `FEE_MANAGER_ROLE` (audit-09):
15
+ * the fee manager moves fees only within a bound the admin owns. This is the
16
+ * one fee control that is not a fee-manager operation.
17
+ *
18
+ * **Lowering it does not rewrite an already-configured fee.** The stale value
19
+ * stays in storage and reverts `GasFeeExceedsMaximum` at the next create until
20
+ * it is lowered too, so a reduction is two steps, not one.
21
+ *
22
+ * **Invalidates:** this factory's `useFactoryFees` entry (fn `"fees"`, which
23
+ * carries `maxGasFee`) and every `useResolveGasFee` entry. The ceiling is checked
24
+ * at create time, and lowering it below existing fees is allowed: a create whose
25
+ * resolved fee is above it then reverts `GasFeeExceedsMaximum`. Deliberately NOT
26
+ * any instance's fn `"gasFee"` key - an instance's fee is frozen at create and
27
+ * cannot move. Also every cached {@link usePreflightCreateAirdrop} report on this
28
+ * factory: the preflight reports a resolved fee above the ceiling as a blocker,
29
+ * so the new ceiling must reach it.
30
+ *
31
+ * @example
32
+ * const setCeiling = useSetMaxGasFee();
33
+ * await setCeiling.mutateAsync({ maxGasFee: parseEther("0.5") });
34
+ *
35
+ * @alpha
36
+ */
37
+ export declare function useSetMaxGasFee(options?: AirdropClientOptions): UseMutationResult<Hex, Error, SetMaxGasFeeArgs>;