@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,44 +1,11 @@
1
1
  import type { Account, Address, Hex, PublicClient, WalletClient } from "viem";
2
2
  import { type SdkTelemetry } from "../core/telemetry.js";
3
+ import type { ReceiptMode } from "../core/pending.js";
3
4
  import type { EncryptedInput } from "../fhe/types.js";
4
5
  import type { WriteAccountOverride } from "./airdrop-base.js";
5
- import { type DeploymentMode } from "./constants.js";
6
+ import type { DeploymentMode } from "./constants.js";
6
7
  import { type EncryptorSource } from "./encryption.js";
7
- import type { CommonAirdropParams, CreateAirdropArgs, CreateAirdropResult, EcdsaAirdropParams, MerkleAirdropParams } from "./types.js";
8
- /** The on-chain `CommonAirdropParams` struct, field-for-field. */
9
- interface ContractCommonParams {
10
- token: Address;
11
- startTime: number;
12
- endTime: number;
13
- canExtendClaimWindow: boolean;
14
- unwrappable: boolean;
15
- complianceAdmin: Address;
16
- }
17
- /**
18
- * Convert the SDK's `"clone"` / `"uups"` name to the contract's
19
- * `DeploymentMode` ordinal.
20
- *
21
- * The string union is the SDK's currency everywhere else; the ordinal exists
22
- * only at the ABI edge. Keeping the conversion in one exported function makes
23
- * an inverted mapping a one-line test failure rather than a silently
24
- * upgradeable instance.
25
- *
26
- * @param mode Deployment shell to select.
27
- * @returns The `uint8` the factory expects.
28
- */
29
- export declare function toDeploymentModeOrdinal(mode: DeploymentMode): number;
30
- /**
31
- * Project {@link CommonAirdropParams} onto the contract's struct.
32
- *
33
- * The two shapes are already identical, so this is a re-assembly rather than a
34
- * translation — and that is the point: it pins the field set and their order to
35
- * the vendored ABI, so a struct change in a future contract commit surfaces
36
- * here instead of as a silently mis-encoded tuple.
37
- *
38
- * @param common Create-time fields shared by both airdrop variants.
39
- * @returns The struct in the ABI's declared field order.
40
- */
41
- export declare function toContractCommonParams(common: CommonAirdropParams): ContractCommonParams;
8
+ import type { AirdropVariantParams, CreateAirdropArgs, CreateAirdropResult, CreateCommitments, CreateMerkleAirdropArgs, EcdsaAirdropParams, MerkleAirdropParams, PendingCreateAirdropResult } from "./types.js";
42
9
  /** @alpha */
