@hinkal/common 0.0.112 → 0.0.114

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 (269) hide show
  1. package/API/API.js +58 -0
  2. package/API/HinkalPointsCalls.js +38 -0
  3. package/API/callBeefyGraphAPI.js +37 -0
  4. package/API/callCurveAPI.js +156 -0
  5. package/API/callMonitor.js +30 -0
  6. package/API/callOdosAPI.js +44 -0
  7. package/API/callOneInchAPI.js +37 -0
  8. package/API/callRelayer.js +32 -0
  9. package/API/checkRisk.js +30 -0
  10. package/API/dataServerCalls.js +32 -0
  11. package/API/fetchCommitmentsCache.js +31 -0
  12. package/API/fetchNullifiers.js +30 -0
  13. package/API/getAxelarGasEstimate.js +37 -0
  14. package/API/getCoingeckoPrice.js +27 -0
  15. package/API/getConnextReceiveFee.js +30 -0
  16. package/API/getGasEstimates.js +38 -0
  17. package/API/getRelayerURL.js +32 -0
  18. package/API/getServerURL.js +67 -0
  19. package/API/getTokenPrice.js +41 -0
  20. package/API/kycCalls.js +32 -0
  21. package/API/passwordCalls.js +36 -0
  22. package/API/referralProgramCalls.js +58 -0
  23. package/API/relayCalls.js +30 -0
  24. package/API/restoreSnapshots.js +32 -0
  25. package/API/rewardsPointsCalls.js +40 -0
  26. package/API/userVerifyTransactions.js +45 -0
  27. package/assets/{snarkjsWorkerLauncher-fuD5h_j0.js → snarkjsWorkerLauncher-CaBCnle3.js} +283 -257
  28. package/assets/snarkjsWorkerLogic-BAbiO5gj.js +17935 -0
  29. package/assets/snarkjsWorkerLogic-wHJfYCfg.js +15636 -0
  30. package/assets/{utxoWorkerLogic-CtFLQiAX.js → utxoWorkerLogic-BGFm-Zl2.js} +2 -2
  31. package/assets/{zkProofWorkerLauncher-J3Ts5_Ba.js → zkProofWorkerLauncher-BteYxRBn.js} +1 -1
  32. package/assets/{zkProofWorkerLogic-CPNuu61R.js → zkProofWorkerLogic-DiLbAhAo.js} +8354 -8298
  33. package/constants/assets.constants.js +16 -0
  34. package/constants/axelar.constants.js +55 -0
  35. package/constants/backend.constants.js +18 -0
  36. package/constants/beefy.registry.js +24 -0
  37. package/constants/chains.constants.js +204 -0
  38. package/constants/coingecko.constants.js +53 -0
  39. package/constants/contracts.constants.js +276 -0
  40. package/constants/crvCvx.registry.js +636 -0
  41. package/constants/crvDynamic.registry.js +24 -0
  42. package/constants/deploy-data/deploy-data-arbMainnet.json.js +7415 -0
  43. package/constants/deploy-data/deploy-data-avalanche.json.js +7411 -0
  44. package/constants/deploy-data/deploy-data-axelar1.json.js +4329 -0
  45. package/constants/deploy-data/deploy-data-axelar2.json.js +4329 -0
  46. package/constants/deploy-data/deploy-data-base.json.js +8425 -0
  47. package/constants/deploy-data/deploy-data-blast.json.js +9600 -0
  48. package/constants/deploy-data/deploy-data-bnbMainnet.json.js +6877 -0
  49. package/constants/deploy-data/deploy-data-ethMainnet.json.js +11427 -0
  50. package/constants/deploy-data/deploy-data-localhost.json.js +13283 -0
  51. package/constants/deploy-data/deploy-data-optimism.json.js +7417 -0
  52. package/constants/deploy-data/deploy-data-polygon.json.js +7439 -0
  53. package/constants/fees.constants.js +57 -0
  54. package/constants/kyc.constants.js +118 -0
  55. package/constants/lido.constants.js +13 -0
  56. package/constants/pendle.registry.js +253 -0
  57. package/constants/protocol.constants.js +26 -0
  58. package/constants/reorg-depths.constants.js +15 -0
  59. package/constants/rewards.constants.js +27 -0
  60. package/constants/server.constants.js +157 -0
  61. package/constants/token-data/ERC20Registry.js +85 -0
  62. package/constants/token-data/arbMainnetRegistry.json.js +946 -0
  63. package/constants/token-data/arbMainnetRegistryFixed.json.js +856 -0
  64. package/constants/token-data/avalancheRegistry.json.js +591 -0
  65. package/constants/token-data/avalancheRegistryFixed.json.js +591 -0
  66. package/constants/token-data/baseRegistry.json.js +490 -0
  67. package/constants/token-data/baseRegistryFixed.json.js +463 -0
  68. package/constants/token-data/blastRegistry.json.js +137 -0
  69. package/constants/token-data/blastRegistryFixed.json.js +137 -0
  70. package/constants/token-data/bnbMainnetRegistry.json.js +973 -0
  71. package/constants/token-data/bnbMainnetRegistryFixed.json.js +973 -0
  72. package/constants/token-data/coingeckoRegistry.json.js +115623 -0
  73. package/constants/token-data/ethMainnetRegistry.json.js +2700 -0
  74. package/constants/token-data/ethMainnetRegistryFixed.json.js +2251 -0
  75. package/constants/token-data/index.js +6 -0
  76. package/constants/token-data/localhostRegistry.json.js +2768 -0
  77. package/constants/token-data/optimismRegistry.json.js +1455 -0
  78. package/constants/token-data/optimismRegistryFixed.json.js +1392 -0
  79. package/constants/token-data/polygonRegistry.json.js +1327 -0
  80. package/constants/token-data/polygonRegistryFixed.json.js +1255 -0
  81. package/constants/token-data/popularTokens.constants.js +14 -0
  82. package/constants/token-data/tokenPricing.consts.js +8 -0
  83. package/constants/vite.constants.js +29 -0
  84. package/crypto/babyJub.js +15 -0
  85. package/crypto/poseidon.js +26 -0
  86. package/crypto/preProcessing.js +9 -0
  87. package/data-structures/Hinkal/Hinkal.js +299 -0
  88. package/data-structures/Hinkal/hinkalActionBeefy.js +101 -0
  89. package/data-structures/Hinkal/hinkalActionConvex.js +83 -0
  90. package/data-structures/Hinkal/hinkalActionCurve.js +112 -0
  91. package/data-structures/Hinkal/hinkalActionLidoEth.js +91 -0
  92. package/data-structures/Hinkal/hinkalActionPendle.js +140 -0
  93. package/data-structures/Hinkal/hinkalActionPendleLP.js +96 -0
  94. package/data-structures/Hinkal/hinkalActionStake.js +138 -0
  95. package/data-structures/Hinkal/hinkalActionVolatile.js +112 -0
  96. package/data-structures/Hinkal/hinkalDeposit.js +95 -0
  97. package/data-structures/Hinkal/hinkalGetZkMeProvider.js +47 -0
  98. package/data-structures/Hinkal/hinkalPrivateWallet.js +66 -0
  99. package/data-structures/Hinkal/hinkalSwap.js +98 -0
  100. package/data-structures/Hinkal/hinkalTransfer.js +5 -0
  101. package/data-structures/Hinkal/hinkalWithdraw.js +91 -0
  102. package/data-structures/Hinkal/resetMerkleTrees.js +49 -0
  103. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.js +83 -0
  104. package/data-structures/ValueCache/ValueCache.js +25 -0
  105. package/data-structures/crypto-keys/decodeUTXO.js +40 -0
  106. package/data-structures/crypto-keys/encryptDecryptUtxo.js +41 -0
  107. package/data-structures/crypto-keys/keyUtils.js +10 -0
  108. package/data-structures/crypto-keys/keys.js +90 -0
  109. package/data-structures/custom-token-registry/CustomTokenRegistry.js +33 -0
  110. package/data-structures/event-service/AbstractAccessTokenSnapshotService.js +131 -0
  111. package/data-structures/event-service/AbstractCommitmentsSnapshotService.js +132 -0
  112. package/data-structures/event-service/AbstractEventService.js +118 -0
  113. package/data-structures/event-service/AbstractNullifierSnapshotService.js +59 -0
  114. package/data-structures/event-service/AbstractSnapshotService.js +35 -0
  115. package/data-structures/merkle-tree/MerkleTree.js +177 -0
  116. package/data-structures/merkle-tree/MerkleTreeIncompleteError.js +8 -0
  117. package/data-structures/snapshot/ClientAccessTokenSnapshotService.js +48 -0
  118. package/data-structures/snapshot/ClientCommitmentsSnapshotService.js +47 -0
  119. package/data-structures/snapshot/ClientNullifierSnapshotService.js +44 -0
  120. package/data-structures/token-price-fetcher/TokenChecker.js +29 -0
  121. package/data-structures/token-price-fetcher/TokenPriceFetcher.js +218 -0
  122. package/data-structures/transactions-manager/TransactionsManager.js +194 -0
  123. package/data-structures/transactions-manager/history/getBeefyData.js +68 -0
  124. package/data-structures/transactions-manager/history/getConvexData.js +57 -0
  125. package/data-structures/transactions-manager/history/getCurveData.js +97 -0
  126. package/data-structures/transactions-manager/history/getDepositData.js +36 -0
  127. package/data-structures/transactions-manager/history/getLidoData.js +44 -0
  128. package/data-structures/transactions-manager/history/getPendleData.js +59 -0
  129. package/data-structures/transactions-manager/history/getSwapData.js +43 -0
  130. package/data-structures/transactions-manager/history/getTxDetails.js +74 -0
  131. package/data-structures/transactions-manager/history/getVolatileData.js +75 -0
  132. package/data-structures/transactions-manager/history/history.types.js +62 -0
  133. package/data-structures/transactions-manager/history/history.utils.js +8 -0
  134. package/data-structures/utxo/Utxo.js +134 -0
  135. package/data-structures/volatile-helper/VolatileHelper.js +181 -0
  136. package/error-handling/customErrors/ErrorWithAmount.js +9 -0
  137. package/error-handling/customErrors/FeeOverTransactionValueError.js +9 -0
  138. package/error-handling/customErrors/customErrors.helpers.js +21 -0
  139. package/error-handling/error-codes.constants.js +184 -0
  140. package/error-handling/get-error.message.js +53 -0
  141. package/error-handling/handleErrorRestore.js +35 -0
  142. package/error-handling/logError.js +7 -0
  143. package/error-handling/types.js +4 -0
  144. package/externalABIs/BUSD.js +519 -0
  145. package/externalABIs/BabPassport.json.js +24 -0
  146. package/externalABIs/BeefyRouterAbi.json.js +1022 -0
  147. package/externalABIs/BeefyStrategyAbi.json.js +1423 -0
  148. package/externalABIs/BeefyVaultAbi.json.js +570 -0
  149. package/externalABIs/BeefyZapAbi.json.js +208 -0
  150. package/externalABIs/BeefyZapOneInchAbi.json.js +340 -0
  151. package/externalABIs/ConvexBoosterAbi.json.js +674 -0
  152. package/externalABIs/ConvexBoosterAbiMainnet.json.js +1002 -0
  153. package/externalABIs/ConvexRewardPoolAbi.json.js +883 -0
  154. package/externalABIs/CurveReadingWrapperAbi.json.js +1422 -0
  155. package/externalABIs/CurveWrappedMainPool.json.js +1136 -0
  156. package/externalABIs/CurveZap.json.js +262 -0
  157. package/externalABIs/CvxCrvUtilities.json.js +264 -0
  158. package/externalABIs/DAI.js +334 -0
  159. package/externalABIs/ERC20.json.js +291 -0
  160. package/externalABIs/GalxePassport.json.js +41 -0
  161. package/externalABIs/IQuoterV2.json.js +205 -0
  162. package/externalABIs/ISwapRouter.json.js +568 -0
  163. package/externalABIs/IUniswapV3Factory.json.js +201 -0
  164. package/externalABIs/IUniswapV3Pool.json.js +999 -0
  165. package/externalABIs/LidoStEthAbi.json.js +1603 -0
  166. package/externalABIs/LidoStMaticAbi.json.js +1764 -0
  167. package/externalABIs/LidoStakeManagerAbi.json.js +2082 -0
  168. package/externalABIs/LidoWithdrawalQueueERC721Abi.json.js +2030 -0
  169. package/externalABIs/LidoWstEthAbi.json.js +480 -0
  170. package/externalABIs/OptimismGasPriceOracle.json.js +206 -0
  171. package/externalABIs/PendleRouterAbi.json.js +173 -0
  172. package/externalABIs/PoLidoNftAbi.json.js +701 -0
  173. package/externalABIs/SanctionsList.js +89 -0
  174. package/externalABIs/USDC.js +721 -0
  175. package/externalABIs/USDR.js +346 -0
  176. package/externalABIs/USDR3CRV.js +542 -0
  177. package/externalABIs/USDT.js +393 -0
  178. package/externalABIs/UniswapV2PoolAbi.json.js +80 -0
  179. package/externalABIs/WETH.js +156 -0
  180. package/externalABIs/amToken.js +350 -0
  181. package/externalABIs/transactionsProver.json.js +39 -0
  182. package/functions/kyc/authentoHelper.js +42 -0
  183. package/functions/kyc/passportHelper.js +39 -0
  184. package/functions/kyc/zkMeHelper.js +56 -0
  185. package/functions/pre-transaction/getFlatFees.js +203 -0
  186. package/functions/pre-transaction/interaction-to-action.js +57 -0
  187. package/functions/pre-transaction/outputUtxoProcessing.js +45 -0
  188. package/functions/pre-transaction/process-gas-estimates.js +57 -0
  189. package/functions/pre-transaction/processAmountChanges.js +229 -0
  190. package/functions/private-wallet/emporium.helpers.js +19 -0
  191. package/functions/private-wallet/opProducer.js +24 -0
  192. package/functions/protocols/convex.protocols.js +41 -0
  193. package/functions/protocols/curve.protocols.js +45 -0
  194. package/functions/protocols/pendle.helpers.js +108 -0
  195. package/functions/snarkjs/common.snarkjs.js +96 -0
  196. package/functions/snarkjs/constant.js +211 -0
  197. package/functions/snarkjs/constructEmporiumProof.js +105 -0
  198. package/functions/snarkjs/constructGeneralZkProof.js +129 -0
  199. package/functions/snarkjs/generateCircomData.js +60 -0
  200. package/functions/snarkjs/generateZkProof.js +18 -0
  201. package/functions/snarkjs/getZKFiles.js +30 -0
  202. package/functions/staking/index.js +40 -0
  203. package/functions/utils/amounts.utils.js +70 -0
  204. package/functions/utils/axelar.utils.js +38 -0
  205. package/functions/utils/cacheFunctions.js +67 -0
  206. package/functions/utils/caseInsensitive.utils.js +6 -0
  207. package/functions/utils/convertIntegrationProviderToExternalActionId.js +16 -0
  208. package/functions/utils/create-provider.js +5 -0
  209. package/functions/utils/enum.utils.js +14 -0
  210. package/functions/utils/erc20tokenFunctions.js +20 -0
  211. package/functions/utils/evmNetworkFunctions.js +29 -0
  212. package/functions/utils/external-action.utils.js +61 -0
  213. package/functions/utils/getDataFromTransaction.js +105 -0
  214. package/functions/utils/memoize.utils.js +14 -0
  215. package/functions/utils/nickname.utils.js +7 -0
  216. package/functions/utils/process.utils.js +4 -0
  217. package/functions/utils/reloadPage.js +4 -0
  218. package/functions/utils/requireEnv.js +7 -0
  219. package/functions/utils/resolve-sync.utils.js +22 -0
  220. package/functions/utils/serialize.utils.js +4 -0
  221. package/functions/utils/string.utils.js +14 -0
  222. package/functions/utils/time.utils.js +8 -0
  223. package/functions/utils/userAgent.js +15 -0
  224. package/functions/utils/volatile-patcher.utils.js +40 -0
  225. package/functions/web3/etherFunctions.js +41 -0
  226. package/functions/web3/events/balanceChangedHandler.js +10 -0
  227. package/functions/web3/events/getInputUtxoAndBalance.js +72 -0
  228. package/functions/web3/events/getShieldedBalance.js +107 -0
  229. package/functions/web3/events/web3RetrieveEvents.js +9 -0
  230. package/functions/web3/functionCalls/accessTokenCalls.js +48 -0
  231. package/functions/web3/functionCalls/approveToken.js +153 -0
  232. package/functions/web3/functionCalls/estimateGasRelayer.js +18 -0
  233. package/functions/web3/functionCalls/transactCallDirect.js +60 -0
  234. package/functions/web3/functionCalls/transactCallRelayer.js +42 -0
  235. package/functions/web3/odosAPI.js +65 -0
  236. package/functions/web3/oneInchAPI.js +61 -0
  237. package/functions/web3/runContractFunction.js +95 -0
  238. package/functions/web3/uniswapAPI.js +97 -0
  239. package/index.js +642 -455
  240. package/package.json +2 -2
  241. package/types/beefy.types.js +21 -0
  242. package/types/circom-data.types.js +22 -0
  243. package/types/curve.types.js +25 -0
  244. package/types/ethereum-network.types.js +4 -0
  245. package/types/external-action.types.js +4 -0
  246. package/types/hinkal.stake.types.js +4 -0
  247. package/types/hinkal.types.js +15 -0
  248. package/types/kyc.types.js +13 -0
  249. package/types/pendle.types.js +15 -0
  250. package/types/rewards.types.js +27 -0
  251. package/types/slippage.types.js +15 -0
  252. package/types/time.types.js +58 -0
  253. package/types/token.types.js +4 -0
  254. package/types/transactions.types.js +36 -0
  255. package/webworker/performTaskWithWorker.js +62 -0
  256. package/webworker/snarkjsWorker/snarkjsWorker.types.js +4 -0
  257. package/{snarkjsWorkerLogic-CVna_BW9.mjs → webworker/snarkjsWorker/snarkjsWorkerLogic.js} +1 -1
  258. package/webworker/utxoWorker/utxoWorker.types.js +4 -0
  259. package/webworker/utxoWorker/utxoWorkerLogic.js +70 -0
  260. package/webworker/worker.registry.js +4 -0
  261. package/webworker/workerFactory.js +42 -0
  262. package/{workerProxy-BDj498Ht.mjs → webworker/workerProxy.js} +1 -1
  263. package/webworker/zkProofWorker/zkProofWorker.types.js +4 -0
  264. package/webworker/zkProofWorker/zkProofWorkerLogic.js +66 -0
  265. package/assets/snarkjsWorkerLogic-B6N4z_eM.js +0 -12136
  266. package/assets/snarkjsWorkerLogic-Fv0M38Mc.js +0 -12087
  267. package/index-DXElTGy9.mjs +0 -254449
  268. package/utxoWorkerLogic-B1Hh-bq4.mjs +0 -64
  269. package/zkProofWorkerLogic-D9rxuuiK.mjs +0 -60
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hinkal/common",
3
- "version": "0.0.112",
3
+ "version": "0.0.114",
4
4
  "homepage": "hinkal.pro",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@apollo/client": "^3.8.10",
