@tokenops/sdk 1.0.0 → 1.5.1

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 (162) hide show
  1. package/README.md +120 -26
  2. package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
  3. package/dist/{chunk-QIHZVLIK.js → chunk-2PWNH3UE.js} +35 -6
  4. package/dist/{chunk-T5LVV3KY.cjs → chunk-4WPGQSNT.cjs} +3 -3
  5. package/dist/{chunk-SUOG3BQS.cjs → chunk-5X5WL5CU.cjs} +266 -103
  6. package/dist/{chunk-56UI7LUR.cjs → chunk-67OV5CX2.cjs} +19 -0
  7. package/dist/{chunk-WRCUDSUJ.js → chunk-6BMP4ICG.js} +2 -2
  8. package/dist/{chunk-XXXDQSHE.js → chunk-6R4KNAPK.js} +5 -3
  9. package/dist/{chunk-XSNLAS5M.js → chunk-AOP6HMPW.js} +1 -1
  10. package/dist/{chunk-62DF53UQ.cjs → chunk-C7BRZXJA.cjs} +19 -21
  11. package/dist/{chunk-UOG4PJL5.js → chunk-DUZIIRPF.js} +181 -14
  12. package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
  13. package/dist/chunk-FT4LNBOS.js +11 -0
  14. package/dist/chunk-IJFQ5L4I.js +2171 -0
  15. package/dist/{chunk-52TC6BF7.js → chunk-IXLO7GO5.js} +210 -47
  16. package/dist/{chunk-CQIPRNS7.cjs → chunk-JK4XMMKM.cjs} +3 -3
  17. package/dist/{chunk-ITQ7WKVC.cjs → chunk-JYOTGRSO.cjs} +8 -8
  18. package/dist/{chunk-VDXVNZCO.cjs → chunk-KLKI352M.cjs} +85 -29
  19. package/dist/{chunk-5SA2HF2W.cjs → chunk-MCRBVJGZ.cjs} +24 -22
  20. package/dist/{chunk-ECT3NL2L.js → chunk-NTZY6IB7.js} +4 -4
  21. package/dist/{chunk-ZHFLRKFY.js → chunk-ODLTEGHB.js} +1 -1
  22. package/dist/{chunk-HGXNRR25.js → chunk-ORFTDNFZ.js} +4 -4
  23. package/dist/{chunk-72YGZEQE.js → chunk-OXTLPTO3.js} +9 -11
  24. package/dist/{chunk-HTOMTEA3.cjs → chunk-PFXURMBZ.cjs} +77 -48
  25. package/dist/{chunk-OLDGMKW2.cjs → chunk-PUPKNW3R.cjs} +35 -2
  26. package/dist/{chunk-IVE3QEGD.js → chunk-QBJ7O2B4.js} +18 -1
  27. package/dist/{chunk-JFLEEXKP.js → chunk-SG65XWH7.js} +58 -2
  28. package/dist/{chunk-K6MFFDBJ.cjs → chunk-T46YXSBP.cjs} +11 -11
  29. package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
  30. package/dist/{chunk-6ECAHP5O.cjs → chunk-TIUKIY5V.cjs} +200 -33
  31. package/dist/{chunk-QCA7O2Q5.cjs → chunk-V2PXZVBF.cjs} +4 -4
  32. package/dist/{chunk-JFR5J4FL.cjs → chunk-W7IGCOVL.cjs} +11 -11
  33. package/dist/chunk-WENHUPZC.cjs +2180 -0
  34. package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
  35. package/dist/{chunk-COPFW5Z4.js → chunk-XGGTQQFH.js} +31 -2
  36. package/dist/{chunk-CMRETRZO.js → chunk-YQIBBEFJ.js} +1 -1
  37. package/dist/{chunk-BE2AIZ3K.js → chunk-ZA673I3O.js} +1 -1
  38. package/dist/chunk-ZQUE2B3Q.cjs +33 -0
  39. package/dist/{chunk-FYQ2UW4T.js → chunk-ZWXJTBZO.js} +1 -1
  40. package/dist/core/addresses.d.ts +22 -0
  41. package/dist/core/errors.d.ts +41 -1
  42. package/dist/core/revert-mapper.d.ts +77 -0
  43. package/dist/core/telemetry.d.ts +0 -3
  44. package/dist/core/wagmi-compat.d.ts +40 -0
  45. package/dist/fhe/index.cjs +112 -66
  46. package/dist/fhe/index.d.cts +1 -1
  47. package/dist/fhe/index.d.ts +1 -1
  48. package/dist/fhe/index.js +50 -8
  49. package/dist/fhe/operators.d.ts +1 -1
  50. package/dist/fhe/react/index.cjs +7 -7
  51. package/dist/fhe/react/index.js +2 -2
  52. package/dist/fhe/sepolia-encryptor-web.d.ts +27 -1
  53. package/dist/fhe/sepolia-encryptor.d.ts +38 -0
  54. package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +3 -3
  55. package/dist/fhe-airdrop/advanced/index.cjs +9 -8
  56. package/dist/fhe-airdrop/advanced/index.d.cts +2 -2
  57. package/dist/fhe-airdrop/advanced/index.d.ts +2 -2
  58. package/dist/fhe-airdrop/advanced/index.js +7 -6
  59. package/dist/fhe-airdrop/advanced/react/index.cjs +14 -13
  60. package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -1
  61. package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -1
  62. package/dist/fhe-airdrop/advanced/react/index.js +10 -9
  63. package/dist/fhe-airdrop/airdrop.d.ts +2 -0
  64. package/dist/fhe-airdrop/encryption.d.ts +8 -0
  65. package/dist/fhe-airdrop/factory.d.ts +94 -11
  66. package/dist/fhe-airdrop/index.cjs +61 -57
  67. package/dist/fhe-airdrop/index.d.cts +3 -3
  68. package/dist/fhe-airdrop/index.d.ts +3 -3
  69. package/dist/fhe-airdrop/index.js +7 -7
  70. package/dist/fhe-airdrop/react/index.cjs +163 -133
  71. package/dist/fhe-airdrop/react/index.d.cts +4 -3
  72. package/dist/fhe-airdrop/react/index.d.ts +4 -3
  73. package/dist/fhe-airdrop/react/index.js +38 -13
  74. package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +2 -0
  75. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
  76. package/dist/fhe-airdrop/react/useClaim.d.ts +2 -0
  77. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
  78. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
  79. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
  80. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
  81. package/dist/fhe-airdrop/types.d.ts +45 -0
  82. package/dist/fhe-disperse/encryption.d.ts +8 -0
  83. package/dist/fhe-disperse/index.cjs +69 -65
  84. package/dist/fhe-disperse/index.d.cts +1 -1
  85. package/dist/fhe-disperse/index.d.ts +1 -1
  86. package/dist/fhe-disperse/index.js +8 -8
  87. package/dist/fhe-disperse/react/index.cjs +90 -86
  88. package/dist/fhe-disperse/react/index.d.cts +1 -1
  89. package/dist/fhe-disperse/react/index.d.ts +1 -1
  90. package/dist/fhe-disperse/react/index.js +10 -10
  91. package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
  92. package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
  93. package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
  94. package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
  95. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +8 -2
  96. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
  97. package/dist/fhe-disperse/singleton.d.ts +29 -0
  98. package/dist/fhe-disperse/subtotals.d.ts +6 -0
  99. package/dist/fhe-vesting/advanced/factory-advanced.d.ts +2 -2
  100. package/dist/fhe-vesting/advanced/index.cjs +8 -8
  101. package/dist/fhe-vesting/advanced/index.d.cts +2 -2
  102. package/dist/fhe-vesting/advanced/index.d.ts +2 -2
  103. package/dist/fhe-vesting/advanced/index.js +6 -6
  104. package/dist/fhe-vesting/advanced/react/index.cjs +15 -14
  105. package/dist/fhe-vesting/advanced/react/index.d.cts +1 -1
  106. package/dist/fhe-vesting/advanced/react/index.d.ts +1 -1
  107. package/dist/fhe-vesting/advanced/react/index.js +12 -11
  108. package/dist/fhe-vesting/encryption.d.ts +8 -0
  109. package/dist/fhe-vesting/factory.d.ts +6 -8
  110. package/dist/fhe-vesting/index.cjs +79 -75
  111. package/dist/fhe-vesting/index.d.cts +2 -2
  112. package/dist/fhe-vesting/index.d.ts +2 -2
  113. package/dist/fhe-vesting/index.js +9 -9
  114. package/dist/fhe-vesting/manager.d.ts +101 -3
  115. package/dist/fhe-vesting/react/index.cjs +241 -219
  116. package/dist/fhe-vesting/react/index.d.cts +3 -2
  117. package/dist/fhe-vesting/react/index.d.ts +3 -2
  118. package/dist/fhe-vesting/react/index.js +29 -12
  119. package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
  120. package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +2 -0
  121. package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
  122. package/dist/fhe-vesting/react/useClaim.d.ts +2 -0
  123. package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
  124. package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +7 -1
  125. package/dist/fhe-vesting/react/usePartialClaim.d.ts +8 -0
  126. package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
  127. package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
  128. package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
  129. package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
  130. package/dist/fhe-vesting/types.d.ts +34 -2
  131. package/dist/index.cjs +73 -49
  132. package/dist/index.d.cts +1 -1
  133. package/dist/index.d.ts +1 -1
  134. package/dist/index.js +2 -2
  135. package/dist/testnet-faucet/abis/confidential-test-token.d.ts +1039 -0
  136. package/dist/testnet-faucet/abis/index.d.ts +2 -0
  137. package/dist/testnet-faucet/abis/test-token.d.ts +253 -0
  138. package/dist/testnet-faucet/errors.d.ts +21 -0
  139. package/dist/testnet-faucet/faucet.d.ts +173 -0
  140. package/dist/testnet-faucet/index.cjs +212 -0
  141. package/dist/testnet-faucet/index.d.cts +8 -0
  142. package/dist/testnet-faucet/index.d.ts +8 -0
  143. package/dist/testnet-faucet/index.js +7 -0
  144. package/dist/testnet-faucet/react/_shared.d.ts +61 -0
  145. package/dist/testnet-faucet/react/index.cjs +384 -0
  146. package/dist/testnet-faucet/react/index.d.cts +39 -0
  147. package/dist/testnet-faucet/react/index.d.ts +39 -0
  148. package/dist/testnet-faucet/react/index.js +220 -0
  149. package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +25 -0
  150. package/dist/testnet-faucet/react/useFaucetDecimals.d.ts +9 -0
  151. package/dist/testnet-faucet/react/useFaucetMetadata.d.ts +14 -0
  152. package/dist/testnet-faucet/react/useFaucetRate.d.ts +11 -0
  153. package/dist/testnet-faucet/react/useInferredTotalSupply.d.ts +11 -0
  154. package/dist/testnet-faucet/react/useMaxTotalSupply.d.ts +10 -0
  155. package/dist/testnet-faucet/react/useMintConfidential.d.ts +35 -0
  156. package/dist/testnet-faucet/react/useMintUnderlying.d.ts +31 -0
  157. package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +19 -0
  158. package/dist/testnet-faucet/react/useUnderlyingDecimals.d.ts +9 -0
  159. package/dist/testnet-faucet/react/useUnderlyingTokenAddress.d.ts +12 -0
  160. package/dist/testnet-faucet/types.d.ts +92 -0
  161. package/dist/testnet-faucet/validate.d.ts +44 -0
  162. package/package.json +79 -30