43
10
  export interface ConfidentialAirdropFactoryClientConfig {
44
11
  publicClient: PublicClient;
@@ -188,6 +155,14 @@ export declare const FACTORY_ROLE_CONCENTRATION_NOTE = "The live factory holds a
188
155
  * exists; splitting roles is a contracts-repo decision, not something this
189
156
  * client can arrange.
190
157
  *
158
+ * **Safe / multisig signers.** The four creates take `waitForReceipt: false`
159
+ * and return the committed addresses with `pending: true` (see
160
+ * {@link PendingCreateAirdropResult}). `fundAirdrop` and the admin
161
+ * writes already return a bare hash; the operator approval they need
162
+ * (`setOperator`, `@tokenops/sdk/fhe`) takes `waitForReceipt: false` as well. A post-create role split goes through
163
+ * {@link planInstanceRoleSplit} plus {@link encodeInstanceRoleSplit} as one
164
+ * MultiSend batch, not `grantInstanceRoles`.
165
+ *
191
166
  * @example
192
167
  * const factory = createConfidentialAirdropFactoryClient({ publicClient, walletClient });
193
168
  * const { airdrop, complianceManager } = await factory.createMerkleAirdrop({
@@ -216,9 +191,14 @@ export declare class ConfidentialAirdropFactoryClient {
216
191
  * read-only form of the same checks.
217
192
  *
218
193
  * @param args Instance parameters, deployment shell and the caller's salt.
219
- * @returns The tx hash, the deployed instance and its compliance-manager clone.
194
+ * @returns The tx hash, the deployed instance, its compliance-manager clone, the clone's
195
+ * implementation and the platform delegate it was wired with. With `waitForReceipt: false`,
196
+ * a {@link PendingCreateAirdropResult}.
197
+ * @throws {@link InvalidArgumentError} on `gasFee` when the resolved fee exceeds the factory's `maxGasFee` ceiling, checked before the creator's bound.
198
+ * @throws {@link GasFeeNotAcceptedError} when the factory resolves a fee above `common.maxAcceptedGasFee`.
220
199
  * @throws {@link NonStockWrapperError} when `unwrappable` is set on a token that is not a stock wrapper.
221
200
  * @throws {@link SaltCollisionError} when this `(mode, deployer, userSalt)` tuple already deployed an instance.
201
+ * @throws {@link CreateCommitmentMismatchError} when a quoted or pinned commitment no longer matches what the factory would deploy.
222
202
  * @throws {@link UpgradeabilityNotAllowedError} when `mode: "uups"` is not permitted for the creator.
223
203
  * @throws {@link InvalidArgumentError} when `userSalt` was already consumed by this creator and mode.
224
204
  *
@@ -229,7 +209,11 @@ export declare class ConfidentialAirdropFactoryClient {
229
209
  * userSalt: keccak256(toBytes("campaign-42")),
230
210
  * });
231
211
  */
232
- createEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & WriteAccountOverride): Promise<CreateAirdropResult>;
212
+ createEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & WriteAccountOverride & ReceiptMode<true>): Promise<CreateAirdropResult>;
213
+ /** With `waitForReceipt: false`: returns on submission, before the receipt exists. */
214
+ createEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & WriteAccountOverride & ReceiptMode<false>): Promise<PendingCreateAirdropResult>;
215
+ /** With a runtime `boolean`: either result, narrowed by `pending`. */
216
+ createEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & WriteAccountOverride & ReceiptMode): Promise<CreateAirdropResult | PendingCreateAirdropResult>;
233
217
  /**
234
218
  * Deploy a Merkle-proof airdrop instance.
235
219
  *
@@ -239,14 +223,43 @@ export declare class ConfidentialAirdropFactoryClient {
239
223
  * across that change reinterprets live storage. See
240
224
  * {@link MerkleUupsUnsupportedError}.
241
225
  *
242
- * @param args Instance parameters, deployment shell and the caller's salt.
243
- * @returns The tx hash, the deployed instance and its compliance-manager clone.
226
+ * **Creating from a plan.** Pass the {@link PlannedCampaign} as `plan`, with
227
+ * `merkleRoot: plan.root`. The plan's leaves are bound to `plan.predictedAddress`, so the
228
+ * create pins it, refuses a root that differs from `plan.root`, and refuses to send once
229
+ * the factory's Merkle implementation has moved since the plan was taken
230
+ * ({@link PredictionDriftError}). A rotation landing after that check is still refused by
231
+ * the contract ({@link CreateCommitmentMismatchError}). `expected: { airdrop: plan.predictedAddress }`
232
+ * is the lower-level equivalent of the pin alone.
233
+ *
234
+ * @example
235
+ * const plan = await planMerkleCampaign({
236
+ * factory, params, mode, creator, userSalt, recipients, encryptor,
237
+ * });
238
+ * await factory.createMerkleAirdrop({
239
+ * params: { ...params, merkleRoot: plan.root, isMerkleRootMutable: false },
240
+ * mode,
241
+ * userSalt,
242
+ * plan,
243
+ * });
244
+ *
245
+ * @param args Instance parameters, deployment shell, the caller's salt and, optionally, the plan being realised.
246
+ * @returns The tx hash, the deployed instance, its compliance-manager clone, the clone's
247
+ * implementation and the platform delegate it was wired with. With `waitForReceipt: false`,
248
+ * a {@link PendingCreateAirdropResult}.
249
+ * @throws {@link InvalidArgumentError} on `gasFee` when the resolved fee exceeds the factory's `maxGasFee` ceiling, checked before the creator's bound.
250
+ * @throws {@link GasFeeNotAcceptedError} when the factory resolves a fee above `common.maxAcceptedGasFee`.
244
251
  * @throws {@link MerkleUupsUnsupportedError} when `mode` is `"uups"`.
245
252
  * @throws {@link NonStockWrapperError} when `unwrappable` is set on a token that is not a stock wrapper.
246
253
  * @throws {@link SaltCollisionError} when this `(mode, deployer, userSalt)` tuple already deployed an instance.
247
- * @throws {@link InvalidArgumentError} when the root is zero and `isMerkleRootMutable` is false, or the salt was already used.
254
+ * @throws {@link CreateCommitmentMismatchError} when a quoted or pinned commitment no longer matches what the factory would deploy.
255
+ * @throws {@link PredictionDriftError} when `plan` is given and the factory's Merkle implementation moved since it was taken.
256
+ * @throws {@link InvalidArgumentError} when the root is zero and `isMerkleRootMutable` is false, the salt was already used, or `params.merkleRoot` / `expected.airdrop` disagrees with `plan`.
248
257
  */
