@tokenops/sdk 1.6.0 → 2.0.0-alpha.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 (194) hide show
  1. package/CHANGELOG.md +48 -8
  2. package/CONTRIBUTING.md +4 -2
  3. package/README.md +146 -90
  4. package/SUPPORT.md +47 -0
  5. package/dist/{chunk-HETNKZEE.js → chunk-335Z2W67.js} +1 -1
  6. package/dist/{chunk-BD4LZBVF.cjs → chunk-3QHNYEQD.cjs} +18 -17
  7. package/dist/chunk-456VDDA3.js +370 -0
  8. package/dist/{chunk-6WSNS3UV.js → chunk-4RAAATVY.js} +2 -4
  9. package/dist/{chunk-4KJ66YRH.js → chunk-4TSDNZQ3.js} +2 -2
  10. package/dist/{chunk-WUXUWTFW.cjs → chunk-5576FRT3.cjs} +31 -7
  11. package/dist/chunk-66IHPTOK.cjs +20 -0
  12. package/dist/{chunk-2RNW4MIJ.cjs → chunk-67OV5CX2.cjs} +0 -18
  13. package/dist/{chunk-PD7ME2BT.js → chunk-6GNR22OV.js} +2 -1
  14. package/dist/{chunk-VHSNYUYV.js → chunk-6NAVMWZQ.js} +5 -5
  15. package/dist/{chunk-EUKPOXWR.cjs → chunk-6PXXGACR.cjs} +17 -15
  16. package/dist/{chunk-WTK6JDSI.js → chunk-74QFZ5MK.js} +6 -4
  17. package/dist/{chunk-WOEETTH7.cjs → chunk-7AFPOE7N.cjs} +6 -6
  18. package/dist/{chunk-U57COLUE.js → chunk-AXIPOR3C.js} +2 -2
  19. package/dist/chunk-CTED3MTR.cjs +380 -0
  20. package/dist/{chunk-QKKBBH7I.js → chunk-DZHYSUGY.js} +28 -7
  21. package/dist/{chunk-V5D7BHW3.js → chunk-EAJ7SYHE.js} +6 -4
  22. package/dist/{chunk-SYHNZSZZ.cjs → chunk-FAXIIH5R.cjs} +3 -3
  23. package/dist/{chunk-7G7UOQV4.cjs → chunk-FGEB7RMY.cjs} +4 -4
  24. package/dist/chunk-GKKDAW44.js +8823 -0
  25. package/dist/{chunk-QET3Q4JP.js → chunk-H5POPGOZ.js} +8 -6
  26. package/dist/{chunk-VR3FREBX.cjs → chunk-JK4XMMKM.cjs} +3 -3
  27. package/dist/{chunk-CBRL2PJA.cjs → chunk-JQYC66TO.cjs} +12 -12
  28. package/dist/{chunk-YFIWCYHC.cjs → chunk-JZLGCTGK.cjs} +56 -54
  29. package/dist/{chunk-4ZCXK4VI.cjs → chunk-KFRDLKMA.cjs} +14 -14
  30. package/dist/chunk-KWFFIJYX.js +11 -0
  31. package/dist/chunk-M4IT6DNJ.cjs +608 -0
  32. package/dist/{chunk-43RFBQ73.cjs → chunk-MVDQMV25.cjs} +29 -32
  33. package/dist/chunk-NCVX3K2N.cjs +161 -0
  34. package/dist/chunk-NWFMBLSQ.js +4 -0
  35. package/dist/chunk-O5676ZWY.js +585 -0
  36. package/dist/chunk-PUX5VXDB.cjs +8845 -0
  37. package/dist/{chunk-DRSPMIZ7.js → chunk-QBJ7O2B4.js} +1 -11
  38. package/dist/{chunk-UJS4N2XM.cjs → chunk-TEBM66WA.cjs} +12 -12
  39. package/dist/{chunk-TN65XNTI.js → chunk-TWT3STIX.js} +8 -6
  40. package/dist/chunk-UG5RKLU2.cjs +6 -0
  41. package/dist/chunk-VP2B4WM2.js +154 -0
  42. package/dist/{chunk-BK7YIVLK.cjs → chunk-WJLECC22.cjs} +75 -73
  43. package/dist/{chunk-NFW7AUEX.js → chunk-WMACINXO.js} +1 -1
  44. package/dist/{chunk-AYGRYDBX.cjs → chunk-XAYGD4E4.cjs} +37 -35
  45. package/dist/{chunk-46T67CE2.js → chunk-ZA673I3O.js} +1 -1
  46. package/dist/{chunk-YPYCWLYP.js → chunk-ZWXJTBZO.js} +1 -1
  47. package/dist/core/addresses.d.ts +14 -2
  48. package/dist/core/brands.d.ts +8 -2
  49. package/dist/core/errors.d.ts +71 -10
  50. package/dist/core/preflight.d.ts +1 -0
  51. package/dist/fhe/erc7984-abi.d.ts +1 -0
  52. package/dist/fhe/index.cjs +64 -63
  53. package/dist/fhe/index.js +7 -6
  54. package/dist/fhe/operators.d.ts +22 -5
  55. package/dist/fhe/react/index.cjs +13 -12
  56. package/dist/fhe/react/index.js +6 -5
  57. package/dist/fhe/types.d.ts +6 -0
  58. package/dist/fhe-airdrop/abis/{cloneable.d.ts → airdrop-base.d.ts} +254 -396
  59. package/dist/fhe-airdrop/abis/compliance.d.ts +422 -0
  60. package/dist/fhe-airdrop/abis/ecdsa.d.ts +1316 -0
  61. package/dist/fhe-airdrop/abis/factory.d.ts +1319 -190
  62. package/dist/fhe-airdrop/abis/index.d.ts +5 -2
  63. package/dist/fhe-airdrop/abis/merkle.d.ts +1238 -0
  64. package/dist/fhe-airdrop/advanced/index.cjs +11 -12
  65. package/dist/fhe-airdrop/advanced/index.d.cts +34 -11
  66. package/dist/fhe-airdrop/advanced/index.d.ts +34 -11
  67. package/dist/fhe-airdrop/advanced/index.js +3 -8
  68. package/dist/fhe-airdrop/advanced/react/index.cjs +37 -50
  69. package/dist/fhe-airdrop/advanced/react/index.d.cts +9 -3
  70. package/dist/fhe-airdrop/advanced/react/index.d.ts +9 -3
  71. package/dist/fhe-airdrop/advanced/react/index.js +36 -50
  72. package/dist/fhe-airdrop/advanced/react/usePredictEcdsaAirdropAddress.d.ts +33 -0
  73. package/dist/fhe-airdrop/advanced/react/usePredictMerkleAirdropAddress.d.ts +27 -0
  74. package/dist/fhe-airdrop/airdrop-base.d.ts +600 -0
  75. package/dist/fhe-airdrop/campaign.d.ts +297 -0
  76. package/dist/fhe-airdrop/compliance.d.ts +302 -0
  77. package/dist/fhe-airdrop/constants.d.ts +33 -0
  78. package/dist/fhe-airdrop/ecdsa.d.ts +263 -0
  79. package/dist/fhe-airdrop/encryption.d.ts +92 -14
  80. package/dist/fhe-airdrop/errors.d.ts +245 -15
  81. package/dist/fhe-airdrop/factory.d.ts +533 -274
  82. package/dist/fhe-airdrop/guards.d.ts +273 -0
  83. package/dist/fhe-airdrop/index.cjs +1131 -74
  84. package/dist/fhe-airdrop/index.d.cts +46 -8
  85. package/dist/fhe-airdrop/index.d.ts +46 -8
  86. package/dist/fhe-airdrop/index.js +931 -8
  87. package/dist/fhe-airdrop/merkle-tree.d.ts +103 -0
  88. package/dist/fhe-airdrop/merkle.d.ts +180 -0
  89. package/dist/fhe-airdrop/react/_shared.d.ts +144 -71
  90. package/dist/fhe-airdrop/react/index.cjs +399 -459
  91. package/dist/fhe-airdrop/react/index.d.cts +53 -74
  92. package/dist/fhe-airdrop/react/index.d.ts +53 -74
  93. package/dist/fhe-airdrop/react/index.js +261 -374
  94. package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +10 -5
  95. package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +15 -6
  96. package/dist/fhe-airdrop/react/useAirdropPause.d.ts +30 -0
  97. package/dist/fhe-airdrop/react/useAirdropPaused.d.ts +17 -0
  98. package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -4
  99. package/dist/fhe-airdrop/react/useAirdropWindow.d.ts +37 -0
  100. package/dist/fhe-airdrop/react/useClaimedAmount.d.ts +29 -0
  101. package/dist/fhe-airdrop/react/useComplianceManager.d.ts +16 -0
  102. package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +28 -0
  103. package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +25 -0
  104. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +23 -0
  105. package/dist/fhe-airdrop/react/useEffectiveUpgradeable.d.ts +20 -0
  106. package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +17 -12
  107. package/dist/fhe-airdrop/react/useFactoryFees.d.ts +28 -0
  108. package/dist/fhe-airdrop/react/useFactoryRegistry.d.ts +35 -0
  109. package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +35 -0
  110. package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +35 -0
  111. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +34 -0
  112. package/dist/fhe-airdrop/react/useMerkleRoot.d.ts +15 -0
  113. package/dist/fhe-airdrop/react/useSetMerkleRoot.d.ts +22 -0
  114. package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +23 -0
  115. package/dist/fhe-airdrop/roles.d.ts +147 -0
  116. package/dist/fhe-airdrop/types.d.ts +67 -65
  117. package/dist/fhe-disperse/index.cjs +70 -68
  118. package/dist/fhe-disperse/index.js +10 -8
  119. package/dist/fhe-disperse/react/index.cjs +94 -92
  120. package/dist/fhe-disperse/react/index.js +13 -11
  121. package/dist/fhe-vesting/advanced/index.cjs +10 -8
  122. package/dist/fhe-vesting/advanced/index.js +8 -6
  123. package/dist/fhe-vesting/advanced/react/index.cjs +16 -14
  124. package/dist/fhe-vesting/advanced/react/index.js +13 -11
  125. package/dist/fhe-vesting/index.cjs +74 -72
  126. package/dist/fhe-vesting/index.js +11 -9
  127. package/dist/fhe-vesting/react/index.cjs +228 -226
  128. package/dist/fhe-vesting/react/index.js +15 -13
  129. package/dist/index.cjs +100 -87
  130. package/dist/index.js +3 -2
  131. package/dist/testnet-faucet/index.cjs +57 -55
  132. package/dist/testnet-faucet/index.js +7 -5
  133. package/dist/testnet-faucet/react/index.cjs +55 -53
  134. package/dist/testnet-faucet/react/index.js +9 -7
  135. package/package.json +6 -2
  136. package/dist/chunk-CNP4L3GF.js +0 -105
  137. package/dist/chunk-KSDSXJ34.js +0 -41
  138. package/dist/chunk-LBWRFZR3.cjs +0 -1681
  139. package/dist/chunk-OL6SHN3D.cjs +0 -44
  140. package/dist/chunk-S2XD75JM.js +0 -1637
  141. package/dist/chunk-SPGSO5SO.cjs +0 -1644
  142. package/dist/chunk-UE5XK2SY.js +0 -1673
  143. package/dist/chunk-WO72UBQD.cjs +0 -109
  144. package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +0 -53
  145. package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +0 -49
  146. package/dist/fhe-airdrop/airdrop.d.ts +0 -317
  147. package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +0 -37
  148. package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +0 -7
  149. package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +0 -10
  150. package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +0 -16
  151. package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +0 -6
  152. package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +0 -8
  153. package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +0 -10
  154. package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +0 -17
  155. package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +0 -10
  156. package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +0 -15
  157. package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +0 -11
  158. package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +0 -17
  159. package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +0 -17
  160. package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +0 -16
  161. package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +0 -15
  162. package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +0 -16
  163. package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +0 -7
  164. package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +0 -7
  165. package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +0 -9
  166. package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +0 -8
  167. package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +0 -22
  168. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +0 -51
  169. package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +0 -15
  170. package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +0 -10
  171. package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +0 -15
  172. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +0 -14
  173. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +0 -14
  174. package/dist/fhe-airdrop/react/useClaim.d.ts +0 -39
  175. package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +0 -11
  176. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +0 -41
  177. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +0 -48
  178. package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +0 -29
  179. package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +0 -31
  180. package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +0 -14
  181. package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +0 -17
  182. package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +0 -10
  183. package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +0 -11
  184. package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +0 -17
  185. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +0 -33
  186. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +0 -51
  187. package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +0 -16
  188. package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +0 -15
  189. package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +0 -14
  190. package/dist/fhe-airdrop/react/useSetPaused.d.ts +0 -14
  191. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +0 -31
  192. package/dist/fhe-airdrop/react/useWithdraw.d.ts +0 -12
  193. package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +0 -13
  194. package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +0 -13
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk2RNW4MIJ_cjs = require('./chunk-2RNW4MIJ.cjs');
3
+ var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
4
4
  var viem = require('viem');