@@ -44,6 +44,7 @@ export { useFactoryDefaultGasFee } from "./useFactoryDefaultGasFee.js";
44
44
  export { useFactoryFeeCollector } from "./useFactoryFeeCollector.js";
45
45
  export { useFactoryCustomFee, type UseFactoryCustomFeeArgs } from "./useFactoryCustomFee.js";
46
46
  export { useFactoryInitCodeHash, type UseFactoryInitCodeHashArgs, } from "./useFactoryInitCodeHash.js";
47
+ export { usePreflightCreateAirdrop, type UsePreflightCreateAirdropArgs, } from "./usePreflightCreateAirdrop.js";
47
48
  export { useCreateConfidentialAirdropAndGetAddress } from "./useCreateConfidentialAirdropAndGetAddress.js";
48
49
  export { useCreateConfidentialAirdrop } from "./useCreateConfidentialAirdrop.js";
49
50
  export { useCreateAndFundConfidentialAirdrop } from "./useCreateAndFundConfidentialAirdrop.js";
@@ -82,9 +83,9 @@ export { useAirdropRevokeRole, type UseAirdropRevokeRoleArgs } from "./useAirdro
82
83
  export { useSignClaimAuthorization, type UseSignClaimAuthorizationArgs, type UseSignClaimAuthorizationOptions, } from "./useSignClaimAuthorization.js";
