@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,13 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkNS44KBV5_cjs = require('./chunk-NS44KBV5.cjs');
4
- var chunkQ7ARQSUH_cjs = require('./chunk-Q7ARQSUH.cjs');
5
- var chunkVDXVNZCO_cjs = require('./chunk-VDXVNZCO.cjs');
6
- var chunk3ZRHDTEX_cjs = require('./chunk-3ZRHDTEX.cjs');
7
- var chunkCQIPRNS7_cjs = require('./chunk-CQIPRNS7.cjs');
3
+ var chunkUJS4N2XM_cjs = require('./chunk-UJS4N2XM.cjs');
4
+ var chunkSYHNZSZZ_cjs = require('./chunk-SYHNZSZZ.cjs');
5
+ var chunk43RFBQ73_cjs = require('./chunk-43RFBQ73.cjs');
6
+ var chunkWUXUWTFW_cjs = require('./chunk-WUXUWTFW.cjs');
7
+ var chunkVR3FREBX_cjs = require('./chunk-VR3FREBX.cjs');
8
+ var chunk2RNW4MIJ_cjs = require('./chunk-2RNW4MIJ.cjs');
8
9
  var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
9
- var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
10
- var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
11
10
  var viem = require('viem');
12
11
 
13
12
  // src/fhe-disperse/abis/singleton.ts