249
- createMerkleAirdrop(args: CreateAirdropArgs<MerkleAirdropParams> & WriteAccountOverride): Promise<CreateAirdropResult>;
258
+ createMerkleAirdrop(args: CreateMerkleAirdropArgs & WriteAccountOverride & ReceiptMode<true>): Promise<CreateAirdropResult>;
259
+ /** With `waitForReceipt: false`: returns on submission, before the receipt exists. */
260
+ createMerkleAirdrop(args: CreateMerkleAirdropArgs & WriteAccountOverride & ReceiptMode<false>): Promise<PendingCreateAirdropResult>;
261
+ /** With a runtime `boolean`: either result, narrowed by `pending`. */
262
+ createMerkleAirdrop(args: CreateMerkleAirdropArgs & WriteAccountOverride & ReceiptMode): Promise<CreateAirdropResult | PendingCreateAirdropResult>;
250
263
  /**
251
264
  * Deploy an ECDSA airdrop and seed its pool in the same transaction.
252
265
  *
@@ -260,12 +273,21 @@ export declare class ConfidentialAirdropFactoryClient {
260
273
  * does not prove the pool was funded — confirm the funder's balance first.
261
274
  *
262
275
  * @param args Create arguments plus exactly one of `amount` / `encryptedInput`.
263
- * @returns The tx hash, the deployed instance and its compliance-manager clone.
276
+ * @returns The tx hash, the deployed instance, its compliance-manager clone, the clone's
277
+ * implementation and the platform delegate it was wired with. With `waitForReceipt: false`,
278
+ * a {@link PendingCreateAirdropResult}.
279
+ * @throws {@link InvalidArgumentError} on `gasFee` when the resolved fee exceeds the factory's `maxGasFee` ceiling, checked before the creator's bound.
280
+ * @throws {@link GasFeeNotAcceptedError} when the factory resolves a fee above `common.maxAcceptedGasFee`.
264
281
  * @throws {@link NonStockWrapperError} when `unwrappable` is set on a token that is not a stock wrapper.
265
282
  * @throws {@link SaltCollisionError} when this `(mode, deployer, userSalt)` tuple already deployed an instance.
283
+ * @throws {@link CreateCommitmentMismatchError} when a quoted or pinned commitment no longer matches what the factory would deploy.
266
284
  * @throws {@link MissingEncryptorError} when `amount` is given and no encryptor is resolvable.
267
285
  */