83
84
  export type { BaseHookOptions, AirdropHookOptions, FactoryHookOptions } from "./_shared.js";
84
85
  export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization, type Encryptor, type EncryptorSource, type EncryptUint64Args, type EncryptUint64BatchArgs, type FheValueInput, } from "../encryption.js";
85
- export { type AirdropParams, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
86
+ export { type AirdropParams, type CreateAirdropPreflightReport, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
86
87
  export type { ClaimArgs, EncryptedViewResult, GetClaimAmountArgs, IsSignatureValidArgs, } from "../airdrop.js";
87
- export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, } from "../factory.js";
88
- export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
88
+ export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, PreflightCreateAirdropArgs, } from "../factory.js";
89
+ export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, OperatorNotApprovedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
89
90
  export { type PreflightResult } from "../../core/preflight.js";
90
91
  export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from "../errors.js";
@@ -44,6 +44,7 @@ export { useFactoryDefaultGasFee } from "./useFactoryDefaultGasFee.js";
44
44
  export { useFactoryFeeCollector } from "./useFactoryFeeCollector.js";
45
45
  export { useFactoryCustomFee, type UseFactoryCustomFeeArgs } from "./useFactoryCustomFee.js";
46
46
  export { useFactoryInitCodeHash, type UseFactoryInitCodeHashArgs, } from "./useFactoryInitCodeHash.js";
