@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,15 +1,15 @@
1
- import { createTestnetFaucetClient, isTestnetFaucetChainId } from '../../chunk-QE7ZONJ2.js';
2
- export { FaucetSupplyExhaustedError } from '../../chunk-QE7ZONJ2.js';
3
- import '../../chunk-JFLEEXKP.js';
4
- import { getConfidentialTestTokenAddress } from '../../chunk-M7V2EDPB.js';
5
- import '../../chunk-BE2AIZ3K.js';
1
+ import { createTestnetFaucetClient, isTestnetFaucetChainId } from '../../chunk-WTK6JDSI.js';
2
+ export { FaucetSupplyExhaustedError } from '../../chunk-WTK6JDSI.js';
3
+ import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
4
+ import '../../chunk-6WSNS3UV.js';
5
+ import { getConfidentialTestTokenAddress } from '../../chunk-QKKBBH7I.js';
6
+ import '../../chunk-46T67CE2.js';
7
+ import { MissingClientError, UnsupportedChainError, DeploymentAddressUnavailableError } from '../../chunk-DRSPMIZ7.js';
8
+ 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, TokenOpsContractError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-DRSPMIZ7.js';
6
9
  import '../../chunk-Q2GP5UDC.js';
7
- import '../../chunk-KWFFIJYX.js';
8
- import { MissingClientError, UnsupportedChainError, DeploymentAddressUnavailableError } from '../../chunk-IVE3QEGD.js';
9
- 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, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-IVE3QEGD.js';
10
10
  import { useQuery, useMutation } from '@tanstack/react-query';
11
- import { useAccount, usePublicClient, useWalletClient } from 'wagmi';
12
11
  import { useMemo } from 'react';
12
+ import { usePublicClient, useWalletClient } from 'wagmi';
13
13
 
14
14
  var TESTNET_FAUCET_KEY = "tokenops-sdk";
15
15
  var TESTNET_FAUCET_NAMESPACE = "testnet-faucet";
