@hinkal/common 0.0.111 → 0.0.113

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 (261) hide show
  1. package/index-DXElTGy9.mjs +254449 -0
  2. package/index.js +455 -642
  3. package/package.json +1 -1
  4. package/{webworker/snarkjsWorker/snarkjsWorkerLogic.js → snarkjsWorkerLogic-CVna_BW9.mjs} +1 -1
  5. package/utxoWorkerLogic-B1Hh-bq4.mjs +64 -0
  6. package/{webworker/workerProxy.js → workerProxy-BDj498Ht.mjs} +1 -1
  7. package/zkProofWorkerLogic-D9rxuuiK.mjs +60 -0
  8. package/API/API.js +0 -58
  9. package/API/HinkalPointsCalls.js +0 -38
  10. package/API/callBeefyGraphAPI.js +0 -37
  11. package/API/callCurveAPI.js +0 -156
  12. package/API/callMonitor.js +0 -30
  13. package/API/callOdosAPI.js +0 -44
  14. package/API/callOneInchAPI.js +0 -37
  15. package/API/callRelayer.js +0 -32
  16. package/API/checkRisk.js +0 -30
  17. package/API/dataServerCalls.js +0 -32
  18. package/API/fetchCommitmentsCache.js +0 -31
  19. package/API/fetchNullifiers.js +0 -30
  20. package/API/getAxelarGasEstimate.js +0 -37
  21. package/API/getCoingeckoPrice.js +0 -27
  22. package/API/getConnextReceiveFee.js +0 -30
  23. package/API/getGasEstimates.js +0 -38
  24. package/API/getRelayerURL.js +0 -32
  25. package/API/getServerURL.js +0 -67
  26. package/API/getTokenPrice.js +0 -41
  27. package/API/kycCalls.js +0 -32
  28. package/API/passwordCalls.js +0 -36
  29. package/API/referralProgramCalls.js +0 -58
  30. package/API/relayCalls.js +0 -30
  31. package/API/restoreSnapshots.js +0 -32
  32. package/API/rewardsPointsCalls.js +0 -40
  33. package/API/userVerifyTransactions.js +0 -45
  34. package/constants/assets.constants.js +0 -16
  35. package/constants/axelar.constants.js +0 -55
  36. package/constants/backend.constants.js +0 -18
  37. package/constants/beefy.registry.js +0 -24
  38. package/constants/chains.constants.js +0 -204
  39. package/constants/coingecko.constants.js +0 -53
  40. package/constants/contracts.constants.js +0 -276
  41. package/constants/crvCvx.registry.js +0 -636
  42. package/constants/crvDynamic.registry.js +0 -24
  43. package/constants/deploy-data/deploy-data-arbMainnet.json.js +0 -7415
  44. package/constants/deploy-data/deploy-data-avalanche.json.js +0 -7411
  45. package/constants/deploy-data/deploy-data-axelar1.json.js +0 -4329
  46. package/constants/deploy-data/deploy-data-axelar2.json.js +0 -4329
  47. package/constants/deploy-data/deploy-data-base.json.js +0 -8425
  48. package/constants/deploy-data/deploy-data-blast.json.js +0 -9600
  49. package/constants/deploy-data/deploy-data-bnbMainnet.json.js +0 -6877
  50. package/constants/deploy-data/deploy-data-ethMainnet.json.js +0 -11427
  51. package/constants/deploy-data/deploy-data-localhost.json.js +0 -13283
  52. package/constants/deploy-data/deploy-data-optimism.json.js +0 -7417
  53. package/constants/deploy-data/deploy-data-polygon.json.js +0 -7439
  54. package/constants/fees.constants.js +0 -57
  55. package/constants/kyc.constants.js +0 -118
  56. package/constants/lido.constants.js +0 -13
  57. package/constants/pendle.registry.js +0 -253
  58. package/constants/protocol.constants.js +0 -26
  59. package/constants/reorg-depths.constants.js +0 -15
  60. package/constants/rewards.constants.js +0 -27
  61. package/constants/server.constants.js +0 -157
  62. package/constants/token-data/ERC20Registry.js +0 -85
  63. package/constants/token-data/arbMainnetRegistry.json.js +0 -946
  64. package/constants/token-data/arbMainnetRegistryFixed.json.js +0 -856
  65. package/constants/token-data/avalancheRegistry.json.js +0 -591
  66. package/constants/token-data/avalancheRegistryFixed.json.js +0 -591
  67. package/constants/token-data/baseRegistry.json.js +0 -490
  68. package/constants/token-data/baseRegistryFixed.json.js +0 -463
  69. package/constants/token-data/blastRegistry.json.js +0 -137
  70. package/constants/token-data/blastRegistryFixed.json.js +0 -137
  71. package/constants/token-data/bnbMainnetRegistry.json.js +0 -973
  72. package/constants/token-data/bnbMainnetRegistryFixed.json.js +0 -973
  73. package/constants/token-data/coingeckoRegistry.json.js +0 -115623
  74. package/constants/token-data/ethMainnetRegistry.json.js +0 -2700
  75. package/constants/token-data/ethMainnetRegistryFixed.json.js +0 -2251
  76. package/constants/token-data/index.js +0 -6
  77. package/constants/token-data/localhostRegistry.json.js +0 -2768
  78. package/constants/token-data/optimismRegistry.json.js +0 -1455
  79. package/constants/token-data/optimismRegistryFixed.json.js +0 -1392
  80. package/constants/token-data/polygonRegistry.json.js +0 -1327
  81. package/constants/token-data/polygonRegistryFixed.json.js +0 -1255
  82. package/constants/token-data/popularTokens.constants.js +0 -14
  83. package/constants/token-data/tokenPricing.consts.js +0 -8
  84. package/constants/vite.constants.js +0 -29
  85. package/crypto/babyJub.js +0 -15
  86. package/crypto/poseidon.js +0 -26
  87. package/crypto/preProcessing.js +0 -9
  88. package/data-structures/Hinkal/Hinkal.js +0 -299
  89. package/data-structures/Hinkal/hinkalActionBeefy.js +0 -101
  90. package/data-structures/Hinkal/hinkalActionConvex.js +0 -83
  91. package/data-structures/Hinkal/hinkalActionCurve.js +0 -112
  92. package/data-structures/Hinkal/hinkalActionLidoEth.js +0 -91
  93. package/data-structures/Hinkal/hinkalActionPendle.js +0 -140
  94. package/data-structures/Hinkal/hinkalActionPendleLP.js +0 -96
  95. package/data-structures/Hinkal/hinkalActionStake.js +0 -138
  96. package/data-structures/Hinkal/hinkalActionVolatile.js +0 -112
  97. package/data-structures/Hinkal/hinkalDeposit.js +0 -95
  98. package/data-structures/Hinkal/hinkalGetZkMeProvider.js +0 -47
  99. package/data-structures/Hinkal/hinkalPrivateWallet.js +0 -66
  100. package/data-structures/Hinkal/hinkalSwap.js +0 -98
  101. package/data-structures/Hinkal/hinkalTransfer.js +0 -5
  102. package/data-structures/Hinkal/hinkalWithdraw.js +0 -91
  103. package/data-structures/Hinkal/resetMerkleTrees.js +0 -49
  104. package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.js +0 -83
  105. package/data-structures/ValueCache/ValueCache.js +0 -25
  106. package/data-structures/crypto-keys/decodeUTXO.js +0 -40
  107. package/data-structures/crypto-keys/encryptDecryptUtxo.js +0 -41
  108. package/data-structures/crypto-keys/keyUtils.js +0 -10
  109. package/data-structures/crypto-keys/keys.js +0 -90
  110. package/data-structures/custom-token-registry/CustomTokenRegistry.js +0 -33
  111. package/data-structures/event-service/AbstractAccessTokenSnapshotService.js +0 -131
  112. package/data-structures/event-service/AbstractCommitmentsSnapshotService.js +0 -132
  113. package/data-structures/event-service/AbstractEventService.js +0 -118
  114. package/data-structures/event-service/AbstractNullifierSnapshotService.js +0 -59
  115. package/data-structures/event-service/AbstractSnapshotService.js +0 -35
  116. package/data-structures/merkle-tree/MerkleTree.js +0 -177
  117. package/data-structures/merkle-tree/MerkleTreeIncompleteError.js +0 -8
  118. package/data-structures/snapshot/ClientAccessTokenSnapshotService.js +0 -48
  119. package/data-structures/snapshot/ClientCommitmentsSnapshotService.js +0 -47
  120. package/data-structures/snapshot/ClientNullifierSnapshotService.js +0 -44
  121. package/data-structures/token-price-fetcher/TokenChecker.js +0 -29
  122. package/data-structures/token-price-fetcher/TokenPriceFetcher.js +0 -218
  123. package/data-structures/transactions-manager/TransactionsManager.js +0 -194
  124. package/data-structures/transactions-manager/history/getBeefyData.js +0 -68
  125. package/data-structures/transactions-manager/history/getConvexData.js +0 -57
  126. package/data-structures/transactions-manager/history/getCurveData.js +0 -97
  127. package/data-structures/transactions-manager/history/getDepositData.js +0 -36
  128. package/data-structures/transactions-manager/history/getLidoData.js +0 -44
  129. package/data-structures/transactions-manager/history/getPendleData.js +0 -59
  130. package/data-structures/transactions-manager/history/getSwapData.js +0 -43
  131. package/data-structures/transactions-manager/history/getTxDetails.js +0 -74
  132. package/data-structures/transactions-manager/history/getVolatileData.js +0 -75
  133. package/data-structures/transactions-manager/history/history.types.js +0 -62
  134. package/data-structures/transactions-manager/history/history.utils.js +0 -8
  135. package/data-structures/utxo/Utxo.js +0 -134
  136. package/data-structures/volatile-helper/VolatileHelper.js +0 -181
  137. package/error-handling/customErrors/ErrorWithAmount.js +0 -9
  138. package/error-handling/customErrors/FeeOverTransactionValueError.js +0 -9
  139. package/error-handling/customErrors/customErrors.helpers.js +0 -21
  140. package/error-handling/error-codes.constants.js +0 -184
  141. package/error-handling/get-error.message.js +0 -53
  142. package/error-handling/handleErrorRestore.js +0 -35
  143. package/error-handling/logError.js +0 -7
  144. package/error-handling/types.js +0 -4
  145. package/externalABIs/BUSD.js +0 -519
  146. package/externalABIs/BabPassport.json.js +0 -24
  147. package/externalABIs/BeefyRouterAbi.json.js +0 -1022
  148. package/externalABIs/BeefyStrategyAbi.json.js +0 -1423
  149. package/externalABIs/BeefyVaultAbi.json.js +0 -570
  150. package/externalABIs/BeefyZapAbi.json.js +0 -208
  151. package/externalABIs/BeefyZapOneInchAbi.json.js +0 -340
  152. package/externalABIs/ConvexBoosterAbi.json.js +0 -674
  153. package/externalABIs/ConvexBoosterAbiMainnet.json.js +0 -1002
  154. package/externalABIs/ConvexRewardPoolAbi.json.js +0 -883
  155. package/externalABIs/CurveReadingWrapperAbi.json.js +0 -1422
  156. package/externalABIs/CurveWrappedMainPool.json.js +0 -1136
  157. package/externalABIs/CurveZap.json.js +0 -262
  158. package/externalABIs/CvxCrvUtilities.json.js +0 -264
  159. package/externalABIs/DAI.js +0 -334
  160. package/externalABIs/ERC20.json.js +0 -291
  161. package/externalABIs/GalxePassport.json.js +0 -41
  162. package/externalABIs/IQuoterV2.json.js +0 -205
  163. package/externalABIs/ISwapRouter.json.js +0 -568
  164. package/externalABIs/IUniswapV3Factory.json.js +0 -201
  165. package/externalABIs/IUniswapV3Pool.json.js +0 -999
  166. package/externalABIs/LidoStEthAbi.json.js +0 -1603
  167. package/externalABIs/LidoStMaticAbi.json.js +0 -1764
  168. package/externalABIs/LidoStakeManagerAbi.json.js +0 -2082
  169. package/externalABIs/LidoWithdrawalQueueERC721Abi.json.js +0 -2030
  170. package/externalABIs/LidoWstEthAbi.json.js +0 -480
  171. package/externalABIs/OptimismGasPriceOracle.json.js +0 -206
  172. package/externalABIs/PendleRouterAbi.json.js +0 -173
  173. package/externalABIs/PoLidoNftAbi.json.js +0 -701
  174. package/externalABIs/SanctionsList.js +0 -89
  175. package/externalABIs/USDC.js +0 -721
  176. package/externalABIs/USDR.js +0 -346
  177. package/externalABIs/USDR3CRV.js +0 -542
  178. package/externalABIs/USDT.js +0 -393
  179. package/externalABIs/UniswapV2PoolAbi.json.js +0 -80
  180. package/externalABIs/WETH.js +0 -156
  181. package/externalABIs/amToken.js +0 -350
  182. package/externalABIs/transactionsProver.json.js +0 -39
  183. package/functions/kyc/authentoHelper.js +0 -42
  184. package/functions/kyc/passportHelper.js +0 -39
  185. package/functions/kyc/zkMeHelper.js +0 -56
  186. package/functions/pre-transaction/getFlatFees.js +0 -203
  187. package/functions/pre-transaction/interaction-to-action.js +0 -57
  188. package/functions/pre-transaction/outputUtxoProcessing.js +0 -45
  189. package/functions/pre-transaction/process-gas-estimates.js +0 -57
  190. package/functions/pre-transaction/processAmountChanges.js +0 -229
  191. package/functions/private-wallet/emporium.helpers.js +0 -19
  192. package/functions/private-wallet/opProducer.js +0 -24
  193. package/functions/protocols/convex.protocols.js +0 -41
  194. package/functions/protocols/curve.protocols.js +0 -45
  195. package/functions/protocols/pendle.helpers.js +0 -108
  196. package/functions/snarkjs/common.snarkjs.js +0 -96
  197. package/functions/snarkjs/constant.js +0 -211
  198. package/functions/snarkjs/constructEmporiumProof.js +0 -105
  199. package/functions/snarkjs/constructGeneralZkProof.js +0 -129
  200. package/functions/snarkjs/generateCircomData.js +0 -60
  201. package/functions/snarkjs/generateZkProof.js +0 -18
  202. package/functions/snarkjs/getZKFiles.js +0 -30
  203. package/functions/staking/index.js +0 -40
  204. package/functions/utils/amounts.utils.js +0 -70
  205. package/functions/utils/axelar.utils.js +0 -38
  206. package/functions/utils/cacheFunctions.js +0 -67
  207. package/functions/utils/caseInsensitive.utils.js +0 -6
  208. package/functions/utils/convertIntegrationProviderToExternalActionId.js +0 -16
  209. package/functions/utils/create-provider.js +0 -5
  210. package/functions/utils/enum.utils.js +0 -14
  211. package/functions/utils/erc20tokenFunctions.js +0 -20
  212. package/functions/utils/evmNetworkFunctions.js +0 -29
  213. package/functions/utils/external-action.utils.js +0 -61
  214. package/functions/utils/getDataFromTransaction.js +0 -105
  215. package/functions/utils/memoize.utils.js +0 -14
  216. package/functions/utils/nickname.utils.js +0 -7
  217. package/functions/utils/process.utils.js +0 -4
  218. package/functions/utils/reloadPage.js +0 -4
  219. package/functions/utils/requireEnv.js +0 -7
  220. package/functions/utils/resolve-sync.utils.js +0 -22
  221. package/functions/utils/serialize.utils.js +0 -4
  222. package/functions/utils/string.utils.js +0 -14
  223. package/functions/utils/time.utils.js +0 -8
  224. package/functions/utils/userAgent.js +0 -15
  225. package/functions/utils/volatile-patcher.utils.js +0 -40
  226. package/functions/web3/etherFunctions.js +0 -41
  227. package/functions/web3/events/balanceChangedHandler.js +0 -10
  228. package/functions/web3/events/getInputUtxoAndBalance.js +0 -72
  229. package/functions/web3/events/getShieldedBalance.js +0 -107
  230. package/functions/web3/events/web3RetrieveEvents.js +0 -9
  231. package/functions/web3/functionCalls/accessTokenCalls.js +0 -48
  232. package/functions/web3/functionCalls/approveToken.js +0 -153
  233. package/functions/web3/functionCalls/estimateGasRelayer.js +0 -18
  234. package/functions/web3/functionCalls/transactCallDirect.js +0 -60
  235. package/functions/web3/functionCalls/transactCallRelayer.js +0 -42
  236. package/functions/web3/odosAPI.js +0 -65
  237. package/functions/web3/oneInchAPI.js +0 -61
  238. package/functions/web3/runContractFunction.js +0 -95
  239. package/functions/web3/uniswapAPI.js +0 -97
  240. package/types/beefy.types.js +0 -21
  241. package/types/circom-data.types.js +0 -22
  242. package/types/curve.types.js +0 -25
  243. package/types/ethereum-network.types.js +0 -4
  244. package/types/external-action.types.js +0 -4
  245. package/types/hinkal.stake.types.js +0 -4
  246. package/types/hinkal.types.js +0 -15
  247. package/types/kyc.types.js +0 -13
  248. package/types/pendle.types.js +0 -15
  249. package/types/rewards.types.js +0 -27
  250. package/types/slippage.types.js +0 -15
  251. package/types/time.types.js +0 -58
  252. package/types/token.types.js +0 -4
  253. package/types/transactions.types.js +0 -36
  254. package/webworker/performTaskWithWorker.js +0 -62
  255. package/webworker/snarkjsWorker/snarkjsWorker.types.js +0 -4
  256. package/webworker/utxoWorker/utxoWorker.types.js +0 -4
  257. package/webworker/utxoWorker/utxoWorkerLogic.js +0 -70
  258. package/webworker/worker.registry.js +0 -4
  259. package/webworker/workerFactory.js +0 -42
  260. package/webworker/zkProofWorker/zkProofWorker.types.js +0 -4
  261. package/webworker/zkProofWorker/zkProofWorkerLogic.js +0 -66
