@tokenops/sdk 1.1.1 → 1.6.0

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 (163) hide show
  1. package/CHANGELOG.md +158 -2
  2. package/README.md +18 -8
  3. package/SECURITY.md +7 -1
  4. package/dist/{chunk-56UI7LUR.cjs → chunk-2RNW4MIJ.cjs} +37 -0
  5. package/dist/{chunk-VDXVNZCO.cjs → chunk-43RFBQ73.cjs} +85 -29
  6. package/dist/{chunk-BE2AIZ3K.js → chunk-46T67CE2.js} +1 -1
  7. package/dist/{chunk-WRCUDSUJ.js → chunk-4KJ66YRH.js} +61 -3
  8. package/dist/{chunk-ITQ7WKVC.cjs → chunk-4ZCXK4VI.cjs} +68 -8
  9. package/dist/{chunk-JFLEEXKP.js → chunk-6WSNS3UV.js} +58 -2
  10. package/dist/{chunk-W7JHOK7G.cjs → chunk-7G7UOQV4.cjs} +4 -4
  11. package/dist/{chunk-5KHIQG7Y.cjs → chunk-AYGRYDBX.cjs} +35 -36
  12. package/dist/{chunk-5SGMJADP.cjs → chunk-BD4LZBVF.cjs} +85 -9
  13. package/dist/{chunk-OYLZEEHF.cjs → chunk-BK7YIVLK.cjs} +304 -179
  14. package/dist/{chunk-SEKC7H5Y.cjs → chunk-CBRL2PJA.cjs} +12 -11
  15. package/dist/{chunk-XWDVPV42.js → chunk-CNP4L3GF.js} +4 -4
  16. package/dist/{chunk-IVE3QEGD.js → chunk-DRSPMIZ7.js} +28 -1
  17. package/dist/{chunk-SAGJIEQK.cjs → chunk-EUKPOXWR.cjs} +15 -16
  18. package/dist/chunk-FT4LNBOS.js +11 -0
  19. package/dist/{chunk-ITQBDRWX.js → chunk-HETNKZEE.js} +1 -1
  20. package/dist/{chunk-JJ4R5QXF.js → chunk-KSDSXJ34.js} +1 -1
  21. package/dist/{chunk-SYHXDHWX.cjs → chunk-LBWRFZR3.cjs} +218 -31
  22. package/dist/{chunk-ZXCOJY2Z.js → chunk-NFW7AUEX.js} +1 -1
  23. package/dist/{chunk-FPQBFIUW.cjs → chunk-OL6SHN3D.cjs} +3 -3
  24. package/dist/{chunk-XSNLAS5M.js → chunk-PD7ME2BT.js} +75 -2
  25. package/dist/{chunk-FXCW7LVB.js → chunk-QET3Q4JP.js} +94 -9
  26. package/dist/{chunk-M7V2EDPB.js → chunk-QKKBBH7I.js} +2 -2
  27. package/dist/{chunk-XXXDQSHE.js → chunk-S2XD75JM.js} +12 -3
  28. package/dist/{chunk-5SA2HF2W.cjs → chunk-SPGSO5SO.cjs} +31 -22
  29. package/dist/{chunk-Q7ARQSUH.cjs → chunk-SYHNZSZZ.cjs} +3 -3
  30. package/dist/{chunk-X56UVEXS.js → chunk-TN65XNTI.js} +248 -120
  31. package/dist/chunk-U57COLUE.js +56 -0
  32. package/dist/{chunk-OQZAZIAS.js → chunk-UE5XK2SY.js} +193 -6
  33. package/dist/{chunk-NS44KBV5.cjs → chunk-UJS4N2XM.cjs} +12 -12
  34. package/dist/{chunk-IR5AK5U5.js → chunk-V5D7BHW3.js} +4 -5
  35. package/dist/{chunk-3PQ2RFPC.js → chunk-VHSNYUYV.js} +5 -4
  36. package/dist/{chunk-CQIPRNS7.cjs → chunk-VR3FREBX.cjs} +3 -3
  37. package/dist/{chunk-G7G75C46.cjs → chunk-WO72UBQD.cjs} +11 -11
  38. package/dist/chunk-WOEETTH7.cjs +59 -0
  39. package/dist/{chunk-QE7ZONJ2.js → chunk-WTK6JDSI.js} +4 -5
  40. package/dist/{chunk-3ZRHDTEX.cjs → chunk-WUXUWTFW.cjs} +3 -3
  41. package/dist/{chunk-23F7JIK5.cjs → chunk-YFIWCYHC.cjs} +141 -54
  42. package/dist/{chunk-FYQ2UW4T.js → chunk-YPYCWLYP.js} +1 -1
  43. package/dist/chunk-ZQUE2B3Q.cjs +33 -0
  44. package/dist/core/addresses.d.ts +1 -1
  45. package/dist/core/errors.d.ts +41 -1
  46. package/dist/core/revert-mapper.d.ts +77 -0
  47. package/dist/core/wagmi-compat.d.ts +40 -0
  48. package/dist/fhe/index.cjs +134 -68
  49. package/dist/fhe/index.d.cts +2 -1
  50. package/dist/fhe/index.d.ts +2 -1
  51. package/dist/fhe/index.js +64 -10
  52. package/dist/fhe/mock-erc7984.d.ts +4 -4
  53. package/dist/fhe/operators.d.ts +142 -2
  54. package/dist/fhe/react/index.cjs +21 -8
  55. package/dist/fhe/react/index.d.cts +2 -0
  56. package/dist/fhe/react/index.d.ts +2 -0
  57. package/dist/fhe/react/index.js +8 -3
  58. package/dist/fhe/react/useEnsureOperator.d.ts +56 -0
  59. package/dist/fhe/react/useIsOperator.d.ts +54 -0
  60. package/dist/fhe/sepolia-encryptor-web.d.ts +45 -4
  61. package/dist/fhe/sepolia-encryptor.d.ts +38 -0
  62. package/dist/fhe-airdrop/advanced/index.cjs +9 -9
  63. package/dist/fhe-airdrop/advanced/index.js +7 -7
  64. package/dist/fhe-airdrop/advanced/react/index.cjs +14 -14
  65. package/dist/fhe-airdrop/advanced/react/index.js +10 -10
  66. package/dist/fhe-airdrop/airdrop.d.ts +9 -0
  67. package/dist/fhe-airdrop/encryption.d.ts +8 -0
  68. package/dist/fhe-airdrop/factory.d.ts +86 -1
  69. package/dist/fhe-airdrop/index.cjs +69 -66
  70. package/dist/fhe-airdrop/index.d.cts +3 -3
  71. package/dist/fhe-airdrop/index.d.ts +3 -3
  72. package/dist/fhe-airdrop/index.js +7 -8
  73. package/dist/fhe-airdrop/react/index.cjs +176 -135
  74. package/dist/fhe-airdrop/react/index.d.cts +7 -4
  75. package/dist/fhe-airdrop/react/index.d.ts +7 -4
  76. package/dist/fhe-airdrop/react/index.js +43 -16
  77. package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +17 -11
  78. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
  79. package/dist/fhe-airdrop/react/useClaim.d.ts +10 -0
  80. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
  81. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
  82. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
  83. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
  84. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +1 -1
  85. package/dist/fhe-airdrop/types.d.ts +56 -0
  86. package/dist/fhe-disperse/encryption.d.ts +8 -0
  87. package/dist/fhe-disperse/errors.d.ts +55 -0
  88. package/dist/fhe-disperse/index.cjs +77 -66
  89. package/dist/fhe-disperse/index.d.cts +2 -2
  90. package/dist/fhe-disperse/index.d.ts +2 -2
  91. package/dist/fhe-disperse/index.js +8 -9
  92. package/dist/fhe-disperse/react/index.cjs +108 -87
  93. package/dist/fhe-disperse/react/index.d.cts +4 -2
  94. package/dist/fhe-disperse/react/index.d.ts +4 -2
  95. package/dist/fhe-disperse/react/index.js +12 -11
  96. package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
  97. package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
  98. package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
  99. package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
  100. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +6 -0
  101. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
  102. package/dist/fhe-disperse/singleton.d.ts +29 -0
  103. package/dist/fhe-disperse/subtotals.d.ts +6 -0
  104. package/dist/fhe-vesting/advanced/index.cjs +8 -9
  105. package/dist/fhe-vesting/advanced/index.js +6 -7
  106. package/dist/fhe-vesting/advanced/react/index.cjs +15 -15
  107. package/dist/fhe-vesting/advanced/react/index.js +12 -12
  108. package/dist/fhe-vesting/encryption.d.ts +8 -0
  109. package/dist/fhe-vesting/index.cjs +82 -79
  110. package/dist/fhe-vesting/index.d.cts +2 -2
  111. package/dist/fhe-vesting/index.d.ts +2 -2
  112. package/dist/fhe-vesting/index.js +9 -10
  113. package/dist/fhe-vesting/manager.d.ts +119 -1
  114. package/dist/fhe-vesting/react/index.cjs +264 -224
  115. package/dist/fhe-vesting/react/index.d.cts +9 -6
  116. package/dist/fhe-vesting/react/index.d.ts +9 -6
  117. package/dist/fhe-vesting/react/index.js +44 -21
  118. package/dist/fhe-vesting/react/useAccessClaimableAmount.d.ts +11 -3
  119. package/dist/fhe-vesting/react/useAccessSettledAmount.d.ts +11 -3
  120. package/dist/fhe-vesting/react/useAccessTotalAllocation.d.ts +11 -3
  121. package/dist/fhe-vesting/react/useAccessVestedAmount.d.ts +11 -3
  122. package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
  123. package/dist/fhe-vesting/react/useAdminGetClaimableAmount.d.ts +1 -1
  124. package/dist/fhe-vesting/react/useAdminGetSettledAmount.d.ts +1 -1
  125. package/dist/fhe-vesting/react/useAdminGetTotalAllocation.d.ts +1 -1
  126. package/dist/fhe-vesting/react/useAdminGetVestedAmount.d.ts +1 -1
  127. package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +10 -0
  128. package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
  129. package/dist/fhe-vesting/react/useClaim.d.ts +3 -1
  130. package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
  131. package/dist/fhe-vesting/react/useDiscloseHandleToParty.d.ts +1 -1
  132. package/dist/fhe-vesting/react/useManagerDiscloseHandleToParty.d.ts +1 -1
  133. package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +6 -0
  134. package/dist/fhe-vesting/react/usePartialClaim.d.ts +9 -1
  135. package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
  136. package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
  137. package/dist/fhe-vesting/react/useVestingInfo.d.ts +1 -1
  138. package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
  139. package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
  140. package/dist/fhe-vesting/types.d.ts +45 -0
  141. package/dist/index.cjs +93 -86
  142. package/dist/index.d.cts +1 -1
  143. package/dist/index.d.ts +1 -1
  144. package/dist/index.js +2 -3
  145. package/dist/testnet-faucet/index.cjs +58 -55
  146. package/dist/testnet-faucet/index.d.cts +1 -1
  147. package/dist/testnet-faucet/index.d.ts +1 -1
  148. package/dist/testnet-faucet/index.js +5 -6
  149. package/dist/testnet-faucet/react/index.cjs +60 -56
  150. package/dist/testnet-faucet/react/index.d.cts +3 -2
  151. package/dist/testnet-faucet/react/index.d.ts +3 -2
  152. package/dist/testnet-faucet/react/index.js +11 -11
  153. package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +3 -2
  154. package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +2 -2
  155. package/package.json +14 -8
  156. package/dist/chunk-66IHPTOK.cjs +0 -20
  157. package/dist/chunk-KWFFIJYX.js +0 -11
  158. package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +0 -25
  159. package/dist/fhe-airdrop/react/useGetClaimAmount.d.ts +0 -30
  160. package/dist/fhe-vesting/react/useGetClaimableAmount.d.ts +0 -13
  161. package/dist/fhe-vesting/react/useGetSettledAmount.d.ts +0 -14
  162. package/dist/fhe-vesting/react/useGetTotalAllocation.d.ts +0 -13
  163. package/dist/fhe-vesting/react/useGetVestedAmount.d.ts +0 -25
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkOYLZEEHF_cjs = require('./chunk-OYLZEEHF.cjs');
4
- var chunkSAGJIEQK_cjs = require('./chunk-SAGJIEQK.cjs');
5
- var chunk3ZRHDTEX_cjs = require('./chunk-3ZRHDTEX.cjs');
6
- var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
3
+ var chunkBK7YIVLK_cjs = require('./chunk-BK7YIVLK.cjs');
4
+ var chunkBD4LZBVF_cjs = require('./chunk-BD4LZBVF.cjs');
5
+ var chunkEUKPOXWR_cjs = require('./chunk-EUKPOXWR.cjs');
6
+ var chunkWUXUWTFW_cjs = require('./chunk-WUXUWTFW.cjs');
7
+ var chunk2RNW4MIJ_cjs = require('./chunk-2RNW4MIJ.cjs');
7
8
  var react = require('react');
