@tokenops/sdk 1.0.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +120 -26
  2. package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
  3. package/dist/{chunk-QIHZVLIK.js → chunk-2PWNH3UE.js} +35 -6
  4. package/dist/{chunk-T5LVV3KY.cjs → chunk-4WPGQSNT.cjs} +3 -3
  5. package/dist/{chunk-SUOG3BQS.cjs → chunk-5X5WL5CU.cjs} +266 -103
  6. package/dist/{chunk-56UI7LUR.cjs → chunk-67OV5CX2.cjs} +19 -0
  7. package/dist/{chunk-WRCUDSUJ.js → chunk-6BMP4ICG.js} +2 -2
  8. package/dist/{chunk-XXXDQSHE.js → chunk-6R4KNAPK.js} +5 -3
  9. package/dist/{chunk-XSNLAS5M.js → chunk-AOP6HMPW.js} +1 -1
  10. package/dist/{chunk-62DF53UQ.cjs → chunk-C7BRZXJA.cjs} +19 -21
  11. package/dist/{chunk-UOG4PJL5.js → chunk-DUZIIRPF.js} +181 -14
  12. package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
  13. package/dist/chunk-FT4LNBOS.js +11 -0
  14. package/dist/chunk-IJFQ5L4I.js +2171 -0
  15. package/dist/{chunk-52TC6BF7.js → chunk-IXLO7GO5.js} +210 -47
  16. package/dist/{chunk-CQIPRNS7.cjs → chunk-JK4XMMKM.cjs} +3 -3
  17. package/dist/{chunk-ITQ7WKVC.cjs → chunk-JYOTGRSO.cjs} +8 -8
  18. package/dist/{chunk-VDXVNZCO.cjs → chunk-KLKI352M.cjs} +85 -29
  19. package/dist/{chunk-5SA2HF2W.cjs → chunk-MCRBVJGZ.cjs} +24 -22
  20. package/dist/{chunk-ECT3NL2L.js → chunk-NTZY6IB7.js} +4 -4
  21. package/dist/{chunk-ZHFLRKFY.js → chunk-ODLTEGHB.js} +1 -1
  22. package/dist/{chunk-HGXNRR25.js → chunk-ORFTDNFZ.js} +4 -4
  23. package/dist/{chunk-72YGZEQE.js → chunk-OXTLPTO3.js} +9 -11
  24. package/dist/{chunk-HTOMTEA3.cjs → chunk-PFXURMBZ.cjs} +77 -48
  25. package/dist/{chunk-OLDGMKW2.cjs → chunk-PUPKNW3R.cjs} +35 -2
  26. package/dist/{chunk-IVE3QEGD.js → chunk-QBJ7O2B4.js} +18 -1
  27. package/dist/{chunk-JFLEEXKP.js → chunk-SG65XWH7.js} +58 -2
  28. package/dist/{chunk-K6MFFDBJ.cjs → chunk-T46YXSBP.cjs} +11 -11
  29. package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
  30. package/dist/{chunk-6ECAHP5O.cjs → chunk-TIUKIY5V.cjs} +200 -33
  31. package/dist/{chunk-QCA7O2Q5.cjs → chunk-V2PXZVBF.cjs} +4 -4
  32. package/dist/{chunk-JFR5J4FL.cjs → chunk-W7IGCOVL.cjs} +11 -11
  33. package/dist/chunk-WENHUPZC.cjs +2180 -0
  34. package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
  35. package/dist/{chunk-COPFW5Z4.js → chunk-XGGTQQFH.js} +31 -2
  36. package/dist/{chunk-CMRETRZO.js → chunk-YQIBBEFJ.js} +1 -1
  37. package/dist/{chunk-BE2AIZ3K.js → chunk-ZA673I3O.js} +1 -1
  38. package/dist/chunk-ZQUE2B3Q.cjs +33 -0
  39. package/dist/{chunk-FYQ2UW4T.js → chunk-ZWXJTBZO.js} +1 -1
  40. package/dist/core/addresses.d.ts +22 -0
  41. package/dist/core/errors.d.ts +41 -1
  42. package/dist/core/revert-mapper.d.ts +77 -0
  43. package/dist/core/telemetry.d.ts +0 -3
  44. package/dist/core/wagmi-compat.d.ts +40 -0
  45. package/dist/fhe/index.cjs +112 -66
  46. package/dist/fhe/index.d.cts +1 -1
  47. package/dist/fhe/index.d.ts +1 -1
  48. package/dist/fhe/index.js +50 -8
  49. package/dist/fhe/operators.d.ts +1 -1
  50. package/dist/fhe/react/index.cjs +7 -7
  51. package/dist/fhe/react/index.js +2 -2
  52. package/dist/fhe/sepolia-encryptor-web.d.ts +27 -1
  53. package/dist/fhe/sepolia-encryptor.d.ts +38 -0
  54. package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +3 -3
  55. package/dist/fhe-airdrop/advanced/index.cjs +9 -8
  56. package/dist/fhe-airdrop/advanced/index.d.cts +2 -2
  57. package/dist/fhe-airdrop/advanced/index.d.ts +2 -2
  58. package/dist/fhe-airdrop/advanced/index.js +7 -6
  59. package/dist/fhe-airdrop/advanced/react/index.cjs +14 -13
  60. package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -1
  61. package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -1
  62. package/dist/fhe-airdrop/advanced/react/index.js +10 -9
  63. package/dist/fhe-airdrop/airdrop.d.ts +2 -0
  64. package/dist/fhe-airdrop/encryption.d.ts +8 -0
  65. package/dist/fhe-airdrop/factory.d.ts +94 -11
  66. package/dist/fhe-airdrop/index.cjs +61 -57
  67. package/dist/fhe-airdrop/index.d.cts +3 -3
  68. package/dist/fhe-airdrop/index.d.ts +3 -3
  69. package/dist/fhe-airdrop/index.js +7 -7
  70. package/dist/fhe-airdrop/react/index.cjs +163 -133
  71. package/dist/fhe-airdrop/react/index.d.cts +4 -3
  72. package/dist/fhe-airdrop/react/index.d.ts +4 -3
  73. package/dist/fhe-airdrop/react/index.js +38 -13
  74. package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +2 -0
  75. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
  76. package/dist/fhe-airdrop/react/useClaim.d.ts +2 -0
  77. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
  78. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
  79. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
  80. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
  81. package/dist/fhe-airdrop/types.d.ts +45 -0
  82. package/dist/fhe-disperse/encryption.d.ts +8 -0
  83. package/dist/fhe-disperse/index.cjs +69 -65
  84. package/dist/fhe-disperse/index.d.cts +1 -1
  85. package/dist/fhe-disperse/index.d.ts +1 -1
  86. package/dist/fhe-disperse/index.js +8 -8
  87. package/dist/fhe-disperse/react/index.cjs +90 -86
  88. package/dist/fhe-disperse/react/index.d.cts +1 -1
  89. package/dist/fhe-disperse/react/index.d.ts +1 -1
  90. package/dist/fhe-disperse/react/index.js +10 -10
  91. package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
  92. package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
  93. package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
  94. package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
  95. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +8 -2
  96. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
  97. package/dist/fhe-disperse/singleton.d.ts +29 -0
  98. package/dist/fhe-disperse/subtotals.d.ts +6 -0
  99. package/dist/fhe-vesting/advanced/factory-advanced.d.ts +2 -2
  100. package/dist/fhe-vesting/advanced/index.cjs +8 -8
  101. package/dist/fhe-vesting/advanced/index.d.cts +2 -2
  102. package/dist/fhe-vesting/advanced/index.d.ts +2 -2
  103. package/dist/fhe-vesting/advanced/index.js +6 -6
  104. package/dist/fhe-vesting/advanced/react/index.cjs +15 -14
  105. package/dist/fhe-vesting/advanced/react/index.d.cts +1 -1
  106. package/dist/fhe-vesting/advanced/react/index.d.ts +1 -1
  107. package/dist/fhe-vesting/advanced/react/index.js +12 -11
  108. package/dist/fhe-vesting/encryption.d.ts +8 -0
  109. package/dist/fhe-vesting/factory.d.ts +6 -8
  110. package/dist/fhe-vesting/index.cjs +79 -75
  111. package/dist/fhe-vesting/index.d.cts +2 -2
  112. package/dist/fhe-vesting/index.d.ts +2 -2
  113. package/dist/fhe-vesting/index.js +9 -9
  114. package/dist/fhe-vesting/manager.d.ts +101 -3
  115. package/dist/fhe-vesting/react/index.cjs +241 -219
  116. package/dist/fhe-vesting/react/index.d.cts +3 -2
  117. package/dist/fhe-vesting/react/index.d.ts +3 -2
  118. package/dist/fhe-vesting/react/index.js +29 -12
  119. package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
  120. package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +2 -0
  121. package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
  122. package/dist/fhe-vesting/react/useClaim.d.ts +2 -0
  123. package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
  124. package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +7 -1
  125. package/dist/fhe-vesting/react/usePartialClaim.d.ts +8 -0
  126. package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
  127. package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
  128. package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
  129. package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
  130. package/dist/fhe-vesting/types.d.ts +34 -2
  131. package/dist/index.cjs +73 -49
  132. package/dist/index.d.cts +1 -1
  133. package/dist/index.d.ts +1 -1
  134. package/dist/index.js +2 -2
  135. package/dist/testnet-faucet/abis/confidential-test-token.d.ts +1039 -0
  136. package/dist/testnet-faucet/abis/index.d.ts +2 -0
  137. package/dist/testnet-faucet/abis/test-token.d.ts +253 -0
  138. package/dist/testnet-faucet/errors.d.ts +21 -0
  139. package/dist/testnet-faucet/faucet.d.ts +173 -0
  140. package/dist/testnet-faucet/index.cjs +212 -0
  141. package/dist/testnet-faucet/index.d.cts +8 -0
  142. package/dist/testnet-faucet/index.d.ts +8 -0
  143. package/dist/testnet-faucet/index.js +7 -0
  144. package/dist/testnet-faucet/react/_shared.d.ts +61 -0
  145. package/dist/testnet-faucet/react/index.cjs +384 -0
  146. package/dist/testnet-faucet/react/index.d.cts +39 -0
  147. package/dist/testnet-faucet/react/index.d.ts +39 -0
  148. package/dist/testnet-faucet/react/index.js +220 -0
  149. package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +25 -0
  150. package/dist/testnet-faucet/react/useFaucetDecimals.d.ts +9 -0
  151. package/dist/testnet-faucet/react/useFaucetMetadata.d.ts +14 -0
  152. package/dist/testnet-faucet/react/useFaucetRate.d.ts +11 -0
  153. package/dist/testnet-faucet/react/useInferredTotalSupply.d.ts +11 -0
  154. package/dist/testnet-faucet/react/useMaxTotalSupply.d.ts +10 -0
  155. package/dist/testnet-faucet/react/useMintConfidential.d.ts +35 -0
  156. package/dist/testnet-faucet/react/useMintUnderlying.d.ts +31 -0
  157. package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +19 -0
  158. package/dist/testnet-faucet/react/useUnderlyingDecimals.d.ts +9 -0
  159. package/dist/testnet-faucet/react/useUnderlyingTokenAddress.d.ts +12 -0
  160. package/dist/testnet-faucet/types.d.ts +92 -0
  161. package/dist/testnet-faucet/validate.d.ts +44 -0
  162. package/package.json +79 -30