5
5
 
6
- // src/core/version.ts
7
- var SDK_VERSION = "1.0.0";
8
6
  var ERC7984_ERRORS_ABI = [
9
7
  {
10
8
  type: "error",
@@ -49,7 +47,7 @@ var ERC7984_ERRORS_ABI = [
49
47
  }
50
48
  ];
51
49
  function mapContractRevert(error, args) {
52
- if (error instanceof chunk2RNW4MIJ_cjs.TokenOpsSdkError) return error;
50
+ if (error instanceof chunk67OV5CX2_cjs.TokenOpsSdkError) return error;
53
51
  const ctx = {
54
52
  method: args.method,
55
53
  contractAddress: args.contractAddress,
@@ -84,7 +82,7 @@ function mapContractRevert(error, args) {
84
82
  const fromDefault = defaultRevertNameMapper(revertName, revertArgs, ctx, args.account);
85
83
  if (fromDefault) return attachCause(fromDefault, error);
86
84
  }
87
- return new chunk2RNW4MIJ_cjs.ContractRevertError({
85
+ return new chunk67OV5CX2_cjs.ContractRevertError({
88
86
  method: args.method,
89
87
  contractAddress: args.contractAddress,
90
88
  revertName,
@@ -112,66 +110,66 @@ function defaultRevertNameMapper(name, errArgs, ctx, account) {
112
110
  case "EnforcedPause":
113
111
  case "PausableUpgradeable__Paused":
114
112
  case "ClaimsPaused":
115
- return new chunk2RNW4MIJ_cjs.PausedError(ctx);
113
+ return new chunk67OV5CX2_cjs.PausedError(ctx);
116
114
  case "AccessControlUnauthorizedAccount": {
117
115
  const acct = errArgs?.[0] ?? account;
118
116
  const role = errArgs?.[1];
119
- return new chunk2RNW4MIJ_cjs.AccessDeniedError({ ...ctx, account: acct, role });
117
+ return new chunk67OV5CX2_cjs.AccessDeniedError({ ...ctx, account: acct, role });
120
118
  }
121
119
  case "AccessControlBadConfirmation":
122
- return new chunk2RNW4MIJ_cjs.InvalidArgumentError({
120
+ return new chunk67OV5CX2_cjs.InvalidArgumentError({
123
121
  method: ctx.method,
124
122
  argument: "callerConfirmation",
125
123
  reason: "must equal msg.sender for renounceRole"
126
124
  });
127
125
  case "InvalidInitialization":
128
126
  case "Initializable_InvalidInitialization":
129
- return new chunk2RNW4MIJ_cjs.AlreadyInitializedError(ctx);
127
+ return new chunk67OV5CX2_cjs.AlreadyInitializedError(ctx);
130
128
  case "ReentrancyGuardReentrantCall":
131
129
  case "ReentrancyGuardTransient":
132
- return new chunk2RNW4MIJ_cjs.ReentrancyError(ctx);
130
+ return new chunk67OV5CX2_cjs.ReentrancyError(ctx);
133
131
  // Cross-product custom errors with stable, unambiguous meaning.
134
132
  case "InsufficientFee":
135
133
  case "InsufficientGasFee":
136
- return new chunk2RNW4MIJ_cjs.InsufficientFeeError({ ...ctx, feeKind: "gas" });
134
+ return new chunk67OV5CX2_cjs.InsufficientFeeError({ ...ctx, feeKind: "gas" });
137
135
  case "InsufficientAmount": {
138
136
  const provided = errArgs?.[0];
139
137
  const required = errArgs?.[1];
140
- return new chunk2RNW4MIJ_cjs.InsufficientFeeError({ ...ctx, feeKind: "gas", required, provided });
138
+ return new chunk67OV5CX2_cjs.InsufficientFeeError({ ...ctx, feeKind: "gas", required, provided });
141
139
  }
142
140
  case "ZeroBalance":
143
141
  case "InsufficientBalance":
144
- return new chunk2RNW4MIJ_cjs.InsufficientBalanceError({ ...ctx, balanceKind: "eth" });
142
+ return new chunk67OV5CX2_cjs.InsufficientBalanceError({ ...ctx, balanceKind: "eth" });
145
143
  case "BatchTooLarge": {
146
144
  const requested = Number(errArgs?.[0] ?? 0);
147
145
  const max = errArgs?.[1] ?? 0n;
148
- return new chunk2RNW4MIJ_cjs.BatchTooLargeError({ ...ctx, requested, max });
146
+ return new chunk67OV5CX2_cjs.BatchTooLargeError({ ...ctx, requested, max });
149
147
  }
150
148
  case "SplitDisabled":
151
- return new chunk2RNW4MIJ_cjs.FeatureDisabledError({ ...ctx, feature: "split" });
149
+ return new chunk67OV5CX2_cjs.FeatureDisabledError({ ...ctx, feature: "split" });
152
150
  case "PausableDisabled":
153
- return new chunk2RNW4MIJ_cjs.FeatureDisabledError({ ...ctx, feature: "pause" });
151
+ return new chunk67OV5CX2_cjs.FeatureDisabledError({ ...ctx, feature: "pause" });
154
152
  case "ExtensionNotAllowed":
155
- return new chunk2RNW4MIJ_cjs.FeatureDisabledError({ ...ctx, feature: "extendClaimWindow" });
153
+ return new chunk67OV5CX2_cjs.FeatureDisabledError({ ...ctx, feature: "extendClaimWindow" });
156
154
  case "TransferFailed":
157
- return new chunk2RNW4MIJ_cjs.TransferFailedError({ ...ctx, asset: "eth" });
155
+ return new chunk67OV5CX2_cjs.TransferFailedError({ ...ctx, asset: "eth" });
158
156
  case "HandleNotAllowed":
159
- return new chunk2RNW4MIJ_cjs.FheHandleNotAllowedError({ ...ctx, account });
157
+ return new chunk67OV5CX2_cjs.FheHandleNotAllowedError({ ...ctx, account });
160
158
  case "SenderNotAllowedToUseHandle": {
161
159
  const handle = errArgs?.[0];
162
160
  const sender = errArgs?.[1] ?? account;
163
- return new chunk2RNW4MIJ_cjs.FheHandleNotAllowedError({ ...ctx, handle, account: sender });
161
+ return new chunk67OV5CX2_cjs.FheHandleNotAllowedError({ ...ctx, handle, account: sender });
164
162
  }
165
163
  case "SenderNotAllowed": {
166
164
  const sender = errArgs?.[0] ?? account;
167
- return new chunk2RNW4MIJ_cjs.FheHandleNotAllowedError({ ...ctx, account: sender });
165
+ return new chunk67OV5CX2_cjs.FheHandleNotAllowedError({ ...ctx, account: sender });
168
166
  }
169
167
  case "InvalidSignature":
170
- return new chunk2RNW4MIJ_cjs.InvalidSignatureError(ctx);
168
+ return new chunk67OV5CX2_cjs.InvalidSignatureError(ctx);
171
169
  case "ERC7984UnauthorizedSpender": {
172
170
  const holder = errArgs?.[0];
173
171
  const spender = errArgs?.[1];
174
- return new chunk2RNW4MIJ_cjs.OperatorNotApprovedError({
172
+ return new chunk67OV5CX2_cjs.OperatorNotApprovedError({
175
173
  method: ctx.method,
176
174
  contractAddress: ctx.contractAddress,
177
175
  holder,
@@ -211,7 +209,7 @@ function defaultRevertNameMapper(name, errArgs, ctx, account) {
211
209
  case "ArrayLengthMismatch":
212
210
  case "VestingIdsNotStrictlyAsc":
213
211
  case "CustomFeeNotSet":
214
- return new chunk2RNW4MIJ_cjs.InvalidArgumentError({
212
+ return new chunk67OV5CX2_cjs.InvalidArgumentError({
215
213
  method: ctx.method,
216
214
  argument: invalidArgumentLabelFor(name),
217
215
  reason: `the contract reverted with \`${name}\`. If you did not pass an invalid value, this may be an SDK bug \u2014 please file an issue.`
@@ -284,7 +282,7 @@ function isContractRevert(error) {
284
282
  }
285
283
  function classifyNonRevert(error, args) {
286
284
  if (!(error instanceof viem.BaseError)) {
287
- return new chunk2RNW4MIJ_cjs.UnknownWriteFailureError({
285
+ return new chunk67OV5CX2_cjs.UnknownWriteFailureError({
288
286
  method: args.method,
289
287
  contractAddress: args.contractAddress,
290
288
  cause: error
@@ -295,21 +293,21 @@ function classifyNonRevert(error, args) {
295
293
  return predicate(frame) ? frame : void 0;
296
294
  };
297
295
  if (walk((e) => e instanceof viem.UserRejectedRequestError) || walk((e) => e instanceof viem.TransactionRejectedRpcError)) {
298
- return new chunk2RNW4MIJ_cjs.WalletRejectedError({
296
+ return new chunk67OV5CX2_cjs.WalletRejectedError({
299
297
  method: args.method,
300
298
  contractAddress: args.contractAddress,
301
299
  cause: error
302
300
  });
303
301
  }
304
302
  if (walk((e) => e instanceof viem.ChainMismatchError)) {
305
- return new chunk2RNW4MIJ_cjs.WalletChainMismatchError({
303
+ return new chunk67OV5CX2_cjs.WalletChainMismatchError({
306
304
  method: args.method,
307
305
  contractAddress: args.contractAddress,
308
306
  cause: error
309
307
  });
310
308
  }
311
309
  if (walk((e) => e instanceof viem.InsufficientFundsError)) {
312
- return new chunk2RNW4MIJ_cjs.InsufficientGasFundsError({
310
+ return new chunk67OV5CX2_cjs.InsufficientGasFundsError({
313
311
  method: args.method,
314
312
  contractAddress: args.contractAddress,
315
313
  cause: error
@@ -317,7 +315,7 @@ function classifyNonRevert(error, args) {
317
315
  }
318
316
  const httpFrame = walk((e) => e instanceof viem.HttpRequestError);
319
317
  if (httpFrame) {
320
- return new chunk2RNW4MIJ_cjs.NetworkError({
318
+ return new chunk67OV5CX2_cjs.NetworkError({
321
319
  method: args.method,
322
320
  contractAddress: args.contractAddress,
323
321
  statusCode: httpFrame.status,
@@ -325,13 +323,13 @@ function classifyNonRevert(error, args) {
325
323
  });
326
324
  }
327
325
  if (walk((e) => e instanceof viem.TimeoutError)) {
328
- return new chunk2RNW4MIJ_cjs.NetworkError({
326
+ return new chunk67OV5CX2_cjs.NetworkError({
329
327
  method: args.method,
330
328
  contractAddress: args.contractAddress,
331
329
  cause: error
332
330
  });
333
331
  }
334
- return new chunk2RNW4MIJ_cjs.UnknownWriteFailureError({
332
+ return new chunk67OV5CX2_cjs.UnknownWriteFailureError({
335
333
  method: args.method,
336
334
  contractAddress: args.contractAddress,
337
335
  cause: error
@@ -380,6 +378,5 @@ function coerceRevertHex(value) {
380
378
  return void 0;
381
379
  }
382
380
 
383
- exports.SDK_VERSION = SDK_VERSION;
384
381
  exports.isContractRevert = isContractRevert;
385
382
  exports.mapContractRevert = mapContractRevert;
@@ -0,0 +1,161 @@
1
+ 'use strict';
2
+
3
+ var chunkPUX5VXDB_cjs = require('./chunk-PUX5VXDB.cjs');
4
+ var chunk5576FRT3_cjs = require('./chunk-5576FRT3.cjs');
5
+ var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
6
+ var react = require('react');
7
+ var wagmi = require('wagmi');
8
+
9
+ var FHE_AIRDROP_KEY = "tokenops-sdk";
10
+ var FHE_AIRDROP_NAMESPACE = "fhe-airdrop";
11
+ function airdropQueryKey(params) {
12
+ return [
13
+ FHE_AIRDROP_KEY,
14
+ FHE_AIRDROP_NAMESPACE,
15
+ params.chainId ?? null,
16
+ params.address ? normalizeKeyArg(params.address) : null,
17
+ params.fn,
18
+ params.args.map(normalizeKeyArg)
19
+ ];
20
+ }
21
+ function airdropQueryKeyPrefix(params) {
22
+ const prefix = [
23
+ FHE_AIRDROP_KEY,
24
+ FHE_AIRDROP_NAMESPACE,
25
+ params.chainId ?? null,
26
+ params.address ? normalizeKeyArg(params.address) : null
27
+ ];
28
+ if (params.fn !== void 0) prefix.push(params.fn);
29
+ return prefix;
30
+ }
31
+ function normalizeKeyArg(value) {
32
+ if (typeof value === "bigint") return value.toString();
33
+ if (Array.isArray(value)) return value.map(normalizeKeyArg);
34
+ if (value && typeof value === "object") {
35
+ return Object.fromEntries(
36
+ Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
37
+ );
38
+ }
39
+ if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
40
+ return value;
41
+ }
42
+ function tryResolveAirdropFactoryAddress(override, chainId) {
43
+ if (override) return override;
44
+ if (chainId === void 0) return void 0;
45
+ return chunk5576FRT3_cjs.getFheAirdropFactoryAddress(chainId);
46
+ }
47
+ function computeAirdropFactoryResolutionError(override, chainId) {
48
+ if (override) return void 0;
49
+ if (chainId === void 0) {
50
+ return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
51
+ reason: "chain-id-missing",
52
+ product: "fheAirdrop",
53
+ contract: "airdropFactory",
54
+ clientLabel: "ConfidentialAirdropFactoryClient"
55
+ });
56
+ }
57
+ const resolved = chunk5576FRT3_cjs.getFheAirdropFactoryAddress(chainId);
58
+ if (!resolved) {
59
+ return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
60
+ reason: "registry-not-deployed",
61
+ product: "fheAirdrop",
62
+ contract: "airdropFactory",
63
+ chainId,
64
+ clientLabel: "ConfidentialAirdropFactoryClient"
65
+ });
66
+ }
67
+ return void 0;
68
+ }
69
+ function useMemoAirdropFactoryClient(opts = {}) {
70
+ const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
71
+ const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
72
+ const chainId = opts.chainId ?? publicClient?.chain?.id;
73
+ const resolvedAddress = tryResolveAirdropFactoryAddress(opts.address, chainId);
74
+ const resolutionError = computeAirdropFactoryResolutionError(opts.address, chainId);
75
+ const encryptorSourceRef = react.useRef(opts.encryptor);
76
+ encryptorSourceRef.current = opts.encryptor;
77
+ const telemetry = opts.telemetry;
78
+ const client = react.useMemo(() => {
79
+ if (!publicClient) return void 0;
80
+ if (!resolvedAddress) return void 0;
81
+ return chunkPUX5VXDB_cjs.createConfidentialAirdropFactoryClient({
82
+ publicClient,
83
+ ...walletClient ? { walletClient } : {},
84
+ address: resolvedAddress,
85
+ ...chainId !== void 0 ? { chainId } : {},
86
+ // Lazy — invoked per-encryption inside the headless client.
87
+ encryptor: () => chunkPUX5VXDB_cjs.resolveEncryptor(encryptorSourceRef.current),
88
+ ...telemetry ? { telemetry } : {}
89
+ });
90
+ }, [publicClient, walletClient, resolvedAddress, chainId, telemetry]);
91
+ return {
92
+ client,
93
+ resolutionError,
94
+ publicClient,
95
+ walletClient: walletClient ?? void 0,
96
+ chainId,
97
+ resolvedAddress
98
+ };
99
+ }
100
+ function useMemoAirdropBaseClient(opts) {
101
+ const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
102
+ const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
103
+ const chainId = opts.chainId ?? publicClient?.chain?.id;
104
+ const telemetry = opts.telemetry;
105
+ const client = react.useMemo(() => {
106
+ if (!publicClient) return void 0;
107
+ if (!opts.address) return void 0;
108
+ return chunkPUX5VXDB_cjs.createAirdropBaseClient({
109
+ publicClient,
110
+ ...walletClient ? { walletClient } : {},
111
+ address: opts.address,
112
+ ...chainId !== void 0 ? { chainId } : {},
113
+ ...telemetry ? { telemetry } : {}
114
+ });
115
+ }, [publicClient, walletClient, opts.address, chainId, telemetry]);
116
+ return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
117
+ }
118
+ function useMemoMerkleAirdropClient(opts) {
119
+ const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
120
+ const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
121
+ const chainId = opts.chainId ?? publicClient?.chain?.id;
122
+ const telemetry = opts.telemetry;
123
+ const client = react.useMemo(() => {
124
+ if (!publicClient) return void 0;
125
+ if (!opts.address) return void 0;
126
+ return chunkPUX5VXDB_cjs.createMerkleAirdropClient({
127
+ publicClient,
128
+ ...walletClient ? { walletClient } : {},
129
+ address: opts.address,
130
+ ...chainId !== void 0 ? { chainId } : {},
131
+ ...telemetry ? { telemetry } : {}
132
+ });
133
+ }, [publicClient, walletClient, opts.address, chainId, telemetry]);
134
+ return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
135
+ }
136
+ function useMemoEcdsaAirdropClient(opts) {
137
+ const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
138
+ const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
139
+ const chainId = opts.chainId ?? publicClient?.chain?.id;
140
+ const telemetry = opts.telemetry;
141
+ const client = react.useMemo(() => {
142
+ if (!publicClient) return void 0;
143
+ if (!opts.address) return void 0;
144
+ return chunkPUX5VXDB_cjs.createEcdsaAirdropClient({
145
+ publicClient,
146
+ ...walletClient ? { walletClient } : {},
147
+ address: opts.address,
148
+ dedupMode: opts.dedupMode,
149
+ ...chainId !== void 0 ? { chainId } : {},
150
+ ...telemetry ? { telemetry } : {}
151
+ });
152
+ }, [publicClient, walletClient, opts.address, opts.dedupMode, chainId, telemetry]);
153
+ return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
154
+ }
155
+
156
+ exports.airdropQueryKey = airdropQueryKey;
157
+ exports.airdropQueryKeyPrefix = airdropQueryKeyPrefix;
158
+ exports.useMemoAirdropBaseClient = useMemoAirdropBaseClient;
159
+ exports.useMemoAirdropFactoryClient = useMemoAirdropFactoryClient;
160
+ exports.useMemoEcdsaAirdropClient = useMemoEcdsaAirdropClient;
161
+ exports.useMemoMerkleAirdropClient = useMemoMerkleAirdropClient;
@@ -0,0 +1,4 @@
1
+ // src/core/version.ts
2
+ var SDK_VERSION = "1.0.0";
3
+
4
+ export { SDK_VERSION };