47
+ export { usePreflightCreateAirdrop, type UsePreflightCreateAirdropArgs, } from "./usePreflightCreateAirdrop.js";
47
48
  export { useCreateConfidentialAirdropAndGetAddress } from "./useCreateConfidentialAirdropAndGetAddress.js";
48
49
  export { useCreateConfidentialAirdrop } from "./useCreateConfidentialAirdrop.js";
49
50
  export { useCreateAndFundConfidentialAirdrop } from "./useCreateAndFundConfidentialAirdrop.js";
@@ -82,9 +83,9 @@ export { useAirdropRevokeRole, type UseAirdropRevokeRoleArgs } from "./useAirdro
82
83
  export { useSignClaimAuthorization, type UseSignClaimAuthorizationArgs, type UseSignClaimAuthorizationOptions, } from "./useSignClaimAuthorization.js";
83
84
  export type { BaseHookOptions, AirdropHookOptions, FactoryHookOptions } from "./_shared.js";
84
85
  export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization, type Encryptor, type EncryptorSource, type EncryptUint64Args, type EncryptUint64BatchArgs, type FheValueInput, } from "../encryption.js";
85
- export { type AirdropParams, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
86
+ export { type AirdropParams, type CreateAirdropPreflightReport, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
86
87
  export type { ClaimArgs, EncryptedViewResult, GetClaimAmountArgs, IsSignatureValidArgs, } from "../airdrop.js";
87
- export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, } from "../factory.js";
88
- export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
88
+ export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, PreflightCreateAirdropArgs, } from "../factory.js";
89
+ export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, OperatorNotApprovedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
89
90
  export { type PreflightResult } from "../../core/preflight.js";
90
91
  export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from "../errors.js";