@@ -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 = {
@@ -19,6 +19,23 @@ var DEPLOYED_ADDRESSES = {
19
19
  [mainnet.id]: "0x4fC0d28cBe4B82D512Ad0B42F6787480Cc98cC70",
20
20
  [sepolia.id]: "0x710dD9885Cc9986EfD234E7719483147a6d8DBb4"
21
21
  }
22
+ },
23
+ // Testnet-only faucet token pair (see `/testnet-faucet`). The standard
24
+ // `TokenopsTestToken` (TTT, 18-decimal ERC-20, open mint) and its
25
+ // confidential ERC-7984 wrapper `ConfidentialTokenopsTestToken` (CTTT,
26
+ // 6-decimal, open backed faucet mint). Sepolia only — these mint value-less
27
+ // test tokens to anyone, so they MUST NOT appear on mainnet.
28
+ // `confidentialTestToken` is the UUPS *proxy* address; call it with the
29
+ // implementation ABI.
30
+ testnetFaucet: {
31
+ testToken: {
32
+ [sepolia.id]: "0x37a057Fa8C201a7bf8caF32dfa9A0878f577D92b"
33
+ // mainnet omitted — testnet-only by design.
34
+ },
35
+ confidentialTestToken: {
36
+ [sepolia.id]: "0x258F9D60dc023870e4E3109c894D834D5377361a"
37
+ // mainnet omitted — testnet-only by design.
38
+ }
22
39
  }