24
- "@axelar-network/axelarjs-sdk": "0.17.0",
24
+ "@axelar-network/axelarjs-sdk": "0.16.0",
25
25
  "@ethersproject/providers": "^5.4.7",
26
26
  "@openzeppelin/contracts": "^4.8.0",
27
27
  "@zkmelabs/widget": "^0.1.2",
@@ -0,0 +1,21 @@
1
+ const p = {
2
+ base: "https://data.beefy.finance/api/v2/",
3
+ routes: {
4
+ prices: (a, s) => {
5
+ const e = new URLSearchParams();
6
+ return e.append("oracle", a), e.append("bucket", s), `prices/?${e}`;
7
+ },
8
+ tvls: (a, s) => {
9
+ const e = new URLSearchParams();
10
+ return e.append("vault", a), e.append("bucket", s), `tvls/?${e}`;
11
+ },
12
+ apys: (a, s) => {
13
+ const e = new URLSearchParams();
14
+ return e.append("vault", a), e.append("bucket", s), `apys/?${e}`;
15
+ }
16
+ }
17
+ }, t = (a) => a <= 4;
18
+ export {
19
+ p as dataBeefyApiConfig,
20
+ t as isBeefyDeposit
21
+ };
@@ -0,0 +1,22 @@
1
+ const a = {
2
+ extraRandomization: "",
3
+ stealthAddress: "",
4
+ H0: "",
5
+ H1: ""
6
+ }, t = {
7
+ preHookContract: "0x0000000000000000000000000000000000000000",
8
+ hookContract: "0x0000000000000000000000000000000000000000",
9
+ preHookMetadata: "0x00",
10
+ postHookMetadata: "0x00"
11
+ }, o = Object.values(t), e = {
12
+ extraRandomization: 1n,
13
+ stealthAddress: 0n,
14
+ H0: 0n,
15
+ H1: 0n
16
+ };
17
+ export {
18
+ t as defaultHookData,
19
+ o as defaultHookDataArray,
20
+ e as defaultStealthAddressStructure,
21
+ a as emptyStealthAddressStructure
22
+ };
@@ -0,0 +1,25 @@
1
+ import { chainIds as a } from "../constants/chains.constants.js";
2
+ const e = {
3
+ [a.polygon]: "polygon",
4
+ [a.arbMainnet]: "arbitrum",
5
+ [a.ethMainnet]: "ethereum",
6
+ [a.avalanche]: "avalanche",
7
+ [a.optimism]: "optimism",
8
+ [a.base]: "base",
9
+ [a.blast]: ""
10
+ }, i = [
11
+ "factory",
12
+ "main",
13
+ "crypto",
14
+ "factory-crypto",
15
+ "factory-crvusd",
16
+ "factory-stable-ng",
17
+ "factory-tricrypto"
18
+ ], s = ["DEPOSIT", "WITHDRAW/CLAIM"];
19
+ var o = /* @__PURE__ */ ((t) => (t.Liquidity = "Liquidity", t.Swaps = "Swaps", t))(o || {});
20
+ export {
21
+ o as StatType,
22
+ s as UpperTabPossibleValues,
23
+ e as curveNetworkNames,
24
+ i as curvePools
25
+ };
@@ -0,0 +1,4 @@
1
+ var l = /* @__PURE__ */ ((e) => (e[e.HinkalContract = 0] = "HinkalContract", e[e.HinkalHelperContract = 1] = "HinkalHelperContract", e[e.CrossChainAccessTokenContract = 2] = "CrossChainAccessTokenContract", e[e.UniswapV3FactoryContract = 3] = "UniswapV3FactoryContract", e[e.UniswapV3PoolContract = 4] = "UniswapV3PoolContract", e[e.UniswapV3QuoterContract = 5] = "UniswapV3QuoterContract", e[e.ERC20Contract = 6] = "ERC20Contract", e[e.WATokenContract = 7] = "WATokenContract", e[e.OneInchExternalActionContract = 8] = "OneInchExternalActionContract", e[e.MerkleTreeContract = 9] = "MerkleTreeContract", e[e.ContractWithNonces = 10] = "ContractWithNonces", e[e.PermitterContract = 11] = "PermitterContract", e[e.CurveWrappedMainPool = 12] = "CurveWrappedMainPool", e[e.CurveReadingWrapper = 13] = "CurveReadingWrapper", e[e.CurvePoolLPTokenAmountCalculator2 = 14] = "CurvePoolLPTokenAmountCalculator2", e[e.CurvePoolLPTokenAmountCalculator3 = 15] = "CurvePoolLPTokenAmountCalculator3", e[e.CurvePoolLPTokenAmountCalculator4 = 16] = "CurvePoolLPTokenAmountCalculator4", e[e.CurvePoolLPTokenAmountCalculatorDynamic = 17] = "CurvePoolLPTokenAmountCalculatorDynamic", e[e.CurvePoolLPTokenAmountCalculator2OneArg = 18] = "CurvePoolLPTokenAmountCalculator2OneArg", e[e.CurvePoolLPTokenAmountCalculator3OneArg = 19] = "CurvePoolLPTokenAmountCalculator3OneArg", e[e.CurvePoolLPTokenAmountCalculator4OneArg = 20] = "CurvePoolLPTokenAmountCalculator4OneArg", e[e.CurvePoolWithIntCoins = 21] = "CurvePoolWithIntCoins", e[e.CurveExternalAction = 22] = "CurveExternalAction", e[e.WrappedStakedCurveLp = 23] = "WrappedStakedCurveLp", e[e.WrappedStakedRewardsCurveLp = 24] = "WrappedStakedRewardsCurveLp", e[e.CurveGauge = 25] = "CurveGauge", e[e.ConvexBooster = 26] = "ConvexBooster", e[e.ConvexBoosterMainnet = 27] = "ConvexBoosterMainnet", e[e.ConvexRewardPool = 28] = "ConvexRewardPool", e[e.ConvexCvxLocker = 29] = "ConvexCvxLocker", e[e.ConvexStakePool = 30] = "ConvexStakePool", e[e.ConvexCvxCRVWrapper = 31] = "ConvexCvxCRVWrapper", e[e.ConvexCxvCrvUtillities = 32] = "ConvexCxvCrvUtillities", e[e.ConvexExternalAction = 33] = "ConvexExternalAction", e[e.WrappedStakedConvexLp = 34] = "WrappedStakedConvexLp", e[e.CurvePoolWithIntBalances = 35] = "CurvePoolWithIntBalances", e[e.CurveZaps = 36] = "CurveZaps", e[e.BeefyVault = 37] = "BeefyVault", e[e.BeefyZap = 38] = "BeefyZap", e[e.BeefyRouter = 39] = "BeefyRouter", e[e.BeefyZapOneInch = 40] = "BeefyZapOneInch", e[e.BeefyExternalAction = 41] = "BeefyExternalAction", e[e.BeefyStakeExternalAction = 42] = "BeefyStakeExternalAction", e[e.BeefyStrategy = 43] = "BeefyStrategy", e[e.WrappedStakedBeefyLp = 44] = "WrappedStakedBeefyLp", e[e.UniswapV2PoolContract = 45] = "UniswapV2PoolContract", e[e.LidoWstEther = 46] = "LidoWstEther", e[e.LidoStEther = 47] = "LidoStEther", e[e.LidoStMatic = 48] = "LidoStMatic", e[e.LidoWithdrawalQueueERC721 = 49] = "LidoWithdrawalQueueERC721", e[e.LidoStakeManager = 50] = "LidoStakeManager", e[e.PoLidoNFT = 51] = "PoLidoNFT", e[e.PendleGeneralExternalAction = 52] = "PendleGeneralExternalAction", e[e.PendleRouter = 53] = "PendleRouter", e[e.WstPendleLPToken = 54] = "WstPendleLPToken", e[e.WstYtToken = 55] = "WstYtToken", e[e.VolatileVault = 56] = "VolatileVault", e[e.VolatileTokenAction = 57] = "VolatileTokenAction", e[e.HinkalWrapper = 58] = "HinkalWrapper", e[e.HinkalWrapper2 = 59] = "HinkalWrapper2", e[e.HinkalStakeExternalAction = 60] = "HinkalStakeExternalAction", e[e.HToken = 61] = "HToken", e))(l || {});
2
+ export {
3
+ l as ContractType
4
+ };
@@ -0,0 +1,4 @@
1
+ var C = /* @__PURE__ */ ((e) => (e.Transact = "Transact", e.Uniswap = "Uniswap", e.Odos = "Odos", e.OneInch = "OneInch", e.Curve = "Curve", e.CurveDynamic = "CurveDynamic", e.CurveCRV = "CurveCRV", e.CurveCRVRewards = "CurveCRVRewards", e.Convex = "Convex", e.Beefy = "Beefy", e.BeefyStake = "BeefyStake", e.Volatile = "Volatile", e.LidoETH = "LidoETH", e.LidoMATIC = "LidoMATIC", e.LidoETHNFT = "LidoETHNFT", e.LidoMATICNFT = "LidoMATICNFT", e.Pendle = "Pendle", e.PendleLP = "PendleLP", e.HinkalStake = "HinkalStake", e.Connext = "Connext", e.Emporium = "Emporium", e))(C || {});
2
+ export {
3
+ C as ExternalActionId
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = /* @__PURE__ */ ((t) => (t.Deposit = "Deposit", t.Stake = "Stake", t.Unstake = "Unstake", t))(e || {});
2
+ export {
3
+ e as HinkalStakeMode
4
+ };
@@ -0,0 +1,15 @@
1
+ var E = /* @__PURE__ */ ((a) => (a.BalanceChange = "BalanceChange", a.NetworkChange = "NetworkChange", a.KycNeeded = "KycNeeded", a.AccountChanged = "AccountChanged", a.ShowConnect = "ShowConnect", a.ShowNetworkPopup = "ShowNetworkPopup", a.MerkleTreeUpdated = "MerkleTreeUpdated", a.MerkleTreeResetStarted = "MerkleTreeResetStarted", a.MerkleTreeResetFinished = "MerkleTreeResetFinished", a))(E || {}), S = /* @__PURE__ */ ((a) => (a[a.UNISWAP = 1] = "UNISWAP", a[a.ODOS = 2] = "ODOS", a[a.ONEINCH = 3] = "ONEINCH", a[a.PENDLE = 4] = "PENDLE", a[a.ALL = 5] = "ALL", a[a.NONE = 6] = "NONE", a))(S || {}), D = /* @__PURE__ */ ((a) => (a[a.CurveAavePool = 0] = "CurveAavePool", a))(D || {}), _ = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.WithdrawInt = 11] = "WithdrawInt", a[a.WithdrawUint = 12] = "WithdrawUint", a[a.WithdrawImbalance = 13] = "WithdrawImbalance", a[a.Stake = 2] = "Stake", a[a.Unstake = 3] = "Unstake", a[a.GetCRV = 4] = "GetCRV", a))(_ || {}), h = /* @__PURE__ */ ((a) => (a[a.StakeLP = 0] = "StakeLP", a[a.UnStakeLP = 1] = "UnStakeLP", a[a.ClaimRewardsLP = 2] = "ClaimRewardsLP", a))(h || {}), W = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.DepositRegular = 1] = "DepositRegular", a[a.DepositOneInchSingle = 2] = "DepositOneInchSingle", a[a.DepositOneInchUniswap = 3] = "DepositOneInchUniswap", a[a.DepositOneInchSolidly = 4] = "DepositOneInchSolidly", a[a.Withdraw = 5] = "Withdraw", a[a.WithdrawRegular = 6] = "WithdrawRegular", a[a.WithdrawOneInchSingle = 7] = "WithdrawOneInchSingle", a[a.WithdrawOneInchUniswapAndSolidly = 8] = "WithdrawOneInchUniswapAndSolidly", a[a.WithdrawBoth = 9] = "WithdrawBoth", a[a.Stake = 10] = "Stake", a[a.Unstake = 11] = "Unstake", a[a.GetRewards = 12] = "GetRewards", a))(W || {}), L = /* @__PURE__ */ ((a) => (a.Ethereum = "Ethereum", a.Polygon = "Polygon", a))(L || {}), r = /* @__PURE__ */ ((a) => (a[a.Stake = 0] = "Stake", a[a.Request = 1] = "Request", a[a.Claim = 2] = "Claim", a))(r || {}), w = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.Withdraw = 1] = "Withdraw", a[a.SwapFromYt = 2] = "SwapFromYt", a[a.SwapToYt = 3] = "SwapToYt", a[a.SwapPt = 4] = "SwapPt", a[a.Mint = 5] = "Mint", a[a.Redeem = 6] = "Redeem", a[a.Checkpoint = 7] = "Checkpoint", a[a.PoolRemove = 8] = "PoolRemove", a))(w || {}), s = /* @__PURE__ */ ((a) => (a[a.AddOrRemoveLiquidity = 0] = "AddOrRemoveLiquidity", a[a.Checkpoint = 1] = "Checkpoint", a[a.Invalid = 99] = "Invalid", a))(s || {}), U = /* @__PURE__ */ ((a) => (a[a.Persist = 0] = "Persist", a[a.Deposit = 1] = "Deposit", a[a.Withdraw = 2] = "Withdraw", a[a.Swap = 3] = "Swap", a))(U || {}), p = /* @__PURE__ */ ((a) => (a.WITHDRAW = "WITHDRAW", a.SWAP = "SWAP", a.CURVE_DEPOSIT = "CURVE_DEPOSIT", a.CURVE_WITHDRAW = "CURVE_WITHDRAW", a.CURVE_WITHDRAW_INBALANCED = "CURVE_WITHDRAW_INBALANCED", a.STAKING = "STAKING", a.UNSTAKING = "UNSTAKING", a.CLAIMING = "CLAIMING", a.BEEFY = "BEEFY", a.BEEFY_STAKE = "BEEFY_STAKE", a.BEEFY_UNSTAKE = "BEEFY_UNSTAKE", a.BEEFY_GET_REWARDS = "BEEFY_GET_REWARDS", a.LIDO_STAKE = "LIDO_STAKE", a.LIDO_REQUEST = "LIDO_REQUEST", a.LIDO_CLAIM = "LIDO_CLAIM", a.PENDLE_TRANSACT = "PENDLE_TRANSACT", a.PENDLE_YT_IN_SWAP = "PENDLE_YT_IN_SWAP", a.PENDLE_YT_OUT_SWAP = "PENDLE_YT_OUT_SWAP", a.PENDLE_PT_SWAP = "PENDLE_PT_SWAP", a.PENDLE_MINT = "PENDLE_MINT", a.PENDLE_REDEEM = "PENDLE_REDEEM", a.PENDLE_CLAIM = "PENDLE_CLAIM", a.PENDLE_LP = "PENDLE_LP", a.PENDLE_LP_CLAIM = "PENDLE_LP_CLAIM", a.VOLATILE_WITHDRAW = "VOLATILE_WITHDRAW", a.VOLATILE_SWAP = "VOLATILE_SWAP", a.EMPORIUM = "EMPORIUM", a.NONE = "NONE", a))(p || {});
2
+ export {
3
+ W as BeefyAction,
4
+ h as ConvexAction,
5
+ _ as CurveAction,
6
+ E as EventType,
7
+ p as INTERACTION,
8
+ S as IntegrationProvider,
9
+ r as LidoAction,
10
+ L as LidoVariant,
11
+ w as PendleAction,
12
+ s as PendleLPAction,
13
+ D as StakeProvider,
14
+ U as VolatileAction
15
+ };
@@ -0,0 +1,13 @@
1
+ var N = /* @__PURE__ */ ((E) => (E.USER = "USER", E.BUSINESS = "BUSINESS", E))(N || {});
2
+ const S = [
3
+ "USER",
4
+ "BUSINESS"
5
+ /* BUSINESS */
6
+ ];
7
+ var D = /* @__PURE__ */ ((E) => (E.APPROVED = "APPROVED", E.DECLINED = "DECLINED", E.REVIEW = "REVIEW", E.UNKNOWN = "UNKNOWN", E))(D || {}), I = /* @__PURE__ */ ((E) => (E.COMPLETED = "COMPLETED", E.FAILED = "FAILED", E.PENDING = "PENDING", E.RUNNING = "RUNNING", E.NOT_STARTED = "NOT_STARTED", E))(I || {});
8
+ export {
9
+ D as KycVerificationResult,
10
+ I as KycVerificationStatus,
11
+ N as VERIFICATION_TYPE,
12
+ S as VerificationTypes
13
+ };
@@ -0,0 +1,15 @@
1
+ var t = /* @__PURE__ */ ((r) => (r.Trade = "TRADE", r.Earn = "EARN", r))(t || {}), E = /* @__PURE__ */ ((r) => (r.Markets = "Market", r.Pools = "Pools", r.Dashboard = "Dashboard", r))(E || {}), u = /* @__PURE__ */ ((r) => (r.Swap = "Swap", r.Mint = "Mint", r))(u || {}), Y = /* @__PURE__ */ ((r) => (r.Zap = "Zap", r.Manual = "Manual", r))(Y || {}), i = /* @__PURE__ */ ((r) => (r.ZapIn = "Zap In", r.ZapOut = "Zap Out", r))(i || {}), o = /* @__PURE__ */ ((r) => (r.AddLiquidity = "Add Liquidity", r.RemoveLiquidity = "Remove Liquidity", r))(o || {}), v = /* @__PURE__ */ ((r) => (r.YT = "YT", r.LP = "LP", r))(v || {}), I = /* @__PURE__ */ ((r) => (r.Pool = "Pool", r.Stake = "Stake", r))(I || {}), L = /* @__PURE__ */ ((r) => (r.Ethereum = "ethereum", r.Arbitrum = "arbitrum", r.BNB = "bnb", r.Optimism = "optimism", r))(L || {}), S = /* @__PURE__ */ ((r) => (r.IB = "IB", r.GENERIC = "GENERIC", r.PENDLE_LP = "PENDLE_LP", r.NATIVE = "NATIVE", r.PT = "PT", r.SY = "SY", r.YT = "YT", r))(S || {}), m = /* @__PURE__ */ ((r) => (r.SwapExactTokenForYt = "SwapExactTokenForYt", r.SwapExactTokenForPt = "SwapExactTokenForPt", r.SwapExactYtForToken = "SwapExactYtForToken", r.SwapExactPtForToken = "SwapExactPtForToken", r))(m || {}), a = /* @__PURE__ */ ((r) => (r.mintPY = "MINT_PY", r.redeemPY = "REDEEM_PY", r.addLiquidity = "ADD_LIQUIDITY", r.removeLiquidity = "REMOVE_LIQUIDITY", r.swapPT = "SWAP_PT", r.swapYT = "SWAP_YT", r.swapPY = "SWAP_PY", r))(a || {});
2
+ export {
3
+ S as PendleAssetType,
4
+ L as PendleChains,
5
+ v as PendleDashboardTabs,
6
+ I as PendleEarnTabs,
7
+ a as PendleMarketTransactionTypes,
8
+ o as PendlePoolManualTabs,
9
+ Y as PendlePoolTabs,
10
+ i as PendlePoolZapTabs,
11
+ m as PendleSwapType,
12
+ t as PendleTabs,
13
+ E as PendleTradeGeneralTabs,
14
+ u as PendleTradeTabs
15
+ };
@@ -0,0 +1,27 @@
1
+ var r = /* @__PURE__ */ ((n) => (n.None = "None", n.Bronze = "Bronze", n.Silver = "Silver", n.Gold = "Gold", n.Platinum = "Platinum", n.Diamond = "Diamond", n.Elite = "Elite", n))(r || {}), i = /* @__PURE__ */ ((n) => (n.None = "None", n.Bronze = "Bronze", n.Silver = "Silver", n.Gold = "Gold", n.Platinum = "Platinum", n.Diamond = "Diamond", n))(i || {}), t = /* @__PURE__ */ ((n) => (n.Points = "POINTS", n.ReferralProgram = "REFERRAL", n.LrtPoints = "LRT_POINTS", n.LPProgram = "LP", n.RewardsHistory = "HISTORY", n))(t || {}), e = /* @__PURE__ */ ((n) => (n.InProgress = "In Progress", n.Closed = "Closed", n))(e || {}), o = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Submitted = "Submitted", n.Unsubmitted = "Didn't Submit", n))(o || {}), l = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Eligible = "Eligible", n.Ineligible = "Ineligible", n))(l || {}), P = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Completed = "Completed", n.Unsubmitted = "Didn't Submit", n))(P || {}), v = /* @__PURE__ */ ((n) => (n.Gold = "Gold", n.Silver = "Silver", n))(v || {}), m = /* @__PURE__ */ ((n) => (n.CertificationPoints = "CertificationPoints", n.TradePoints = "TradePoints", n.LPPoints = "LPPoints", n.ReferralPoints = "ReferralPoints", n.GalxePoints = "GalxePoints", n.ZealyPoints = "ZealyPoints", n.TaskOnPoints = "TaskOnPoints", n.BonusPoints = "BonusPoints", n))(m || {}), u = /* @__PURE__ */ ((n) => (n.Season = "Season", n.Week = "Week", n))(u || {}), d = /* @__PURE__ */ ((n) => (n.PAID = "PAID", n.PENDING = "PENDING", n))(d || {}), S = /* @__PURE__ */ ((n) => (n[n.Certify = 0] = "Certify", n[n.CheckActivity = 1] = "CheckActivity", n))(S || {}), G = /* @__PURE__ */ ((n) => (n[n.Points = 0] = "Points", n[n.Trader = 1] = "Trader", n[n.Affiliate = 2] = "Affiliate", n[n.LP = 3] = "LP", n[n.History = 4] = "History", n))(G || {}), c = /* @__PURE__ */ ((n) => (n[n.IntegrationCheck = 0] = "IntegrationCheck", n[n.RandomPrizeGold = 1] = "RandomPrizeGold", n[n.RandomPrizeSilver = 2] = "RandomPrizeSilver", n))(c || {});
2
+ const s = {
3
+ Result: {}
4
+ }, k = {
5
+ renzo: 0,
6
+ kelp: 0,
7
+ etherFi: 0,
8
+ zircuit: 0
9
+ };
10
+ export {
11
+ c as BonusType,
12
+ S as CertifyType,
13
+ i as LP_TIER,
14
+ d as PaymentStatus,
15
+ m as PointType,
16
+ v as RafflePrizeType,
17
+ G as RewardPage,
18
+ P as RewardsHistoryDistribution,
19
+ l as RewardsHistoryEligibility,
20
+ o as RewardsHistorySnapshots,
21
+ e as RewardsHistoryStatuses,
22
+ t as RewardsPageTabs,
23
+ r as TIER_LEVEL,
24
+ u as Timeline,
25
+ k as emptyUserPointsBreakdown,
26
+ s as emptyUserPointsResponse
27
+ };
@@ -0,0 +1,15 @@
1
+ var r = /* @__PURE__ */ ((e) => (e.Swap = "Swap", e.CurveDeposit = "CurveDeposit", e.CurveWithdraw = "CurveWithdraw", e.Beefy = "Beefy", e.Pendle = "Pendle", e))(r || {});
2
+ const t = {
3
+ Swap: 0.7,
4
+ // means 0.7% -> taken from default Uniswap Slippage
5
+ CurveDeposit: 0.9,
6
+ // 0.03 taken from Curve
7
+ CurveWithdraw: 0.9,
8
+ Beefy: 1,
9
+ Pendle: 3
10
+ // 1 means 1%
11
+ };
12
+ export {
13
+ r as SlippageType,
14
+ t as slippageLevels
15
+ };
@@ -0,0 +1,58 @@
1
+ const w = 1e3, R = 6e4, m = 36e5, f = 864e5, A = 6048e5, r = /* @__PURE__ */ new Date("2024-03-04T00:00:00.000Z"), c = (e) => {
2
+ if (e < 0)
3
+ throw Error("Certification for the past week is not available");
4
+ }, o = (e) => (c(e), new Date(new Date(r).setUTCDate(r.getUTCDate() + 7 * e))), U = (e) => {
5
+ c(e);
6
+ const t = o(e).getTime() / 1e3, n = o(e + 1).getTime() / 1e3;
7
+ return { initialTimestamp: t, endTimestamp: n };
8
+ }, i = () => {
9
+ const e = (/* @__PURE__ */ new Date()).getTime() / 1e3;
10
+ let t = -1, n;
11
+ do
12
+ t += 1, { endTimestamp: n } = U(t);
13
+ while (e > n);
14
+ return t;
15
+ }, I = (e) => {
16
+ if (e === void 0)
17
+ return i();
18
+ const t = Number(e);
19
+ return !Number.isFinite(t) || t < 0 ? i() : t;
20
+ }, Y = (e, t = "/") => [e.getUTCDate(), e.getUTCMonth() + 1, e.getUTCFullYear()].join(t), h = (e) => {
21
+ const t = i();
22
+ return e === t;
23
+ }, p = (e) => {
24
+ const t = i();
25
+ return e < t - 1;
26
+ }, v = (e) => {
27
+ const t = new Date(e);
28
+ return t.setUTCDate(t.getUTCDate() + 1), t.setUTCHours(0), t.setUTCMinutes(0), t.setUTCSeconds(0), t.setUTCMilliseconds(0), t;
29
+ };
30
+ var g = /* @__PURE__ */ ((e) => (e[e.JANUARY = 0] = "JANUARY", e[e.FEBRUARY = 1] = "FEBRUARY", e[e.MARCH = 2] = "MARCH", e[e.APRIL = 3] = "APRIL", e[e.MAY = 4] = "MAY", e[e.JUNE = 5] = "JUNE", e[e.JULY = 6] = "JULY", e[e.AUGUST = 7] = "AUGUST", e[e.SEPTEMBER = 8] = "SEPTEMBER", e[e.OCTOBER = 9] = "OCTOBER", e[e.NOVEMBER = 10] = "NOVEMBER", e[e.DECEMBER = 11] = "DECEMBER", e))(g || {});
31
+ const C = (e, t) => {
32
+ if (t < 0 || t > 11)
33
+ throw Error("getNextMonth: incorrect month provided");
34
+ if (e < 2023 || e > 2025)
35
+ throw Error("getNextMonth: incorrect year provided");
36
+ let n = e, s;
37
+ return t < 11 ? s = t + 1 : (s = 0, n = e + 1), { newYear: n, newMonth: s };
38
+ }, B = (e, t) => {
39
+ const { newYear: n, newMonth: s } = C(e, t), a = new Date(e, t, 1).getTime() / 1e3, l = new Date(e, t, 8).getTime() / 1e3, u = new Date(e, t, 15).getTime() / 1e3, d = new Date(e, t, 23).getTime() / 1e3, E = new Date(n, s, 1).getTime() / 1e3;
40
+ return [a, l, u, d, E];
41
+ };
42
+ export {
43
+ g as MONTHS,
44
+ f as dayInMilliseconds,
45
+ B as divideMonthOnIntervals,
46
+ i as getCurrentWeek,
47
+ o as getDateFromWeek,
48
+ v as getNextDay,
49
+ U as getWeekTimestamps,
50
+ p as hasCertificationPeriodExpired,
51
+ m as hourInMilliseconds,
52
+ h as isWeekCurrent,
53
+ R as minuteInMilliseconds,
54
+ I as parseWeek,
55
+ w as secondInMilliseconds,
56
+ Y as toDateString,
57
+ A as weekInMilliseconds
58
+ };
@@ -0,0 +1,4 @@
1
+ var t = /* @__PURE__ */ ((i) => (i[i.Classic = 0] = "Classic", i[i.ERC20Permit = 1] = "ERC20Permit", i[i.DAIPermit = 2] = "DAIPermit", i))(t || {});
2
+ export {
3
+ t as ApprovalType
4
+ };
@@ -0,0 +1,36 @@
1
+ import { BigNumber as t } from "ethers";
2
+ const o = t.from(0), r = {
3
+ blockNumber: 0,
4
+ timeStamp: 0,
5
+ methodId: "",
6
+ input: "",
7
+ decodedInput: {
8
+ erc20TokenAddresses: [],
9
+ amountChanges: [],
10
+ flatFees: [0n, 0n].map((e) => t.from(e)),
11
+ externalActionId: o,
12
+ externalActionMetadata: "",
13
+ encryptedOutputs: [],
14
+ hookData: {
15
+ hookContract: "",
16
+ preHookContract: "",
17
+ preHookMetadata: "",
18
+ postHookMetadata: ""
19
+ },
20
+ stealthAddressStructure: {
21
+ extraRandomization: 0n,
22
+ stealthAddress: 0n,
23
+ H0: 0n,
24
+ H1: 0n
25
+ }
26
+ },
27
+ logs: [],
28
+ hash: "",
29
+ gas: 0,
30
+ gasPrice: 0,
31
+ isError: "",
32
+ status: ""
33
+ };
34
+ export {
35
+ r as emptyDecodedTx
36
+ };
@@ -0,0 +1,62 @@
1
+ import { chainIds as f } from "../constants/chains.constants.js";
2
+ import "../types/circom-data.types.js";
3
+ import "../types/transactions.types.js";
4
+ import "../types/curve.types.js";
5
+ import "ethers";
6
+ import "circomlibjs";
7
+ import "../data-structures/crypto-keys/keys.js";
8
+ import "axios";
9
+ import "../data-structures/crypto-keys/encryptDecryptUtxo.js";
10
+ import "../functions/web3/events/getShieldedBalance.js";
11
+ import { WorkerFactory as w } from "./workerFactory.js";
12
+ import "../functions/utils/external-action.utils.js";
13
+ import "../data-structures/custom-token-registry/CustomTokenRegistry.js";
14
+ import "../functions/utils/convertIntegrationProviderToExternalActionId.js";
15
+ import "../constants/coingecko.constants.js";
16
+ import { isDevelopment as h } from "../constants/vite.constants.js";
17
+ import "../functions/utils/userAgent.js";
18
+ import "../constants/reorg-depths.constants.js";
19
+ import "../constants/kyc.constants.js";
20
+ import "../data-structures/volatile-helper/VolatileHelper.js";
21
+ import "libsodium-wrappers";
22
+ import "../constants/contracts.constants.js";
23
+ import "../constants/axelar.constants.js";
24
+ import "../constants/rewards.constants.js";
25
+ const H = async (r) => {
26
+ const o = await w.getWebWorker(r.type);
27
+ return new Promise((m, p) => {
28
+ let i = {};
29
+ if (typeof window < "u" && window.location) {
30
+ const { origin: t, protocol: n, host: a, port: s, hostname: c, href: d } = window.location;
31
+ i = {
32
+ origin: t,
33
+ protocol: n,
34
+ host: a,
35
+ port: s,
36
+ hostname: c,
37
+ href: d
38
+ };
39
+ }
40
+ o.onmessage = (t) => {
41
+ m(t.data), o.terminate();
42
+ }, o.onerror = (t) => {
43
+ p(t), o.terminate();
44
+ };
45
+ const e = {
46
+ payload: r.payload,
47
+ metadata: {
48
+ hostLocation: i,
49
+ constants: {
50
+ chains: {
51
+ chainIds: f
52
+ },
53
+ isDevelopment: h
54
+ }
55
+ }
56
+ };
57
+ o.postMessage(e);
58
+ });
59
+ };
60
+ export {
61
+ H as performTaskWithWorker
62
+ };
@@ -0,0 +1,4 @@
1
+ var E = /* @__PURE__ */ ((L) => (L[L.FULL_PROVE = 0] = "FULL_PROVE", L))(E || {});
2
+ export {
3
+ E as SnarkJSWorkerActionType
4
+ };
@@ -1,4 +1,4 @@
1
- import { W as k } from "./workerProxy-BDj498Ht.mjs";
1
+ import { WorkerProxy as k } from "../workerProxy.js";
2
2
  import * as c from "snarkjs";