@@ -1,17 +1,19 @@
1
- import { useMemoFactoryClient, buildQueryKey, useMemoAirdropClient } from '../../chunk-HGXNRR25.js';
2
- export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from '../../chunk-XXXDQSHE.js';
3
- import { signClaimAuthorization } from '../../chunk-UOG4PJL5.js';
4
- export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-UOG4PJL5.js';
5
- import '../../chunk-FYQ2UW4T.js';
6
- import '../../chunk-JFLEEXKP.js';
7
- import '../../chunk-COPFW5Z4.js';
8
- import '../../chunk-BE2AIZ3K.js';
1
+ import { useMemoFactoryClient, buildQueryKey, useMemoAirdropClient } from '../../chunk-ORFTDNFZ.js';
2
+ export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from '../../chunk-6R4KNAPK.js';
3
+ import { signClaimAuthorization } from '../../chunk-DUZIIRPF.js';
4
+ export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-DUZIIRPF.js';
5
+ import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
6
+ import '../../chunk-ZWXJTBZO.js';
7
+ import '../../chunk-7VELUOMI.js';
8
+ import '../../chunk-SG65XWH7.js';
9
+ import '../../chunk-XGGTQQFH.js';
10
+ import '../../chunk-ZA673I3O.js';
9
11
  import '../../chunk-Q2GP5UDC.js';
10
12
  import '../../chunk-KWFFIJYX.js';
11
- import { MissingClientError, MissingWalletClientError } from '../../chunk-IVE3QEGD.js';
12
- 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, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-IVE3QEGD.js';
13
+ import { MissingClientError, MissingWalletClientError } from '../../chunk-QBJ7O2B4.js';
14
+ export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-QBJ7O2B4.js';
13
15
  import { useQuery, useMutation } from '@tanstack/react-query';
14
- import { useAccount, useWalletClient } from 'wagmi';
16
+ import { useWalletClient } from 'wagmi';
15
17
 
16
18
  function useConfidentialAirdropFactoryImplementation(options = {}) {
17
19
  const { client, chainId, resolvedAddress } = useMemoFactoryClient(options);
@@ -60,6 +62,29 @@ function useFactoryInitCodeHash(args = {}) {
60
62
  staleTime: 0
61
63
  });
62
64
  }