268
- createAndFundEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & FundInput & WriteAccountOverride): Promise<CreateAirdropResult>;
286
+ createAndFundEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & FundInput & WriteAccountOverride & ReceiptMode<true>): Promise<CreateAirdropResult>;
287
+ /** With `waitForReceipt: false`: returns on submission, before the receipt exists. */
288
+ createAndFundEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & FundInput & WriteAccountOverride & ReceiptMode<false>): Promise<PendingCreateAirdropResult>;
289
+ /** With a runtime `boolean`: either result, narrowed by `pending`. */
290
+ createAndFundEcdsaAirdrop(args: CreateAirdropArgs<EcdsaAirdropParams> & FundInput & WriteAccountOverride & ReceiptMode): Promise<CreateAirdropResult | PendingCreateAirdropResult>;
269
291
  /**
270
292
  * Deploy a Merkle airdrop and seed its pool in the same transaction.
271
293
  *
@@ -277,14 +299,31 @@ export declare class ConfidentialAirdropFactoryClient {
277
299
  * because reverting would leak the balance. A successful receipt therefore
278
300
  * does not prove the pool was funded.
279
301
  *
280
- * @param args Create arguments plus exactly one of `amount` / `encryptedInput`.
281
- * @returns The tx hash, the deployed instance and its compliance-manager clone.
302
+ * **Creating from a plan.** Pass the {@link PlannedCampaign} as `plan`, with
303
+ * `merkleRoot: plan.root`, exactly as for {@link createMerkleAirdrop}: the address is pinned,
304
+ * the root and the Merkle init-code hash are checked, and both checks run before anything is
305
+ * encrypted. `expected: { airdrop: plan.predictedAddress }` is the lower-level equivalent of
306
+ * the pin alone.
307
+ *
308
+ * @param args Create arguments plus exactly one of `amount` / `encryptedInput`, and optionally the plan being realised.
309
+ * @returns The tx hash, the deployed instance, its compliance-manager clone, the clone's
310
+ * implementation and the platform delegate it was wired with. With `waitForReceipt: false`,
311
+ * a {@link PendingCreateAirdropResult}.
312
+ * @throws {@link InvalidArgumentError} on `gasFee` when the resolved fee exceeds the factory's `maxGasFee` ceiling, checked before the creator's bound.
313
+ * @throws {@link GasFeeNotAcceptedError} when the factory resolves a fee above `common.maxAcceptedGasFee`.
282
314
  * @throws {@link MerkleUupsUnsupportedError} when `mode` is `"uups"`.
283
315
  * @throws {@link NonStockWrapperError} when `unwrappable` is set on a token that is not a stock wrapper.
284
316
  * @throws {@link SaltCollisionError} when this `(mode, deployer, userSalt)` tuple already deployed an instance.
317
+ * @throws {@link CreateCommitmentMismatchError} when a quoted or pinned commitment no longer matches what the factory would deploy.
285
318
  * @throws {@link MissingEncryptorError} when `amount` is given and no encryptor is resolvable.
319
+ * @throws {@link PredictionDriftError} when `plan` is given and the factory's Merkle implementation moved since it was taken.
320
+ * @throws {@link InvalidArgumentError} when `params.merkleRoot` or `expected.airdrop` disagrees with `plan`.
286
321
  */
287
- createAndFundMerkleAirdrop(args: CreateAirdropArgs<MerkleAirdropParams> & FundInput & WriteAccountOverride): Promise<CreateAirdropResult>;
322
+ createAndFundMerkleAirdrop(args: CreateMerkleAirdropArgs & FundInput & WriteAccountOverride & ReceiptMode<true>): Promise<CreateAirdropResult>;
323
+ /** With `waitForReceipt: false`: returns on submission, before the receipt exists. */
324
+ createAndFundMerkleAirdrop(args: CreateMerkleAirdropArgs & FundInput & WriteAccountOverride & ReceiptMode<false>): Promise<PendingCreateAirdropResult>;
325
+ /** With a runtime `boolean`: either result, narrowed by `pending`. */
326
+ createAndFundMerkleAirdrop(args: CreateMerkleAirdropArgs & FundInput & WriteAccountOverride & ReceiptMode): Promise<CreateAirdropResult | PendingCreateAirdropResult>;
288
327
  /**
289
328
  * Top up the pool of an instance this factory already deployed.
290
329
  *
@@ -293,12 +332,22 @@ export declare class ConfidentialAirdropFactoryClient {
293
332
  * grants the compliance-manager clone its ACL on the amount. Sending tokens
294
333
  * to the instance directly leaves the pool unusable for compliance reads.
295
334
  *
335
+ * The token pulled is the one the factory recorded at create ({@link tokenOf}), not
336
+ * whatever the instance reports today.
337
+ *
338
+ * Prerequisite: the funder approved the factory as an ERC-7984 operator on that token
339
+ * (`setOperator` / `ensureOperator` from `@tokenops/sdk/fhe`). Those wait for their receipt
340
+ * by default, so a Safe passes `waitForReceipt: false` there too and lets the approval
341
+ * execute before this transaction does.
342
+ *
296
343
  * **Silent-zero transfers.** A short encrypted balance moves an encrypted
297
344
  * zero instead of reverting — the receipt cannot tell you value arrived.
298
345
  *
299
346
  * @param args The instance address plus exactly one of `amount` / `encryptedInput`.
300
347
  * @returns The transaction hash.
301
348
  * @throws {@link InvalidArgumentError} when `airdrop` was not created by this factory (`UnknownAirdrop`).
349
+ * @throws {@link InvalidArgumentError} when both or neither of `amount` / `encryptedInput` is supplied.
350
+ * @throws {@link MissingEncryptorError} when `amount` is given and no encryptor is resolvable.
302
351
  */