@@ -1689,7 +1688,7 @@ function resolveEncryptor(source) {
1689
1688
  var MAX_UINT64 = (1n << 64n) - 1n;
1690
1689
  function assertUint64(value, label) {
1691
1690
  if (value < 0n || value > MAX_UINT64) {
1692
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1691
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1693
1692
  method: "encryptUint64",
1694
1693
  argument: label,
1695
1694
  reason: "exceeds uint64 range (0..2^64-1)",
@@ -1710,7 +1709,7 @@ async function encryptUint64({
1710
1709
  userAddress
1711
1710
  });
1712
1711
  if (handles.length !== 1) {
1713
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1712
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1714
1713
  method: "encryptUint64",
1715
1714
  argument: "handles",
1716
1715
  reason: `expected 1 handle, got ${handles.length}`,
@@ -1718,8 +1717,8 @@ async function encryptUint64({
1718
1717
  });
1719
1718
  }
1720
1719
  return {
1721
- handle: chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(handles[0])),
1722
- inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
1720
+ handle: chunk2RNW4MIJ_cjs.asEncryptedHandle(viem.bytesToHex(handles[0])),
1721
+ inputProof: chunk2RNW4MIJ_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
1723
1722
  };
1724
1723
  }
1725
1724
  async function encryptUint64Batch({
@@ -1729,7 +1728,7 @@ async function encryptUint64Batch({
1729
1728
  values
1730
1729
  }) {
1731
1730
  if (values.length === 0) {
1732
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1731
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1733
1732
  method: "encryptUint64Batch",
1734
1733
  argument: "values",
1735
1734
  reason: "must be non-empty"
@@ -1742,7 +1741,7 @@ async function encryptUint64Batch({
1742
1741
  userAddress
1743
1742
  });
1744
1743
  if (handles.length !== values.length) {
1745
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1744
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1746
1745
  method: "encryptUint64Batch",
1747
1746
  argument: "handles",
1748
1747
  reason: `expected ${values.length} handles, got ${handles.length}`,
@@ -1750,13 +1749,13 @@ async function encryptUint64Batch({
1750
1749
  });
1751
1750
  }
1752
1751
  return {
1753
- handles: handles.map((h) => chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(h))),
1754
- inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
1752
+ handles: handles.map((h) => chunk2RNW4MIJ_cjs.asEncryptedHandle(viem.bytesToHex(h))),
1753
+ inputProof: chunk2RNW4MIJ_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
1755
1754
  };
1756
1755
  }
1757
1756
 
1758
1757
  // src/fhe-disperse/errors.ts
1759
- var NotRegisteredError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1758
+ var NotRegisteredError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError {
1760
1759
  name = "NotRegisteredError";
1761
1760
  constructor(args) {
1762
1761
  super(
@@ -1773,7 +1772,45 @@ var NotRegisteredError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1773
1772
  );
1774
1773
  }
1775
1774
  };
1776
- var AlreadyRegisteredError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1775
+ var SubwalletsNotApprovedError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError {
1776
+ name = "SubwalletsNotApprovedError";
1777
+ constructor(args) {
1778
+ super(
1779
+ `${args.method}: sub-wallets are not fully approved for token ${args.token} \u2014 wallet0: ${args.wallet0Approved}, wallet1: ${args.wallet1Approved}. Call \`approveUserWalletsForToken\` first.`,
1780
+ {
1781
+ code: "TOKENOPS_SUBWALLETS_NOT_APPROVED",
1782
+ cause: args.cause,
1783
+ context: {
1784
+ method: args.method,
1785
+ contractAddress: args.contractAddress,
1786
+ user: args.user,
1787
+ token: args.token,
1788
+ wallet0Approved: args.wallet0Approved,
1789
+ wallet1Approved: args.wallet1Approved
1790
+ }
1791
+ }
1792
+ );
1793
+ }
1794
+ };
1795
+ var SingletonNotApprovedError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError {
1796
+ name = "SingletonNotApprovedError";
1797
+ constructor(args) {
1798
+ super(
1799
+ `${args.method}: ${args.user} has not approved the singleton ${args.contractAddress} as an operator on token ${args.token}. Call setOperator() (see @tokenops/sdk/fhe) before this transaction.`,
1800
+ {
1801
+ code: "TOKENOPS_SINGLETON_NOT_APPROVED",
1802
+ cause: args.cause,
1803
+ context: {
1804
+ method: args.method,
1805
+ contractAddress: args.contractAddress,
1806
+ user: args.user,
1807
+ token: args.token
1808
+ }
1809
+ }
1810
+ );
1811
+ }
1812
+ };
1813
+ var AlreadyRegisteredError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError {
1777
1814
  name = "AlreadyRegisteredError";
1778
1815
  constructor(args) {
1779
1816
  super(
@@ -1810,7 +1847,7 @@ function validateDisperseInputs(args) {
1810
1847
  const errors = [];
1811
1848
  if (recipients.length === 0) {
1812
1849
  errors.push(
1813
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1850
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1814
1851
  method,
1815
1852
  argument: "recipients",
1816
1853
  reason: "must be non-empty"
@@ -1819,7 +1856,7 @@ function validateDisperseInputs(args) {
1819
1856
  }
1820
1857
  if (amounts.length !== recipients.length) {
1821
1858
  errors.push(
1822
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1859
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1823
1860
  method,
1824
1861
  argument: "amounts",
1825
1862
  reason: `length mismatch: recipients.length (${recipients.length}) !== amounts.length (${amounts.length})`
@@ -1829,7 +1866,7 @@ function validateDisperseInputs(args) {
1829
1866
  recipients.forEach((r, i) => {
1830
1867
  if (!viem.isAddress(r, { strict: true })) {
1831
1868
  errors.push(
1832
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1869
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1833
1870
  method,
1834
1871
  argument: `recipients[${i}]`,
1835
1872
  reason: "must be a valid EIP-55 checksummed address",
@@ -1840,7 +1877,7 @@ function validateDisperseInputs(args) {
1840
1877
  }
1841
1878
  if (r === ZERO_ADDRESS) {
1842
1879
  errors.push(
1843
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1880
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1844
1881
  method,
1845
1882
  argument: `recipients[${i}]`,
1846
1883
  reason: "zero address",
@@ -1852,7 +1889,7 @@ function validateDisperseInputs(args) {
1852
1889
  amounts.forEach((v, i) => {
1853
1890
  if (v < 0n || v > MAX_UINT642) {
1854
1891
  errors.push(
1855
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1892
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1856
1893
  method,
1857
1894
  argument: `amounts[${i}]`,
1858
1895
  reason: "exceeds uint64 range (0..2^64-1)"
@@ -1866,7 +1903,7 @@ function validateDisperseInputs(args) {
1866
1903
  const { group0, group1 } = computeSubtotals([...amounts]);
1867
1904
  if (group0 > MAX_UINT642) {
1868
1905
  errors.push(
1869
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1906
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1870
1907
  method,
1871
1908
  argument: "amounts",
1872
1909
  reason: "wallet-mode subtotal exceeds uint64 range"
@@ -1875,7 +1912,7 @@ function validateDisperseInputs(args) {
1875
1912
  }
1876
1913
  if (group1 > MAX_UINT642) {
1877
1914
  errors.push(
1878
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1915
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1879
1916
  method,
1880
1917
  argument: "amounts",
1881
1918
  reason: "wallet-mode subtotal exceeds uint64 range"
@@ -1884,7 +1921,7 @@ function validateDisperseInputs(args) {
1884
1921
  }
1885
1922
  if (group0 <= MAX_UINT642 && group1 <= MAX_UINT642 && group0 + group1 > MAX_UINT642) {
1886
1923
  errors.push(
1887
- new chunk56UI7LUR_cjs.InvalidArgumentError({
1924
+ new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1888
1925
  method,
1889
1926
  argument: "amounts",
1890
1927
  reason: "wallet-mode subtotals sum exceeds uint64 range (would silently zero on-chain)"
@@ -1894,7 +1931,7 @@ function validateDisperseInputs(args) {
1894
1931
  }
1895
1932
  if (batchLimit > 0n && BigInt(recipients.length) > batchLimit) {
1896
1933
  errors.push(
1897
- new chunk56UI7LUR_cjs.BatchTooLargeError({
1934
+ new chunk2RNW4MIJ_cjs.BatchTooLargeError({
1898
1935
  method,
1899
1936
  contractAddress,
1900
1937
  requested: recipients.length,
@@ -1907,7 +1944,7 @@ function validateDisperseInputs(args) {
1907
1944
  function assertChecksumAddress(value, argument, method) {
1908
1945
  if (value === void 0) return;
1909
1946
  if (!viem.isAddress(value, { strict: true })) {
1910
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1947
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1911
1948
  method,
1912
1949
  argument,
1913
1950
  reason: "must be a valid EIP-55 checksummed address \u2014 use viem's getAddress(addr) to fix the checksum",
@@ -1919,7 +1956,7 @@ function assertNonZeroChecksumAddress(value, argument, method) {
1919
1956
  if (value === void 0) return;
1920
1957
  assertChecksumAddress(value, argument, method);
1921
1958
  if (value === ZERO_ADDRESS) {
1922
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1959
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1923
1960
  method,
1924
1961
  argument,
1925
1962
  reason: "must not be the zero address",
@@ -1934,7 +1971,7 @@ function batchLimitForMode(mode, limits) {
1934
1971
  }
1935
1972
 
1936
1973
  // src/fhe-disperse/types.ts
1937
- var DisperseSubwalletNotFoundError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1974
+ var DisperseSubwalletNotFoundError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError {
1938
1975
  name = "DisperseSubwalletNotFoundError";
1939
1976
  constructor(txHash, singletonAddress) {
1940
1977
  super(
@@ -1946,7 +1983,7 @@ var DisperseSubwalletNotFoundError = class extends chunk56UI7LUR_cjs.TokenOpsSdk
1946
1983
  );
1947
1984
  }
1948
1985
  };
1949
- var DisperseEncryptedReserveNotGrantedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1986
+ var DisperseEncryptedReserveNotGrantedError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError {
1950
1987
  name = "DisperseEncryptedReserveNotGrantedError";
1951
1988
  constructor(txHash, callerAddress) {
1952
1989
  super(
@@ -1968,7 +2005,7 @@ var disperseProductMapper = (name, _args, ctx) => {
1968
2005
  case "UserNotRegistered":
1969
2006
  return new NotRegisteredError({ ...ctx, user });
1970
2007
  case "ContractNotAllowed":
1971
- return new chunk56UI7LUR_cjs.InvalidArgumentError({
2008
+ return new chunk2RNW4MIJ_cjs.InvalidArgumentError({
1972
2009
  method: ctx.method,
1973
2010
  argument: "handle",
1974
2011
  reason: "the handle's origin contract did not grant this singleton persistent ACL on the handle. ERC-7984 `transferred` handles are scoped to the token contract \u2014 disclose them through the token, not through `DisperseConfidential`."
@@ -2012,10 +2049,10 @@ var ConfidentialDisperseClient = class {
2012
2049
  this.encryptor = config.encryptor;
2013
2050
  this.#telemetry = config.telemetry;
2014
2051
  const chainId = config.chainId ?? config.publicClient.chain?.id;
2015
- const addressOverride = config.address ? chunkCQIPRNS7_cjs.normaliseAddress(config.address) : void 0;
2016
- const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunk3ZRHDTEX_cjs.getFheDisperseSingletonAddress(chainId));
2052
+ const addressOverride = config.address ? chunkVR3FREBX_cjs.normaliseAddress(config.address) : void 0;
2053
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkWUXUWTFW_cjs.getFheDisperseSingletonAddress(chainId));
2017
2054
  if (!resolved) {
2018
- throw new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
2055
+ throw new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
2019
2056
  reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
2020
2057
  product: "fheDisperse",
2021
2058
  contract: "disperseConfidentialSingleton",
@@ -2029,8 +2066,8 @@ var ConfidentialDisperseClient = class {
2029
2066
  surface: "singleton",
2030
2067
  chainId: chainId ?? null,
2031
2068
  hasWallet: !!this.walletClient,
2032
- aclResolved: !!config.aclAddress || chainId !== void 0 && !!chunkQ7ARQSUH_cjs.getFhevmAclAddress(chainId),
2033
- sdkVersion: chunkVDXVNZCO_cjs.SDK_VERSION
2069
+ aclResolved: !!config.aclAddress || chainId !== void 0 && !!chunkSYHNZSZZ_cjs.getFhevmAclAddress(chainId),
2070
+ sdkVersion: chunk43RFBQ73_cjs.SDK_VERSION
2034
2071
  });
2035
2072
  }
2036
2073
  /**
@@ -2041,7 +2078,7 @@ var ConfidentialDisperseClient = class {
2041
2078
  */
2042
2079
  get aclAddress() {
2043
2080
  if (this.#cachedAclAddress) return this.#cachedAclAddress;
2044
- this.#cachedAclAddress = this.#aclAddressOverride ?? chunkQ7ARQSUH_cjs.requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialDisperseClient");
2081
+ this.#cachedAclAddress = this.#aclAddressOverride ?? chunkSYHNZSZZ_cjs.requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialDisperseClient");
2045
2082
  return this.#cachedAclAddress;
2046
2083
  }
2047
2084
  // ============================================================
@@ -2168,13 +2205,20 @@ var ConfidentialDisperseClient = class {
2168
2205
  * subtotal1` for the result to match the on-chain computation. Both this
2169
2206
  * SDK and the contract round the BPS multiplication down (floor division).
2170
2207
  *
2208
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2209
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2210
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
2211
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2212
+ * transparent TTT test token uses 18 decimals. `totalTokens` follows this
2213
+ * convention.
2214
+ *
2171
2215
  * @throws {TokenOpsSdkError} if mode is `"wallet-token-fee"` and `totalTokens` is not provided.
2172
2216
  */
2173
2217
  async calculateFee(args) {
2174
2218
  const fees = await this.getFees(args.user);
2175
2219
  if (args.mode === "wallet-token-fee") {
2176
2220
  if (args.totalTokens === void 0) {
2177
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2221
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
2178
2222
  method: "calculateFee",
2179
2223
  argument: "totalTokens",
2180
2224
  reason: "is required for wallet-token-fee mode"
@@ -2231,6 +2275,13 @@ var ConfidentialDisperseClient = class {
2231
2275
  * - `hasApprovedSubwallets` (wallet modes) or `isOperator(sender, singleton)` (direct mode)
2232
2276
  * - `calculateFee` / `getBatchLimits`
2233
2277
  * - Structural recipient + amount validation
2278
+ *
2279
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2280
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2281
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
2282
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2283
+ * transparent TTT test token uses 18 decimals. Pass `amounts[]` in the same
2284
+ * units you will pass to `disperse` so the report reflects the real call.
2234
2285
  */
2235
2286
  async preflightDisperse(args) {
2236
2287
  const { user, token, recipients, amounts, mode } = args;
@@ -2323,23 +2374,42 @@ var ConfidentialDisperseClient = class {
2323
2374
  })
2324
2375
  );
2325
2376
  } else if (mode === "wallet" || mode === "wallet-token-fee") {
2326
- if (!hasApprovedSubwallets.both)
2377
+ if (!hasApprovedSubwallets.both) {
2327
2378
  blockers.push(
2328
2379
  `Wallets not fully approved for token \u2014 wallet0: ${hasApprovedSubwallets.wallet0}, wallet1: ${hasApprovedSubwallets.wallet1}`
2329
2380
  );
2381
+ blockerErrors.push(
2382
+ new SubwalletsNotApprovedError({
2383
+ method: "preflightDisperse",
2384
+ contractAddress: this.address,
2385
+ user: args.user,
2386
+ token: args.token,
2387
+ wallet0Approved: hasApprovedSubwallets.wallet0,
2388
+ wallet1Approved: hasApprovedSubwallets.wallet1
2389
+ })
2390
+ );
2391
+ }
2330
2392
  }
2331
2393
  if (mode === "direct" && hasApprovedSingleton === false) {
2332
2394
  blockers.push("Sender has not approved the singleton as operator on the token");
2395
+ blockerErrors.push(
2396
+ new SingletonNotApprovedError({
2397
+ method: "preflightDisperse",
2398
+ contractAddress: this.address,
2399
+ user: args.user,
2400
+ token: args.token
2401
+ })
2402
+ );
2333
2403
  }
2334
2404
  if (isPaused) {
2335
2405
  blockers.push("Singleton is paused");
2336
2406
  blockerErrors.push(
2337
- new chunk56UI7LUR_cjs.PausedError({ method: "preflightDisperse", contractAddress: this.address })
2407
+ new chunk2RNW4MIJ_cjs.PausedError({ method: "preflightDisperse", contractAddress: this.address })
2338
2408
  );
2339
2409
  }
2340
2410
  if (callerBalance < fee.ethValue) {
2341
2411
  blockerErrors.push(
2342
- new chunk56UI7LUR_cjs.InsufficientFeeError({
2412
+ new chunk2RNW4MIJ_cjs.InsufficientFeeError({
2343
2413
  method: "preflightDisperse",
2344
2414
  contractAddress: this.address,
2345
2415
  feeKind: "gas",
@@ -2476,6 +2546,15 @@ var ConfidentialDisperseClient = class {
2476
2546
  * 4. Computes `msg.value` for gas-fee modes; `0` for token-fee mode.
2477
2547
  * 5. Dispatches to the correct contract function based on `mode`.
2478
2548
  *
2549
+ * **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.
2550
+ *
2551
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2552
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2553
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
2554
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2555
+ * transparent TTT test token uses 18 decimals. Every entry of `amounts[]`
2556
+ * follows this convention.
2557
+ *
2479
2558
  * @throws {TokenOpsSdkError} on input validation failure (first deterministic error).
2480
2559
  * @throws {TokenOpsSdkError} if no encryptor is available at call time.
2481
2560
  */
@@ -2487,7 +2566,7 @@ var ConfidentialDisperseClient = class {
2487
2566
  const account = this.#resolveAccount(wallet, args.account, "disperse");
2488
2567
  const enc = resolveEncryptor(this.encryptor);
2489
2568
  if (!enc) {
2490
- throw new chunk56UI7LUR_cjs.MissingEncryptorError("disperse", {
2569
+ throw new chunk2RNW4MIJ_cjs.MissingEncryptorError("disperse", {
2491
2570
  hint: "Pass `encryptor` to the call or the client config."
2492
2571
  });
2493
2572
  }
@@ -2582,7 +2661,7 @@ var ConfidentialDisperseClient = class {
2582
2661
  const aclLogs = receipt.logs.filter(
2583
2662
  (log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
2584
2663
  );
2585
- const events = viem.parseEventLogs({ abi: [chunkQ7ARQSUH_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
2664
+ const events = viem.parseEventLogs({ abi: [chunkSYHNZSZZ_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
2586
2665
  const granted = events.filter(
2587
2666
  (ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
2588
2667
  );
@@ -2590,7 +2669,7 @@ var ConfidentialDisperseClient = class {
2590
2669
  throw new DisperseEncryptedReserveNotGrantedError(hash, accountAddress(account));
2591
2670
  }
2592
2671
  if (granted.length > 1) {
2593
- throw new chunk56UI7LUR_cjs.ReceiptEventAmbiguousError({
2672
+ throw new chunk2RNW4MIJ_cjs.ReceiptEventAmbiguousError({
2594
2673
  method: "getEncryptedFeeReserve",
2595
2674
  eventName: "Allowed",
2596
2675
  contractAddress: this.aclAddress,
@@ -2791,6 +2870,12 @@ var ConfidentialDisperseClient = class {
2791
2870
  * encryptor, or pass `encryptedInput` directly. The contract caps the
2792
2871
  * withdrawal at the available reserve via `FHE.min`.
2793
2872
  *
2873
+ * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2874
+ * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2875
+ * ERC-20. Amount parameters are base units of the token's actual decimals:
2876
+ * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2877
+ * transparent TTT test token uses 18 decimals.
2878
+ *
2794
2879
  * Returns the tx hash plus the **transferred** handle parsed from the
2795
2880
  * `TokenFeeWithdrawn` event. Decrypt the handle via Zama's `userDecrypt`
2796
2881
  * to view the actual amount moved (which can be less than requested when
@@ -2936,7 +3021,7 @@ var ConfidentialDisperseClient = class {
2936
3021
  values: amounts
2937
3022
  });
2938
3023
  } catch (err) {
2939
- throw chunkNS44KBV5_cjs.mapZamaError(err, { method: "disperse[direct]", operation: "encrypt" });
3024
+ throw chunkUJS4N2XM_cjs.mapZamaError(err, { method: "disperse[direct]", operation: "encrypt" });
2940
3025
  }
2941
3026
  let ethValue = gasFeeOverride;
2942
3027
  if (ethValue === void 0) {
@@ -2982,7 +3067,7 @@ var ConfidentialDisperseClient = class {
2982
3067
  values: allValues
2983
3068
  });
2984
3069
  } catch (err) {
2985
- throw chunkNS44KBV5_cjs.mapZamaError(err, { method: `disperse[${mode}]`, operation: "encrypt" });
3070
+ throw chunkUJS4N2XM_cjs.mapZamaError(err, { method: `disperse[${mode}]`, operation: "encrypt" });
2986
3071
  }
2987
3072
  const amountHandles = encrypted.handles.slice(0, count);
2988
3073
  const subtotal0Handle = encrypted.handles[count];
@@ -3109,14 +3194,14 @@ var ConfidentialDisperseClient = class {
3109
3194
  const hasAmount = amount !== void 0;
3110
3195
  const hasInput = preEncrypted !== void 0;
3111
3196
  if (hasAmount && hasInput) {
3112
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
3197
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
3113
3198
  method,
3114
3199
  argument: "amount/encryptedInput",
3115
3200
  reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
3116
3201
  });
3117
3202
  }
3118
3203
  if (!hasAmount && !hasInput) {
3119
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
3204
+ throw new chunk2RNW4MIJ_cjs.InvalidArgumentError({
3120
3205
  method,
3121
3206
  argument: "amount/encryptedInput",
3122
3207
  reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
@@ -3125,7 +3210,7 @@ var ConfidentialDisperseClient = class {
3125
3210
  if (hasInput) return preEncrypted;
3126
3211
  const enc = encryptor ?? resolveEncryptor(this.encryptor);
3127
3212
  if (!enc) {
3128
- throw new chunk56UI7LUR_cjs.MissingEncryptorError("encryptSingle", {
3213
+ throw new chunk2RNW4MIJ_cjs.MissingEncryptorError("encryptSingle", {
3129
3214
  hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
3130
3215
  });
3131
3216
  }
@@ -3137,19 +3222,19 @@ var ConfidentialDisperseClient = class {
3137
3222
  value: amount
3138
3223
  });
3139
3224
  } catch (err) {
3140
- throw chunkNS44KBV5_cjs.mapZamaError(err, { method: "encryptSingle", operation: "encrypt" });
3225
+ throw chunkUJS4N2XM_cjs.mapZamaError(err, { method: "encryptSingle", operation: "encrypt" });
3141
3226
  }
3142
3227
  }
3143
3228
  #requireWallet(method) {
3144
3229
  if (!this.walletClient) {
3145
- throw new chunk56UI7LUR_cjs.MissingWalletClientError(method);
3230
+ throw new chunk2RNW4MIJ_cjs.MissingWalletClientError(method);
3146
3231
  }
3147
3232
  return this.walletClient;
3148
3233
  }
3149
3234
  #resolveAccount(wallet, override, method) {
3150
3235
  const acct = override ?? wallet.account;
3151
3236
  if (!acct) {
3152
- throw new chunk56UI7LUR_cjs.MissingAccountError(method);
3237
+ throw new chunk2RNW4MIJ_cjs.MissingAccountError(method);
3153
3238
  }
3154
3239
  return acct;
3155
3240
  }
@@ -3202,13 +3287,13 @@ var ConfidentialDisperseClient = class {
3202
3287
  ...value !== void 0 ? { value } : {}
3203
3288
  });
3204
3289
  } catch (err) {
3205
- if (chunkVDXVNZCO_cjs.isContractRevert(err)) {
3290
+ if (chunk43RFBQ73_cjs.isContractRevert(err)) {
3206
3291
  throw this.#mapRevert(method, err, productContext, accountAddress(account));
3207
3292
  }
3208
3293
  }
3209
3294
  }
3210
3295
  #mapRevert(method, err, productContext, account) {
3211
- return chunkVDXVNZCO_cjs.mapContractRevert(err, {
3296
+ return chunk43RFBQ73_cjs.mapContractRevert(err, {
3212
3297
  method,
3213
3298
  contractAddress: this.address,
3214
3299
  abi: disperseConfidentialAbi,
@@ -3396,6 +3481,8 @@ exports.FEE_COLLECTOR_ROLE = FEE_COLLECTOR_ROLE;
3396
3481
  exports.FEE_MANAGER_ROLE = FEE_MANAGER_ROLE;
3397
3482
  exports.NotRegisteredError = NotRegisteredError;
3398
3483
  exports.PAUSER_ROLE = PAUSER_ROLE;
3484
+ exports.SingletonNotApprovedError = SingletonNotApprovedError;
3485
+ exports.SubwalletsNotApprovedError = SubwalletsNotApprovedError;
3399
3486
  exports.WITHDRAWER_ROLE = WITHDRAWER_ROLE;
3400
3487
  exports.computeSubtotals = computeSubtotals;
3401
3488
  exports.createConfidentialDisperseClient = createConfidentialDisperseClient;
@@ -1,4 +1,4 @@
1
- import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
1
+ import { DeploymentAddressUnavailableError } from './chunk-DRSPMIZ7.js';
2
2
  import { parseAbiItem } from 'viem';
3
3
 
4
4
  var FHEVM_ACL_ADDRESS_BY_CHAIN = {
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var wagmi = require('wagmi');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var wagmi__namespace = /*#__PURE__*/_interopNamespace(wagmi);
24
+
25
+ // src/core/wagmi-compat.ts
26
+ var wagmiModule = wagmi__namespace;
27
+ var useWagmiAccount = wagmiModule.useConnection ?? wagmiModule.useAccount ?? (() => {
28
+ throw new Error(
29
+ "@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."
30
+ );
31
+ });
32
+
33
+ exports.useWagmiAccount = useWagmiAccount;
@@ -10,7 +10,7 @@ import type { Address } from "viem";
10
10
  export declare const DEPLOYED_ADDRESSES: {
11
11
  readonly fheVesting: {
12
12
  readonly confidentialVestingFactory: {
13
- readonly 11155111: "0xA87701CE9A52D43681600583a99c85b50DbE3150";
13
+ readonly 11155111: "0x059d6Bb8ff9a13E794fe416d4757d7310CdC69ab";
14
14
  };
15
15
  };
16
16
  readonly fheAirdrop: {
@@ -12,7 +12,7 @@ declare const TOKENOPS_SDK_ERROR_BRAND: unique symbol;
12
12
  * on `error.code` in `onError` handlers and UI surfaces. Messages stay
13
13
  * human-readable and may evolve between versions.
14
14
  */
15
- export type TokenOpsSdkErrorCode = "TOKENOPS_UNSUPPORTED_CHAIN" | "TOKENOPS_DEPLOYMENT_ADDRESS_UNAVAILABLE" | "TOKENOPS_MISSING_PUBLIC_CLIENT" | "TOKENOPS_MISSING_WALLET_CLIENT" | "TOKENOPS_MISSING_ACCOUNT" | "TOKENOPS_MISSING_ENCRYPTOR" | "TOKENOPS_MISSING_CLIENT" | "TOKENOPS_INVALID_ARGUMENT" | "TOKENOPS_RECEIPT_EVENT_NOT_FOUND" | "TOKENOPS_RECEIPT_EVENT_AMBIGUOUS" | "TOKENOPS_CONTRACT_REVERT" | "TOKENOPS_PAUSED" | "TOKENOPS_ACCESS_DENIED" | "TOKENOPS_INSUFFICIENT_FEE" | "TOKENOPS_INSUFFICIENT_BALANCE" | "TOKENOPS_BATCH_TOO_LARGE" | "TOKENOPS_FEATURE_DISABLED" | "TOKENOPS_TRANSFER_FAILED" | "TOKENOPS_FHE_HANDLE_NOT_ALLOWED" | "TOKENOPS_ALREADY_INITIALIZED" | "TOKENOPS_REENTRANCY" | "TOKENOPS_INVALID_SIGNATURE" | "TOKENOPS_WALLET_REJECTED" | "TOKENOPS_WALLET_CHAIN_MISMATCH" | "TOKENOPS_NETWORK_ERROR" | "TOKENOPS_INSUFFICIENT_GAS_FUNDS" | "TOKENOPS_UNKNOWN_WRITE_FAILURE" | "TOKENOPS_USER_REJECTED" | "TOKENOPS_SIGNING_FAILED" | "TOKENOPS_RELAYER_UNREACHABLE" | "TOKENOPS_ENCRYPTION_FAILED" | "TOKENOPS_DECRYPTION_FAILED" | "TOKENOPS_USER_DECRYPT_NOT_ALLOWED" | "TOKENOPS_VESTING_NOT_FOUND" | "TOKENOPS_NOT_RECIPIENT" | "TOKENOPS_CLAIM_LOCKED" | "TOKENOPS_VESTING_REVOKED" | "TOKENOPS_NOT_REVOCABLE" | "TOKENOPS_VESTING_EXPIRED" | "TOKENOPS_TRANSFER_ALREADY_PENDING" | "TOKENOPS_NO_PENDING_TRANSFER" | "TOKENOPS_NOT_PENDING_RECIPIENT" | "TOKENOPS_TRANSFER_EXPIRED" | "TOKENOPS_ALREADY_CLAIMED" | "TOKENOPS_CLAIM_NOT_STARTED" | "TOKENOPS_CLAIM_WINDOW_CLOSED" | "TOKENOPS_NOT_REGISTERED" | "TOKENOPS_ALREADY_REGISTERED" | "TOKENOPS_FAUCET_SUPPLY_EXHAUSTED";
15
+ export type TokenOpsSdkErrorCode = "TOKENOPS_UNSUPPORTED_CHAIN" | "TOKENOPS_DEPLOYMENT_ADDRESS_UNAVAILABLE" | "TOKENOPS_MISSING_PUBLIC_CLIENT" | "TOKENOPS_MISSING_WALLET_CLIENT" | "TOKENOPS_MISSING_ACCOUNT" | "TOKENOPS_MISSING_ENCRYPTOR" | "TOKENOPS_MISSING_CLIENT" | "TOKENOPS_INVALID_ARGUMENT" | "TOKENOPS_RECEIPT_EVENT_NOT_FOUND" | "TOKENOPS_RECEIPT_EVENT_AMBIGUOUS" | "TOKENOPS_CONTRACT_REVERT" | "TOKENOPS_PAUSED" | "TOKENOPS_ACCESS_DENIED" | "TOKENOPS_OPERATOR_NOT_APPROVED" | "TOKENOPS_INSUFFICIENT_FEE" | "TOKENOPS_INSUFFICIENT_BALANCE" | "TOKENOPS_BATCH_TOO_LARGE" | "TOKENOPS_FEATURE_DISABLED" | "TOKENOPS_TRANSFER_FAILED" | "TOKENOPS_FHE_HANDLE_NOT_ALLOWED" | "TOKENOPS_ALREADY_INITIALIZED" | "TOKENOPS_REENTRANCY" | "TOKENOPS_INVALID_SIGNATURE" | "TOKENOPS_WALLET_REJECTED" | "TOKENOPS_WALLET_CHAIN_MISMATCH" | "TOKENOPS_NETWORK_ERROR" | "TOKENOPS_INSUFFICIENT_GAS_FUNDS" | "TOKENOPS_UNKNOWN_WRITE_FAILURE" | "TOKENOPS_USER_REJECTED" | "TOKENOPS_SIGNING_FAILED" | "TOKENOPS_RELAYER_UNREACHABLE" | "TOKENOPS_ENCRYPTION_FAILED" | "TOKENOPS_DECRYPTION_FAILED" | "TOKENOPS_USER_DECRYPT_NOT_ALLOWED" | "TOKENOPS_VESTING_NOT_FOUND" | "TOKENOPS_NOT_RECIPIENT" | "TOKENOPS_CLAIM_LOCKED" | "TOKENOPS_VESTING_REVOKED" | "TOKENOPS_NOT_REVOCABLE" | "TOKENOPS_VESTING_EXPIRED" | "TOKENOPS_TRANSFER_ALREADY_PENDING" | "TOKENOPS_NO_PENDING_TRANSFER" | "TOKENOPS_NOT_PENDING_RECIPIENT" | "TOKENOPS_TRANSFER_EXPIRED" | "TOKENOPS_ALREADY_CLAIMED" | "TOKENOPS_CLAIM_NOT_STARTED" | "TOKENOPS_CLAIM_WINDOW_CLOSED" | "TOKENOPS_NOT_REGISTERED" | "TOKENOPS_ALREADY_REGISTERED" | "TOKENOPS_SUBWALLETS_NOT_APPROVED" | "TOKENOPS_SINGLETON_NOT_APPROVED" | "TOKENOPS_FAUCET_SUPPLY_EXHAUSTED";
16
16
  export interface TokenOpsSdkErrorInit {
17
17
  code: TokenOpsSdkErrorCode;
18
18
  cause?: unknown;
@@ -286,6 +286,46 @@ export declare class AccessDeniedError extends TokenOpsSdkError {
286
286
  cause?: unknown;
287
287
  });
288
288
  }
289
+ /**
290
+ * Canonical remediation copy for the ERC-7984 operator prerequisite. Kept as
291
+ * a single exported constant so every surface that mentions the prerequisite
292
+ * (this error, operator helpers, docs) reuses the exact same wording.
293
+ * Do NOT reword — the string is shared verbatim with the docs repo.
294
+ */
295
+ export declare const OPERATOR_NOT_APPROVED_REMEDIATION: "The token has not approved this contract as an operator. Call `setOperator()` (see `/fhe` operators) before this transaction.";
296
+ /**
297
+ * The ERC-7984 token rejected the product contract as a spender —
298
+ * `ERC7984UnauthorizedSpender(address holder, address spender)` (selector
299
+ * `0x79f2cb38`). Raised whenever a TokenOps contract tries to pull
300
+ * confidential tokens from a holder that never called `setOperator()` for it
301
+ * (vesting `createVesting`, airdrop funding, disperse pulls). Also surfaced
302
+ * pre-write as a `blockerErrors[]` entry by the create-side preflights
303
+ * (`preflightCreateVesting` / `preflightCreateAirdrop`).
304
+ *
305
+ * Remediation: call `setOperator()` on the token (see the `/fhe` operator
306
+ * helpers) with the product contract as operator, then retry.
307
+ */
308
+ export declare class OperatorNotApprovedError extends TokenOpsSdkError {
309
+ readonly name = "OperatorNotApprovedError";
310
+ readonly context: {
311
+ method: string;
312
+ contractAddress: Address;
313
+ /** ERC-7984 token whose operator approval is missing (known statically on preflight paths). */
314
+ tokenAddress?: Address;
315
+ /** Token holder whose balance the contract tried to pull (decoded from the revert when available). */
316
+ holder?: Address;
317
+ /** Address the token refused as a spender — the product contract needing operator approval. */
318
+ spender?: Address;
319
+ };
320
+ constructor(args: {
321
+ method: string;
322
+ contractAddress: Address;
323
+ tokenAddress?: Address;
324
+ holder?: Address;
325
+ spender?: Address;
326
+ cause?: unknown;
327
+ });
328
+ }
289
329
  /**
290
330
  * Native ETH (gas) fee or token fee did not match what the contract requires.
291
331
  * `feeKind === "gas"` means the `msg.value` was wrong; `"token"` means the