3
3
  const $ = typeof process < "u" && process.versions != null && process.versions.node != null, i = (
4
4
  // @ts-expect-error webpack check is done like this
@@ -0,0 +1,4 @@
1
+ var _ = /* @__PURE__ */ ((I) => (I[I.BATCH_FILTER_UTXOS_WITH_NULLIFIER = 0] = "BATCH_FILTER_UTXOS_WITH_NULLIFIER", I[I.BUILD_UTXOS = 1] = "BUILD_UTXOS", I[I.DECIPHER_OUTPUTS = 2] = "DECIPHER_OUTPUTS", I))(_ || {});
2
+ export {
3
+ _ as UtxoWorkerActionType
4
+ };
@@ -0,0 +1,70 @@
1
+ import { preProcessing as f } from "../../crypto/preProcessing.js";
2
+ import { UserKeys as p } from "../../data-structures/crypto-keys/keys.js";
3
+ import { Utxo as h } from "../../data-structures/utxo/Utxo.js";
4
+ import { decryptUtxoConstructorArgs as y, decryptUtxo as m } from "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
5
+ import { decodeUtxoConstructorArgs as U, checkUtxoSignature as g } from "../../data-structures/crypto-keys/decodeUTXO.js";
6
+ import { logError as d } from "../../error-handling/logError.js";
7
+ import { WorkerProxy as x } from "../workerProxy.js";
8
+ import { UtxoWorkerActionType as l } from "./utxoWorker.types.js";
9
+ const a = new x(), T = async ({ data: e }) => {
10
+ const { utxos: t, nullifiers: o } = e, s = t.filter((r) => {
11
+ const c = new h(r);
12
+ return !o.has(c.getNullifier());
13
+ });
14
+ a.postMessageToMainThread(s);
15
+ }, v = async ({ data: e }) => {
16
+ const t = new p(e.signature), o = t.getShieldedPrivateKey(), s = e.encryptedOutputs.map((r) => {
17
+ try {
18
+ return r.isPositive ? y(Buffer.from(r.value.slice(2), "hex"), t) : U(r.value, o);
19
+ } catch {
20
+ return;
21
+ }
22
+ }).filter((r) => r !== void 0);
23
+ a.postMessageToMainThread(s);
24
+ }, k = async ({ data: e }) => {
25
+ const t = new p(e.signature), o = [], { encryptedOutputs: s } = e;
26
+ let { lastOutput: r } = e;
27
+ for (let c = 0; c < s.length; c += 1) {
28
+ const n = s[c];
29
+ if (r = n.value, n.isPositive)
30
+ try {
31
+ const i = m(Buffer.from(r.slice(2), "hex"), t);
32
+ if (!i.erc20TokenAddress || !i.amount || !i.stealthAddress)
33
+ throw Error("bruh");
34
+ o.map((u) => u.value).includes(n.value) || o.push(n);
35
+ } catch {
36
+ d("Utxo not decrypted");
37
+ }
38
+ else
39
+ try {
40
+ g(r, t.getShieldedPrivateKey()) && (o.map((u) => u.value).includes(n.value) || o.push(n));
41
+ } catch {
42
+ d("Utxo not decoded");
43
+ }
44
+ }
45
+ a.postMessageToMainThread({ additionalEncryptedOutputs: o, lastOutput: r });
46
+ }, w = async (e) => {
47
+ await f();
48
+ const { type: t } = e.payload;
49
+ switch (t) {
50
+ case l.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
51
+ T(e.payload);
52
+ return;
53
+ case l.BUILD_UTXOS:
54
+ v(e.payload);
55
+ return;
56
+ case l.DECIPHER_OUTPUTS:
57
+ k(e.payload);
58
+ return;
59
+ default:
60
+ throw Error(`Unknown worker message type ${t}`);
61
+ }
62
+ };
63
+ a.attachWorkerSideOnMessage(w);
64
+ export {
65
+ a as default,
66
+ v as handleBuildUtxosMessage,
67
+ k as handleDecipherMessage,
68
+ T as handleFilterUtxosWithNullifier,
69
+ w as onWorkerMessage
70
+ };
@@ -0,0 +1,4 @@
1
+ var o = /* @__PURE__ */ ((S) => (S.ZKProof = "ZKProof", S.SnarkJS = "SnarkJS", S.UTXO = "UTXO", S))(o || {});
2
+ export {
3
+ o as WorkerVariant
4
+ };
@@ -0,0 +1,42 @@
1
+ import { WorkerVariant as r } from "./worker.registry.js";
2
+ class t {
3
+ static isRunningInNode = typeof process < "u" && process.versions != null && process.versions.node != null;
4
+ constructor() {
5
+ }
6
+ static createWorker = async (e) => {
7
+ if (t.isRunningInNode) {
8
+ let s;
9
+ return e === r.SnarkJS ? s = await import(
10
+ /* @vite-ignore */
11
+ "./snarkjsWorker/snarkjsWorkerLogic.js"
12
+ ) : e === r.ZKProof ? s = await import(
13
+ /* @vite-ignore */
14
+ "./zkProofWorker/zkProofWorkerLogic.js"
15
+ ) : e === r.UTXO && (s = await import(
16
+ /* @vite-ignore */
17
+ "./utxoWorker/utxoWorkerLogic.js"
18
+ )), s.default;
19
+ }
20
+ if (e === r.SnarkJS)
21
+ return new Worker(new URL("" + new URL("../assets/snarkjsWorkerLauncher-CaBCnle3.js", import.meta.url).href, import.meta.url), { type: "module" });
22
+ if (e === r.ZKProof)
23
+ return new Worker(new URL("" + new URL("../assets/zkProofWorkerLauncher-BteYxRBn.js", import.meta.url).href, import.meta.url), { type: "module" });
24
+ if (e === r.UTXO)
25
+ return new Worker(new URL("" + new URL("../assets/utxoWorkerLauncher-TRT6Cdzd.js", import.meta.url).href, import.meta.url), { type: "module" });
26
+ };
27
+ static getWebWorker(e) {
28
+ switch (e) {
29
+ case r.ZKProof:
30
+ return t.createWorker(e);
31
+ case r.SnarkJS:
32
+ return t.createWorker(e);
33
+ case r.UTXO:
34
+ return t.createWorker(e);
35
+ default:
36
+ throw Error(`Unknown worker type: ${e}`);
37
+ }
38
+ }
39
+ }
40
+ export {
41
+ t as WorkerFactory
42
+ };
@@ -50,5 +50,5 @@ class i {
50
50
  }
51
51
  }