303
352
  fundAirdrop(args: {
304
353
  airdrop: Address;
@@ -362,16 +411,39 @@ export declare class ConfidentialAirdropFactoryClient {
362
411
  * @returns The page, possibly shorter than `limit`.
363
412
  */
364
413
  airdrops(offset: bigint, limit: bigint): Promise<readonly Address[]>;
414
+ /**
415
+ * Whether THIS factory created `candidate` - the genuineness check.
416
+ *
417
+ * Nothing observable at an instance proves which factory, if any, deployed
418
+ * it: an attacker can deploy a contract with the same ABI, the same events
419
+ * and a pool it controls. The only trustworthy question is whether the
420
+ * canonical factory's own registry contains the address, which is why this
421
+ * read has to be addressed to a factory taken from
422
+ * `src/core/addresses.ts` rather than one the instance names.
423
+ *
424
+ * @param candidate The address to check.
425
+ * @returns True when this factory's registry contains `candidate`.
426
+ */
427
+ isAirdrop(candidate: Address): Promise<boolean>;
365
428
  /**
366
429
  * The compliance-manager clone bound to an instance.
367
430
  *
368
- * Doubles as a provenance check: the factory records this mapping only for
369
- * instances it deployed, so a zero address means the instance is not ours.
431
+ * Doubles as a provenance check, though a weaker one than {@link isAirdrop}:
432
+ * the factory records this mapping only for instances it deployed, so a zero
433
+ * address means the instance is not ours.
370
434
  *
371
435
  * @param airdrop Instance address.
372
436
  * @returns The clone address, or the zero address when unknown to this factory.
373
437
  */
374
438
  complianceManagerOf(airdrop: Address): Promise<Address>;
439
+ /**
440
+ * The token recorded for `airdrop` at create - what {@link fundAirdrop} pulls, regardless
441
+ * of what the instance reports today.
442
+ *
443
+ * @param airdrop Instance address.
444
+ * @returns The token address, or the zero address when unknown to this factory.
445
+ */
446
+ tokenOf(airdrop: Address): Promise<Address>;
375
447
  /**
376
448
  * Redirect where accrued claim-fee ETH withdraws to. Requires
377
449
  * `FEE_MANAGER_ROLE`.
@@ -403,12 +475,43 @@ export declare class ConfidentialAirdropFactoryClient {
403
475
  feeCollector(): Promise<Address>;
404
476
  /** Per-claim gas fee new instances default to absent a {@link setCustomFee} override. */
405
477
  defaultGasFee(): Promise<bigint>;
478
+ /** The factory's own ceiling on every configurable fee and every create-time resolved fee. */
479
+ maxGasFee(): Promise<bigint>;
480
+ /**
481
+ * Set the factory's ceiling on every fee `setDefaultGasFee`/`setCustomFee`
482
+ * may configure, and on the fee resolved at create.
483
+ *
484
+ * Requires `DEFAULT_ADMIN_ROLE`, deliberately not `FEE_MANAGER_ROLE`: the fee
485
+ * manager moves fees only within a bound the admin controls. `0n` admits a
486
+ * zero fee and nothing else.
487
+ *
488
+ * Lowering it below an already-configured fee does not rewrite that fee - the
489
+ * stale value stays in storage and reverts `GasFeeExceedsMaximum` at the next
490
+ * create until it is lowered too. The contract sets no lower bound, so this call
491
+ * itself does not revert on that account.
492
+ */
493
+ setMaxGasFee(maxGasFee: bigint, account?: Account | Address): Promise<Hex>;
494
+ /**
495
+ * The per-claim fee a `create*` from `creator` would freeze into the new
496
+ * instance right now: their {@link getCustomFee} override when enabled, else
497
+ * {@link defaultGasFee}.
498
+ *
499
+ * This is the number `CommonAirdropParams.maxAcceptedGasFee` is checked
500
+ * against, so it is also what to show a creator before they choose a bound.
501
+ * It is a snapshot, not a quote: `FEE_MANAGER_ROLE` can move it between this
502
+ * read and the create, which is exactly what the bound exists to catch.
503
+ *
504
+ * @param creator The account that will send `create*`.
505
+ * @returns The resolved fee in wei.
506
+ */
507
+ resolveGasFee(creator: Address): Promise<bigint>;
406
508
  /**
407
509
  * Point future `createEcdsaAirdrop*` calls at a new ECDSA implementation.
408
510
  * Requires `IMPL_MANAGER_ROLE`. Does not affect already-deployed instances —
409
511
  * clones point at the implementation live when they were created.
410
512
  *
411
513
  * @throws {@link InvalidArgumentError} when `implementation` is the zero address (`ZeroImplementation`).
514
+ * @throws {@link InvalidArgumentError} when `implementation` has no code or is an EIP-7702 delegation designator (`InvalidImplementation`).
412
515
  */
413
516
  setEcdsaImplementation(implementation: Address, account?: Account | Address): Promise<Hex>;
414
517
  /**
@@ -416,6 +519,7 @@ export declare class ConfidentialAirdropFactoryClient {
416
519
  * Requires `IMPL_MANAGER_ROLE`. Does not affect already-deployed instances.
417
520
  *
418
521
  * @throws {@link InvalidArgumentError} when `implementation` is the zero address (`ZeroImplementation`).
522
+ * @throws {@link InvalidArgumentError} when `implementation` has no code or is an EIP-7702 delegation designator (`InvalidImplementation`).
419
523
  */
420
524
  setMerkleImplementation(implementation: Address, account?: Account | Address): Promise<Hex>;
421
525
  /** The implementation address `createEcdsaAirdrop*` currently clones. */
@@ -427,16 +531,17 @@ export declare class ConfidentialAirdropFactoryClient {
427
531
  * `COMPLIANCE_WIRING_ROLE`. Does not affect already-deployed clones.
428
532
  *
429
533
  * @throws {@link InvalidArgumentError} when `implementation` is the zero address (`ZeroComplianceManagerImpl`).
534
+ * @throws {@link InvalidArgumentError} when `implementation` has no code or is an EIP-7702 delegation designator (`InvalidImplementation`).
430
535
  */
431
536
  setComplianceManagerImpl(implementation: Address, account?: Account | Address): Promise<Hex>;
432
537
  /**
433
538
  * Set the platform-designated compliance delegate every compliance-manager
434
539
  * clone wires in. Requires `COMPLIANCE_WIRING_ROLE`.
435
540
  *
436
- * **Ordering:** call this before {@link setDefaultDelegateToCompliance}`(true)`
437
- * — the contracts' own deploy script does it in this order, and the reverse
438
- * reverts `ZeroComplianceDelegate` (turning delegation on with no delegate
439
- * set has nothing to delegate to).
541
+ * The factory's constructor already seeded a non-zero delegate with delegation ON, so
542
+ * this only rotates it: it can never be cleared, and the zero address always reverts.
543
+ * Applies to clones created after it lands; existing clones keep the delegate they were
544
+ * initialized with.
440
545
  *
441
546
  * @throws {@link InvalidArgumentError} when `delegate` is the zero address (`ZeroComplianceDelegate`).
442
547
  */
@@ -445,10 +550,8 @@ export declare class ConfidentialAirdropFactoryClient {
445
550
  * Set whether new instances default to delegating compliance disclosure to
446
551
  * {@link complianceDelegate}. Requires `COMPLIANCE_WIRING_ROLE`.
447
552
  *
448
- * **Ordering:** call {@link setComplianceDelegate} first when turning this
449
- * on — passing `true` while no delegate is set reverts `ZeroComplianceDelegate`.
450
- *
451
- * @throws {@link InvalidArgumentError} when `on` is `true` and no delegate is set yet (`ZeroComplianceDelegate`).
553
+ * The default starts ON at construction (no post-deploy wiring); passing `false` is the
554
+ * deliberate opt-out. A per-creator {@link setCompliancePolicy} override still wins.
452
555
  */
453
556
  setDefaultDelegateToCompliance(on: boolean, account?: Account | Address): Promise<Hex>;
454
557
  /**
@@ -465,6 +568,24 @@ export declare class ConfidentialAirdropFactoryClient {
465
568
  complianceManagerImpl(): Promise<Address>;
466
569
  /** The platform-designated compliance delegate wired into new compliance-manager clones. */
467
570
  complianceDelegate(): Promise<Address>;
571
+ /**
572
+ * The platform delegate a create from `creator` would wire into its compliance clone:
573
+ * `complianceDelegate()` while the creator's effective policy is ON, the zero address
574
+ * while it is OFF. This is the value the factory checks `expectedComplianceDelegate`
575
+ * against.
576
+ */
577
+ resolveComplianceDelegate(creator: Address): Promise<Address>;
578
+ /**
579
+ * Quote the {@link CreateCommitments} a create from `deployer` will be checked against,
580
+ * honouring anything already pinned in `expected`. The predicted address comes from the
581
+ * variant's prediction oracle, the other two from the factory's live configuration.
582
+ */
583
+ quoteCreateCommitments(args: AirdropVariantParams & {
584
+ mode: DeploymentMode;
585
+ deployer: Address;
586
+ userSalt: Hex;
587
+ expected?: Partial<CreateCommitments> | undefined;
588
+ }): Promise<CreateCommitments>;
468
589
  /** A creator's delegate-to-compliance override, if any — `overridden: false` means the factory default applies instead. */
469
590
  getCompliancePolicy(creator: Address): Promise<CompliancePolicy>;
470
591
  /**
@@ -571,17 +692,14 @@ export declare class ConfidentialAirdropFactoryClient {
571
692
  /**
572
693
  * Revoke `role` from `holder`. Requires the role's admin role.
573
694
  *
574
- * Unlike an airdrop instance, the factory declares no "never empty" floor:
575
- * revoking the last `DEFAULT_ADMIN_ROLE` member succeeds, and what it
576
- * freezes is **role administration**, permanently. `DEFAULT_ADMIN_ROLE`
577
- * administers all four operational roles and itself, so with the set empty
578
- * no role can ever be granted or revoked again - including putting an admin
579
- * back. The four operational roles keep working for whoever already holds
580
- * them: a `FEE_MANAGER_ROLE` holder can still call {@link setDefaultGasFee},
581
- * an `IMPL_MANAGER_ROLE` holder can still rotate an implementation. The
582
- * factory therefore keeps running with exactly the role holders it had at
583
- * that moment, with no way to rotate or remove them. Grant the successor
584
- * first.
695
+ * **The factory floors `DEFAULT_ADMIN_ROLE` at one live member**, matching
696
+ * the instances. Renouncing or revoking the sole holder reverts `LastAdmin`,
697
+ * and granting the role to the zero address reverts `ZeroAdminGrant`, so the
698
+ * set can neither be emptied (which would freeze role administration
699
+ * permanently) nor satisfied by a member nobody controls.
700
+ *
701
+ * A handover is still available and is the supported way out: grant the
702
+ * successor first, then renounce.
585
703
  *
586
704
  * @returns The transaction hash.
587
705
  */
@@ -598,12 +716,9 @@ export declare class ConfidentialAirdropFactoryClient {
598
716
  * the resolved sending account. Renouncing for somebody else is not a call
599
717
  * that can succeed; use {@link revokeRole} to remove another account's role.
600
718
  *
601
- * The same frozen-role-administration warning as {@link revokeRole} applies,
602
- * and more sharply - a sole admin renouncing `DEFAULT_ADMIN_ROLE` is not
603
- * blocked here the way it is on an instance. Read that warning for what
604
- * actually stops working: role grants and revokes, permanently; not the
605
- * operational setters, which keep answering to whoever already holds the
606
- * role that gates them.
719
+ * The same `DEFAULT_ADMIN_ROLE` floor as {@link revokeRole} applies: the sole admin
720
+ * cannot renounce, the call reverts `LastAdmin`. Grant a successor first, then
721
+ * renounce.
607
722
  *
608
723
  * @returns The transaction hash.
609
724
  */
@@ -620,4 +735,3 @@ export declare class ConfidentialAirdropFactoryClient {
620
735
  * @alpha
621
736
  */
622
737
  export declare function createConfidentialAirdropFactoryClient(config: ConfidentialAirdropFactoryClientConfig): ConfidentialAirdropFactoryClient;
623
- export {};