23
40
  };
24
41
  function getDeployedAddress(product, contract, chainId) {
@@ -56,6 +73,18 @@ function getFheDisperseSingletonAddress(chainId) {
56
73
  function requireFheDisperseSingletonAddress(chainId) {
57
74
  return requireDeployedAddress("fheDisperse", "disperseConfidentialSingleton", chainId);
58
75
  }
76
+ function getTestTokenAddress(chainId) {
77
+ return getDeployedAddress("testnetFaucet", "testToken", chainId);
78
+ }
79
+ function requireTestTokenAddress(chainId) {
80
+ return requireDeployedAddress("testnetFaucet", "testToken", chainId);
81
+ }
82
+ function getConfidentialTestTokenAddress(chainId) {
83
+ return getDeployedAddress("testnetFaucet", "confidentialTestToken", chainId);
84
+ }
85
+ function requireConfidentialTestTokenAddress(chainId) {
86
+ return requireDeployedAddress("testnetFaucet", "confidentialTestToken", chainId);
87
+ }
59
88
  function chainsWithKnownRegistryEntry(product) {
60
89
  const productEntry = DEPLOYED_ADDRESSES[product];
61
90
  const ids = /* @__PURE__ */ new Set();
@@ -79,4 +108,4 @@ function chainsWithDeployment(product) {
79
108
  ).sort((a, b) => a - b);
80
109
  }
81
110
 
82
- export { DEPLOYED_ADDRESSES, chainsWithDeployment, chainsWithKnownRegistryEntry, getDeployedAddress, getFheAirdropFactoryAddress, getFheDisperseSingletonAddress, getFheVestingFactoryAddress, requireFheAirdropFactoryAddress, requireFheDisperseSingletonAddress, requireFheVestingFactoryAddress };
111
+ export { DEPLOYED_ADDRESSES, chainsWithDeployment, chainsWithKnownRegistryEntry, getConfidentialTestTokenAddress, getDeployedAddress, getFheAirdropFactoryAddress, getFheDisperseSingletonAddress, getFheVestingFactoryAddress, getTestTokenAddress, requireConfidentialTestTokenAddress, requireFheAirdropFactoryAddress, requireFheDisperseSingletonAddress, requireFheVestingFactoryAddress, requireTestTokenAddress };
@@ -1,4 +1,4 @@
1
- import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-72YGZEQE.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 = {
@@ -24,6 +24,14 @@ export declare const DEPLOYED_ADDRESSES: {
24
24
  readonly 11155111: "0x710dD9885Cc9986EfD234E7719483147a6d8DBb4";
25
25
  };
26
26
  };
27
+ readonly testnetFaucet: {
28
+ readonly testToken: {
29
+ readonly 11155111: "0x37a057Fa8C201a7bf8caF32dfa9A0878f577D92b";
30
+ };
31
+ readonly confidentialTestToken: {
32
+ readonly 11155111: "0x258F9D60dc023870e4E3109c894D834D5377361a";
33
+ };
34
+ };
27
35
  };
28
36
  export type DeployedAddresses = typeof DEPLOYED_ADDRESSES;
29
37
  export type ProductKey = keyof DeployedAddresses;
@@ -41,6 +49,20 @@ export declare function getFheAirdropFactoryAddress(chainId: number): Address |
41
49
  export declare function requireFheAirdropFactoryAddress(chainId: number): Address;
42
50
  export declare function getFheDisperseSingletonAddress(chainId: number): Address | undefined;
43
51
  export declare function requireFheDisperseSingletonAddress(chainId: number): Address;
52
+ /**
53
+ * Address of the standard `TokenopsTestToken` (TTT) — the 18-decimal ERC-20
54
+ * with an open `mint` that backs the confidential faucet. Testnet-only;
55
+ * returns `undefined` on chains without a deployment (e.g. mainnet).
56
+ */
57
+ export declare function getTestTokenAddress(chainId: number): Address | undefined;
58
+ export declare function requireTestTokenAddress(chainId: number): Address;
59
+ /**
60
+ * Address of the `ConfidentialTokenopsTestToken` (CTTT) UUPS proxy — the
61
+ * 6-decimal ERC-7984 confidential wrapper with an open backed faucet `mint`.
62
+ * Testnet-only; returns `undefined` on chains without a deployment.
63
+ */
64
+ export declare function getConfidentialTestTokenAddress(chainId: number): Address | undefined;
65
+ export declare function requireConfidentialTestTokenAddress(chainId: number): Address;
44
66
  /**
45
67
  * Chains with a registry entry for `product`, including ones explicitly
46
68
  * marked `null` (known chain, not yet deployed). Useful when the consumer
@@ -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";
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. */
@@ -29,9 +29,6 @@ export interface SdkTelemetry {
29
29
  * Adapters that DO implement it should return a NEW telemetry instance —
30
30
  * mutating `this` would leak tags across unrelated consumers sharing the
31
31
  * same SDK client.
32
- *
33
- * Added per backend-integrator-r14 nit-positive friction
34
- * (`docs/feedback/resolved/2026-05-24-backend-integrator-r14-minor-sdktelemetry-shape-matches-node-logger-pattern-cleanly.md`).
35
32
  */
36
33
  scope?(tags: SdkTelemetryTags): SdkTelemetry;
37
34
  }
@@ -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;