65
+ function usePreflightCreateAirdrop(args = {}) {
66
+ const { params, creator, userSalt, funding, ...base } = args;
67
+ const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
68
+ return useQuery({
69
+ queryKey: buildQueryKey(
70
+ "factory:preflightCreateAirdrop",
71
+ chainId,
72
+ resolvedAddress,
73
+ creator,
74
+ params,
75
+ userSalt,
76
+ funding
77
+ ),
78
+ queryFn: () => client.preflightCreateAirdrop({
79
+ params,
80
+ creator,
81
+ ...userSalt !== void 0 ? { userSalt } : {},
82
+ ...funding !== void 0 ? { funding } : {}
83
+ }),
84
+ enabled: !!client && !!params && !!creator,
85
+ staleTime: 0
86
+ });
87
+ }
63
88
  function useCreateConfidentialAirdropAndGetAddress(options = {}) {
64
89
  const { client, resolutionError } = useMemoFactoryClient(options);
65
90
  return useMutation({
@@ -290,7 +315,7 @@ function useAirdropIsSignatureClaimed(args) {
290
315
  function useAirdropIsSignatureValid(args) {
291
316
  const { encryptedAmountHandle, signature, caller, ...base } = args;
292
317
  const { client, chainId } = useMemoAirdropClient(base);
293
- const { address: connectedAddress } = useAccount();
318
+ const { address: connectedAddress } = useWagmiAccount();
294
319
  const resolvedCaller = caller ?? connectedAddress;
295
320
  return useQuery({
296
321
  queryKey: buildQueryKey(
@@ -427,4 +452,4 @@ function useSignClaimAuthorization(options = {}) {
427
452
  });
428
453
  }
429
454
 
430
- export { useAirdropCanExtendClaimWindow, useAirdropClaimTypehash, useAirdropClaimedSignatures, useAirdropDeploymentBlockNumber, useAirdropDomainSeparator, useAirdropEndTime, useAirdropGasFee, useAirdropGrantRole, useAirdropHasClaimEnded, useAirdropHasClaimStarted, useAirdropHasRole, useAirdropIsClaimWindowActive, useAirdropIsPaused, useAirdropIsSignatureClaimed, useAirdropIsSignatureValid, useAirdropRevokeRole, useAirdropStartTime, useAirdropToken, useAirdropWithdrawGasFee, useClaim, useConfidentialAirdropFactoryImplementation, useCreateAndFundConfidentialAirdrop, useCreateAndFundConfidentialAirdropAndGetAddress, useCreateConfidentialAirdrop, useCreateConfidentialAirdropAndGetAddress, useDisableCustomFee, useExtendClaimWindow, useFactoryCustomFee, useFactoryDefaultGasFee, useFactoryFeeCollector, useFactoryInitCodeHash, useFundConfidentialAirdrop, useGetClaimAmount, useSetCustomFee, useSetDefaultGasFee, useSetFeeCollector, useSetPaused, useSignClaimAuthorization, useWithdraw, useWithdrawOtherConfidentialToken, useWithdrawOtherToken };
455
+ export { useAirdropCanExtendClaimWindow, useAirdropClaimTypehash, useAirdropClaimedSignatures, useAirdropDeploymentBlockNumber, useAirdropDomainSeparator, useAirdropEndTime, useAirdropGasFee, useAirdropGrantRole, useAirdropHasClaimEnded, useAirdropHasClaimStarted, useAirdropHasRole, useAirdropIsClaimWindowActive, useAirdropIsPaused, useAirdropIsSignatureClaimed, useAirdropIsSignatureValid, useAirdropRevokeRole, useAirdropStartTime, useAirdropToken, useAirdropWithdrawGasFee, useClaim, useConfidentialAirdropFactoryImplementation, useCreateAndFundConfidentialAirdrop, useCreateAndFundConfidentialAirdropAndGetAddress, useCreateConfidentialAirdrop, useCreateConfidentialAirdropAndGetAddress, useDisableCustomFee, useExtendClaimWindow, useFactoryCustomFee, useFactoryDefaultGasFee, useFactoryFeeCollector, useFactoryInitCodeHash, useFundConfidentialAirdrop, useGetClaimAmount, usePreflightCreateAirdrop, useSetCustomFee, useSetDefaultGasFee, useSetFeeCollector, useSetPaused, useSignClaimAuthorization, useWithdraw, useWithdrawOtherConfidentialToken, useWithdrawOtherToken };
@@ -18,6 +18,8 @@ import { type AirdropHookOptions } from "./_shared.js";
18
18
  * `useAirdropIsSignatureClaimed({ user, encryptedAmountHandle })` and any
19
19
  * UI counts you computed off it.
20
20
  *
21
+ * **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.
22
+ *
21
23
  * @example
22
24
  * const claim = useAirdropClaim({ address: airdropAddress, encryptor: () => useZamaSDK().relayer });
23
25
  * claim.mutate({ amount: 1_000_000n, signature });
@@ -9,8 +9,9 @@ export interface UseAirdropIsSignatureValidArgs extends AirdropHookOptions {
9
9
  /**
10
10
  * Caller address — the contract recomputes the struct hash over
11
11
  * `(msg.sender, encryptedAmount)`, so validity is caller-specific.
12
- * Defaults to the connected wallet via `wagmi`'s `useAccount()`; pass
13
- * explicitly to check on behalf of another address.
12
+ * Defaults to the connected wallet via wagmi's account hook (v2
13
+ * `useAccount()` / v3 `useConnection()`); pass explicitly to check on
14
+ * behalf of another address.
14
15
  */
15
16
  caller?: Address;
16
17
  }
@@ -22,6 +22,8 @@ import { type AirdropHookOptions } from "./_shared.js";
22
22
  * `useAirdropIsSignatureClaimed({ user, encryptedAmountHandle })` and any
23
23
  * UI counts you computed off it.
24
24
  *
25
+ * **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.
26
+ *
25
27
  * @example
26
28
  * const claim = useClaim({ address: airdropAddress });
27
29
  * claim.mutate({ encryptedInput, signature });
@@ -15,6 +15,14 @@ import { type FactoryHookOptions } from "./_shared.js";
15
15
  * **Prerequisites:** caller must have set the factory as an operator on the
16
16
  * token: `token.setOperator(factoryAddress, deadline)`.
17
17
  *
18
+ * **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.
19
+ *
20
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
21
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
22
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
23
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
24
+ * transparent TTT test token uses 18 decimals.
25
+ *
18
26
  * After success, invalidate factory queries that depend on per-creator state:
19
27
  *
20
28
  * ```ts
@@ -13,6 +13,14 @@ import { type FactoryHookOptions } from "./_shared.js";
13
13
  * Internally: `createAndFundConfidentialAirdrop` → `waitForTransactionReceipt`
14
14
  * → `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
15
15
  *
16
+ * **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.
17
+ *
18
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
19
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
20
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
21
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
22
+ * transparent TTT test token uses 18 decimals.
23
+ *
16
24
  * After a successful create, invalidate factory queries that depend on
17
25
  * per-creator state:
18
26
  *
@@ -17,6 +17,14 @@ import { type FactoryHookOptions } from "./_shared.js";
17
17
  * **Prerequisites:** caller must have set the factory as an operator on the
18
18
  * token: `token.setOperator(factoryAddress, deadline)`.
19
19
  *
20
+ * **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.
21
+ *
22
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
23
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
24
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
25
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
26
+ * transparent TTT test token uses 18 decimals.
27
+ *
20
28
  * **`args.gasFee` MUST match the fee active for `deployer` at airdrop creation
21
29
  * time** — custom fee if `getCustomFee(deployer).enabled`, otherwise
22
30
  * `defaultGasFee`. The factory derives the target clone address from this
@@ -0,0 +1,51 @@
1
+ import { type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Address, Hex } from "viem";
3
+ import type { AirdropParams, CreateAirdropPreflightReport } from "../types.js";
4
+ import { type BaseHookOptions } from "./_shared.js";
5
+ export interface UsePreflightCreateAirdropArgs extends BaseHookOptions {
6
+ /** The airdrop parameters that will be passed to the create call. */
7
+ params?: AirdropParams;
8
+ /** The address that will send the create transaction (`msg.sender`). */
9
+ creator?: Address;
10
+ /**
11
+ * The `userSalt` planned for the create call. Optional — when supplied, the
12
+ * report also carries `predictedAirdrop` and `alreadyDeployed`.
13
+ */
14
+ userSalt?: Hex;
15
+ /**
16
+ * Set `true` when the plan is `useCreateAndFundConfidentialAirdrop` — a
17
+ * missing factory-operator approval then becomes a blocker instead of
18
+ * informational `isFactoryOperator` state.
19
+ */
20
+ funding?: boolean;
21
+ }
22
+ /**
23
+ * Read-only preflight for `useCreateConfidentialAirdrop` /
24
+ * `useCreateAndFundConfidentialAirdrop` — wraps
25
+ * {@link ConfidentialAirdropFactoryClient.preflightCreateAirdrop} as a
26
+ * TanStack query.
27
+ *
28
+ * The report carries `isFactoryOperator`, `gasFee`, `predictedAirdrop`,
29
+ * `alreadyDeployed`, `ready`, `blockers` (human-readable strings) and
30
+ * `blockerErrors` (typed `TokenOpsSdkError`s, index-aligned with `blockers` —
31
+ * branch on `error.code`).
32
+ *
33
+ * Checks: structural `params` validation (non-zero token/admin, timestamp
34
+ * ordering, end time in the future), ERC-7984 operator approval of the
35
+ * factory on `params.token` (blocker only with `funding: true`), and — when
36
+ * `userSalt` is set — whether a clone already exists at the predicted CREATE2
37
+ * address. The creator's confidential token balance is NOT checked
38
+ * (encrypted; an underfunded create-and-fund silently moves an encrypted
39
+ * zero) — see the headless method's TSDoc.
40
+ *
41
+ * Hook is disabled until `params` and `creator` are both set. Refetch after
42
+ * the user calls `setOperator` (e.g. via `queryClient.invalidateQueries` or a
43
+ * `refetchInterval`).
44
+ *
45
+ * @example
46
+ * const { data: report } = usePreflightCreateAirdrop({
47
+ * params, creator, userSalt, funding: true,
48
+ * });
49
+ * if (report?.ready) { /* enable submit *\/ }
50
+ */
51
+ export declare function usePreflightCreateAirdrop(args?: UsePreflightCreateAirdropArgs): UseQueryResult<CreateAirdropPreflightReport, Error>;
@@ -1,4 +1,5 @@
1
1
  import type { Address } from "viem";
2
+ import type { TokenOpsSdkError } from "../core/errors.js";
2
3
  export type { EncryptedInput, EncryptedInputs, EncryptedViewResult } from "../fhe/types.js";
3
4
  /**
4
5
  * Parameters for creating a confidential airdrop.
@@ -19,3 +20,47 @@ export interface CustomFee {
19
20
  enabled: boolean;
20
21
  gasFee: bigint;
21
22
  }
23
+ /**
24
+ * Report returned by `ConfidentialAirdropFactoryClient.preflightCreateAirdrop`.
25
+ *
26
+ * Fields:
27
+ * - `isFactoryOperator` — `true` when the creator has approved the factory as
28
+ * an ERC-7984 operator on `params.token`. Only required when funding in the
29
+ * same transaction (`createAndFundConfidentialAirdrop` /
30
+ * `fundConfidentialAirdrop`); `false` also when the token address was
31
+ * structurally invalid and the read was skipped.
32
+ * - `gasFee` — the per-claim gas fee (wei) the factory will embed into the
33
+ * clone for this creator: the creator's custom fee when one is enabled,
34
+ * otherwise `defaultGasFee`. This is the `gasFee` to use for address
35
+ * prediction and later `fundConfidentialAirdrop` calls.
36
+ * - `predictedAirdrop` — deterministic CREATE2 clone address for
37
+ * `(params, userSalt, creator, gasFee)`. `undefined` when `userSalt` was not
38
+ * supplied or the params were structurally invalid.
39
+ * - `alreadyDeployed` — `true` when bytecode already exists at
40
+ * `predictedAirdrop` (a repeat create with the same salt would revert).
41
+ * `undefined` when `predictedAirdrop` is `undefined`.
42
+ * - `ready` — `true` when no blockers were detected.
43
+ * - `blockers` — human-readable blocker descriptions. Empty when
44
+ * `ready === true`.
45
+ * - `blockerErrors` — the same blockers as typed `TokenOpsSdkError`s, index-
46
+ * aligned with `blockers`. Branch on `error.code` to render UI.
47
+ */
48
+ export interface CreateAirdropPreflightReport {
49
+ /** `true` when the creator has approved the factory as operator on `params.token`. */
50
+ isFactoryOperator: boolean;
51
+ /** Per-claim gas fee (wei) the factory will embed into the clone for this creator. */
52
+ gasFee: bigint;
53
+ /** Predicted CREATE2 clone address. `undefined` without `userSalt` or with invalid params. */
54
+ predictedAirdrop?: Address;
55
+ /** `true` when bytecode already exists at `predictedAirdrop`. `undefined` when not predicted. */
56
+ alreadyDeployed?: boolean;
57
+ /** `true` when no blockers were detected — green light to submit the write. */
58
+ ready: boolean;
59
+ /** Human-readable blocker descriptions. Empty when `ready === true`. */
60
+ blockers: string[];
61
+ /**
62
+ * Typed errors that would otherwise surface at write time, index-aligned
63
+ * with `blockers`. Empty when `ready === true`.
64
+ */
65
+ blockerErrors: TokenOpsSdkError[];
66
+ }
@@ -62,6 +62,14 @@ export interface EncryptUint64BatchArgs {
62
62
  }
63
63
  /**
64
64
  * Encrypt a single `uint64` value into an `externalEuint64` handle + KMS input proof.
65
+ *
66
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
67
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
68
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
69
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
70
+ * transparent TTT test token uses 18 decimals. `value` (and each entry of
71
+ * `values` in {@link encryptUint64Batch}) follows this convention when it
72
+ * encodes a token amount.
65
73
  */
66
74
  export declare function encryptUint64({ encryptor, contractAddress, userAddress, value, }: EncryptUint64Args): Promise<EncryptedInput>;
67
75
  /**