8
9
  var wagmi = require('wagmi');
9
10
 
@@ -25,7 +26,7 @@ function useHookFiredEvent(hookName, telemetry, hasWallet, chainId) {
25
26
  function tryResolveFactoryAddress(override, chainId) {
26
27
  if (override) return override;
27
28
  if (chainId === void 0) return void 0;
28
- return chunk3ZRHDTEX_cjs.getFheVestingFactoryAddress(chainId);
29
+ return chunkWUXUWTFW_cjs.getFheVestingFactoryAddress(chainId);
29
30
  }
30
31
  function useMemoFactoryClient(opts = {}) {
31
32
  const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
@@ -38,7 +39,7 @@ function useMemoFactoryClient(opts = {}) {
38
39
  const client = react.useMemo(() => {
39
40
  if (!publicClient) return void 0;
40
41
  if (!resolvedAddress) return void 0;
41
- return chunkSAGJIEQK_cjs.createConfidentialVestingFactoryClient({
42
+ return chunkEUKPOXWR_cjs.createConfidentialVestingFactoryClient({
42
43
  publicClient,
43
44
  ...walletClient ? { walletClient } : {},
44
45
  address: resolvedAddress,
@@ -58,16 +59,16 @@ function useMemoFactoryClient(opts = {}) {
58
59
  function computeFactoryResolutionError(override, chainId) {
59
60
  if (override) return void 0;
60
61
  if (chainId === void 0) {
61
- return new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
62
+ return new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
62
63
  reason: "chain-id-missing",
63
64
  product: "fheVesting",
64
65
  contract: "confidentialVestingFactory",
65
66
  clientLabel: "ConfidentialVestingFactoryClient"
66
67
  });
67
68
  }
68
- const resolved = chunk3ZRHDTEX_cjs.getFheVestingFactoryAddress(chainId);
69
+ const resolved = chunkWUXUWTFW_cjs.getFheVestingFactoryAddress(chainId);
69
70
  if (!resolved) {
70
- return new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
71
+ return new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
71
72
  reason: "registry-not-deployed",
72
73
  product: "fheVesting",
73
74
  contract: "confidentialVestingFactory",
@@ -88,13 +89,13 @@ function useMemoManagerClient(opts) {
88
89
  const client = react.useMemo(() => {
89
90
  if (!publicClient) return void 0;
90
91
  if (!opts.address) return void 0;
91
- return chunkOYLZEEHF_cjs.createConfidentialVestingManagerClient({
92
+ return chunkBK7YIVLK_cjs.createConfidentialVestingManagerClient({
92
93
  publicClient,
93
94
  ...walletClient ? { walletClient } : {},
94
95
  address: opts.address,
95
96
  // Lazy — invoked per-encryption inside the headless client. Picks up
96
97
  // whichever EncryptorSource the consumer last passed in.
97
- encryptor: () => chunkOYLZEEHF_cjs.resolveEncryptor(encryptorSourceRef.current),
98
+ encryptor: () => chunkBD4LZBVF_cjs.resolveEncryptor(encryptorSourceRef.current),
98
99
  ...opts.aclAddress ? { aclAddress: opts.aclAddress } : {},
99
100
  ...telemetry ? { telemetry } : {}
100
101
  });
@@ -1,7 +1,7 @@
1
- import { createConfidentialAirdropClient } from './chunk-XXXDQSHE.js';
2
- import { createConfidentialAirdropFactoryClient, resolveEncryptor } from './chunk-OQZAZIAS.js';
3
- import { getFheAirdropFactoryAddress } from './chunk-M7V2EDPB.js';
4
- import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
1
+ import { createConfidentialAirdropClient } from './chunk-S2XD75JM.js';
2
+ import { createConfidentialAirdropFactoryClient, resolveEncryptor } from './chunk-UE5XK2SY.js';
3
+ import { getFheAirdropFactoryAddress } from './chunk-QKKBBH7I.js';
4
+ import { DeploymentAddressUnavailableError } from './chunk-DRSPMIZ7.js';
5
5
  import { useRef, useMemo } from 'react';
6
6
  import { usePublicClient, useWalletClient } from 'wagmi';
7
7
 
@@ -206,6 +206,23 @@ var AccessDeniedError = class extends TokenOpsSdkError {
206
206
  });
207
207
  }
208
208
  };
209
+ var OPERATOR_NOT_APPROVED_REMEDIATION = "The token has not approved this contract as an operator. Call `setOperator()` (see `/fhe` operators) before this transaction.";
210
+ var OperatorNotApprovedError = class extends TokenOpsSdkError {
211
+ name = "OperatorNotApprovedError";
212
+ constructor(args) {
213
+ super(OPERATOR_NOT_APPROVED_REMEDIATION, {
214
+ code: "TOKENOPS_OPERATOR_NOT_APPROVED",
215
+ cause: args.cause,
216
+ context: {
217
+ method: args.method,
218
+ contractAddress: args.contractAddress,
219
+ tokenAddress: args.tokenAddress,
220
+ holder: args.holder,
221
+ spender: args.spender
222
+ }
223
+ });
224
+ }
225
+ };
209
226
  var InsufficientFeeError = class extends TokenOpsSdkError {
210
227
  name = "InsufficientFeeError";
211
228
  constructor(args) {
@@ -475,4 +492,14 @@ var TokenOpsContractError = class extends TokenOpsSdkError {
475
492
  }
476
493
  };
477
494
 
478
- export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError };
495
+ // src/core/brands.ts
496
+ var asEncryptedHandle = (h) => h;
497
+ var asExternalInputProof = (h) => h;
498
+ var asTxHash = (h) => h;
499
+ var asVestingId = (h) => h;
500
+ var asAirdropId = (h) => h;
501
+ var asDisperseId = (h) => h;
502
+ var asRole = (h) => h;
503
+ var asSignature = (h) => h;
504
+
505
+ export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OPERATOR_NOT_APPROVED_REMEDIATION, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, asAirdropId, asDisperseId, asEncryptedHandle, asExternalInputProof, asRole, asSignature, asTxHash, asVestingId, isTokenOpsSdkError };
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkVDXVNZCO_cjs = require('./chunk-VDXVNZCO.cjs');
4
- var chunk3ZRHDTEX_cjs = require('./chunk-3ZRHDTEX.cjs');
5
- var chunkCQIPRNS7_cjs = require('./chunk-CQIPRNS7.cjs');
3
+ var chunk43RFBQ73_cjs = require('./chunk-43RFBQ73.cjs');
4
+ var chunkWUXUWTFW_cjs = require('./chunk-WUXUWTFW.cjs');
5
+ var chunkVR3FREBX_cjs = require('./chunk-VR3FREBX.cjs');
6
+ var chunk2RNW4MIJ_cjs = require('./chunk-2RNW4MIJ.cjs');
6
7
  var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
7
- var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
8
- var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
9
8
  var viem = require('viem');
10
9
 
11
10
  // src/fhe-vesting/abis/factory.ts
@@ -444,10 +443,10 @@ var ConfidentialVestingFactoryClient = class {
444
443
  this.publicClient = config.publicClient;
445
444
  this.walletClient = config.walletClient;
446
445
  const chainId = config.chainId ?? config.publicClient.chain?.id;
447
- const addressOverride = config.address ? chunkCQIPRNS7_cjs.normaliseAddress(config.address) : void 0;
448
- const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunk3ZRHDTEX_cjs.getFheVestingFactoryAddress(chainId));
446
+ const addressOverride = config.address ? chunkVR3FREBX_cjs.normaliseAddress(config.address) : void 0;
447
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkWUXUWTFW_cjs.getFheVestingFactoryAddress(chainId));
449
448
  if (!resolved) {
450
- throw new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
449
+ throw new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
451
450
  reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
452
451
  product: "fheVesting",
453
452
  contract: "confidentialVestingFactory",
@@ -463,7 +462,7 @@ var ConfidentialVestingFactoryClient = class {
463
462
  hasWallet: !!this.walletClient,
464
463
  aclResolved: true,
465
464
  // factory has no ACL dependency; constant for funnel-shape parity with manager.
466
- sdkVersion: chunkVDXVNZCO_cjs.SDK_VERSION
465
+ sdkVersion: chunk43RFBQ73_cjs.SDK_VERSION
467
466
  });
468
467
  }
469
468
  // ----------------------- writes -----------------------
@@ -653,20 +652,20 @@ var ConfidentialVestingFactoryClient = class {
653
652
  });
654
653
  const ours = events.filter((ev) => ev.address.toLowerCase() === this.address.toLowerCase());
655
654
  if (ours.length === 0) {
656
- throw new chunk56UI7LUR_cjs.TokenOpsSdkError(
655
+ throw new chunk2RNW4MIJ_cjs.TokenOpsSdkError(
657
656
  `${method}: no ManagerCreated event from factory ${this.address} in tx ${hash}`
658
657
  );
659
658
  }
660
659
  if (ours.length > 1) {
661
- throw new chunk56UI7LUR_cjs.TokenOpsSdkError(
660
+ throw new chunk2RNW4MIJ_cjs.TokenOpsSdkError(
662
661
  `${method}: ${ours.length} ManagerCreated events from factory ${this.address} in tx ${hash}; ambiguous result`
663
662
  );
664
663
  }
665
- return { hash: chunk66IHPTOK_cjs.asTxHash(hash), manager: ours[0].args.manager };
664
+ return { hash: chunk2RNW4MIJ_cjs.asTxHash(hash), manager: ours[0].args.manager };
666
665
  }
667
666
  #requireWallet(method) {
668
667
  if (!this.walletClient) {
669
- throw new chunk56UI7LUR_cjs.MissingWalletClientError(method);
668
+ throw new chunk2RNW4MIJ_cjs.MissingWalletClientError(method);
670
669
  }
671
670
  return this.walletClient;
672
671
  }
@@ -674,7 +673,7 @@ var ConfidentialVestingFactoryClient = class {
674
673
  const wallet = this.#requireWallet(functionName);
675
674
  const acct = account ?? wallet.account;
676
675
  if (!acct) {
677
- throw new chunk56UI7LUR_cjs.MissingAccountError(String(functionName));
676
+ throw new chunk2RNW4MIJ_cjs.MissingAccountError(String(functionName));
678
677
  }
679
678
  await this.#preflightWrite(String(functionName), functionName, args, acct);
680
679
  try {
@@ -691,7 +690,7 @@ var ConfidentialVestingFactoryClient = class {
691
690
  }
692
691
  }
693
692
  #mapRevert(method, err, account) {
694
- return chunkVDXVNZCO_cjs.mapContractRevert(err, {
693
+ return chunk43RFBQ73_cjs.mapContractRevert(err, {
695
694
  method,
696
695
  contractAddress: this.address,
697
696
  abi: confidentialVestingFactoryAbi,
@@ -716,7 +715,7 @@ var ConfidentialVestingFactoryClient = class {
716
715
  ...value !== void 0 ? { value } : {}
717
716
  });
718
717
  } catch (err) {
719
- if (chunkVDXVNZCO_cjs.isContractRevert(err)) {
718
+ if (chunk43RFBQ73_cjs.isContractRevert(err)) {
720
719
  throw this.#mapRevert(method, err, accountAddress(account));
721
720
  }
722
721
  }
@@ -0,0 +1,11 @@
1
+ import * as wagmi from 'wagmi';
2
+
3
+ // src/core/wagmi-compat.ts
4
+ var wagmiModule = wagmi;
5
+ var useWagmiAccount = wagmiModule.useConnection ?? wagmiModule.useAccount ?? (() => {
6
+ throw new Error(
7
+ "@tokenops/sdk: the installed `wagmi` package exposes neither `useConnection` (v3) nor `useAccount` (v2). Install wagmi ^2.0.0 or ^3.0.0 \u2014 the SDK's /react subpaths support both majors."
8
+ );
9
+ });
10
+
11
+ export { useWagmiAccount };
@@ -1,4 +1,4 @@
1
- import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-IR5AK5U5.js';
1
+ import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-V5D7BHW3.js';
2
2
 
3
3
  // src/fhe-vesting/advanced/factory-advanced.ts
4
4
  var ConfidentialVestingFactoryAdvancedClient = class extends ConfidentialVestingFactoryClient {
@@ -1,4 +1,4 @@
1
- import { ConfidentialAirdropFactoryClient, confidentialAirdropFactoryAbi } from './chunk-OQZAZIAS.js';
1
+ import { ConfidentialAirdropFactoryClient, confidentialAirdropFactoryAbi } from './chunk-UE5XK2SY.js';
2
2
 
3
3
  // src/fhe-airdrop/advanced/factory-advanced.ts
4
4
  var ConfidentialAirdropFactoryAdvancedClient = class extends ConfidentialAirdropFactoryClient {
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkVDXVNZCO_cjs = require('./chunk-VDXVNZCO.cjs');
4
- var chunk3ZRHDTEX_cjs = require('./chunk-3ZRHDTEX.cjs');
5
- var chunkCQIPRNS7_cjs = require('./chunk-CQIPRNS7.cjs');
3
+ var chunkFWHYQZ5E_cjs = require('./chunk-FWHYQZ5E.cjs');
4
+ var chunk43RFBQ73_cjs = require('./chunk-43RFBQ73.cjs');
5
+ var chunkWUXUWTFW_cjs = require('./chunk-WUXUWTFW.cjs');
6
+ var chunkVR3FREBX_cjs = require('./chunk-VR3FREBX.cjs');
7
+ var chunk2RNW4MIJ_cjs = require('./chunk-2RNW4MIJ.cjs');
6
8
  var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
7
- var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
8
- var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
9
9
  var viem = require('viem');
10
10
 
11
11
  // src/fhe-airdrop/abis/factory.ts
@@ -935,7 +935,7 @@ function resolveEncryptor(source) {
935
935
  var MAX_UINT64 = (1n << 64n) - 1n;
936
936
  function assertUint64(value, label) {
937
937
  if (value < 0n || value > MAX_UINT64) {
938
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
938
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
939
939
  method: "encryptUint64",
940
940
  argument: label,
941
941
  reason: "exceeds uint64 range (0..2^64-1)",
@@ -956,7 +956,7 @@ async function encryptUint64({
956
956
  userAddress
957
957
  });
958
958
  if (handles.length !== 1) {
959
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
959
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
960
960
  method: "encryptUint64",
961
961
  argument: "handles",
962
962
  reason: `expected 1 handle, got ${handles.length}`,
@@ -964,8 +964,8 @@ async function encryptUint64({
964
964
  });
965
965
  }
966
966
  return {
967
- handle: chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(handles[0])),
968
- inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
967
+ handle: chunk2RNW4MIJ_cjs.asEncryptedHandle(viem.bytesToHex(handles[0])),
968
+ inputProof: chunk2RNW4MIJ_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
969
969
  };
970
970
  }
971
971
  async function encryptUint64Batch({
@@ -975,7 +975,7 @@ async function encryptUint64Batch({
975
975
  values
976
976
  }) {
977
977
  if (values.length === 0) {
978
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
978
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
979
979
  method: "encryptUint64Batch",
980
980
  argument: "values",
981
981
  reason: "must be non-empty"
@@ -988,7 +988,7 @@ async function encryptUint64Batch({
988
988
  userAddress
989
989
  });
990
990
  if (handles.length !== values.length) {
991
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
991
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
992
992
  method: "encryptUint64Batch",
993
993
  argument: "handles",
994
994
  reason: `expected ${values.length} handles, got ${handles.length}`,
@@ -996,23 +996,23 @@ async function encryptUint64Batch({
996
996
  });
997
997
  }
998
998
  return {
999
- handles: handles.map((h) => chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(h))),
1000
- inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
999
+ handles: handles.map((h) => chunk2RNW4MIJ_cjs.asEncryptedHandle(viem.bytesToHex(h))),
1000
+ inputProof: chunk2RNW4MIJ_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
1001
1001
  };
1002
1002
  }
1003
1003
  async function signClaimAuthorization(args) {
1004
1004
  if (args.encryptedAmountHandle.length !== 66) {
1005
- throw new chunk56UI7LUR_cjs.TokenOpsSdkError(
1005
+ throw new chunk2RNW4MIJ_cjs.TokenOpsSdkError(
1006
1006
  `signClaimAuthorization: encryptedAmountHandle must be a 32-byte hex string (0x + 64 chars), got length ${args.encryptedAmountHandle.length}`
1007
1007
  );
1008
1008
  }
1009
1009
  const account = args.walletClient.account;
1010
1010
  if (!account) {
1011
- throw new chunk56UI7LUR_cjs.MissingAccountError("signClaimAuthorization");
1011
+ throw new chunk2RNW4MIJ_cjs.MissingAccountError("signClaimAuthorization");
1012
1012
  }
1013
1013
  const chainId = args.walletClient.chain?.id;
1014
1014
  if (!chainId) {
1015
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1015
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1016
1016
  method: "signClaimAuthorization",
1017
1017
  argument: "walletClient.chain.id",
1018
1018
  reason: "required for EIP712 chainId binding; pass a walletClient constructed with a known chain (e.g. `createWalletClient({ chain: sepolia, ... })`)."
@@ -1038,7 +1038,7 @@ async function signClaimAuthorization(args) {
1038
1038
  encryptedAmount: args.encryptedAmountHandle
1039
1039
  }
1040
1040
  });
1041
- return chunk66IHPTOK_cjs.asSignature(sig);
1041
+ return chunk2RNW4MIJ_cjs.asSignature(sig);
1042
1042
  }
1043
1043
  var airdropFactoryProductMapper = () => void 0;
1044
1044
  var ConfidentialAirdropFactoryClient = class {
@@ -1052,10 +1052,10 @@ var ConfidentialAirdropFactoryClient = class {
1052
1052
  this.walletClient = config.walletClient;
1053
1053
  this.encryptor = config.encryptor;
1054
1054
  const chainId = config.chainId ?? config.publicClient.chain?.id;
1055
- const addressOverride = config.address ? chunkCQIPRNS7_cjs.normaliseAddress(config.address) : void 0;
1056
- const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunk3ZRHDTEX_cjs.getFheAirdropFactoryAddress(chainId));
1055
+ const addressOverride = config.address ? chunkVR3FREBX_cjs.normaliseAddress(config.address) : void 0;
1056
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkWUXUWTFW_cjs.getFheAirdropFactoryAddress(chainId));
1057
1057
  if (!resolved) {
1058
- throw new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
1058
+ throw new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
1059
1059
  reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
1060
1060
  product: "fheAirdrop",
1061
1061
  contract: "confidentialAirdropFactory",
@@ -1071,7 +1071,7 @@ var ConfidentialAirdropFactoryClient = class {
1071
1071
  hasWallet: !!this.walletClient,
1072
1072
  aclResolved: true,
1073
1073
  // factory has no ACL dependency; constant for funnel-shape parity with client.
1074
- sdkVersion: chunkVDXVNZCO_cjs.SDK_VERSION
1074
+ sdkVersion: chunk43RFBQ73_cjs.SDK_VERSION
1075
1075
  });
1076
1076
  }
1077
1077
  // ----------------------- writes -----------------------
@@ -1118,6 +1118,14 @@ var ConfidentialAirdropFactoryClient = class {
1118
1118
  * Prerequisites: caller must have set this factory as an operator on the
1119
1119
  * token: `token.setOperator(factoryAddress, deadline)`.
1120
1120
  *
1121
+ * **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
1122
+ *
1123
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
1124
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
1125
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
1126
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
1127
+ * transparent TTT test token uses 18 decimals.
1128
+ *
1121
1129
  * Symmetric with {@link ConfidentialAirdropFactoryClient.createConfidentialAirdrop}
1122
1130
  * — both return `{ hash, airdrop }` parsed from the
1123
1131
  * `ConfidentialAirdropCreated` event.
@@ -1180,6 +1188,14 @@ var ConfidentialAirdropFactoryClient = class {
1180
1188
  * Prerequisites: caller must have set this factory as an operator on the token:
1181
1189
  * `token.setOperator(factoryAddress, deadline)`
1182
1190
  *
1191
+ * **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
1192
+ *
1193
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
1194
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
1195
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
1196
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
1197
+ * transparent TTT test token uses 18 decimals.
1198
+ *
1183
1199
  * @returns Transaction hash.
1184
1200
  */
1185
1201
  async fundConfidentialAirdrop(args) {
@@ -1249,6 +1265,14 @@ var ConfidentialAirdropFactoryClient = class {
1249
1265
  * Symmetry with {@link ConfidentialAirdropFactoryClient.createConfidentialAirdropAndGetAddress}
1250
1266
  * — use this when you also need to seed the pool in the same transaction.
1251
1267
  *
1268
+ * **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
1269
+ *
1270
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
1271
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
1272
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
1273
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
1274
+ * transparent TTT test token uses 18 decimals.
1275
+ *
1252
1276
  * Internally: {@link ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdrop} →
1253
1277
  * {@link PublicClient.waitForTransactionReceipt} →
1254
1278
  * `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
@@ -1331,6 +1355,163 @@ var ConfidentialAirdropFactoryClient = class {
1331
1355
  async getInitCodeHash(args) {
1332
1356
  return this.#read("getInitCodeHash", [toAbiParams(args.params), args.gasFee]);
1333
1357
  }
1358
+ // ----------------------- preflight -----------------------
1359
+ /**
1360
+ * Read-only preflight for {@link createConfidentialAirdrop} /
1361
+ * {@link createAndFundConfidentialAirdrop}. Runs the
1362
+ * deterministic-from-off-chain checks and reports blockers both as
1363
+ * human-readable strings (`blockers`) and as typed {@link TokenOpsSdkError}s
1364
+ * (`blockerErrors`), index-aligned.
1365
+ *
1366
+ * Preflight is **opt-in**. Consumers who have already validated state can
1367
+ * skip this call and invoke the write directly — they'll receive the same
1368
+ * typed errors at write time via the revert mapper.
1369
+ *
1370
+ * Report fields: `isFactoryOperator`, `gasFee`, `predictedAirdrop`,
1371
+ * `alreadyDeployed`, `ready`, `blockers`, `blockerErrors` — see
1372
+ * {@link CreateAirdropPreflightReport} for the meaning of each.
1373
+ *
1374
+ * Checks performed (all read-only, no gas):
1375
+ * - Structural `params` validation mirroring the factory + clone
1376
+ * `initialize` requirements (`InvalidArgumentError` blockers): `token` and
1377
+ * `admin` are checksummed non-zero addresses,
1378
+ * `startTimestamp < endTimestamp`, and `endTimestamp` is in the future
1379
+ * (the clone's `initialize` reverts with `EndTimeInPast`).
1380
+ * - Operator: creator has approved this factory as an ERC-7984 operator on
1381
+ * `params.token` — a blocker only when `funding: true`
1382
+ * ({@link OperatorNotApprovedError}); otherwise informational via
1383
+ * `isFactoryOperator`.
1384
+ * - Collision (only when `userSalt` is supplied): bytecode already at the
1385
+ * predicted CREATE2 address means a repeat create with the same
1386
+ * `(params, userSalt, gasFee)` would revert
1387
+ * ({@link AlreadyInitializedError} blocker).
1388
+ *
1389
+ * **Not preflight-detectable — read before trusting `ready: true`:** the
1390
+ * creator's confidential token balance is an encrypted `euint64` the SDK
1391
+ * cannot read in plaintext, and an underfunded `createAndFund` does **not**
1392
+ * revert — the ERC-7984 transfer silently moves an encrypted zero. Confirm
1393
+ * the creator's balance covers the pool before submitting.
1394
+ *
1395
+ * @param args See {@link PreflightCreateAirdropArgs}.
1396
+ * @returns A {@link CreateAirdropPreflightReport}.
1397
+ */
1398
+ async preflightCreateAirdrop(args) {
1399
+ const { params, creator, userSalt, funding } = args;
1400
+ const blockers = [];
1401
+ const blockerErrors = [];
1402
+ const pushBlocker = (err) => {
1403
+ blockerErrors.push(err);
1404
+ blockers.push(err.message);
1405
+ };
1406
+ const tokenOk = viem.isAddress(params.token, { strict: true }) && params.token !== ZERO_ADDRESS;
1407
+ if (!tokenOk) {
1408
+ pushBlocker(
1409
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1410
+ method: "createConfidentialAirdrop",
1411
+ argument: "params.token",
1412
+ reason: "must be a valid, non-zero EIP-55 checksummed address",
1413
+ value: params.token
1414
+ })
1415
+ );
1416
+ }
1417
+ const adminOk = viem.isAddress(params.admin, { strict: true }) && params.admin !== ZERO_ADDRESS;
1418
+ if (!adminOk) {
1419
+ pushBlocker(
1420
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1421
+ method: "createConfidentialAirdrop",
1422
+ argument: "params.admin",
1423
+ reason: "must be a valid, non-zero EIP-55 checksummed address",
1424
+ value: params.admin
1425
+ })
1426
+ );
1427
+ }
1428
+ if (params.startTimestamp >= params.endTimestamp) {
1429
+ pushBlocker(
1430
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1431
+ method: "createConfidentialAirdrop",
1432
+ argument: "params.startTimestamp/params.endTimestamp",
1433
+ reason: "startTimestamp must be strictly less than endTimestamp",
1434
+ value: { startTimestamp: params.startTimestamp, endTimestamp: params.endTimestamp }
1435
+ })
1436
+ );
1437
+ }
1438
+ const [block, customFee, defaultFee, operatorRead] = await Promise.all([
1439
+ this.publicClient.getBlock(),
1440
+ this.getCustomFee(creator),
1441
+ this.defaultGasFee(),
1442
+ tokenOk ? this.publicClient.readContract({
1443
+ address: params.token,
1444
+ abi: chunkFWHYQZ5E_cjs.erc7984OperatorAbi,
1445
+ functionName: "isOperator",
1446
+ args: [creator, this.address]
1447
+ }).then((v) => ({ ok: true, value: v })).catch((err) => {
1448
+ if (isNotErc7984Failure(err)) return { ok: false, err };
1449
+ throw err;
1450
+ }) : Promise.resolve({ ok: true, value: false })
1451
+ ]);
1452
+ const isFactoryOperator = operatorRead.ok ? operatorRead.value : false;
1453
+ if (!operatorRead.ok) {
1454
+ pushBlocker(
1455
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1456
+ method: "createConfidentialAirdrop",
1457
+ argument: "params.token",
1458
+ reason: "does not implement the ERC-7984 `isOperator(address,address)` view \u2014 it is not a confidential token (or the address holds no contract on this chain)",
1459
+ value: params.token
1460
+ })
1461
+ );
1462
+ }
1463
+ const gasFee = customFee.enabled ? customFee.gasFee : defaultFee;
1464
+ if (params.endTimestamp <= Number(block.timestamp)) {
1465
+ pushBlocker(
1466
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1467
+ method: "createConfidentialAirdrop",
1468
+ argument: "params.endTimestamp",
1469
+ reason: "must be in the future (the clone's initialize reverts with EndTimeInPast)",
1470
+ value: params.endTimestamp
1471
+ })
1472
+ );
1473
+ }
1474
+ if (funding === true && tokenOk && operatorRead.ok && !isFactoryOperator) {
1475
+ pushBlocker(
1476
+ new chunk2RNW4MIJ_cjs.OperatorNotApprovedError({
1477
+ method: "createAndFundConfidentialAirdrop",
1478
+ contractAddress: this.address,
1479
+ tokenAddress: params.token,
1480
+ holder: creator,
1481
+ spender: this.address
1482
+ })
1483
+ );
1484
+ }
1485
+ let predictedAirdrop;
1486
+ let alreadyDeployed;
1487
+ if (userSalt !== void 0 && tokenOk && adminOk) {
1488
+ predictedAirdrop = await this.#read("predictAirdropAddress", [
1489
+ toAbiParams(params),
1490
+ userSalt,
1491
+ creator,
1492
+ gasFee
1493
+ ]);
1494
+ const bytecode = await this.publicClient.getCode({ address: predictedAirdrop });
1495
+ alreadyDeployed = bytecode !== void 0 && bytecode !== "0x";
1496
+ if (alreadyDeployed) {
1497
+ pushBlocker(
1498
+ new chunk2RNW4MIJ_cjs.AlreadyInitializedError({
1499
+ method: "createConfidentialAirdrop",
1500
+ contractAddress: predictedAirdrop
1501
+ })
1502
+ );
1503
+ }
1504
+ }
1505
+ return {
1506
+ isFactoryOperator,
1507
+ gasFee,
1508
+ predictedAirdrop,
1509
+ alreadyDeployed,
1510
+ ready: blockers.length === 0,
1511
+ blockers,
1512
+ blockerErrors
1513
+ };
1514
+ }
1334
1515
  // ----------------------- internals -----------------------
1335
1516
  /**
1336
1517
  * Wait for the receipt of a clone-deploy tx and parse the
@@ -1347,27 +1528,27 @@ var ConfidentialAirdropFactoryClient = class {
1347
1528
  });
1348
1529
  const ours = events.filter((ev) => ev.address.toLowerCase() === this.address.toLowerCase());
1349
1530
  if (ours.length === 0) {
1350
- throw new chunk56UI7LUR_cjs.TokenOpsSdkError(
1531
+ throw new chunk2RNW4MIJ_cjs.TokenOpsSdkError(
1351
1532
  `${method}: no ConfidentialAirdropCreated event from factory ${this.address} in tx ${hash}`
1352
1533
  );
1353
1534
  }
1354
1535
  if (ours.length > 1) {
1355
- throw new chunk56UI7LUR_cjs.TokenOpsSdkError(
1536
+ throw new chunk2RNW4MIJ_cjs.TokenOpsSdkError(
1356
1537
  `${method}: ${ours.length} ConfidentialAirdropCreated events from factory ${this.address} in tx ${hash}; ambiguous result`
1357
1538
  );
1358
1539
  }
1359
- return { hash: chunk66IHPTOK_cjs.asTxHash(hash), airdrop: ours[0].args.airdrop };
1540
+ return { hash: chunk2RNW4MIJ_cjs.asTxHash(hash), airdrop: ours[0].args.airdrop };
1360
1541
  }
1361
1542
  #requireWallet(method) {
1362
1543
  if (!this.walletClient) {
1363
- throw new chunk56UI7LUR_cjs.MissingWalletClientError(method);
1544
+ throw new chunk2RNW4MIJ_cjs.MissingWalletClientError(method);
1364
1545
  }
1365
1546
  return this.walletClient;
1366
1547
  }
1367
1548
  #resolveAccount(wallet, override, method) {
1368
1549
  const acct = override ?? wallet.account;
1369
1550
  if (!acct) {
1370
- throw new chunk56UI7LUR_cjs.MissingAccountError(method);
1551
+ throw new chunk2RNW4MIJ_cjs.MissingAccountError(method);
1371
1552
  }
1372
1553
  return acct;
1373
1554
  }
@@ -1381,14 +1562,14 @@ var ConfidentialAirdropFactoryClient = class {
1381
1562
  const hasAmount = amount !== void 0;
1382
1563
  const hasInput = preEncrypted !== void 0;
1383
1564
  if (hasAmount && hasInput) {
1384
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1565
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1385
1566
  method,
1386
1567
  argument: "amount/encryptedInput",
1387
1568
  reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
1388
1569
  });
1389
1570
  }
1390
1571
  if (!hasAmount && !hasInput) {
1391
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1572
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1392
1573
  method,
1393
1574
  argument: "amount/encryptedInput",
1394
1575
  reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
@@ -1397,7 +1578,7 @@ var ConfidentialAirdropFactoryClient = class {
1397
1578
  if (hasInput) return preEncrypted;
1398
1579
  const enc = encryptor ?? resolveEncryptor(this.encryptor);
1399
1580
  if (!enc) {
1400
- throw new chunk56UI7LUR_cjs.MissingEncryptorError("encryptAmount", {
1581
+ throw new chunk2RNW4MIJ_cjs.MissingEncryptorError("encryptAmount", {
1401
1582
  hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
1402
1583
  });
1403
1584
  }
@@ -1426,7 +1607,7 @@ var ConfidentialAirdropFactoryClient = class {
1426
1607
  }
1427
1608
  }
1428
1609
  #mapRevert(method, err, account) {
1429
- return chunkVDXVNZCO_cjs.mapContractRevert(err, {
1610
+ return chunk43RFBQ73_cjs.mapContractRevert(err, {
1430
1611
  method,
1431
1612
  contractAddress: this.address,
1432
1613
  abi: confidentialAirdropFactoryAbi,
@@ -1454,7 +1635,7 @@ var ConfidentialAirdropFactoryClient = class {
1454
1635
  ...value !== void 0 ? { value } : {}
1455
1636
  });
1456
1637
  } catch (err) {
1457
- if (chunkVDXVNZCO_cjs.isContractRevert(err)) {
1638
+ if (chunk43RFBQ73_cjs.isContractRevert(err)) {
1458
1639
  throw this.#mapRevert(method, err, accountAddress(account));
1459
1640
  }
1460
1641
  }
@@ -1472,6 +1653,12 @@ var ConfidentialAirdropFactoryClient = class {
1472
1653
  function createConfidentialAirdropFactoryClient(config) {
1473
1654
  return new ConfidentialAirdropFactoryClient(config);
1474
1655
  }
1656
+ function isNotErc7984Failure(err) {
1657
+ if (chunk43RFBQ73_cjs.isContractRevert(err)) return true;
1658
+ if (!(err instanceof viem.BaseError)) return false;
1659
+ return err.walk((e) => e instanceof viem.ContractFunctionZeroDataError) instanceof viem.ContractFunctionZeroDataError;
1660
+ }
1661
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
1475
1662
  function accountAddress(account) {
1476
1663
  return typeof account === "string" ? account : account.address;
1477
1664
  }
@@ -1,4 +1,4 @@
1
- import { TokenOpsSdkError, InvalidArgumentError, DecryptionFailedError, EncryptionFailedError, RelayerUnreachableError, SigningFailedError, UserRejectedSignatureError, UserDecryptNotAllowedError } from './chunk-IVE3QEGD.js';
1
+ import { TokenOpsSdkError, InvalidArgumentError, DecryptionFailedError, EncryptionFailedError, RelayerUnreachableError, SigningFailedError, UserRejectedSignatureError, UserDecryptNotAllowedError } from './chunk-DRSPMIZ7.js';
2
2
 
3
3
  // src/core/zama-error-mapper.ts
4
4
  function mapZamaError(error, args) {