@@ -95,7 +95,7 @@ function normalizeKeyArg(value) {
95
95
  function useConfidentialBalance(args = {}) {
96
96
  const { account, ...base } = args;
97
97
  const { client, chainId, resolvedAddress } = useMemoFaucetClient(base);
98
- const { address: connected } = useAccount();
98
+ const { address: connected } = useWagmiAccount();
99
99
  const resolvedAccount = account ?? connected;
100
100
  return useQuery({
101
101
  queryKey: buildQueryKey("confidentialBalanceOf", chainId, resolvedAddress, resolvedAccount),
@@ -107,7 +107,7 @@ function useConfidentialBalance(args = {}) {
107
107
  function useUnderlyingBalance(args = {}) {
108
108
  const { account, ...base } = args;
109
109
  const { client, chainId, resolvedAddress } = useMemoFaucetClient(base);
110
- const { address: connected } = useAccount();
110
+ const { address: connected } = useWagmiAccount();
111
111
  const resolvedAccount = account ?? connected;
112
112
  return useQuery({
113
113
  // The TTT is derived from the CTTT, which is already keyed via
@@ -4,8 +4,9 @@ import { type BaseHookOptions } from "./_shared.js";
4
4
  export interface UseConfidentialBalanceArgs extends BaseHookOptions {
5
5
  /**
6
6
  * Account whose confidential balance handle to read. Defaults to the
7
- * connected wallet (`useAccount().address`). The hook stays disabled until an
8
- * account is available.
7
+ * connected wallet (wagmi v2 `useAccount().address` / v3
8
+ * `useConnection().address`). The hook stays disabled until an account is
9
+ * available.
9
10
  */
10
11
  account?: Address;
11
12
  }
@@ -4,8 +4,8 @@ import { type BaseHookOptions } from "./_shared.js";
4
4
  export interface UseUnderlyingBalanceArgs extends BaseHookOptions {
5
5
  /**
6
6
  * Account whose underlying TTT balance to read. Defaults to the connected
7
- * wallet (`useAccount().address`). The hook stays disabled until an account
8
- * is available.
7
+ * wallet (wagmi v2 `useAccount().address` / v3 `useConnection().address`).
8
+ * The hook stays disabled until an account is available.
9
9
  */
10
10
  account?: Address;
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenops/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.6.0",
4
4
  "description": "Typed viem-first SDK for TokenOps FHEVM contracts (confidential vesting, confidential airdrops, confidential disperse, plus a testnet faucet for the ERC-7984 test-token pair TTT + CTTT) — consumed by tokenops-app (Next.js) and tokenops-api (Express).",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -267,6 +267,7 @@
267
267
  "test:watch": "vitest",
268
268
  "test:coverage": "vitest run --coverage",
269
269
  "test:unit": "vitest run src",
270
+ "test:hooks": "vitest run src/core/wagmi-compat.test.ts test/fhe-vesting/react test/fhe-airdrop/react test/fhe-disperse/react test/testnet-faucet/react test/fhe/react test/react",
270
271
  "test:local": "vitest run test",
271
272
  "test:local-all": "./scripts/run-local-fhevm-tests.sh",
272
273
  "test:sepolia": "vitest run test --reporter=verbose",
@@ -289,7 +290,7 @@
289
290
  "@zama-fhe/sdk": "^3.0.0",
290
291
  "react": ">=18.0.0",
291
292
  "viem": "^2.47.0",
292
- "wagmi": "^2.0.0"
293
+ "wagmi": "^2.0.0 || ^3.0.0"
293
294
  },
294
295
  "peerDependenciesMeta": {
295
296
  "@zama-fhe/sdk": {
@@ -315,25 +316,30 @@
315
316
  "overrides": {
316
317
  "@types/react": "19.2.15",
317
318
  "@types/react-dom": "19.2.3",
318
- "axios@<1.15.2": "^1.16.1",
319
+ "axios@<1.18.0": "^1.18.0",
319
320
  "form-data@<4.0.6": "^4.0.6",
320
321
  "dompurify@<3.4.11": "^3.4.11",
321
322
  "ws@>=8.0.0 <8.20.1": "^8.21.0",
322
323
  "ws@>=7.0.0 <7.5.11": "^7.5.11",
323
- "postcss@>=8.0.0 <8.5.10": "^8.5.15",
324
+ "postcss@<8.5.18": "8.5.23",
324
325
  "esbuild@<0.28.1": "^0.28.1",
325
326
  "vite@<6.4.3": "^6.4.3",
326
- "hono@<4.12.25": "^4.12.25",
327
- "js-yaml@<4.2.0": "^4.2.0",
327
+ "hono@<4.12.27": "^4.12.27",
328
+ "js-yaml@<4.3.0": "^4.3.0",
328
329
  "uuid@<11.1.1": "^11.1.1",
329
330
  "linkifyjs@<4.3.2": "^4.3.3",
331
+ "linkify-it@<5.0.2": "^5.0.2",
332
+ "fast-uri@>=3.0.0 <3.1.4": "^3.1.4",
333
+ "brace-expansion@<1.1.16": "^1.1.16",
334
+ "brace-expansion@>=2.0.0 <2.1.3": "^2.1.3",
335
+ "brace-expansion@>=3.0.0 <5.0.8": "^5.0.8",
330
336
  "@privy-io/js-sdk-core@<0.56.0": "^0.56.4"
331
337
  }
332
338
  },
333
339
  "devDependencies": {
334
340
  "@commitlint/cli": "^20.0.0",
335
341
  "@commitlint/config-conventional": "^20.0.0",
336
- "@eslint/js": "^9.0.0",
342
+ "@eslint/js": "^10.0.1",
337
343
  "@fhevm/mock-utils": "^0.4.2",
338
344
  "@microsoft/api-extractor": "^7.58.7",
339
345
  "@tanstack/react-query": "^5.100.11",
@@ -343,7 +349,7 @@
343
349
  "@types/react-dom": "^18.3.7",
344
350
  "@vitest/coverage-v8": "^3.2.6",
345
351
  "@zama-fhe/sdk": "^3.0.0",
346
- "eslint": "^9.0.0",
352
+ "eslint": "^10.8.0",
347
353
  "eslint-config-prettier": "^10.0.0",
348
354
  "ethers": "^6.16.0",
349
355
  "happy-dom": "^20.9.0",
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- // src/core/brands.ts
4
- var asEncryptedHandle = (h) => h;
5
- var asExternalInputProof = (h) => h;
6
- var asTxHash = (h) => h;
7
- var asVestingId = (h) => h;
8
- var asAirdropId = (h) => h;
9
- var asDisperseId = (h) => h;
10
- var asRole = (h) => h;
11
- var asSignature = (h) => h;
12
-
13
- exports.asAirdropId = asAirdropId;
14
- exports.asDisperseId = asDisperseId;
15
- exports.asEncryptedHandle = asEncryptedHandle;
16
- exports.asExternalInputProof = asExternalInputProof;
17
- exports.asRole = asRole;
18
- exports.asSignature = asSignature;
19
- exports.asTxHash = asTxHash;
20
- exports.asVestingId = asVestingId;
@@ -1,11 +0,0 @@
1
- // src/core/brands.ts
2
- var asEncryptedHandle = (h) => h;
3
- var asExternalInputProof = (h) => h;
4
- var asTxHash = (h) => h;
5
- var asVestingId = (h) => h;
6
- var asAirdropId = (h) => h;
7
- var asDisperseId = (h) => h;
8
- var asRole = (h) => h;
9
- var asSignature = (h) => h;
10
-
11
- export { asAirdropId, asDisperseId, asEncryptedHandle, asExternalInputProof, asRole, asSignature, asTxHash, asVestingId };
@@ -1,25 +0,0 @@
1
- import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { TxHash } from "../../core/brands.js";
3
- import type { ClaimArgs } from "../airdrop.js";
4
- import { type AirdropHookOptions } from "./_shared.js";
5
- /**
6
- * Claim tokens from an airdrop using an EIP-712 admin signature. The SDK
7
- * encrypts the plaintext `amount` into an `externalEuint64` and submits it
8
- * with an input proof — callers never handle ciphertext. Attaches `GAS_FEE()`
9
- * ETH automatically unless `args.value` is set.
10
- *
11
- * **Encryptor resolution.** The hook-level `encryptor` (from
12
- * {@link AirdropHookOptions}) is forwarded lazily to the SDK client. You can
13
- * also pass `encryptor` per-mutation via `args.encryptor` to override it. If
14
- * neither is present, the SDK throws `Missing encryptor — pass encryptor…`
15
- * verbatim.
16
- *
17
- * After a successful claim, invalidate
18
- * `useAirdropIsSignatureClaimed({ user, encryptedAmountHandle })` and any
19
- * UI counts you computed off it.
20
- *
21
- * @example
22
- * const claim = useAirdropClaim({ address: airdropAddress, encryptor: () => useZamaSDK().relayer });
23
- * claim.mutate({ amount: 1_000_000n, signature });
24
- */
25
- export declare function useAirdropClaim(options: AirdropHookOptions): UseMutationResult<TxHash, Error, ClaimArgs>;
@@ -1,30 +0,0 @@
1
- import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { EncryptedViewResult, GetClaimAmountArgs } from "../airdrop.js";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- /**
5
- * **Submits a transaction (costs gas) to grant the caller decrypt access to
6
- * the claim amount as an `euint64` handle.** The handle is granted persistent
7
- * ACL on-chain via `FHE.allow(handle, msg.sender)`; the SDK extracts it from
8
- * the receipt's `ACL.Allowed` event (NOT from simulation — that returns a
9
- * divergent, ACL-less handle; see CLAUDE.md Pitfall #1).
10
- *
11
- * Pass `data.handle` to the Zama relayer's `userDecrypt` to obtain the
12
- * plaintext amount. The handle is only valid after the tx lands.
13
- *
14
- * Does **not** consume the claim (the `claimedSignatures` bit is not set).
15
- * Call {@link useClaim} when the user is ready to transfer tokens.
16
- *
17
- * Submits the admin-issued `{ encryptedInput, signature }` pair verbatim. The
18
- * SDK does NOT re-encrypt — the signature commits to the exact handle.
19
- *
20
- * @example
21
- * // `encryptedInput` + `signature` are the admin-issued payload delivered to
22
- * // the recipient (same pair the recipient passes to `useClaim`). Sourced
23
- * // from your server API or, for admin-dashboard flows, by combining
24
- * // `encryptUint64({ userAddress: recipient, ... })` with
25
- * // `useSignClaimAuthorization`.
26
- * const view = useGetClaimAmount({ address: airdropAddress });
27
- * view.mutate({ encryptedInput, signature });
28
- * // view.data → { handle: "0x...", hash: "0x..." }
29
- */
30
- export declare function useGetClaimAmount(options: AirdropHookOptions): UseMutationResult<EncryptedViewResult, Error, GetClaimAmountArgs>;
@@ -1,13 +0,0 @@
1
- import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { Account, Address, Hex } from "viem";
3
- import type { EncryptedViewResult } from "../manager.js";
4
- import { type ManagerHookOptions } from "./_shared.js";
5
- export interface UseGetClaimableAmountArgs {
6
- vestingId: Hex;
7
- account?: Account | Address;
8
- }
9
- /**
10
- * **Submits a transaction** to read the currently-claimable amount as an
11
- * `euint128` handle. Pass `data.handle` to the Zama relayer's `userDecrypt`.
12
- */
13
- export declare function useGetClaimableAmount(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetClaimableAmountArgs>;
@@ -1,14 +0,0 @@
1
- import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { Account, Address, Hex } from "viem";
3
- import type { EncryptedViewResult } from "../manager.js";
4
- import { type ManagerHookOptions } from "./_shared.js";
5
- export interface UseGetSettledAmountArgs {
6
- vestingId: Hex;
7
- account?: Account | Address;
8
- }
9
- /**
10
- * **Submits a transaction** to read the already-claimed (settled) amount of a
11
- * vesting as an `euint128` handle. Pass `data.handle` to the Zama relayer's
12
- * `userDecrypt`.
13
- */
14
- export declare function useGetSettledAmount(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetSettledAmountArgs>;
@@ -1,13 +0,0 @@
1
- import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { Account, Address, Hex } from "viem";
3
- import type { EncryptedViewResult } from "../manager.js";
4
- import { type ManagerHookOptions } from "./_shared.js";
5
- export interface UseGetTotalAllocationArgs {
6
- vestingId: Hex;
7
- account?: Account | Address;
8
- }
9
- /**
10
- * **Submits a transaction** to read the total allocation of a vesting as an
11
- * `euint128` handle. Pass `data.handle` to the Zama relayer's `userDecrypt`.
12
- */
13
- export declare function useGetTotalAllocation(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetTotalAllocationArgs>;
@@ -1,25 +0,0 @@
1
- import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { Account, Address, Hex } from "viem";
3
- import type { EncryptedViewResult } from "../manager.js";
4
- import { type ManagerHookOptions } from "./_shared.js";
5
- export interface UseGetVestedAmountArgs {
6
- vestingId: Hex;
7
- /** Unix timestamp (seconds) — `Math.floor(Date.now() / 1000)` for "now". */
8
- timestamp: number;
9
- account?: Account | Address;
10
- }
11
- /**
12
- * **Submits a transaction** to read the vested amount at a given timestamp as
13
- * an `euint128` handle. The contract performs `FHE.allow(handle, msg.sender)`
14
- * so persistent ACL is granted to the caller; the SDK parses the handle from
15
- * the receipt's `ACL.Allowed` event (NOT from simulation — that returns a
16
- * different, ACL-less handle).
17
- *
18
- * Pass `data.handle` to the Zama relayer's `userDecrypt` to get the plaintext.
19
- *
20
- * @example
21
- * const getVested = useGetVestedAmount({ address: managerAddress });
22
- * getVested.mutate({ vestingId, timestamp: Math.floor(Date.now() / 1000) });
23
- * // getVested.data → { handle: "0x...", hash: "0x..." }
24
- */
25
- export declare function useGetVestedAmount(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetVestedAmountArgs>;