52
52
  export {
53
- i as W
53
+ i as WorkerProxy
54
54
  };
@@ -0,0 +1,4 @@
1
+ var _ = /* @__PURE__ */ ((I) => (I[I.CALC_COMMITMENTS_SIBLING_AND_SIDES = 0] = "CALC_COMMITMENTS_SIBLING_AND_SIDES", I[I.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES = 1] = "CALC_ACCESS_TOKEN_SIBLING_AND_SIDES", I[I.BUILD_IN_NULLIFIERS = 2] = "BUILD_IN_NULLIFIERS", I))(_ || {});
2
+ export {
3
+ _ as ZKProofWorkerActionType
4
+ };
@@ -0,0 +1,66 @@
1
+ import { preProcessing as u } from "../../crypto/preProcessing.js";
2
+ import { UserKeys as I } from "../../data-structures/crypto-keys/keys.js";
3
+ import { Utxo as S } from "../../data-structures/utxo/Utxo.js";
4
+ import { poseidonFunction as g } from "../../crypto/poseidon.js";
5
+ import { MerkleTree as T } from "../../data-structures/merkle-tree/MerkleTree.js";
6
+ import { calcCommitmentsSiblingAndSides as k, calcAccessTokenSiblingsAndSides as C } from "../../functions/snarkjs/common.snarkjs.js";
7
+ import { WorkerProxy as M } from "../workerProxy.js";
8
+ import { ZKProofWorkerActionType as d } from "./zkProofWorker.types.js";
9
+ const l = new M(), f = (e) => {
10
+ const { inputUtxosSerialized: t, merkleTreeSerialized: n } = e.data, m = n.tree, r = new Map(
11
+ Object.entries(m).map(([a, c]) => [BigInt(a), BigInt(c)])
12
+ ), o = T.createWithData(
13
+ r,
14
+ BigInt(n.index),
15
+ BigInt(n.count),
16
+ g,
17
+ 25n,
18
+ 0n
19
+ ), i = t.map(
20
+ (a) => a.map((c) => new S(c))
21
+ ), { inCommitmentSiblings: s, inCommitmentSiblingSides: p } = k(i, o);
22
+ l.postMessageToMainThread({ inCommitmentSiblings: s, inCommitmentSiblingSides: p });
23
+ }, A = (e) => {
24
+ const { userSignature: t, merkleTreeAccessTokenSerialized: n } = e.data, m = new I(t), r = n.tree, o = new Map(
25
+ Object.entries(r).map(([a, c]) => [BigInt(a), BigInt(c)])
26
+ ), i = T.createWithData(
27
+ o,
28
+ BigInt(n.index),
29
+ BigInt(n.count),
30
+ g,
31
+ 25n,
32
+ 0n
33
+ ), { accessTokenSiblings: s, accessTokenSiblingSides: p } = C(m, i);
34
+ l.postMessageToMainThread({ accessTokenSiblings: s, accessTokenSiblingSides: p });
35
+ }, h = (e) => {
36
+ const { inputUtxosSerialized: t, onChainCreation: n } = e.data, r = t.map(
37
+ (o) => o.map((i) => new S(i))
38
+ ).map(
39
+ (o, i) => o.map((s) => n[i] ? "0" : s.getNullifier())
40
+ );
41
+ l.postMessageToMainThread(r);
42
+ }, w = async (e) => {
43
+ await u();
44
+ const { type: t } = e.payload;
45
+ switch (t) {
46
+ case d.CALC_COMMITMENTS_SIBLING_AND_SIDES:
47
+ f(e.payload);
48
+ return;
49
+ case d.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES:
50
+ A(e.payload);
51
+ return;
52
+ case d.BUILD_IN_NULLIFIERS:
53
+ h(e.payload);
54
+ return;
55
+ default:
56
+ throw Error(`Unknown worker message type ${t}`);
57
+ }
58
+ };
59
+ l.attachWorkerSideOnMessage(w);
60
+ export {
61
+ l as default,
62
+ h as handleBuildInNullifiers,
63
+ A as handleCalcAccessTokenSiblingAndSides,
64
+ f as handleCalcCommitmentsSiblingAndSides,
65
+ w as onWorkerMessage
66
+ };