@tokenops/sdk 1.1.1 → 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 (131) hide show
  1. package/README.md +18 -8
  2. package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
  3. package/dist/{chunk-FXCW7LVB.js → chunk-2PWNH3UE.js} +35 -6
  4. package/dist/{chunk-FPQBFIUW.cjs → chunk-4WPGQSNT.cjs} +3 -3
  5. package/dist/{chunk-OYLZEEHF.cjs → chunk-5X5WL5CU.cjs} +265 -101
  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-SAGJIEQK.cjs → chunk-C7BRZXJA.cjs} +14 -14
  11. package/dist/{chunk-OQZAZIAS.js → chunk-DUZIIRPF.js} +174 -5
  12. package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
  13. package/dist/chunk-FT4LNBOS.js +11 -0
  14. package/dist/{chunk-QE7ZONJ2.js → chunk-IJFQ5L4I.js} +4 -4
  15. package/dist/{chunk-X56UVEXS.js → chunk-IXLO7GO5.js} +209 -45
  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-3PQ2RFPC.js → chunk-NTZY6IB7.js} +4 -4
  21. package/dist/{chunk-JJ4R5QXF.js → chunk-ODLTEGHB.js} +1 -1
  22. package/dist/{chunk-XWDVPV42.js → chunk-ORFTDNFZ.js} +4 -4
  23. package/dist/{chunk-IR5AK5U5.js → chunk-OXTLPTO3.js} +4 -4
  24. package/dist/{chunk-23F7JIK5.cjs → chunk-PFXURMBZ.cjs} +77 -48
  25. package/dist/{chunk-3ZRHDTEX.cjs → chunk-PUPKNW3R.cjs} +2 -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-G7G75C46.cjs → chunk-T46YXSBP.cjs} +11 -11
  29. package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
  30. package/dist/{chunk-SYHXDHWX.cjs → chunk-TIUKIY5V.cjs} +193 -24
  31. package/dist/{chunk-W7JHOK7G.cjs → chunk-V2PXZVBF.cjs} +4 -4
  32. package/dist/{chunk-SEKC7H5Y.cjs → chunk-W7IGCOVL.cjs} +11 -11
  33. package/dist/{chunk-5KHIQG7Y.cjs → chunk-WENHUPZC.cjs} +31 -31
  34. package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
  35. package/dist/{chunk-M7V2EDPB.js → chunk-XGGTQQFH.js} +1 -1
  36. package/dist/{chunk-ITQBDRWX.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/errors.d.ts +41 -1
  41. package/dist/core/revert-mapper.d.ts +77 -0
  42. package/dist/core/wagmi-compat.d.ts +40 -0
  43. package/dist/fhe/index.cjs +112 -66
  44. package/dist/fhe/index.d.cts +1 -1
  45. package/dist/fhe/index.d.ts +1 -1
  46. package/dist/fhe/index.js +50 -8
  47. package/dist/fhe/react/index.cjs +7 -7
  48. package/dist/fhe/react/index.js +2 -2
  49. package/dist/fhe/sepolia-encryptor-web.d.ts +27 -1
  50. package/dist/fhe/sepolia-encryptor.d.ts +38 -0
  51. package/dist/fhe-airdrop/advanced/index.cjs +9 -8
  52. package/dist/fhe-airdrop/advanced/index.js +7 -6
  53. package/dist/fhe-airdrop/advanced/react/index.cjs +14 -13
  54. package/dist/fhe-airdrop/advanced/react/index.js +10 -9
  55. package/dist/fhe-airdrop/airdrop.d.ts +2 -0
  56. package/dist/fhe-airdrop/encryption.d.ts +8 -0
  57. package/dist/fhe-airdrop/factory.d.ts +86 -1
  58. package/dist/fhe-airdrop/index.cjs +61 -57
  59. package/dist/fhe-airdrop/index.d.cts +3 -3
  60. package/dist/fhe-airdrop/index.d.ts +3 -3
  61. package/dist/fhe-airdrop/index.js +7 -7
  62. package/dist/fhe-airdrop/react/index.cjs +163 -133
  63. package/dist/fhe-airdrop/react/index.d.cts +4 -3
  64. package/dist/fhe-airdrop/react/index.d.ts +4 -3
  65. package/dist/fhe-airdrop/react/index.js +38 -13
  66. package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +2 -0
  67. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
  68. package/dist/fhe-airdrop/react/useClaim.d.ts +2 -0
  69. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
  70. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
  71. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
  72. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
  73. package/dist/fhe-airdrop/types.d.ts +45 -0
  74. package/dist/fhe-disperse/encryption.d.ts +8 -0
  75. package/dist/fhe-disperse/index.cjs +69 -65
  76. package/dist/fhe-disperse/index.d.cts +1 -1
  77. package/dist/fhe-disperse/index.d.ts +1 -1
  78. package/dist/fhe-disperse/index.js +8 -8
  79. package/dist/fhe-disperse/react/index.cjs +90 -86
  80. package/dist/fhe-disperse/react/index.d.cts +1 -1
  81. package/dist/fhe-disperse/react/index.d.ts +1 -1
  82. package/dist/fhe-disperse/react/index.js +10 -10
  83. package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
  84. package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
  85. package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
  86. package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
  87. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +6 -0
  88. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
  89. package/dist/fhe-disperse/singleton.d.ts +29 -0
  90. package/dist/fhe-disperse/subtotals.d.ts +6 -0
  91. package/dist/fhe-vesting/advanced/index.cjs +8 -8
  92. package/dist/fhe-vesting/advanced/index.js +6 -6
  93. package/dist/fhe-vesting/advanced/react/index.cjs +15 -14
  94. package/dist/fhe-vesting/advanced/react/index.js +12 -11
  95. package/dist/fhe-vesting/encryption.d.ts +8 -0
  96. package/dist/fhe-vesting/index.cjs +79 -75
  97. package/dist/fhe-vesting/index.d.cts +2 -2
  98. package/dist/fhe-vesting/index.d.ts +2 -2
  99. package/dist/fhe-vesting/index.js +9 -9
  100. package/dist/fhe-vesting/manager.d.ts +100 -1
  101. package/dist/fhe-vesting/react/index.cjs +241 -219
  102. package/dist/fhe-vesting/react/index.d.cts +3 -2
  103. package/dist/fhe-vesting/react/index.d.ts +3 -2
  104. package/dist/fhe-vesting/react/index.js +29 -12
  105. package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
  106. package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +2 -0
  107. package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
  108. package/dist/fhe-vesting/react/useClaim.d.ts +2 -0
  109. package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
  110. package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +6 -0
  111. package/dist/fhe-vesting/react/usePartialClaim.d.ts +8 -0
  112. package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
  113. package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
  114. package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
  115. package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
  116. package/dist/fhe-vesting/types.d.ts +34 -0
  117. package/dist/index.cjs +61 -53
  118. package/dist/index.d.cts +1 -1
  119. package/dist/index.d.ts +1 -1
  120. package/dist/index.js +2 -2
  121. package/dist/testnet-faucet/index.cjs +58 -54
  122. package/dist/testnet-faucet/index.d.cts +1 -1
  123. package/dist/testnet-faucet/index.d.ts +1 -1
  124. package/dist/testnet-faucet/index.js +5 -5
  125. package/dist/testnet-faucet/react/index.cjs +60 -55
  126. package/dist/testnet-faucet/react/index.d.cts +3 -2
  127. package/dist/testnet-faucet/react/index.d.ts +3 -2
  128. package/dist/testnet-faucet/react/index.js +11 -10
  129. package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +3 -2
  130. package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +2 -2
  131. package/package.json +3 -2
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkOYLZEEHF_cjs = require('./chunk-OYLZEEHF.cjs');
4
- var chunkSAGJIEQK_cjs = require('./chunk-SAGJIEQK.cjs');
5
- var chunk3ZRHDTEX_cjs = require('./chunk-3ZRHDTEX.cjs');
6
- var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
3
+ var chunk5X5WL5CU_cjs = require('./chunk-5X5WL5CU.cjs');
4
+ var chunkC7BRZXJA_cjs = require('./chunk-C7BRZXJA.cjs');
5
+ var chunkPUPKNW3R_cjs = require('./chunk-PUPKNW3R.cjs');
6
+ var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
7
7
  var react = require('react');
8
8
  var wagmi = require('wagmi');
9
9
 
@@ -25,7 +25,7 @@ function useHookFiredEvent(hookName, telemetry, hasWallet, chainId) {
25
25
  function tryResolveFactoryAddress(override, chainId) {
26
26
  if (override) return override;
27
27
  if (chainId === void 0) return void 0;
28
- return chunk3ZRHDTEX_cjs.getFheVestingFactoryAddress(chainId);
28
+ return chunkPUPKNW3R_cjs.getFheVestingFactoryAddress(chainId);
29
29
  }
30
30
  function useMemoFactoryClient(opts = {}) {
31
31
  const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
@@ -38,7 +38,7 @@ function useMemoFactoryClient(opts = {}) {
38
38
  const client = react.useMemo(() => {
39
39
  if (!publicClient) return void 0;
40
40
  if (!resolvedAddress) return void 0;
41
- return chunkSAGJIEQK_cjs.createConfidentialVestingFactoryClient({
41
+ return chunkC7BRZXJA_cjs.createConfidentialVestingFactoryClient({
42
42
  publicClient,
43
43
  ...walletClient ? { walletClient } : {},
44
44
  address: resolvedAddress,
@@ -58,16 +58,16 @@ function useMemoFactoryClient(opts = {}) {
58
58
  function computeFactoryResolutionError(override, chainId) {
59
59
  if (override) return void 0;
60
60
  if (chainId === void 0) {
61
- return new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
61
+ return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
62
62
  reason: "chain-id-missing",
63
63
  product: "fheVesting",
64
64
  contract: "confidentialVestingFactory",
65
65
  clientLabel: "ConfidentialVestingFactoryClient"
66
66
  });
67
67
  }
68
- const resolved = chunk3ZRHDTEX_cjs.getFheVestingFactoryAddress(chainId);
68
+ const resolved = chunkPUPKNW3R_cjs.getFheVestingFactoryAddress(chainId);
69
69
  if (!resolved) {
70
- return new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
70
+ return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
71
71
  reason: "registry-not-deployed",
72
72
  product: "fheVesting",
73
73
  contract: "confidentialVestingFactory",
@@ -88,13 +88,13 @@ function useMemoManagerClient(opts) {
88
88
  const client = react.useMemo(() => {
89
89
  if (!publicClient) return void 0;
90
90
  if (!opts.address) return void 0;
91
- return chunkOYLZEEHF_cjs.createConfidentialVestingManagerClient({
91
+ return chunk5X5WL5CU_cjs.createConfidentialVestingManagerClient({
92
92
  publicClient,
93
93
  ...walletClient ? { walletClient } : {},
94
94
  address: opts.address,
95
95
  // Lazy — invoked per-encryption inside the headless client. Picks up
96
96
  // whichever EncryptorSource the consumer last passed in.
97
- encryptor: () => chunkOYLZEEHF_cjs.resolveEncryptor(encryptorSourceRef.current),
97
+ encryptor: () => chunk5X5WL5CU_cjs.resolveEncryptor(encryptorSourceRef.current),
98
98
  ...opts.aclAddress ? { aclAddress: opts.aclAddress } : {},
99
99
  ...telemetry ? { telemetry } : {}
100
100
  });
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkVDXVNZCO_cjs = require('./chunk-VDXVNZCO.cjs');
4
- var chunk3ZRHDTEX_cjs = require('./chunk-3ZRHDTEX.cjs');
5
- var chunkCQIPRNS7_cjs = require('./chunk-CQIPRNS7.cjs');
3
+ var chunkKLKI352M_cjs = require('./chunk-KLKI352M.cjs');
4
+ var chunkPUPKNW3R_cjs = require('./chunk-PUPKNW3R.cjs');
5
+ var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
6
6
  var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
7
7
  var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
8
- var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
8
+ var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
9
9
  var chains = require('viem/chains');
10
10
  var viem = require('viem');
11
11
 
@@ -1701,7 +1701,7 @@ var tokenopsTestTokenAbi = [
1701
1701
  ];
1702
1702
 
1703
1703
  // src/testnet-faucet/errors.ts
1704
- var FaucetSupplyExhaustedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1704
+ var FaucetSupplyExhaustedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
1705
1705
  name = "FaucetSupplyExhaustedError";
1706
1706
  constructor(args) {
1707
1707
  super(
@@ -1721,14 +1721,14 @@ function isTestnetFaucetChainId(chainId) {
1721
1721
  function assertTestnetFaucetChain(chainId) {
1722
1722
  if (chainId === void 0) return;
1723
1723
  if (!isTestnetFaucetChainId(chainId)) {
1724
- throw new chunk56UI7LUR_cjs.UnsupportedChainError(chainId);
1724
+ throw new chunk67OV5CX2_cjs.UnsupportedChainError(chainId);
1725
1725
  }
1726
1726
  }
1727
1727
  var UINT64_MAX = (1n << 64n) - 1n;
1728
1728
  var UINT256_MAX = (1n << 256n) - 1n;
1729
1729
  function assertUint64Amount(value, argument, method) {
1730
1730
  if (typeof value !== "bigint") {
1731
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1731
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
1732
1732
  method,
1733
1733
  argument,
1734
1734
  reason: "amount must be a bigint",
@@ -1736,7 +1736,7 @@ function assertUint64Amount(value, argument, method) {
1736
1736
  });
1737
1737
  }
1738
1738
  if (value <= 0n) {
1739
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1739
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
1740
1740
  method,
1741
1741
  argument,
1742
1742
  reason: "amount must be greater than zero",
@@ -1744,7 +1744,7 @@ function assertUint64Amount(value, argument, method) {
1744
1744
  });
1745
1745
  }
1746
1746
  if (value > UINT64_MAX) {
1747
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1747
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
1748
1748
  method,
1749
1749
  argument,
1750
1750
  reason: `amount exceeds uint64 max (${UINT64_MAX.toString()})`,
@@ -1754,7 +1754,7 @@ function assertUint64Amount(value, argument, method) {
1754
1754
  }
1755
1755
  function assertUint256Amount(value, argument, method) {
1756
1756
  if (typeof value !== "bigint") {
1757
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1757
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
1758
1758
  method,
1759
1759
  argument,
1760
1760
  reason: "amount must be a bigint",
@@ -1762,7 +1762,7 @@ function assertUint256Amount(value, argument, method) {
1762
1762
  });
1763
1763
  }
1764
1764
  if (value <= 0n) {
1765
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1765
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
1766
1766
  method,
1767
1767
  argument,
1768
1768
  reason: "amount must be greater than zero",
@@ -1770,7 +1770,7 @@ function assertUint256Amount(value, argument, method) {
1770
1770
  });
1771
1771
  }
1772
1772
  if (value > UINT256_MAX) {
1773
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1773
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
1774
1774
  method,
1775
1775
  argument,
1776
1776
  reason: "amount exceeds uint256 max",
@@ -1779,9 +1779,9 @@ function assertUint256Amount(value, argument, method) {
1779
1779
  }
1780
1780
  }
1781
1781
  function assertNonZeroRecipient(input, argument, method) {
1782
- const normalised = chunkCQIPRNS7_cjs.normaliseAddress(input);
1782
+ const normalised = chunkJK4XMMKM_cjs.normaliseAddress(input);
1783
1783
  if (/^0x0{40}$/i.test(normalised)) {
1784
- throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1784
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
1785
1785
  method,
1786
1786
  argument,
1787
1787
  reason: "recipient must not be the zero address",
@@ -1799,7 +1799,7 @@ var faucetProductMapper = (name, _args, ctx) => {
1799
1799
  });
1800
1800
  case "ERC7984InvalidReceiver":
1801
1801
  case "ERC20InvalidReceiver":
1802
- return new chunk56UI7LUR_cjs.InvalidArgumentError({
1802
+ return new chunk67OV5CX2_cjs.InvalidArgumentError({
1803
1803
  method: ctx.method,
1804
1804
  argument: "to",
1805
1805
  reason: "recipient must not be the zero address"
@@ -1824,10 +1824,10 @@ var TestnetFaucetClient = class {
1824
1824
  const chainId = config.chainId ?? config.publicClient.chain?.id;
1825
1825
  this.#chainId = chainId;
1826
1826
  assertTestnetFaucetChain(chainId);
1827
- const addressOverride = config.address ? chunkCQIPRNS7_cjs.normaliseAddress(config.address) : void 0;
1828
- const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunk3ZRHDTEX_cjs.getConfidentialTestTokenAddress(chainId));
1827
+ const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
1828
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkPUPKNW3R_cjs.getConfidentialTestTokenAddress(chainId));
1829
1829
  if (!resolved) {
1830
- throw new chunk56UI7LUR_cjs.DeploymentAddressUnavailableError({
1830
+ throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
1831
1831
  reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
1832
1832
  product: "testnetFaucet",
1833
1833
  contract: "confidentialTestToken",
@@ -1840,7 +1840,7 @@ var TestnetFaucetClient = class {
1840
1840
  this.#telemetry?.event("testnet-faucet.client.init", {
1841
1841
  chainId: chainId ?? null,
1842
1842
  hasWallet: !!this.walletClient,
1843
- sdkVersion: chunkVDXVNZCO_cjs.SDK_VERSION
1843
+ sdkVersion: chunkKLKI352M_cjs.SDK_VERSION
1844
1844
  });
1845
1845
  }
1846
1846
  // ============================================================
@@ -1863,9 +1863,9 @@ var TestnetFaucetClient = class {
1863
1863
  */
1864
1864
  async underlyingToken() {
1865
1865
  if (this.#cachedUnderlying) return this.#cachedUnderlying;
1866
- const fromRegistry = this.#cttAddressIsOverride || this.#chainId === void 0 ? void 0 : chunk3ZRHDTEX_cjs.getTestTokenAddress(this.#chainId);
1866
+ const fromRegistry = this.#cttAddressIsOverride || this.#chainId === void 0 ? void 0 : chunkPUPKNW3R_cjs.getTestTokenAddress(this.#chainId);
1867
1867
  const resolved = fromRegistry ?? await this.#readCtt("underlying");
1868
- this.#cachedUnderlying = chunkCQIPRNS7_cjs.normaliseAddress(resolved);
1868
+ this.#cachedUnderlying = chunkJK4XMMKM_cjs.normaliseAddress(resolved);
1869
1869
  return this.#cachedUnderlying;
1870
1870
  }
1871
1871
  /**
@@ -1997,7 +1997,7 @@ var TestnetFaucetClient = class {
1997
1997
  }
1998
1998
  const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
1999
1999
  if (receipt.status !== "success") {
2000
- throw new chunk56UI7LUR_cjs.TokenOpsContractError(`mintConfidential: transaction ${hash} reverted`, {
2000
+ throw new chunk67OV5CX2_cjs.TokenOpsContractError(`mintConfidential: transaction ${hash} reverted`, {
2001
2001
  contract: "ConfidentialTokenopsTestToken",
2002
2002
  call: "mint",
2003
2003
  tx: hash
@@ -2010,7 +2010,7 @@ var TestnetFaucetClient = class {
2010
2010
  });
2011
2011
  const ours = events.filter((ev2) => ev2.address.toLowerCase() === this.address.toLowerCase());
2012
2012
  if (ours.length === 0) {
2013
- throw new chunk56UI7LUR_cjs.ReceiptEventNotFoundError({
2013
+ throw new chunk67OV5CX2_cjs.ReceiptEventNotFoundError({
2014
2014
  method: "mintConfidential",
2015
2015
  eventName: "ConfidentialMint",
2016
2016
  contractAddress: this.address,
@@ -2018,7 +2018,7 @@ var TestnetFaucetClient = class {
2018
2018
  });
2019
2019
  }
2020
2020
  if (ours.length > 1) {
2021
- throw new chunk56UI7LUR_cjs.ReceiptEventAmbiguousError({
2021
+ throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
2022
2022
  method: "mintConfidential",
2023
2023
  eventName: "ConfidentialMint",
2024
2024
  contractAddress: this.address,
@@ -2071,7 +2071,7 @@ var TestnetFaucetClient = class {
2071
2071
  }
2072
2072
  const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2073
2073
  if (receipt.status !== "success") {
2074
- throw new chunk56UI7LUR_cjs.TokenOpsContractError(`mintUnderlying: transaction ${hash} reverted`, {
2074
+ throw new chunk67OV5CX2_cjs.TokenOpsContractError(`mintUnderlying: transaction ${hash} reverted`, {
2075
2075
  contract: "TokenopsTestToken",
2076
2076
  call: "mint",
2077
2077
  tx: hash
@@ -2088,14 +2088,14 @@ var TestnetFaucetClient = class {
2088
2088
  }
2089
2089
  #requireWallet(method) {
2090
2090
  if (!this.walletClient) {
2091
- throw new chunk56UI7LUR_cjs.MissingWalletClientError(method);
2091
+ throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
2092
2092
  }
2093
2093
  return this.walletClient;
2094
2094
  }
2095
2095
  #resolveAccount(wallet, override, method) {
2096
2096
  const acct = override ?? wallet.account;
2097
2097
  if (!acct) {
2098
- throw new chunk56UI7LUR_cjs.MissingAccountError(method);
2098
+ throw new chunk67OV5CX2_cjs.MissingAccountError(method);
2099
2099
  }
2100
2100
  return acct;
2101
2101
  }
@@ -2105,10 +2105,10 @@ var TestnetFaucetClient = class {
2105
2105
  * neither is available (a read-only client must be told whose balance to read).
2106
2106
  */
2107
2107
  #resolveReadAddress(override, method) {
2108
- if (override) return chunkCQIPRNS7_cjs.normaliseAddress(override);
2108
+ if (override) return chunkJK4XMMKM_cjs.normaliseAddress(override);
2109
2109
  const acct = this.walletClient?.account?.address;
2110
2110
  if (!acct) {
2111
- throw new chunk56UI7LUR_cjs.MissingAccountError(method);
2111
+ throw new chunk67OV5CX2_cjs.MissingAccountError(method);
2112
2112
  }
2113
2113
  return acct;
2114
2114
  }
@@ -2147,13 +2147,13 @@ var TestnetFaucetClient = class {
2147
2147
  account
2148
2148
  });
2149
2149
  } catch (err) {
2150
- if (chunkVDXVNZCO_cjs.isContractRevert(err)) {
2150
+ if (chunkKLKI352M_cjs.isContractRevert(err)) {
2151
2151
  throw this.#mapRevert(target, method, err, void 0, accountAddress(account));
2152
2152
  }
2153
2153
  }
2154
2154
  }
2155
2155
  #mapRevert(target, method, err, productContext, account) {
2156
- return chunkVDXVNZCO_cjs.mapContractRevert(err, {
2156
+ return chunkKLKI352M_cjs.mapContractRevert(err, {
2157
2157
  method,
2158
2158
  contractAddress: target.address,
2159
2159
  abi: target.abi,
@@ -1,4 +1,4 @@
1
- import { TokenOpsSdkError, InvalidArgumentError, DecryptionFailedError, EncryptionFailedError, RelayerUnreachableError, SigningFailedError, UserRejectedSignatureError, UserDecryptNotAllowedError } from './chunk-IVE3QEGD.js';
1
+ import { TokenOpsSdkError, InvalidArgumentError, DecryptionFailedError, EncryptionFailedError, RelayerUnreachableError, SigningFailedError, UserRejectedSignatureError, UserDecryptNotAllowedError } from './chunk-QBJ7O2B4.js';
2
2
 
3
3
  // src/core/zama-error-mapper.ts
4
4
  function mapZamaError(error, args) {
@@ -1,4 +1,4 @@
1
- import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
1
+ import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
2
2
  import { sepolia, mainnet } from 'viem/chains';
3
3
 
4
4
  var DEPLOYED_ADDRESSES = {
@@ -1,4 +1,4 @@
1
- import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-IR5AK5U5.js';
1
+ import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-OXTLPTO3.js';
2
2
 
3
3
  // src/fhe-vesting/advanced/factory-advanced.ts
4
4
  var ConfidentialVestingFactoryAdvancedClient = class extends ConfidentialVestingFactoryClient {
@@ -1,4 +1,4 @@
1
- import { TokenOpsValidationError } from './chunk-IVE3QEGD.js';
1
+ import { TokenOpsValidationError } from './chunk-QBJ7O2B4.js';
2
2
  import { isAddress, getAddress } from 'viem';
3
3
 
4
4
  function normaliseAddress(input) {
@@ -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;
@@ -1,4 +1,4 @@
1
- import { DeploymentAddressUnavailableError } from './chunk-IVE3QEGD.js';
1
+ import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
2
2
  import { parseAbiItem } from 'viem';
3
3
 
4
4
  var FHEVM_ACL_ADDRESS_BY_CHAIN = {
@@ -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_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
@@ -1,5 +1,82 @@
1
1
  import type { Abi, Address } from "viem";
2
2
  import { TokenOpsSdkError } from "./errors.js";
3
+ /**
4
+ * ERC-7984 (Confidential Token) standard error signatures, from the reference
5
+ * implementation the TokenOps tokens vendor
6
+ * (`openzeppelin-confidential/ERC7984.sol`). None of the product contracts
7
+ * declare these in their own ABIs — the revert originates in the *token*, not
8
+ * the product contract — so {@link mapContractRevert} merges this set into
9
+ * every decode. Without it, `decodeErrorResult` fails and consumers see a raw
10
+ * selector hex string (`ContractRevertError: "… reverted with 0x79f2cb38."`).
11
+ *
12
+ * Selectors (keccak-256 of the signature, first 4 bytes):
13
+ *
14
+ * - `ERC7984UnauthorizedSpender(address,address)` → `0x79f2cb38`
15
+ * - `ERC7984UnauthorizedCaller(address)` → `0x782c6ffd`
16
+ * - `ERC7984UnauthorizedUseOfEncryptedAmount(bytes32,address)` → `0x67cfe805`
17
+ * - `ERC7984InvalidReceiver(address)` → `0x8d518801`
18
+ * - `ERC7984InvalidSender(address)` → `0xee457ebf`
19
+ * - `ERC7984ZeroBalance(address)` → `0x5ff91cdc`
20
+ * - `ERC7984InvalidGatewayRequest(uint256)` → `0x05c5b389`
21
+ *
22
+ * `euint64` parameters are `bytes32` at the ABI boundary.
23
+ */
24
+ export declare const ERC7984_ERRORS_ABI: readonly [{
25
+ readonly type: "error";
26
+ readonly name: "ERC7984UnauthorizedSpender";
27
+ readonly inputs: readonly [{
28
+ readonly name: "holder";
29
+ readonly type: "address";
30
+ }, {
31
+ readonly name: "spender";
32
+ readonly type: "address";
33
+ }];
34
+ }, {
35
+ readonly type: "error";
36
+ readonly name: "ERC7984UnauthorizedCaller";
37
+ readonly inputs: readonly [{
38
+ readonly name: "caller";
39
+ readonly type: "address";
40
+ }];
41
+ }, {
42
+ readonly type: "error";
43
+ readonly name: "ERC7984UnauthorizedUseOfEncryptedAmount";
44
+ readonly inputs: readonly [{
45
+ readonly name: "amount";
46
+ readonly type: "bytes32";
47
+ }, {
48
+ readonly name: "user";
49
+ readonly type: "address";
50
+ }];
51
+ }, {
52
+ readonly type: "error";
53
+ readonly name: "ERC7984InvalidReceiver";
54
+ readonly inputs: readonly [{
55
+ readonly name: "receiver";
56
+ readonly type: "address";
57
+ }];
58
+ }, {
59
+ readonly type: "error";
60
+ readonly name: "ERC7984InvalidSender";
61
+ readonly inputs: readonly [{
62
+ readonly name: "sender";
63
+ readonly type: "address";
64
+ }];
65
+ }, {
66
+ readonly type: "error";
67
+ readonly name: "ERC7984ZeroBalance";
68
+ readonly inputs: readonly [{
69
+ readonly name: "holder";
70
+ readonly type: "address";
71
+ }];
72
+ }, {
73
+ readonly type: "error";
74
+ readonly name: "ERC7984InvalidGatewayRequest";
75
+ readonly inputs: readonly [{
76
+ readonly name: "requestId";
77
+ readonly type: "uint256";
78
+ }];
79
+ }];
3
80
  /** Per-product mapping: contract error name → typed SDK error constructor. */
4
81
  export type RevertNameMapper = (name: string, args: readonly unknown[] | undefined, ctx: RevertMapperContext) => TokenOpsSdkError | undefined;
5
82
  /** Context passed into product mappers. `productContext` lets the call site forward args (vestingId, user, etc.) for the mapper to embed in the typed error. */
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Internal wagmi v2/v3 compatibility layer.
3
+ *
4
+ * The SDK supports both wagmi majors (`peerDependencies.wagmi: "^2.0.0 || ^3.0.0"`).
5
+ * wagmi v3 renamed `useAccount` → `useConnection` (official v2→v3 migration
6
+ * guide); `usePublicClient` and `useWalletClient` survive unchanged, so hooks
7
+ * import those from `"wagmi"` directly. Only the account hook needs resolving.
8
+ *
9
+ * The fields the SDK reads are shape-identical across both majors: `address`
10
+ * lives at the top level of both `useAccount()` (v2) and `useConnection()`
11
+ * (v3) return values, typed `Address | undefined` until connected.
12
+ *
13
+ * This module is intentionally NOT exported from any public subpath — it is an
14
+ * internal helper for the `src/<product>/react/` hook files. We namespace-import
15
+ * wagmi so the module typechecks against either major: a named import of
16
+ * `useAccount` would fail `tsc --noEmit` under v3 (and vice versa for
17
+ * `useConnection` under v2).
18
+ */
19
+ import type { Address } from "viem";
20
+ /**
21
+ * Minimal slice of the wagmi account-hook return value the SDK reads.
22
+ *
23
+ * Deliberately narrow: widening this to the full upstream shape would force
24
+ * this module to pick one major's type surface and break typechecking against
25
+ * the other. Every field listed here has been verified shape-identical in
26
+ * wagmi v2 `useAccount()` and wagmi v3 `useConnection()`.
27
+ */
28
+ export interface WagmiAccountResult {
29
+ /** Connected address from the active connector; `undefined` while disconnected. */
30
+ address: Address | undefined;
31
+ }
32
+ /**
33
+ * The installed wagmi major's account hook: `useConnection` (v3) when present,
34
+ * else `useAccount` (v2). Resolved once at module load — the installed wagmi
35
+ * major cannot change at runtime.
36
+ *
37
+ * This IS a React hook (it aliases one) — the rules of hooks apply at every
38
+ * call site.
39
+ */
40
+ export declare const useWagmiAccount: () => WagmiAccountResult;