@@ -1,129 +0,0 @@
1
- import { chainIds as J } 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 { HinkalStakeMode as c } from "../../types/hinkal.stake.types.js";
6
- import { randomBigInt as V } from "../web3/etherFunctions.js";
7
- import { Utxo as j } from "../../data-structures/utxo/Utxo.js";
8
- import "axios";
9
- import "ethers";
10
- import "../../data-structures/crypto-keys/keys.js";
11
- import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
12
- import { zeroAddress as q } from "../../constants/protocol.constants.js";
13
- import "../web3/events/getShieldedBalance.js";
14
- import { performTaskWithWorker as s } from "../../webworker/performTaskWithWorker.js";
15
- import { WorkerVariant as l } from "../../webworker/worker.registry.js";
16
- import { ZKProofWorkerActionType as S } from "../../webworker/zkProofWorker/zkProofWorker.types.js";
17
- import { calcAmountChanges as F, calcEncryptedOutputs as Q, buildOutCommitments as X, calcPublicSignalCount as Y, createCallDataHash as $, calcStealthAddressStructure as U } from "./common.snarkjs.js";
18
- import { generateCircomData as x } from "./generateCircomData.js";
19
- import { generateZkProof as oo } from "./generateZkProof.js";
20
- import "circomlibjs";
21
- import "../utils/external-action.utils.js";
22
- import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
23
- import "../utils/convertIntegrationProviderToExternalActionId.js";
24
- import "../../constants/coingecko.constants.js";
25
- import "../../constants/vite.constants.js";
26
- import "../utils/userAgent.js";
27
- import "../../constants/reorg-depths.constants.js";
28
- import "../../constants/kyc.constants.js";
29
- import "../../data-structures/volatile-helper/VolatileHelper.js";
30
- import "libsodium-wrappers";
31
- import "../../constants/contracts.constants.js";
32
- import "../../constants/axelar.constants.js";
33
- import "../../constants/rewards.constants.js";
34
- const Lo = async (f, g, e, a, h, u, k, C, I, T = q, R = J.localhost, r = e.map(() => !1), y = e.map(() => 0n), b = void 0, m) => {
35
- const N = f.getRootHash(), P = g.getRootHash(), D = e.map((o) => o.map((i) => i.getConstructableParams())), _ = h.getSignature(), { accessTokenSiblings: B, accessTokenSiblingSides: E } = await s({
36
- type: l.ZKProof,
37
- payload: {
38
- type: S.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES,
39
- data: {
40
- userSignature: _,
41
- merkleTreeAccessTokenSerialized: g.toJSON()
42
- }
43
- }
44
- }), { inCommitmentSiblings: K, inCommitmentSiblingSides: L } = await s({
45
- type: l.ZKProof,
46
- payload: {
47
- type: S.CALC_COMMITMENTS_SIBLING_AND_SIDES,
48
- data: { inputUtxosSerialized: D, userSignature: _, merkleTreeSerialized: f.toJSON() }
49
- }
50
- }), O = F(e, a), d = Q(
51
- a,
52
- (m && m.mode !== c.Deposit) ?? !1
53
- ), p = h.getShieldedPrivateKey(), H = j.findCorrectRandomization(V(31), p), Z = await s({
54
- type: l.ZKProof,
55
- payload: {
56
- type: S.BUILD_IN_NULLIFIERS,
57
- data: { inputUtxosSerialized: D, onChainCreation: r }
58
- }
59
- }), t = {
60
- rootHashHinkal: N,
61
- shieldedPrivateKey: p,
62
- erc20TokenAddresses: e.map((o) => o[0].erc20TokenAddress),
63
- inAmounts: e.map((o) => o.map((i) => i.amount.toString())),
64
- inTimeStamps: e.map((o) => o.map((i) => i.timeStamp)),
65
- inRandomizations: e.map((o) => o.map((i) => i.randomization)),
66
- inNullifiers: Z,
67
- inCommitmentSiblings: K,
68
- inCommitmentSiblingSides: L,
69
- outAmounts: a.map((o) => o.map((i) => i.amount.toString())),
70
- outTimeStamp: BigInt(a[0][0].timeStamp),
71
- outPublicKeys: a.map((o) => o.map((i) => i.getStealthAddress())),
72
- extraRandomization: H,
73
- amountChanges: O,
74
- outCommitments: X(a, r),
75
- rootHashAccessToken: P,
76
- accessTokenSiblings: B,
77
- accessTokenSiblingSides: E,
78
- calldataHash: 0n
79
- };
80
- m || (t.onChainCreation = r);
81
- const n = e.map((o) => o[0].tokenId ?? 0), z = n.reduce((o, i) => o + i, 0) > 0 ? n.length : 0;
82
- z > 0 && (t.tokenIds = n);
83
- const A = Y(
84
- u,
85
- t.erc20TokenAddresses,
86
- t.amountChanges,
87
- t.inNullifiers,
88
- t.outCommitments,
89
- z
90
- );
91
- t.calldataHash = $(
92
- A,
93
- T,
94
- C,
95
- k,
96
- I,
97
- d,
98
- y,
99
- b
100
- ), m && (m.mode === c.Deposit && (t.mode = 0), m.mode === c.Stake && (t.mode = 1), m.mode === c.Unstake && (t.mode = 2), t.stakedTokenRecipient = m.stakedTokenRecipient, t.stakeBlinding = m.stakeBlinding, t.depositorAddress = m.depositorAddress);
101
- const { zkCallData: w, publicSignals: W } = await oo(R, u, t);
102
- console.log("publicSignals", W);
103
- const v = U(H, p), M = await x(
104
- N,
105
- P,
106
- e,
107
- a,
108
- d,
109
- y,
110
- A,
111
- k,
112
- C,
113
- I,
114
- T,
115
- t.calldataHash,
116
- n,
117
- v,
118
- r,
119
- b
120
- ), G = {
121
- tokenNumber: e.length,
122
- nullifierAmount: e[0].length,
123
- outputAmount: a[0].length
124
- };
125
- return { zkCallData: w, circomData: M, dimData: G, encryptedOutputs: d };
126
- };
127
- export {
128
- Lo as constructZkProof
129
- };
@@ -1,60 +0,0 @@
1
- import "../../constants/chains.constants.js";
2
- import { defaultHookData as S } from "../../types/circom-data.types.js";
3
- import "../../types/transactions.types.js";
4
- import "../../types/curve.types.js";
5
- import "ethers";
6
- import { zeroAddress as h } from "../../constants/protocol.constants.js";
7
- import "circomlibjs";
8
- import "../../data-structures/crypto-keys/keys.js";
9
- import "axios";
10
- import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
11
- import "../web3/events/getShieldedBalance.js";
12
- import { performTaskWithWorker as C } from "../../webworker/performTaskWithWorker.js";
13
- import { WorkerVariant as T } from "../../webworker/worker.registry.js";
14
- import { ZKProofWorkerActionType as W } from "../../webworker/zkProofWorker/zkProofWorker.types.js";
15
- import { calcAmountChanges as b, buildOutCommitments as L } from "./common.snarkjs.js";
16
- import { getExternalActionIdHash as N } from "../utils/external-action.utils.js";
17
- import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
18
- import "../utils/convertIntegrationProviderToExternalActionId.js";
19
- import "../../constants/coingecko.constants.js";
20
- import "../../constants/vite.constants.js";
21
- import "../utils/userAgent.js";
22
- import "../../constants/reorg-depths.constants.js";
23
- import "../../constants/kyc.constants.js";
24
- import "../../data-structures/volatile-helper/VolatileHelper.js";
25
- import "libsodium-wrappers";
26
- import "../../constants/contracts.constants.js";
27
- import "../../constants/axelar.constants.js";
28
- import "../../constants/rewards.constants.js";
29
- const ir = async (e, a, o, t, n, s, c, m, i, d, f, k, l, g, p, u) => {
30
- const y = b(o, t, !0), A = o.map((r) => r.map((I) => I.getConstructableParams())), D = await C({
31
- type: T.ZKProof,
32
- payload: {
33
- type: W.BUILD_IN_NULLIFIERS,
34
- data: { inputUtxosSerialized: A, onChainCreation: p }
35
- }
36
- });
37
- return {
38
- rootHashHinkal: e,
39
- erc20TokenAddresses: o.map((r) => r[0].erc20TokenAddress),
40
- tokenIds: l.map((r) => String(r)),
41
- amountChanges: y,
42
- inputNullifiers: D,
43
- outCommitments: L(t, p),
44
- encryptedOutputs: n,
45
- flatFees: s,
46
- timeStamp: t[0][0].timeStamp,
47
- stealthAddressStructure: g,
48
- rootHashAccessToken: a,
49
- relay: f,
50
- externalAddress: i === void 0 ? h : i,
51
- externalActionMetadata: d,
52
- externalActionId: typeof m == "bigint" ? 0n : N(m),
53
- hookData: u || S,
54
- publicSignalCount: c,
55
- calldataHash: k
56
- };
57
- };
58
- export {
59
- ir as generateCircomData
60
- };
@@ -1,18 +0,0 @@
1
- import { performTaskWithWorker as p } from "../../webworker/performTaskWithWorker.js";
2
- import { SnarkJSWorkerActionType as i } from "../../webworker/snarkjsWorker/snarkjsWorker.types.js";
3
- import { WorkerVariant as c } from "../../webworker/worker.registry.js";
4
- import { getZKeyFile as r, getWASMFile as g } from "./getZKFiles.js";
5
- const S = async (o, t, e) => {
6
- console.log("Zero Knowledge proof construction started, please wait...", r(t, o));
7
- const a = g(t, o), n = r(t, o), { publicSignals: l, zkCallData: s } = await p({
8
- type: c.SnarkJS,
9
- payload: {
10
- type: i.FULL_PROVE,
11
- data: { input: e, chainId: o, wasmFilePath: a, zKeyFilePath: n }
12
- }
13
- });
14
- return console.log("Zero Knowledge proof construction finished "), { zkCallData: s, publicSignals: l };
15
- };
16
- export {
17
- S as generateZkProof
18
- };
@@ -1,30 +0,0 @@
1
- import { chainIds as o } 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 "../web3/events/getShieldedBalance.js";
11
- import "../../webworker/workerFactory.js";
12
- import "../utils/external-action.utils.js";
13
- import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
14
- import "../utils/convertIntegrationProviderToExternalActionId.js";
15
- import "../../constants/coingecko.constants.js";
16
- import "../../constants/vite.constants.js";
17
- import "../utils/userAgent.js";
18
- import { prodVerifiers as t, localVerifiers as m } from "./constant.js";
19
- import "../../constants/reorg-depths.constants.js";
20
- import "../../constants/kyc.constants.js";
21
- import "../../data-structures/volatile-helper/VolatileHelper.js";
22
- import "libsodium-wrappers";
23
- import "../../constants/contracts.constants.js";
24
- import "../../constants/axelar.constants.js";
25
- import "../../constants/rewards.constants.js";
26
- const j = (r, i) => i === o.localhost ? m[`${r}Wasm`] : t(i)[`${r}Wasm`], q = (r, i) => i === o.localhost ? m[`${r}Zkey`] : t(i)[`${r}Zkey`];
27
- export {
28
- j as getWASMFile,
29
- q as getZKeyFile
30
- };
@@ -1,40 +0,0 @@
1
- import { ethers as i } from "ethers";
2
- import { UserKeys as f } from "../../data-structures/crypto-keys/keys.js";
3
- import s from "libsodium-wrappers";
4
- import { poseidonHash as c } from "../../crypto/poseidon.js";
5
- import "circomlibjs";
6
- const S = (t, e, r) => {
7
- const o = i.utils.defaultAbiCoder.encode(
8
- ["uint256", "address"],
9
- [t, e]
10
- ), n = s.crypto_box_seal(o, i.utils.arrayify(r));
11
- return `0x${Buffer.from(n).toString("hex")}`;
12
- }, k = (t, e) => {
13
- const r = Buffer.from(t.slice(2), "hex"), { publicKey: o, privateKey: n } = f.getEncryptionKeyPair(e.getShieldedPrivateKey());
14
- try {
15
- const a = s.crypto_box_seal_open(
16
- r,
17
- i.utils.arrayify(o),
18
- i.utils.arrayify(n)
19
- ), d = Buffer.from(a).toString("utf-8"), [u, y] = i.utils.defaultAbiCoder.decode(
20
- ["uint256", "address"],
21
- d
22
- );
23
- return { stakeBlinding: u.toBigInt(), stakedTokenRecipient: y };
24
- } catch {
25
- console.log("failed to decrypt");
26
- return;
27
- }
28
- }, B = (t, e, r, o, n, a) => BigInt(
29
- c(...[t, e, r, o, n, a].map(BigInt))
30
- ), h = (t, e) => c(t, e), x = (t, e, r, o, n) => i.utils.defaultAbiCoder.encode(
31
- ["uint8", "uint256", "address", "bytes", "bytes"],
32
- [t, e, r, o, n]
33
- );
34
- export {
35
- h as calculateStakeNullifier,
36
- B as createStakeCommitment,
37
- k as decryptStake,
38
- x as encodeHStakeMetadata,
39
- S as encryptStake
40
- };
@@ -1,70 +0,0 @@
1
- const s = (t) => t.reduce((n, e) => n + e, 0), u = (t) => t / 100, a = (t, n) => n * t / 10000n;
2
- function d(t) {
3
- return typeof t == "object" && "toBigInt" in t ? t.toBigInt() : BigInt(t);
4
- }
5
- const g = (t) => {
6
- try {
7
- return BigInt(t);
8
- } catch {
9
- return;
10
- }
11
- }, f = (t) => {
12
- const n = Number(t);
13
- return Number.isNaN(n) ? void 0 : n;
14
- }, m = (t, n) => t ? parseInt(t, 10) : n;
15
- function l() {
16
- BigInt.prototype.toJSON = function() {
17
- return this.toString();
18
- };
19
- }
20
- function p(...t) {
21
- return t.reduce((n, e) => e > n ? e : n);
22
- }
23
- function I(t) {
24
- return t === 0 ? 0 : t < 99999e-11 ? "< 0.000001" : +Number(t).toFixed(6);
25
- }
26
- const B = (t, n) => {
27
- const e = t.toFixed(20), r = e.indexOf(".");
28
- if (r === -1)
29
- return e;
30
- const o = r + n + 1;
31
- return e.substring(0, o);
32
- }, i = (t) => {
33
- if (/^0+$/.test(t))
34
- return "0";
35
- if (/^0\.\d+$/.test(t))
36
- return t;
37
- const n = t.replace(/^0+/, "");
38
- return n.startsWith(".") ? `0${n}` : n;
39
- }, N = (t) => {
40
- const n = t.split("."), e = n[0], r = n.length > 1 ? `.${n[1]}` : "";
41
- return `${i(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}${r}`;
42
- }, P = (t) => {
43
- const n = t.match(/^(\d+)(\.\d{1,18})?\d*$/);
44
- if (n) {
45
- const e = n[1], r = n[2] || "";
46
- return `${e}${r}`;
47
- }
48
- return t;
49
- }, $ = (t) => t < 0n ? -t : t, b = (t, n, e) => {
50
- const r = t < n ? t : n;
51
- return e ? r < e ? r : e : r;
52
- };
53
- export {
54
- $ as absBigInt,
55
- u as beepsToPercentage,
56
- l as bigintApplySugar,
57
- p as bigintMax,
58
- a as calculateAmountUsingBeeps,
59
- s as calculateSum,
60
- I as fixDecimalsAmount,
61
- B as getValueFirstNDigit,
62
- b as minBigInt,
63
- d as toBigInt,
64
- g as toBigIntOrUndefined,
65
- N as toCommaSeparatedNumberString,
66
- m as toInt,
67
- f as toNumberOrUndefined,
68
- i as trimLeadingZeros,
69
- P as truncateTo18DecimalPlaces
70
- };
@@ -1,38 +0,0 @@
1
- import "../../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 "../web3/events/getShieldedBalance.js";
11
- import "../../webworker/workerFactory.js";
12
- import "./external-action.utils.js";
13
- import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
14
- import "./convertIntegrationProviderToExternalActionId.js";
15
- import "../../constants/coingecko.constants.js";
16
- import "../../constants/vite.constants.js";
17
- import "./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 { AxelarRegistry as p } from "../../constants/axelar.constants.js";
24
- import "../../constants/rewards.constants.js";
25
- const z = (i) => {
26
- const r = p.find((m) => m.chainId === i.chainId);
27
- if (!r)
28
- return;
29
- const { sourceChain: t, sourceAddress: o } = r;
30
- return {
31
- destinationChain: t,
32
- destinationAddress: o,
33
- messageFee: i.gasFeeInWei ?? 0n
34
- };
35
- };
36
- export {
37
- z as getAxelarMigrationInfo
38
- };
@@ -1,67 +0,0 @@
1
- import "ethers";
2
- import "axios";
3
- import "../../constants/chains.constants.js";
4
- import "../../types/circom-data.types.js";
5
- import "../../types/transactions.types.js";
6
- import "../../types/curve.types.js";
7
- import "circomlibjs";
8
- import "../../data-structures/crypto-keys/keys.js";
9
- import { serializeDecodedTxs as g, deserializeDecodedTxs as C } from "./getDataFromTransaction.js";
10
- import "../web3/events/getShieldedBalance.js";
11
- import "./external-action.utils.js";
12
- import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
13
- import "./convertIntegrationProviderToExternalActionId.js";
14
- import "../../constants/coingecko.constants.js";
15
- import { logError as p } from "../../error-handling/logError.js";
16
- import "./userAgent.js";
17
- import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
18
- import "../../webworker/workerFactory.js";
19
- import "../../constants/reorg-depths.constants.js";
20
- import "../../constants/kyc.constants.js";
21
- import "../../data-structures/volatile-helper/VolatileHelper.js";
22
- import "libsodium-wrappers";
23
- import "../../constants/vite.constants.js";
24
- import "../../constants/contracts.constants.js";
25
- import "../../constants/axelar.constants.js";
26
- import "../../constants/rewards.constants.js";
27
- const l = {
28
- encryptedOutputs: [],
29
- lastOutput: ""
30
- }, c = (o, t) => {
31
- const r = o.substring(0, 25), s = t.substring(0, 25);
32
- return { shortPublicKey: r, shortHinkalAddress: s };
33
- }, L = (o, t, r) => {
34
- if (!o || !t || !r)
35
- throw Error("GetHinkalCache: incorrect arguments");
36
- const { shortPublicKey: s, shortHinkalAddress: e } = c(t, r);
37
- return JSON.parse(
38
- localStorage.getItem(`hinkalCache-${o}-${s}-${e}`) ?? JSON.stringify(l)
39
- );
40
- }, u = (o, t, r, s) => {
41
- if (!t || !r || !s)
42
- throw Error("SetHinkalCache: incorrect arguments");
43
- const { shortPublicKey: e, shortHinkalAddress: a } = c(r, s);
44
- localStorage.setItem(`hinkalCache-${t}-${e}-${a}`, JSON.stringify(o));
45
- }, M = (o, t, r) => {
46
- u(l, o, t, r);
47
- }, Q = (o, t, r, s, e) => {
48
- if (!t || !r || !s)
49
- throw Error("saveTxsCache: incorrect arguments");
50
- const { shortPublicKey: a, shortHinkalAddress: n } = c(r, s), i = g(o);
51
- p("saveTxsCache before saving", { serializedTxs: i }), localStorage.setItem(
52
- `txsCache-${t}-${a}-${n}`,
53
- JSON.stringify({ serializedTxs: i, lastHash: e })
54
- );
55
- }, x = { serializedTxs: [], lastHash: "" }, R = (o, t, r) => {
56
- if (!o || !t || !r)
57
- throw Error("loadTxsCache: incorrect arguments");
58
- const { shortPublicKey: s, shortHinkalAddress: e } = c(t, r), a = localStorage.getItem(`txsCache-${o}-${s}-${e}`), { serializedTxs: n, lastHash: i } = JSON.parse(a ?? JSON.stringify(x)), m = n.map((h) => C(h));
59
- return p("loadTxsCache ", { decodedTxs: m, lastHash: i }), { decodedTxs: m, lastHash: i === "" ? void 0 : i };
60
- };
61
- export {
62
- L as getHinkalCache,
63
- R as loadTxsCache,
64
- M as resetCache,
65
- Q as saveTxsCache,
66
- u as setHinkalCache
67
- };
@@ -1,6 +0,0 @@
1
- const o = (e, s) => !e || !s ? !1 : e.toLowerCase() === s.toLowerCase(), r = (e, s) => e.some((t) => o(t, s)), a = (e, s) => e.some((t) => t.toLowerCase().startsWith(s.toLowerCase()));
2
- export {
3
- o as caseInsensitiveEqual,
4
- r as lowerCaseIncludes,
5
- a as lowerCaseStartsWith
6
- };
@@ -1,16 +0,0 @@
1
- import "../../types/circom-data.types.js";
2
- import { ExternalActionId as r } from "../../types/external-action.types.js";
3
- import { IntegrationProvider as o } from "../../types/hinkal.types.js";
4
- import "../../types/transactions.types.js";
5
- import "../../types/curve.types.js";
6
- const t = {
7
- [o.UNISWAP]: r.Uniswap,
8
- [o.ODOS]: r.Odos,
9
- [o.ONEINCH]: r.OneInch,
10
- [o.PENDLE]: r.Pendle,
11
- [o.ALL]: void 0,
12
- [o.NONE]: void 0
13
- }, p = (n) => t[n];
14
- export {
15
- p as convertIntegrationProviderToExternalActionId
16
- };
@@ -1,5 +0,0 @@
1
- import { ethers as e } from "ethers";
2
- const t = (r) => new e.providers.JsonRpcProvider(r);
3
- export {
4
- t as createProvider
5
- };
@@ -1,14 +0,0 @@
1
- function e(r, n) {
2
- return Object.values(r).includes(n);
3
- }
4
- function o(r, n, i = !1) {
5
- if (e(r, n))
6
- return n;
7
- const t = `Value ${JSON.stringify(n)} is not a valid member of enum ${JSON.stringify(r)}.`;
8
- if (i)
9
- throw new Error(t);
10
- }
11
- export {
12
- e as isInEnum,
13
- o as toEnumValue
14
- };
@@ -1,20 +0,0 @@
1
- import { getERC20Registry as n } from "../../constants/token-data/ERC20Registry.js";
2
- import { customTokenRegistry as i } from "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
3
- const T = (e, o) => {
4
- const r = n(o), t = i.getCustomTokens(o);
5
- return [...r, ...t].find((s) => e === void 0 ? !1 : s.erc20TokenAddress.toLowerCase() === e.toLowerCase());
6
- }, g = (e, o) => {
7
- const r = n(o), t = i.getCustomTokens(o);
8
- return [...r, ...t].find((s) => e === void 0 ? !1 : s.symbol.toLowerCase() === e.toLowerCase());
9
- }, c = (e, o) => {
10
- const r = n(o);
11
- if (e.hasHToken)
12
- return r.find(
13
- (t) => t.underlyingErc20TokenAddress?.toLowerCase() === e.erc20TokenAddress.toLowerCase() && t.isHToken
14
- );
15
- };
16
- export {
17
- T as getERC20Token,
18
- g as getERC20TokenBySymbol,
19
- c as getHToken
20
- };
@@ -1,29 +0,0 @@
1
- import { networkRegistry as i, chainIdsByType as o } 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 "../web3/events/getShieldedBalance.js";
11
- import "../../webworker/workerFactory.js";
12
- import "./external-action.utils.js";
13
- import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
14
- import "./convertIntegrationProviderToExternalActionId.js";
15
- import "../../constants/coingecko.constants.js";
16
- import "../../constants/vite.constants.js";
17
- import "./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 B = (t) => i[t], R = (t) => Object.keys(o)[Object.values(o).findIndex((r) => r.includes(t.chainId))];
26
- export {
27
- B as getNetworkObject,
28
- R as getNetworkType
29
- };
@@ -1,61 +0,0 @@
1
- import { ethers as u } from "ethers";
2
- import { CIRCOM_P as r } from "../../constants/protocol.constants.js";
3
- import "../../types/circom-data.types.js";
4
- import { ExternalActionId as t } from "../../types/external-action.types.js";
5
- import "../../types/transactions.types.js";
6
- import "../../types/curve.types.js";
7
- import { toNumberOrUndefined as a } from "./amounts.utils.js";
8
- const s = (n) => n === 0n ? 0n : BigInt(u.utils.id(n)) % r, g = (n) => BigInt(n) === 0n ? t.Transact : Object.values(t).find(
9
- (e) => BigInt(n) === s(e)
10
- ), i = {
11
- [t.Curve]: ["uint8", "address", "uint256", "uint256"],
12
- [t.CurveDynamic]: ["uint8", "address", "uint256", "uint256"],
13
- [t.CurveCRV]: ["uint8", "address", "uint256", "uint256"],
14
- [t.CurveCRVRewards]: ["uint8", "address", "uint256", "uint256"],
15
- [t.Convex]: ["uint8", "uint256", "uint256", "uint256"],
16
- [t.Beefy]: ["uint8", "bytes", "bytes", "address"],
17
- [t.BeefyStake]: ["uint8", "address", "uint256", "uint256"],
18
- [t.Volatile]: ["uint256[]", "address", "uint256", "bytes", "uint8"],
19
- [t.LidoETH]: ["uint8"],
20
- [t.LidoMATIC]: ["uint8"],
21
- [t.LidoETHNFT]: ["uint8"],
22
- [t.LidoMATICNFT]: ["uint8"],
23
- [t.Pendle]: ["uint8", "address", "uint256", "uint256", "address", "bool", "bytes"],
24
- [t.PendleLP]: ["uint8", "address", "uint256", "uint256", "bytes"],
25
- [t.Connext]: [
26
- "bool",
27
- "bool",
28
- "uint32",
29
- "uint256",
30
- "uint256",
31
- "uint256",
32
- "uint256[2]",
33
- "uint256[2][2]",
34
- "uint256[2]"
35
- ]
36
- }, c = {
37
- [t.Pendle]: !0
38
- }, d = {
39
- [t.Volatile]: 4
40
- }, y = (n, e) => {
41
- if (c[n])
42
- return a(e?.hookData?.preHookMetadata);
43
- if (!i[n] || !e?.externalActionMetadata)
44
- return;
45
- let o = 0;
46
- return d[n] && (o = d[n]), u.utils.defaultAbiCoder.decode(
47
- i[n],
48
- e.externalActionMetadata
49
- )[o];
50
- }, v = (n, e) => {
51
- if (!e || !i[n])
52
- throw Error("No externalActionMetadata");
53
- return u.utils.defaultAbiCoder.decode(i[n], e);
54
- }, E = (n) => BigInt(u.utils.keccak256(n)) % r;
55
- export {
56
- v as decodeMetadata,
57
- y as getActionFromMetadata,
58
- g as getExternalActionIdFromNumber,
59
- s as getExternalActionIdHash,
60
- E as getExternalMetadataHash
61
- };