@hinkal/common 0.3.2 → 0.3.3

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 (446) hide show
  1. package/README.md +15 -18
  2. package/common/src/API/API.cjs +1 -1
  3. package/common/src/API/API.d.ts +5 -5
  4. package/common/src/API/API.mjs +78 -78
  5. package/common/src/API/callRelayer.d.ts +3 -0
  6. package/common/src/API/enclaveUtxoCalls.cjs +1 -1
  7. package/common/src/API/enclaveUtxoCalls.d.ts +8 -7
  8. package/common/src/API/enclaveUtxoCalls.mjs +5 -3
  9. package/common/src/API/getOdosPriceForToken.cjs +1 -0
  10. package/common/src/API/getOdosPriceForToken.d.ts +1 -0
  11. package/common/src/API/getOdosPriceForToken.mjs +14 -0
  12. package/common/src/API/getWebsiteURL.d.ts +0 -1
  13. package/common/src/API/index.cjs +1 -1
  14. package/common/src/API/index.d.ts +0 -1
  15. package/common/src/API/index.mjs +1 -2
  16. package/common/src/API/rewardsUserCalls.cjs +1 -1
  17. package/common/src/API/rewardsUserCalls.d.ts +0 -2
  18. package/common/src/API/rewardsUserCalls.mjs +2 -3
  19. package/common/src/API/tenderly.api.cjs +1 -1
  20. package/common/src/API/tenderly.api.d.ts +5 -10
  21. package/common/src/API/tenderly.api.mjs +1 -1
  22. package/common/src/constants/addresses.constants.cjs +1 -1
  23. package/common/src/constants/addresses.constants.d.ts +4 -46
  24. package/common/src/constants/addresses.constants.mjs +19 -60
  25. package/common/src/constants/balance.constants.cjs +1 -0
  26. package/common/src/constants/balance.constants.d.ts +1 -0
  27. package/common/src/constants/balance.constants.mjs +4 -0
  28. package/common/src/constants/chains.constants.cjs +1 -1
  29. package/common/src/constants/chains.constants.d.ts +3 -1
  30. package/common/src/constants/chains.constants.mjs +117 -131
  31. package/common/src/constants/coingecko.constants.cjs +1 -1
  32. package/common/src/constants/coingecko.constants.d.ts +2 -0
  33. package/common/src/constants/coingecko.constants.mjs +1 -1
  34. package/common/src/constants/contracts.constants.cjs +1 -1
  35. package/common/src/constants/contracts.constants.d.ts +0 -109
  36. package/common/src/constants/contracts.constants.mjs +13 -22
  37. package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
  38. package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +1 -3
  39. package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
  40. package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +6 -6
  41. package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
  42. package/common/src/constants/deploy-data/deploy-data-base.json.mjs +1 -3
  43. package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -0
  44. package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +10 -0
  45. package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
  46. package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +1 -3
  47. package/common/src/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
  48. package/common/src/constants/deploy-data/deploy-data-localhost.json.mjs +0 -3
  49. package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
  50. package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +6 -8
  51. package/common/src/constants/deploy-data/deploy-data-optimismTest.json.cjs +1 -1
  52. package/common/src/constants/deploy-data/deploy-data-optimismTest.json.mjs +1 -4
  53. package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
  54. package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +1 -3
  55. package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.cjs +1 -1
  56. package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.mjs +0 -1
  57. package/common/src/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
  58. package/common/src/constants/deploy-data/deploy-data-solana.json.mjs +2 -2
  59. package/common/src/constants/deploy-data/deploy-data-tempo.json.cjs +1 -1
  60. package/common/src/constants/deploy-data/deploy-data-tempo.json.mjs +6 -7
  61. package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.cjs +1 -1
  62. package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.mjs +2 -4
  63. package/common/src/constants/deploy-data/deploy-data-tronNile.json.cjs +1 -1
  64. package/common/src/constants/deploy-data/deploy-data-tronNile.json.mjs +2 -4
  65. package/common/src/constants/deploy-data/index.cjs +1 -1
  66. package/common/src/constants/deploy-data/index.d.ts +2 -1
  67. package/common/src/constants/deploy-data/index.mjs +16 -15
  68. package/common/src/constants/deploy-data/shared-deploy-data-solana.json.cjs +1 -1
  69. package/common/src/constants/deploy-data/shared-deploy-data-solana.json.mjs +1 -1
  70. package/common/src/constants/deploy-data/shared-deploy-data-tron.json.cjs +1 -1
  71. package/common/src/constants/deploy-data/shared-deploy-data-tron.json.mjs +2 -35
  72. package/common/src/constants/events.constants.cjs +1 -1
  73. package/common/src/constants/events.constants.mjs +3 -2
  74. package/common/src/constants/fees.constants.cjs +1 -1
  75. package/common/src/constants/fees.constants.mjs +2 -2
  76. package/common/src/constants/index.cjs +1 -1
  77. package/common/src/constants/index.d.ts +0 -1
  78. package/common/src/constants/index.mjs +1 -0
  79. package/common/src/constants/protocol.constants.cjs +2 -2
  80. package/common/src/constants/protocol.constants.d.ts +3 -1
  81. package/common/src/constants/protocol.constants.mjs +2 -2
  82. package/common/src/constants/server.constants.cjs +1 -1
  83. package/common/src/constants/server.constants.d.ts +1 -2
  84. package/common/src/constants/server.constants.mjs +1 -2
  85. package/common/src/constants/tokens.constants.cjs +1 -1
  86. package/common/src/constants/tokens.constants.mjs +1 -1
  87. package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
  88. package/common/src/data-structures/Hinkal/Hinkal.mjs +26 -22
  89. package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
  90. package/common/src/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
  91. package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +36 -35
  92. package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
  93. package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +3 -3
  94. package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
  95. package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +60 -58
  96. package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
  97. package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +42 -47
  98. package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
  99. package/common/src/data-structures/Hinkal/hinkalDeposit.d.ts +1 -0
  100. package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +50 -116
  101. package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
  102. package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +102 -92
  103. package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
  104. package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +3 -2
  105. package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +104 -59
  106. package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
  107. package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +4 -4
  108. package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.cjs +1 -1
  109. package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.mjs +7 -3
  110. package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  111. package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +51 -39
  112. package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
  113. package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +1 -2
  114. package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.mjs +53 -131
  115. package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.cjs +1 -1
  116. package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.d.ts +1 -1
  117. package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.mjs +29 -47
  118. package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
  119. package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +3 -3
  120. package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
  121. package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +70 -45
  122. package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
  123. package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +2 -2
  124. package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +47 -45
  125. package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
  126. package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +8 -4
  127. package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +133 -81
  128. package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.cjs +1 -1
  129. package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.d.ts +1 -1
  130. package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.mjs +16 -12
  131. package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
  132. package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +2 -2
  133. package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +61 -54
  134. package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
  135. package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +1 -1
  136. package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
  137. package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +87 -51
  138. package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
  139. package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +1 -0
  140. package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +95 -50
  141. package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
  142. package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +60 -34
  143. package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
  144. package/common/src/data-structures/Hinkal/hinkalSwap.mjs +29 -32
  145. package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -0
  146. package/common/src/data-structures/Hinkal/hinkalTransact.d.ts +3 -0
  147. package/common/src/data-structures/Hinkal/hinkalTransact.mjs +90 -0
  148. package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
  149. package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +40 -45
  150. package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.cjs +1 -0
  151. package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.d.ts +8 -0
  152. package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.mjs +30 -0
  153. package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
  154. package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +35 -45
  155. package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
  156. package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +167 -95
  157. package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.cjs +1 -0
  158. package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.d.ts +27 -0
  159. package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.mjs +31 -0
  160. package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
  161. package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +1 -0
  162. package/common/src/data-structures/IndexedDB/activity-db.cjs +1 -1
  163. package/common/src/data-structures/IndexedDB/activity-db.mjs +34 -34
  164. package/common/src/data-structures/IndexedDB/signatures-db.cjs +1 -1
  165. package/common/src/data-structures/IndexedDB/signatures-db.mjs +11 -11
  166. package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
  167. package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +11 -10
  168. package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +1 -1
  169. package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +14 -14
  170. package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
  171. package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +26 -26
  172. package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
  173. package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +15 -15
  174. package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.cjs +1 -1
  175. package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.mjs +12 -16
  176. package/common/src/data-structures/TokenDBs/TronPublicTokensDB.cjs +1 -1
  177. package/common/src/data-structures/TokenDBs/TronPublicTokensDB.d.ts +1 -0
  178. package/common/src/data-structures/TokenDBs/TronPublicTokensDB.mjs +8 -4
  179. package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
  180. package/common/src/data-structures/crypto-keys/decodeUTXO.d.ts +1 -0
  181. package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +12 -12
  182. package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
  183. package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +12 -12
  184. package/common/src/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -1
  185. package/common/src/data-structures/event-service/helpers/ClientEventHelper.mjs +6 -6
  186. package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
  187. package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +27 -23
  188. package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
  189. package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +10 -0
  190. package/common/src/data-structures/merkle-tree/MerkleTree.mjs +9 -1
  191. package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.cjs +1 -1
  192. package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.d.ts +3 -0
  193. package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.mjs +64 -54
  194. package/common/src/error-handling/error-codes.constants.cjs +1 -1
  195. package/common/src/error-handling/error-codes.constants.d.ts +6 -11
  196. package/common/src/error-handling/error-codes.constants.mjs +8 -13
  197. package/common/src/error-handling/get-error.message.cjs +1 -1
  198. package/common/src/error-handling/get-error.message.mjs +27 -14
  199. package/common/src/externalABIs/index.cjs +1 -1
  200. package/common/src/externalABIs/index.d.ts +1 -113
  201. package/common/src/externalABIs/index.mjs +2 -6
  202. package/common/src/functions/auto-deposit-back-helpers/select-gas-token.cjs +1 -1
  203. package/common/src/functions/auto-deposit-back-helpers/select-gas-token.mjs +8 -8
  204. package/common/src/functions/index.cjs +1 -1
  205. package/common/src/functions/index.d.ts +0 -1
  206. package/common/src/functions/index.mjs +12 -15
  207. package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
  208. package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +39 -5
  209. package/common/src/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
  210. package/common/src/functions/pre-transaction/getExternalSwapAddress.mjs +2 -18
  211. package/common/src/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
  212. package/common/src/functions/pre-transaction/getSolanaCalldataHash.d.ts +1 -1
  213. package/common/src/functions/pre-transaction/getSolanaCalldataHash.mjs +11 -10
  214. package/common/src/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
  215. package/common/src/functions/pre-transaction/getVolatileTransferAmount.mjs +12 -12
  216. package/common/src/functions/pre-transaction/index.cjs +1 -1
  217. package/common/src/functions/pre-transaction/index.d.ts +1 -2
  218. package/common/src/functions/pre-transaction/index.mjs +1 -2
  219. package/common/src/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
  220. package/common/src/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
  221. package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +7 -8
  222. package/common/src/functions/pre-transaction/solana.cjs +1 -1
  223. package/common/src/functions/pre-transaction/solana.d.ts +13 -0
  224. package/common/src/functions/pre-transaction/solana.mjs +46 -22
  225. package/common/src/functions/pre-transaction/store-proof.cjs +1 -1
  226. package/common/src/functions/pre-transaction/store-proof.d.ts +1 -1
  227. package/common/src/functions/pre-transaction/store-proof.mjs +1 -0
  228. package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +1 -1
  229. package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +1 -1
  230. package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
  231. package/common/src/functions/private-wallet/emporium.helpers.mjs +12 -13
  232. package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
  233. package/common/src/functions/private-wallet/emporium.swap.helpers.d.ts +0 -1
  234. package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +38 -80
  235. package/common/src/functions/private-wallet/index.cjs +1 -1
  236. package/common/src/functions/private-wallet/index.d.ts +0 -1
  237. package/common/src/functions/private-wallet/index.mjs +0 -1
  238. package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
  239. package/common/src/functions/snarkjs/common.snarkjs.d.ts +2 -2
  240. package/common/src/functions/snarkjs/common.snarkjs.mjs +89 -52
  241. package/common/src/functions/snarkjs/constant.cjs +1 -1
  242. package/common/src/functions/snarkjs/constant.d.ts +32 -0
  243. package/common/src/functions/snarkjs/constant.mjs +32 -0
  244. package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
  245. package/common/src/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
  246. package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +78 -65
  247. package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
  248. package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +4 -1
  249. package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +44 -39
  250. package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -0
  251. package/common/src/functions/snarkjs/constructTxEnclave.d.ts +32 -0
  252. package/common/src/functions/snarkjs/constructTxEnclave.mjs +162 -0
  253. package/common/src/functions/snarkjs/fetchTronInsertionSiblings.cjs +1 -0
  254. package/common/src/functions/snarkjs/fetchTronInsertionSiblings.d.ts +7 -0
  255. package/common/src/functions/snarkjs/fetchTronInsertionSiblings.mjs +13 -0
  256. package/common/src/functions/snarkjs/generateCircomData.cjs +1 -1
  257. package/common/src/functions/snarkjs/generateCircomData.d.ts +1 -1
  258. package/common/src/functions/snarkjs/generateCircomData.mjs +33 -27
  259. package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.cjs +1 -1
  260. package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.d.ts +1 -1
  261. package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.mjs +7 -7
  262. package/common/src/functions/snarkjs/generateZkProof.cjs +1 -1
  263. package/common/src/functions/snarkjs/generateZkProof.d.ts +1 -1
  264. package/common/src/functions/snarkjs/generateZkProof.mjs +9 -16
  265. package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
  266. package/common/src/functions/snarkjs/signedMessageHash.d.ts +11 -0
  267. package/common/src/functions/snarkjs/signedMessageHash.mjs +21 -3
  268. package/common/src/functions/snarkjs/verifySignedEnclaveResponse.cjs +1 -0
  269. package/common/src/functions/snarkjs/verifySignedEnclaveResponse.d.ts +1 -0
  270. package/common/src/functions/snarkjs/verifySignedEnclaveResponse.mjs +11 -0
  271. package/common/src/functions/utils/addresses.cjs +1 -1
  272. package/common/src/functions/utils/addresses.d.ts +1 -0
  273. package/common/src/functions/utils/addresses.mjs +6 -2
  274. package/common/src/functions/utils/buildClaimableDepositPlan.d.ts +2 -2
  275. package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
  276. package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.mjs +1 -1
  277. package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
  278. package/common/src/functions/utils/deposit-claimable.utils.d.ts +1 -1
  279. package/common/src/functions/utils/deposit-claimable.utils.mjs +3 -1
  280. package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
  281. package/common/src/functions/utils/enclave-utxo-storage.mjs +1 -1
  282. package/common/src/functions/utils/fees.utils.cjs +1 -1
  283. package/common/src/functions/utils/fees.utils.mjs +31 -31
  284. package/common/src/functions/utils/formatter.d.ts +1 -0
  285. package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
  286. package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +6 -6
  287. package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
  288. package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +11 -10
  289. package/common/src/functions/utils/index.cjs +1 -1
  290. package/common/src/functions/utils/index.d.ts +2 -2
  291. package/common/src/functions/utils/index.mjs +11 -10
  292. package/common/src/functions/utils/process.utils.cjs +1 -1
  293. package/common/src/functions/utils/process.utils.d.ts +0 -1
  294. package/common/src/functions/utils/process.utils.mjs +2 -11
  295. package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
  296. package/common/src/functions/utils/publicBalance.utils.mjs +2 -1
  297. package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
  298. package/common/src/functions/utils/transfer-claimable.utils.mjs +2 -2
  299. package/common/src/functions/utils/tron.utils.cjs +1 -1
  300. package/common/src/functions/utils/tron.utils.d.ts +5 -14
  301. package/common/src/functions/utils/tron.utils.mjs +91 -127
  302. package/common/src/functions/utils/waasStamp.cjs +1 -0
  303. package/common/src/functions/utils/waasStamp.d.ts +5 -0
  304. package/common/src/functions/utils/waasStamp.mjs +2 -0
  305. package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
  306. package/common/src/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -8
  307. package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +44 -48
  308. package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
  309. package/common/src/functions/web3/events/getInputUtxosEnclave.d.ts +4 -3
  310. package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +34 -25
  311. package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
  312. package/common/src/functions/web3/events/getShieldedBalance.d.ts +1 -1
  313. package/common/src/functions/web3/events/getShieldedBalance.mjs +88 -76
  314. package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
  315. package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +9 -6
  316. package/common/src/functions/web3/functionCalls/approveToken.cjs +1 -1
  317. package/common/src/functions/web3/functionCalls/approveToken.mjs +12 -12
  318. package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -0
  319. package/common/src/functions/web3/functionCalls/submitProof.d.ts +5 -0
  320. package/common/src/functions/web3/functionCalls/submitProof.mjs +26 -0
  321. package/common/src/functions/web3/functionCalls/transactCallDirectTron.cjs +1 -1
  322. package/common/src/functions/web3/functionCalls/transactCallDirectTron.d.ts +7 -3
  323. package/common/src/functions/web3/functionCalls/transactCallDirectTron.mjs +81 -87
  324. package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
  325. package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +6 -11
  326. package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +4 -2
  327. package/common/src/functions/web3/functionCalls/waitForErc20Approvals.cjs +1 -1
  328. package/common/src/functions/web3/functionCalls/waitForErc20Approvals.mjs +6 -6
  329. package/common/src/functions/web3/getContractMetadata.cjs +1 -1
  330. package/common/src/functions/web3/getContractMetadata.mjs +1 -1
  331. package/common/src/functions/web3/getTokenHolder.cjs +1 -1
  332. package/common/src/functions/web3/getTokenHolder.mjs +3 -2
  333. package/common/src/functions/web3/index.cjs +1 -1
  334. package/common/src/functions/web3/index.d.ts +0 -3
  335. package/common/src/functions/web3/index.mjs +0 -3
  336. package/common/src/functions/web3/lifiAPI.cjs +1 -1
  337. package/common/src/functions/web3/lifiAPI.mjs +1 -1
  338. package/common/src/providers/TronProviderAdapter.cjs +1 -1
  339. package/common/src/providers/TronProviderAdapter.mjs +7 -1
  340. package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
  341. package/common/src/providers/WagmiProviderAdapter.mjs +5 -5
  342. package/common/src/types/activities.types.cjs +1 -1
  343. package/common/src/types/activities.types.d.ts +0 -9
  344. package/common/src/types/activities.types.mjs +1 -1
  345. package/common/src/types/admin.types.cjs +1 -1
  346. package/common/src/types/admin.types.d.ts +3 -1
  347. package/common/src/types/admin.types.mjs +1 -1
  348. package/common/src/types/bridging-tx.types.d.ts +8 -0
  349. package/common/src/types/cache.types.cjs +1 -1
  350. package/common/src/types/cache.types.d.ts +2 -1
  351. package/common/src/types/cache.types.mjs +1 -1
  352. package/common/src/types/circom-data.types.d.ts +6 -0
  353. package/common/src/types/commitments.types.d.ts +2 -0
  354. package/common/src/types/dashboard-transaction.types.d.ts +3 -0
  355. package/common/src/types/ethereum-network.types.cjs +1 -1
  356. package/common/src/types/ethereum-network.types.d.ts +6 -15
  357. package/common/src/types/ethereum-network.types.mjs +1 -1
  358. package/common/src/types/external-action.types.cjs +1 -1
  359. package/common/src/types/external-action.types.d.ts +2 -5
  360. package/common/src/types/external-action.types.mjs +1 -1
  361. package/common/src/types/hinkal.types.cjs +1 -1
  362. package/common/src/types/hinkal.types.d.ts +4 -7
  363. package/common/src/types/hinkal.types.mjs +1 -1
  364. package/common/src/types/index.cjs +1 -1
  365. package/common/src/types/index.d.ts +2 -0
  366. package/common/src/types/index.mjs +1 -0
  367. package/common/src/types/near-intents.types.d.ts +1 -0
  368. package/common/src/types/offscreen.types.cjs +1 -1
  369. package/common/src/types/offscreen.types.d.ts +0 -1
  370. package/common/src/types/offscreen.types.mjs +1 -1
  371. package/common/src/types/pay-activities.types.d.ts +3 -0
  372. package/common/src/types/remote-proof.types.d.ts +0 -6
  373. package/common/src/types/remote-tx-build.types.d.ts +242 -0
  374. package/common/src/types/scheduled-transactions.types.d.ts +3 -0
  375. package/common/src/types/solana.types.d.ts +7 -0
  376. package/common/src/types/tenderly.api.types.d.ts +70 -0
  377. package/common/src/types/transact.types.cjs +1 -0
  378. package/common/src/types/transact.types.d.ts +53 -0
  379. package/common/src/types/transact.types.mjs +6 -0
  380. package/common/src/webworker/{logError-uy41lNp1.js → logError-CxZzSALU.js} +1 -1
  381. package/common/src/webworker/package.json +12 -12
  382. package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
  383. package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
  384. package/common/src/webworker/snarkjsWorkerNode.cjs +1 -1
  385. package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
  386. package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
  387. package/common/src/webworker/utxoWorkerNode.cjs +1 -1
  388. package/common/src/webworker/viteWorkerURL.constant.cjs +3 -3
  389. package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
  390. package/common/src/webworker/workerProxy-swwPYw6e.js +1 -0
  391. package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
  392. package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
  393. package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
  394. package/index.cjs +1 -1
  395. package/index.mjs +1 -1
  396. package/internal/swapApi.cjs +1 -1
  397. package/internal/swapApi.d.ts +3 -3
  398. package/internal/swapApi.mjs +22 -25
  399. package/package.json +12 -12
  400. package/services/Hinkal.cjs +1 -1
  401. package/services/Hinkal.d.ts +3 -3
  402. package/services/Hinkal.mjs +7 -7
  403. package/types/IHinkal.d.ts +3 -3
  404. package/types/swap.types.d.ts +3 -20
  405. package/common/src/API/callOdosAPI.cjs +0 -1
  406. package/common/src/API/callOdosAPI.d.ts +0 -63
  407. package/common/src/API/callOdosAPI.mjs +0 -18
  408. package/common/src/API/callOneInchAPI.cjs +0 -1
  409. package/common/src/API/callOneInchAPI.d.ts +0 -24
  410. package/common/src/API/callOneInchAPI.mjs +0 -16
  411. package/common/src/constants/rewards.constants.d.ts +0 -2
  412. package/common/src/externalABIs/IQuoterV2.json.cjs +0 -1
  413. package/common/src/externalABIs/IQuoterV2.json.mjs +0 -203
  414. package/common/src/externalABIs/ISwapRouter.json.cjs +0 -1
  415. package/common/src/externalABIs/ISwapRouter.json.mjs +0 -537
  416. package/common/src/externalABIs/IUniswapV3Factory.json.cjs +0 -1
  417. package/common/src/externalABIs/IUniswapV3Factory.json.mjs +0 -188
  418. package/common/src/externalABIs/IUniswapV3Pool.json.cjs +0 -1
  419. package/common/src/externalABIs/IUniswapV3Pool.json.mjs +0 -938
  420. package/common/src/externalABIs/UniswapV2PoolAbi.json.cjs +0 -1
  421. package/common/src/externalABIs/UniswapV2PoolAbi.json.mjs +0 -78
  422. package/common/src/functions/pre-transaction/interaction-to-action.cjs +0 -1
  423. package/common/src/functions/pre-transaction/interaction-to-action.d.ts +0 -2
  424. package/common/src/functions/pre-transaction/interaction-to-action.mjs +0 -1
  425. package/common/src/functions/pre-transaction/recipientUtxoProcessing.cjs +0 -1
  426. package/common/src/functions/pre-transaction/recipientUtxoProcessing.d.ts +0 -3
  427. package/common/src/functions/pre-transaction/recipientUtxoProcessing.mjs +0 -30
  428. package/common/src/functions/private-wallet/opProducer.cjs +0 -1
  429. package/common/src/functions/private-wallet/opProducer.d.ts +0 -5
  430. package/common/src/functions/private-wallet/opProducer.mjs +0 -3
  431. package/common/src/functions/snarkjs/generateZkProofEnclave.cjs +0 -1
  432. package/common/src/functions/snarkjs/generateZkProofEnclave.d.ts +0 -5
  433. package/common/src/functions/snarkjs/generateZkProofEnclave.mjs +0 -27
  434. package/common/src/functions/utils/get-signature-header.cjs +0 -1
  435. package/common/src/functions/utils/get-signature-header.d.ts +0 -5
  436. package/common/src/functions/utils/get-signature-header.mjs +0 -4
  437. package/common/src/functions/web3/odosAPI.cjs +0 -1
  438. package/common/src/functions/web3/odosAPI.d.ts +0 -5
  439. package/common/src/functions/web3/odosAPI.mjs +0 -35
  440. package/common/src/functions/web3/oneInchAPI.cjs +0 -1
  441. package/common/src/functions/web3/oneInchAPI.d.ts +0 -5
  442. package/common/src/functions/web3/oneInchAPI.mjs +0 -44
  443. package/common/src/functions/web3/uniswapAPI.cjs +0 -1
  444. package/common/src/functions/web3/uniswapAPI.d.ts +0 -16
  445. package/common/src/functions/web3/uniswapAPI.mjs +0 -60
  446. package/common/src/webworker/workerProxy-MheXtWa4.js +0 -1
@@ -0,0 +1,11 @@
1
+ import "../../constants/protocol.constants.mjs";
2
+ import { caseInsensitiveEqual as e } from "../utils/caseInsensitive.utils.mjs";
3
+ import { ethers as t } from "ethers";
4
+ //#region libs/shared/common/src/functions/snarkjs/verifySignedEnclaveResponse.ts
5
+ var n = (n, r) => {
6
+ let i = t.keccak256(t.toUtf8Bytes(n));
7
+ if (!e(t.recoverAddress(i, r), "0x655C3Aa937530E06A336458D1CF168d297B597A2")) throw Error("Enclave response signature verification failed: unexpected signer");
8
+ return JSON.parse(n);
9
+ };
10
+ //#endregion
11
+ export { n as verifySignedEnclaveResponse };
@@ -1 +1 @@
1
- require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`),require(`../../constants/protocol.constants.cjs`);let e=require(`ethers`);require(`@solana/web3.js`),require(`tronweb`);var t=[`http://`,`https://`,`/payment/`,`.app/`,`.com/`,`.netlify.`],n=e=>{if(t.some(t=>e.includes(t)))return!1;let[n,r,i,a,o,s]=e.split(`,`),c=!n||!s||!r||!i||!a||!o,l=n?.substring(0,2)!==`0x`||s?.substring(0,2)!==`0x`,u=s?.length!==66||n?.length>66||n?.length<64,d=e?.includes(`"`);return!(c||l||u||d)},r=e=>{let[t,n,r,i,a]=e.split(`,`);return{H0x:BigInt(n),H0y:BigInt(r),H1x:BigInt(i),H1y:BigInt(a),stealthAddress:BigInt(t)}},i=t=>e.ethers.keccak256(e.ethers.toUtf8Bytes(t.toLowerCase())),a=t=>e.ethers.keccak256(e.ethers.toUtf8Bytes(t));exports.constructStealthAddressStructure=r,exports.hashEthereumAddress=i,exports.hashString=a,exports.isValidPrivateAddress=n;
1
+ require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`),require(`../../constants/protocol.constants.cjs`);let e=require(`ethers`);require(`@solana/web3.js`),require(`tronweb`);var t=[`http://`,`https://`,`/payment/`,`.app/`,`.com/`,`.netlify.`],n=e=>{if(t.some(t=>e.includes(t)))return!1;let[n,r,i,a,o,s]=e.split(`,`),c=!n||!s||!r||!i||!a||!o,l=n?.substring(0,2)!==`0x`||s?.substring(0,2)!==`0x`,u=s?.length!==66||n?.length>66||n?.length<64,d=e?.includes(`"`);return!(c||l||u||d)},r=e=>{let[t,n,r,i,a]=e.split(`,`);return{H0x:BigInt(n),H0y:BigInt(r),H1x:BigInt(i),H1y:BigInt(a),stealthAddress:BigInt(t)}},i=e=>{let[,,,,,t]=e.split(`,`);if(!t)throw Error(`recipientInfo is missing an encryption key`);return t},a=t=>e.ethers.keccak256(e.ethers.toUtf8Bytes(t.toLowerCase())),o=t=>e.ethers.keccak256(e.ethers.toUtf8Bytes(t));exports.constructStealthAddressStructure=r,exports.getEncryptionKeyFromRecipientInfo=i,exports.hashEthereumAddress=a,exports.hashString=o,exports.isValidPrivateAddress=n;
@@ -1,6 +1,7 @@
1
1
  import { StealthAddressStructure } from '../../types/circom-data.types';
2
2
  export declare const isValidPrivateAddress: (address: string) => boolean;
3
3
  export declare const constructStealthAddressStructure: (recipientInfo: string) => StealthAddressStructure;
4
+ export declare const getEncryptionKeyFromRecipientInfo: (recipientInfo: string) => string;
4
5
  export declare const hashEthereumAddress: (ethereumAddress: string) => string;
5
6
  export declare const hashString: (string: string) => string;
6
7
  export declare const isValidSolanaPublicKey: (str: string) => boolean;
@@ -24,6 +24,10 @@ var t = [
24
24
  H1y: BigInt(a),
25
25
  stealthAddress: BigInt(t)
26
26
  };
27
- }, i = (t) => e.keccak256(e.toUtf8Bytes(t.toLowerCase())), a = (t) => e.keccak256(e.toUtf8Bytes(t));
27
+ }, i = (e) => {
28
+ let [, , , , , t] = e.split(",");
29
+ if (!t) throw Error("recipientInfo is missing an encryption key");
30
+ return t;
31
+ }, a = (t) => e.keccak256(e.toUtf8Bytes(t.toLowerCase())), o = (t) => e.keccak256(e.toUtf8Bytes(t));
28
32
  //#endregion
29
- export { r as constructStealthAddressStructure, i as hashEthereumAddress, a as hashString, n as isValidPrivateAddress };
33
+ export { r as constructStealthAddressStructure, i as getEncryptionKeyFromRecipientInfo, a as hashEthereumAddress, o as hashString, n as isValidPrivateAddress };
@@ -6,12 +6,12 @@ interface BuildClaimableDepositPlanParams {
6
6
  recipientAddresses: string[];
7
7
  recipientInfos?: Array<string | undefined>;
8
8
  nonce: bigint;
9
- tokenAddress: string;
9
+ tokenAddresses: string[];
10
10
  }
11
11
  export interface ClaimableDepositPlan {
12
12
  stealthAddressStructures: StealthAddressStructure[];
13
13
  recipientEncryptionKeys: string[];
14
14
  fallbackRecipients: FallbackRecipientUtxoPlan[];
15
15
  }
16
- export declare const buildClaimableDepositPlan: ({ userKeys, recipientAmounts, recipientAddresses, recipientInfos, nonce, tokenAddress, }: BuildClaimableDepositPlanParams) => ClaimableDepositPlan;
16
+ export declare const buildClaimableDepositPlan: ({ userKeys, recipientAmounts, recipientAddresses, recipientInfos, nonce, tokenAddresses, }: BuildClaimableDepositPlanParams) => ClaimableDepositPlan;
17
17
  export {};
@@ -1 +1 @@
1
- const e=require(`../../types/hinkal.types.cjs`),t=require(`../../types/external-action.types.cjs`);e.IntegrationProvider.UNISWAP,t.ExternalActionId.Uniswap,e.IntegrationProvider.ODOS,t.ExternalActionId.Odos,e.IntegrationProvider.ONEINCH,t.ExternalActionId.OneInch,e.IntegrationProvider.LIFI,t.ExternalActionId.Lifi,e.IntegrationProvider.OKX,t.ExternalActionId.Okx,e.IntegrationProvider.ALL,e.IntegrationProvider.NONE;
1
+ const e=require(`../../types/hinkal.types.cjs`),t=require(`../../types/external-action.types.cjs`);e.IntegrationProvider.LIFI,t.ExternalActionId.Lifi,e.IntegrationProvider.OKX,t.ExternalActionId.Okx,e.IntegrationProvider.ALL,e.IntegrationProvider.NONE;
@@ -1,4 +1,4 @@
1
1
  import { IntegrationProvider as e } from "../../types/hinkal.types.mjs";
2
2
  import { ExternalActionId as t } from "../../types/external-action.types.mjs";
3
- e.UNISWAP, t.Uniswap, e.ODOS, t.Odos, e.ONEINCH, t.OneInch, e.LIFI, t.Lifi, e.OKX, t.Okx, e.ALL, e.NONE;
3
+ e.LIFI, t.Lifi, e.OKX, t.Okx, e.ALL, e.NONE;
4
4
  //#endregion
@@ -1 +1 @@
1
- require(`../../data-structures/utxo/Utxo.cjs`),require(`./solanaMint.utils.cjs`),require(`./token-check.utils.cjs`),require(`../../error-handling/index.cjs`),require(`../pre-transaction/index.cjs`),require(`../../constants/index.cjs`),require(`./getUtxosFromReceipt.utils.cjs`),require(`./getUtxosFromReceiptSolana.cjs`),require(`./tx-confirmation.utils.cjs`),require(`./buildClaimableDepositPlan.cjs`);
1
+ require(`../../data-structures/crypto-keys/keys.cjs`),require(`../../data-structures/utxo/Utxo.cjs`),require(`./solanaMint.utils.cjs`),require(`./token-check.utils.cjs`),require(`../../error-handling/index.cjs`),require(`../pre-transaction/index.cjs`),require(`../../data-structures/Hinkal/hinkalDeposit.cjs`),require(`../../constants/index.cjs`),require(`./tx-confirmation.utils.cjs`),require(`./getUtxosFromReceipt.utils.cjs`),require(`./getUtxosFromReceiptSolana.cjs`),require(`./buildClaimableDepositPlan.cjs`);
@@ -1,6 +1,6 @@
1
1
  import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
2
2
  import { AdminTransactionType, ERC20Token, PendingEnclaveUtxo } from '../../types';
3
- export declare const depositClaimableUtxos: (hinkal: IHinkal, erc20Token: ERC20Token, recipientAmounts: bigint[], recipientAddresses: string[], nonce: bigint, recipientInfos?: Array<string | undefined>, action?: AdminTransactionType) => Promise<{
3
+ export declare const depositClaimableUtxos: (hinkal: IHinkal, erc20Tokens: ERC20Token[], recipientAmounts: bigint[], recipientAddresses: string[], nonce: bigint, recipientInfos?: Array<string | undefined>, action?: AdminTransactionType) => Promise<{
4
4
  pendingEnclaveUtxos: PendingEnclaveUtxo[];
5
5
  txHash: string;
6
6
  }>;
@@ -1,10 +1,12 @@
1
+ import "../../data-structures/crypto-keys/keys.mjs";
1
2
  import "../../data-structures/utxo/Utxo.mjs";
2
3
  import "./solanaMint.utils.mjs";
3
4
  import "./token-check.utils.mjs";
4
5
  import "../../error-handling/index.mjs";
5
6
  import "../pre-transaction/index.mjs";
7
+ import "../../data-structures/Hinkal/hinkalDeposit.mjs";
6
8
  import "../../constants/index.mjs";
9
+ import "./tx-confirmation.utils.mjs";
7
10
  import "./getUtxosFromReceipt.utils.mjs";
8
11
  import "./getUtxosFromReceiptSolana.mjs";
9
- import "./tx-confirmation.utils.mjs";
10
12
  import "./buildClaimableDepositPlan.mjs";
@@ -1 +1 @@
1
- require(`../../data-structures/utxo/Utxo.cjs`),require(`./encryptInputForEnclave.cjs`),require(`../../error-handling/logger.cjs`),require(`../../API/enclaveUtxoCalls.cjs`);
1
+ require(`../../data-structures/utxo/Utxo.cjs`),require(`./encryptInputForEnclave.cjs`),require(`../../API/enclaveUtxoCalls.cjs`),require(`../../error-handling/logger.cjs`);
@@ -1,4 +1,4 @@
1
1
  import "../../data-structures/utxo/Utxo.mjs";
2
2
  import "./encryptInputForEnclave.mjs";
3
- import "../../error-handling/logger.mjs";
4
3
  import "../../API/enclaveUtxoCalls.mjs";
4
+ import "../../error-handling/logger.mjs";
@@ -1 +1 @@
1
- const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../constants/fees.constants.cjs`),r=require(`./caseInsensitive.utils.cjs`),i=require(`../web3/etherFunctions.cjs`),a=require(`../../error-handling/logger.cjs`),o=require(`../../API/getTokenPrice.cjs`),s=require(`./erc20tokenFunctions.cjs`);var c=async r=>{if(!r)return n.EXTENDED_NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS;let i=t.zeroAddress;e.isSolanaLike(r)&&(i=t.solanaNativeAddress);let a=(await s.getErc20TokenFromAPI(r,i))?.symbol;return e.isSolanaLike(r)&&a?[a]:a&&!n.NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS(r).includes(a)?[a,...n.NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS(r)]:n.NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS(r)},l=(e,t)=>{let r=e*t.variableRate/n.BPS_DENOMINATOR;return t.flatFee+r},u=async(e,t,c,u)=>{let d=await s.getErc20TokenFromAPI(e,u.feeToken),f;if(!d||r.caseInsensitiveEqual(u.feeToken,t.erc20TokenAddress)||u.variableRate===0n)f=l(c,u);else{let r=0n;try{let{prices:a}=await o.getTokenPrices(e,[t.erc20TokenAddress,d.erc20TokenAddress]),[s,l]=a;if(!s||!l)throw Error(`failed to get token prices`);r=i.getAmountInWei(d,(Number(i.getAmountInToken(t,c))*s*Number(u.variableRate)/Number(n.BPS_DENOMINATOR)/l).toFixed(d.decimals))}catch(e){a.Logger.error(`calculateModifiedFeeStructure: failed to price cross-token variable fee, charging gas fee only`,e)}f=u.flatFee+r}return{feeToken:u.feeToken,flatFee:f,variableRate:0n}},d=(e,t)=>{if(t.variableRate===0n)return e+t.flatFee;let r=(e+t.flatFee)*n.BPS_DENOMINATOR,i=n.BPS_DENOMINATOR-t.variableRate;return(r+i-1n)/i};exports.calculateGrossAmountWithFee=d,exports.calculateModifiedFeeStructure=u,exports.calculateTotalFee=l,exports.getGasTokenSymbols=c;
1
+ const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../constants/fees.constants.cjs`),r=require(`./caseInsensitive.utils.cjs`),i=require(`../web3/etherFunctions.cjs`),a=require(`../../API/getTokenPrice.cjs`),o=require(`../../error-handling/logger.cjs`),s=require(`./erc20tokenFunctions.cjs`);var c=async r=>{if(!r)return n.EXTENDED_NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS;let i=t.zeroAddress;e.isSolanaLike(r)&&(i=t.solanaNativeAddress),e.isTempo(r)&&(i=n.TEMPO_DEFAULT_GAS_TOKEN_ADDRESS);let a=(await s.getErc20TokenFromAPI(r,i))?.symbol;return e.isSolanaLike(r)&&a?[a]:a&&!n.NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS(r).includes(a)?[a,...n.NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS(r)]:n.NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS(r)},l=(e,t)=>{let r=e*t.variableRate/n.BPS_DENOMINATOR;return t.flatFee+r},u=async(e,t,c,u)=>{let d=await s.getErc20TokenFromAPI(e,u.feeToken),f;if(!d||r.caseInsensitiveEqual(u.feeToken,t.erc20TokenAddress)||u.variableRate===0n)f=l(c,u);else{let r=0n;try{let{prices:o}=await a.getTokenPrices(e,[t.erc20TokenAddress,d.erc20TokenAddress]),[s,l]=o;if(!s||!l)throw Error(`failed to get token prices`);r=i.getAmountInWei(d,(Number(i.getAmountInToken(t,c))*s*Number(u.variableRate)/Number(n.BPS_DENOMINATOR)/l).toFixed(d.decimals))}catch(e){o.Logger.error(`calculateModifiedFeeStructure: failed to price cross-token variable fee, charging gas fee only`,e)}f=u.flatFee+r}return{feeToken:u.feeToken,flatFee:f,variableRate:0n}},d=(e,t)=>{if(t.variableRate===0n)return e+t.flatFee;let r=(e+t.flatFee)*n.BPS_DENOMINATOR,i=n.BPS_DENOMINATOR-t.variableRate;return(r+i-1n)/i};exports.calculateGrossAmountWithFee=d,exports.calculateModifiedFeeStructure=u,exports.calculateTotalFee=l,exports.getGasTokenSymbols=c;
@@ -1,44 +1,44 @@
1
- import { isSolanaLike as e } from "../../constants/chains.constants.mjs";
2
- import { solanaNativeAddress as t, zeroAddress as n } from "../../constants/protocol.constants.mjs";
3
- import { BPS_DENOMINATOR as r, EXTENDED_NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS as i, NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS as a } from "../../constants/fees.constants.mjs";
4
- import { caseInsensitiveEqual as o } from "./caseInsensitive.utils.mjs";
5
- import { getAmountInToken as s, getAmountInWei as c } from "../web3/etherFunctions.mjs";
6
- import { Logger as l } from "../../error-handling/logger.mjs";
7
- import { getTokenPrices as u } from "../../API/getTokenPrice.mjs";
8
- import { getErc20TokenFromAPI as d } from "./erc20tokenFunctions.mjs";
1
+ import { isSolanaLike as e, isTempo as t } from "../../constants/chains.constants.mjs";
2
+ import { solanaNativeAddress as n, zeroAddress as r } from "../../constants/protocol.constants.mjs";
3
+ import { BPS_DENOMINATOR as i, EXTENDED_NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS as a, NON_NATIVE_GAS_COST_TOKEN_SYMBOL_OPTIONS as o, TEMPO_DEFAULT_GAS_TOKEN_ADDRESS as s } from "../../constants/fees.constants.mjs";
4
+ import { caseInsensitiveEqual as c } from "./caseInsensitive.utils.mjs";
5
+ import { getAmountInToken as l, getAmountInWei as u } from "../web3/etherFunctions.mjs";
6
+ import { getTokenPrices as d } from "../../API/getTokenPrice.mjs";
7
+ import { Logger as f } from "../../error-handling/logger.mjs";
8
+ import { getErc20TokenFromAPI as p } from "./erc20tokenFunctions.mjs";
9
9
  //#region libs/shared/common/src/functions/utils/fees.utils.ts
10
- var f = async (r) => {
11
- if (!r) return i;
12
- let o = n;
13
- e(r) && (o = t);
14
- let s = (await d(r, o))?.symbol;
15
- return e(r) && s ? [s] : s && !a(r).includes(s) ? [s, ...a(r)] : a(r);
16
- }, p = (e, t) => {
17
- let n = e * t.variableRate / r;
10
+ var m = async (i) => {
11
+ if (!i) return a;
12
+ let c = r;
13
+ e(i) && (c = n), t(i) && (c = s);
14
+ let l = (await p(i, c))?.symbol;
15
+ return e(i) && l ? [l] : l && !o(i).includes(l) ? [l, ...o(i)] : o(i);
16
+ }, h = (e, t) => {
17
+ let n = e * t.variableRate / i;
18
18
  return t.flatFee + n;
19
- }, m = async (e, t, n, i) => {
20
- let a = await d(e, i.feeToken), f;
21
- if (!a || o(i.feeToken, t.erc20TokenAddress) || i.variableRate === 0n) f = p(n, i);
19
+ }, g = async (e, t, n, r) => {
20
+ let a = await p(e, r.feeToken), o;
21
+ if (!a || c(r.feeToken, t.erc20TokenAddress) || r.variableRate === 0n) o = h(n, r);
22
22
  else {
23
- let o = 0n;
23
+ let s = 0n;
24
24
  try {
25
- let { prices: l } = await u(e, [t.erc20TokenAddress, a.erc20TokenAddress]), [d, f] = l;
26
- if (!d || !f) throw Error("failed to get token prices");
27
- o = c(a, (Number(s(t, n)) * d * Number(i.variableRate) / Number(r) / f).toFixed(a.decimals));
25
+ let { prices: o } = await d(e, [t.erc20TokenAddress, a.erc20TokenAddress]), [c, f] = o;
26
+ if (!c || !f) throw Error("failed to get token prices");
27
+ s = u(a, (Number(l(t, n)) * c * Number(r.variableRate) / Number(i) / f).toFixed(a.decimals));
28
28
  } catch (e) {
29
- l.error("calculateModifiedFeeStructure: failed to price cross-token variable fee, charging gas fee only", e);
29
+ f.error("calculateModifiedFeeStructure: failed to price cross-token variable fee, charging gas fee only", e);
30
30
  }
31
- f = i.flatFee + o;
31
+ o = r.flatFee + s;
32
32
  }
33
33
  return {
34
- feeToken: i.feeToken,
35
- flatFee: f,
34
+ feeToken: r.feeToken,
35
+ flatFee: o,
36
36
  variableRate: 0n
37
37
  };
38
- }, h = (e, t) => {
38
+ }, _ = (e, t) => {
39
39
  if (t.variableRate === 0n) return e + t.flatFee;
40
- let n = (e + t.flatFee) * r, i = r - t.variableRate;
41
- return (n + i - 1n) / i;
40
+ let n = (e + t.flatFee) * i, r = i - t.variableRate;
41
+ return (n + r - 1n) / r;
42
42
  };
43
43
  //#endregion
44
- export { h as calculateGrossAmountWithFee, m as calculateModifiedFeeStructure, p as calculateTotalFee, f as getGasTokenSymbols };
44
+ export { _ as calculateGrossAmountWithFee, g as calculateModifiedFeeStructure, h as calculateTotalFee, m as getGasTokenSymbols };
@@ -1,2 +1,3 @@
1
1
  export declare const formatUSDNumber: (amount: number | null | undefined) => string;
2
2
  export declare const formatUSDAmount: (amount: number | null | undefined) => string;
3
+ export declare const formatApproxUSDAmount: (amount: number | null | undefined) => string;
@@ -1 +1 @@
1
- require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`);const e=require(`./caseInsensitive.utils.cjs`),t=require(`./amounts.utils.cjs`),n=require(`../../data-structures/crypto-keys/keys.cjs`),r=require(`../../types/ethereum-network.types.cjs`);require(`../../types/index.cjs`);const i=require(`../../data-structures/crypto-keys/encryptDecryptUtxo.cjs`),a=require(`../../data-structures/crypto-keys/decodeUTXO.cjs`),o=require(`./getContractAddress.cjs`);let s=require(`ethers`);var c=(n,i,s,c)=>{let l=i.getContractWithFetcher(s,r.ContractType.HinkalContract),u=l.interface,d=i.userKeys.getShieldedPrivateKey(),f=o.getContractAddress(l);return n.logs.filter(t=>e.caseInsensitiveEqual(t.address,f)).map(n=>{try{let r=u.parseLog(n);if(r?.name===`NewCommitment`){let{encryptedOutput:n,index:i}=r.args;if(t.toBigInt(i)<0n){let t=a.decodeUtxo(n,d,s);if(e.caseInsensitiveEqual(t.erc20TokenAddress,c))return t}}}catch{return null}return null}).filter(e=>e!==null)},l=(a,c,l,u,d)=>{let f=c.getContractWithFetcher(l,r.ContractType.HinkalContract),p=f.interface;return a.logs.filter(t=>e.caseInsensitiveEqual(t.address,o.getContractAddress(f))).map(r=>{try{let a=p.parseLog(r);if(a?.name===`NewCommitment`){let{encryptedOutput:r,index:o}=a.args;if(t.toBigInt(o)>=0n){let t=new n.UserKeys(void 0,d);try{let n=i.decryptUtxo(s.ethers.getBytes(r),t);if(e.caseInsensitiveEqual(n.erc20TokenAddress,u))return n}catch{return null}}}return null}catch{return null}}).filter(e=>e!==null)};exports.getOnChainUtxosFromReceipt=c,exports.getUtxosFromReceipt=l;
1
+ require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`);const e=require(`./caseInsensitive.utils.cjs`),t=require(`./amounts.utils.cjs`),n=require(`../../data-structures/crypto-keys/keys.cjs`),r=require(`../../types/ethereum-network.types.cjs`);require(`../../types/index.cjs`);const i=require(`../../data-structures/crypto-keys/encryptDecryptUtxo.cjs`),a=require(`./getContractAddress.cjs`),o=require(`../../data-structures/crypto-keys/decodeUTXO.cjs`);let s=require(`ethers`);var c=(n,i,s,c)=>{let l=i.getContractWithFetcher(s,r.ContractType.HinkalContract),u=l.interface,d=i.userKeys.getShieldedPrivateKey(),f=a.getContractAddress(l);return n.logs.filter(t=>e.caseInsensitiveEqual(t.address,f)).map(n=>{try{let r=u.parseLog(n);if(r?.name===`NewCommitment`){let{encryptedOutput:n,index:i}=r.args;if(t.toBigInt(i)<0n){let t=o.decodeUtxo(n,d,s);if(e.caseInsensitiveEqual(t.erc20TokenAddress,c))return t}}}catch{return null}return null}).filter(e=>e!==null)},l=(o,c,l,u,d)=>{let f=c.getContractWithFetcher(l,r.ContractType.HinkalContract),p=f.interface;return o.logs.filter(t=>e.caseInsensitiveEqual(t.address,a.getContractAddress(f))).map(r=>{try{let a=p.parseLog(r);if(a?.name===`NewCommitment`){let{encryptedOutput:r,index:o}=a.args;if(t.toBigInt(o)>=0n){let t=new n.UserKeys(void 0,d);try{let n=i.decryptUtxo(s.ethers.getBytes(r),t);if(e.caseInsensitiveEqual(n.erc20TokenAddress,u))return n}catch{return null}}}return null}catch{return null}}).filter(e=>e!==null)};exports.getOnChainUtxosFromReceipt=c,exports.getUtxosFromReceipt=l;
@@ -5,19 +5,19 @@ import { UserKeys as n } from "../../data-structures/crypto-keys/keys.mjs";
5
5
  import { ContractType as r } from "../../types/ethereum-network.types.mjs";
6
6
  import "../../types/index.mjs";
7
7
  import { decryptUtxo as i } from "../../data-structures/crypto-keys/encryptDecryptUtxo.mjs";
8
- import { decodeUtxo as a } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
9
- import { getContractAddress as o } from "./getContractAddress.mjs";
8
+ import { getContractAddress as a } from "./getContractAddress.mjs";
9
+ import { decodeUtxo as o } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
10
10
  import { ethers as s } from "ethers";
11
11
  //#region libs/shared/common/src/functions/utils/getUtxosFromReceipt.utils.ts
12
12
  var c = (n, i, s, c) => {
13
- let l = i.getContractWithFetcher(s, r.HinkalContract), u = l.interface, d = i.userKeys.getShieldedPrivateKey(), f = o(l);
13
+ let l = i.getContractWithFetcher(s, r.HinkalContract), u = l.interface, d = i.userKeys.getShieldedPrivateKey(), f = a(l);
14
14
  return n.logs.filter((t) => e(t.address, f)).map((n) => {
15
15
  try {
16
16
  let r = u.parseLog(n);
17
17
  if (r?.name === "NewCommitment") {
18
18
  let { encryptedOutput: n, index: i } = r.args;
19
19
  if (t(i) < 0n) {
20
- let t = a(n, d, s);
20
+ let t = o(n, d, s);
21
21
  if (e(t.erc20TokenAddress, c)) return t;
22
22
  }
23
23
  }
@@ -26,9 +26,9 @@ var c = (n, i, s, c) => {
26
26
  }
27
27
  return null;
28
28
  }).filter((e) => e !== null);
29
- }, l = (a, c, l, u, d) => {
29
+ }, l = (o, c, l, u, d) => {
30
30
  let f = c.getContractWithFetcher(l, r.HinkalContract), p = f.interface;
31
- return a.logs.filter((t) => e(t.address, o(f))).map((r) => {
31
+ return o.logs.filter((t) => e(t.address, a(f))).map((r) => {
32
32
  try {
33
33
  let a = p.parseLog(r);
34
34
  if (a?.name === "NewCommitment") {
@@ -1 +1 @@
1
- require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`);const e=require(`./caseInsensitive.utils.cjs`),t=require(`../../crypto/poseidon.cjs`),n=require(`../../data-structures/utxo/Utxo.cjs`);require(`../../data-structures/crypto-keys/encryptDecryptUtxo.cjs`);const r=require(`./bytes32.utils.cjs`);let i=require(`ethers`),a=require(`@solana/web3.js`),o=require(`@coral-xyz/anchor`);var s=(s,c,l,u)=>[...new o.EventParser(c.programId,new o.BorshCoder(c.idl)).parseLogs(s.meta?.logMessages??[])].filter(({name:t})=>e.caseInsensitiveEqual(t,`newCommitment`)).filter(({data:e})=>e.encryptedOutput.length===0).map(e=>{let{onChainData:o}=e.data,[s,c,u,d,f,,,p,m]=o.map(r.convertBytes32ToBigInt),[,h,g]=o,_=new a.PublicKey([...h.slice(16),...g.slice(16)]),v=t.poseidonHash(c,u),y=new n.Utxo({amount:s,timeStamp:m.toString(),nullifyingKey:l.getShieldedPrivateKey(),mintAddress:_.toBase58(),erc20TokenAddress:v,stealthAddress:i.ethers.toBeHex(p),H0:[d,f]});return y.getStealthAddress(),y}).filter(t=>e.caseInsensitiveEqual(t.erc20TokenAddress,u));exports.getOnChainUtxosFromReceiptSolana=s;
1
+ require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`);const e=require(`./caseInsensitive.utils.cjs`),t=require(`../../crypto/poseidon.cjs`),n=require(`../../data-structures/utxo/Utxo.cjs`);require(`../../data-structures/crypto-keys/encryptDecryptUtxo.cjs`);const r=require(`./bytes32.utils.cjs`),i=require(`../../data-structures/crypto-keys/decodeUTXO.cjs`);let a=require(`ethers`),o=require(`@solana/web3.js`),s=require(`@coral-xyz/anchor`);var c=(c,l,u,d)=>[...new s.EventParser(l.programId,new s.BorshCoder(l.idl)).parseLogs(c.meta?.logMessages??[])].filter(({name:t})=>e.caseInsensitiveEqual(t,`newCommitment`)).filter(({data:e})=>i.hasSolanaOnChainData(e.onChainData)).map(e=>{let{onChainData:i}=e.data,[s,c,l,d,f,,,p,m]=i.map(r.convertBytes32ToBigInt),[,h,g]=i,_=new o.PublicKey([...h.slice(16),...g.slice(16)]),v=t.poseidonHash(c,l),y=new n.Utxo({amount:s,timeStamp:m.toString(),nullifyingKey:u.getShieldedPrivateKey(),mintAddress:_.toBase58(),erc20TokenAddress:v,stealthAddress:a.ethers.toBeHex(p),H0:[d,f]});return y.getStealthAddress(),y}).filter(t=>e.caseInsensitiveEqual(t.erc20TokenAddress,d));exports.getOnChainUtxosFromReceiptSolana=c;
@@ -4,21 +4,22 @@ import { poseidonHash as t } from "../../crypto/poseidon.mjs";
4
4
  import { Utxo as n } from "../../data-structures/utxo/Utxo.mjs";
5
5
  import "../../data-structures/crypto-keys/encryptDecryptUtxo.mjs";
6
6
  import { convertBytes32ToBigInt as r } from "./bytes32.utils.mjs";
7
- import { ethers as i } from "ethers";
8
- import { PublicKey as a } from "@solana/web3.js";
9
- import { BorshCoder as o, EventParser as s } from "@coral-xyz/anchor";
7
+ import { hasSolanaOnChainData as i } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
8
+ import { ethers as a } from "ethers";
9
+ import { PublicKey as o } from "@solana/web3.js";
10
+ import { BorshCoder as s, EventParser as c } from "@coral-xyz/anchor";
10
11
  //#region libs/shared/common/src/functions/utils/getUtxosFromReceiptSolana.ts
11
- var c = (c, l, u, d) => [...new s(l.programId, new o(l.idl)).parseLogs(c.meta?.logMessages ?? [])].filter(({ name: t }) => e(t, "newCommitment")).filter(({ data: e }) => e.encryptedOutput.length === 0).map((e) => {
12
- let { onChainData: o } = e.data, [s, c, l, d, f, , , p, m] = o.map(r), [, h, g] = o, _ = new a([...h.slice(16), ...g.slice(16)]), v = t(c, l), y = new n({
12
+ var l = (l, u, d, f) => [...new c(u.programId, new s(u.idl)).parseLogs(l.meta?.logMessages ?? [])].filter(({ name: t }) => e(t, "newCommitment")).filter(({ data: e }) => i(e.onChainData)).map((e) => {
13
+ let { onChainData: i } = e.data, [s, c, l, u, f, , , p, m] = i.map(r), [, h, g] = i, _ = new o([...h.slice(16), ...g.slice(16)]), v = t(c, l), y = new n({
13
14
  amount: s,
14
15
  timeStamp: m.toString(),
15
- nullifyingKey: u.getShieldedPrivateKey(),
16
+ nullifyingKey: d.getShieldedPrivateKey(),
16
17
  mintAddress: _.toBase58(),
17
18
  erc20TokenAddress: v,
18
- stealthAddress: i.toBeHex(p),
19
- H0: [d, f]
19
+ stealthAddress: a.toBeHex(p),
20
+ H0: [u, f]
20
21
  });
21
22
  return y.getStealthAddress(), y;
22
- }).filter((t) => e(t.erc20TokenAddress, d));
23
+ }).filter((t) => e(t.erc20TokenAddress, f));
23
24
  //#endregion
24
- export { c as getOnChainUtxosFromReceiptSolana };
25
+ export { l as getOnChainUtxosFromReceiptSolana };
@@ -1 +1 @@
1
- require(`./abi.utils.cjs`),require(`./serialize.utils.cjs`),require(`./caseInsensitive.utils.cjs`),require(`./amounts.utils.cjs`),require(`./time.utils.cjs`),require(`./upToDateState.cjs`),require(`./cacheFunctions.cjs`),require(`./enclaveHandshakeService.cjs`),require(`./encryptInputForEnclave.cjs`),require(`./solanaMint.utils.cjs`),require(`./customEnclaveFunctionsRegister.cjs`),require(`./serialize-utxos.utils.cjs`),require(`./addresses.cjs`),require(`./tron.utils.cjs`),require(`./get-signature-header.cjs`),require(`./legacyKeys.cjs`),require(`./auth.utils.cjs`),require(`./string.utils.cjs`),require(`./token-check.utils.cjs`),require(`./map.utils.cjs`),require(`./mutexes.utils.cjs`),require(`./erc20tokenFunctions.cjs`),require(`../pre-transaction/outputUtxoProcessing.cjs`),require(`./external-action.utils.cjs`),require(`../pre-transaction/solana.cjs`),require(`../pre-transaction/process-gas-estimates.cjs`),require(`../pre-transaction/getVolatileTransferAmount.cjs`),require(`../pre-transaction/constructAdminData.cjs`),require(`./create-provider.cjs`),require(`../pre-transaction/convert-okx-instructions.cjs`),require(`./process.utils.cjs`),require(`../pre-transaction/sendV0Transaction.cjs`),require(`./bytes32.utils.cjs`),require(`../pre-transaction/recipientUtxoProcessing.cjs`),require(`../pre-transaction/ensureAmountChanges.cjs`),require(`../pre-transaction/getFeeStructure.cjs`),require(`../pre-transaction/waitForDepositedUtxosInMerkleTree.cjs`),require(`../pre-transaction/buildCommitmentValidationData.cjs`),require(`../pre-transaction/index.cjs`),require(`./resolve-domain-address.cjs`),require(`./resolve-sync.utils.cjs`),require(`./convertIntegrationProviderToExternalActionId.cjs`),require(`./evmNetworkFunctions.cjs`),require(`./userAgent.cjs`),require(`./reloadPage.cjs`),require(`./cacheDevice.utils.cjs`),require(`./getBlockExplorerUrl.cjs`),require(`./involves-permit2-op.cjs`),require(`./convertEmporiumOpToCallInfo.cjs`),require(`./getRecipientInfoFromUserKeys.cjs`),require(`./publicBalance.utils.cjs`),require(`./rpc-int-encode.cjs`),require(`./walletBalances.utils.cjs`),require(`./nftTokenFunctions.cjs`),require(`./inLogicMetadata.cjs`),require(`./networks.utils.cjs`),require(`./postToOffscreen.cjs`),require(`./solanaSendPreflight.utils.cjs`),require(`./voidWallets.utils.cjs`),require(`./prepareHinkal.cjs`),require(`./getContractAddress.cjs`),require(`./getUtxosFromReceipt.utils.cjs`),require(`./getUtxosFromReceiptSolana.cjs`),require(`./fees.utils.cjs`),require(`./proxyAvatar.utils.cjs`),require(`./enclave-utxo-storage.cjs`),require(`./enclave-signature-storage.cjs`),require(`./tx-confirmation.utils.cjs`),require(`./buildClaimableDepositPlan.cjs`),require(`./formatter.cjs`),require(`./tronSimulation.utils.cjs`),require(`./getSignerFromContract.cjs`),require(`./deposit-claimable.utils.cjs`),require(`./transfer-claimable.utils.cjs`),require(`./bridge-flow.utils.cjs`),require(`./bridge-claimable.utils.cjs`),require(`./temp-wallet.utils.cjs`),require(`./dispatchBalanceRefreshes.cjs`),require(`./lifi.utils.cjs`),require(`./enclave-recipient-info-storage.cjs`),require(`./solana-memo.cjs`),require(`./mnemonics.cjs`),require(`./nearIntents.utils.cjs`),require(`./enclaveSessionSigning.cjs`),require(`./validateWalletAddress.cjs`);
1
+ require(`./abi.utils.cjs`),require(`./serialize.utils.cjs`),require(`./caseInsensitive.utils.cjs`),require(`./amounts.utils.cjs`),require(`./time.utils.cjs`),require(`./upToDateState.cjs`),require(`./cacheFunctions.cjs`),require(`./enclaveHandshakeService.cjs`),require(`./encryptInputForEnclave.cjs`),require(`./solanaMint.utils.cjs`),require(`./serialize-utxos.utils.cjs`),require(`./customEnclaveFunctionsRegister.cjs`),require(`./addresses.cjs`),require(`./tron.utils.cjs`),require(`./legacyKeys.cjs`),require(`./auth.utils.cjs`),require(`./string.utils.cjs`),require(`./token-check.utils.cjs`),require(`./map.utils.cjs`),require(`./mutexes.utils.cjs`),require(`./erc20tokenFunctions.cjs`),require(`../pre-transaction/outputUtxoProcessing.cjs`),require(`./external-action.utils.cjs`),require(`../pre-transaction/solana.cjs`),require(`../pre-transaction/process-gas-estimates.cjs`),require(`../pre-transaction/getVolatileTransferAmount.cjs`),require(`../pre-transaction/constructAdminData.cjs`),require(`./create-provider.cjs`),require(`../pre-transaction/calculateSolanaNullifierCount.cjs`),require(`../pre-transaction/convert-okx-instructions.cjs`),require(`./process.utils.cjs`),require(`../pre-transaction/sendV0Transaction.cjs`),require(`./bytes32.utils.cjs`),require(`../pre-transaction/ensureAmountChanges.cjs`),require(`../pre-transaction/getFeeStructure.cjs`),require(`../pre-transaction/getExternalSwapAddress.cjs`),require(`../pre-transaction/waitForDepositedUtxosInMerkleTree.cjs`),require(`../pre-transaction/buildCommitmentValidationData.cjs`),require(`../pre-transaction/index.cjs`),require(`./getContractAddress.cjs`),require(`./getSignerFromContract.cjs`),require(`./tronSimulation.utils.cjs`),require(`./tx-confirmation.utils.cjs`),require(`./getUtxosFromReceipt.utils.cjs`),require(`./getRecipientInfoFromUserKeys.cjs`),require(`./resolve-domain-address.cjs`),require(`./resolve-sync.utils.cjs`),require(`./convertIntegrationProviderToExternalActionId.cjs`),require(`./evmNetworkFunctions.cjs`),require(`./userAgent.cjs`),require(`./reloadPage.cjs`),require(`./cacheDevice.utils.cjs`),require(`./getBlockExplorerUrl.cjs`),require(`./involves-permit2-op.cjs`),require(`./convertEmporiumOpToCallInfo.cjs`),require(`./publicBalance.utils.cjs`),require(`./rpc-int-encode.cjs`),require(`./walletBalances.utils.cjs`),require(`./nftTokenFunctions.cjs`),require(`./inLogicMetadata.cjs`),require(`./networks.utils.cjs`),require(`./postToOffscreen.cjs`),require(`./solanaSendPreflight.utils.cjs`),require(`./voidWallets.utils.cjs`),require(`./prepareHinkal.cjs`),require(`./getUtxosFromReceiptSolana.cjs`),require(`./fees.utils.cjs`),require(`./proxyAvatar.utils.cjs`),require(`./enclave-utxo-storage.cjs`),require(`./enclave-signature-storage.cjs`),require(`./buildClaimableDepositPlan.cjs`),require(`./deposit-claimable.utils.cjs`),require(`./formatter.cjs`),require(`./transfer-claimable.utils.cjs`),require(`./bridge-flow.utils.cjs`),require(`./bridge-claimable.utils.cjs`),require(`./temp-wallet.utils.cjs`),require(`./dispatchBalanceRefreshes.cjs`),require(`./lifi.utils.cjs`),require(`./enclave-recipient-info-storage.cjs`),require(`./solana-memo.cjs`),require(`./mnemonics.cjs`),require(`./nearIntents.utils.cjs`),require(`./enclaveSessionSigning.cjs`),require(`./validateWalletAddress.cjs`),require(`./waasStamp.cjs`);
@@ -39,7 +39,6 @@ export * from './inLogicMetadata';
39
39
  export * from './networks.utils';
40
40
  export * from './is-valid-url';
41
41
  export * from './postToOffscreen';
42
- export * from './get-signature-header';
43
42
  export * from './solanaMint.utils';
44
43
  export * from './solanaSendPreflight.utils';
45
44
  export * from './prepareHinkal';
@@ -54,13 +53,13 @@ export * from './enclave-signature-storage';
54
53
  export * from './serialize-utxos.utils';
55
54
  export * from './tx-confirmation.utils';
56
55
  export * from './buildClaimableDepositPlan';
56
+ export * from './deposit-claimable.utils';
57
57
  export * from './pay-routing.utils';
58
58
  export * from './formatter';
59
59
  export * from './tron.utils';
60
60
  export * from './tronSimulation.utils';
61
61
  export * from './getSignerFromContract';
62
62
  export * from './getContractAddress';
63
- export * from './deposit-claimable.utils';
64
63
  export * from './transfer-claimable.utils';
65
64
  export * from './bridge-claimable.utils';
66
65
  export * from './bridge-flow.utils';
@@ -80,3 +79,4 @@ export * from './nearIntents.utils';
80
79
  export * from './voidWallets.utils';
81
80
  export * from './enclaveSessionSigning';
82
81
  export * from './validateWalletAddress';
82
+ export * from './waasStamp';
@@ -8,11 +8,10 @@ import "./cacheFunctions.mjs";
8
8
  import "./enclaveHandshakeService.mjs";
9
9
  import "./encryptInputForEnclave.mjs";
10
10
  import "./solanaMint.utils.mjs";
11
- import "./customEnclaveFunctionsRegister.mjs";
12
11
  import "./serialize-utxos.utils.mjs";
12
+ import "./customEnclaveFunctionsRegister.mjs";
13
13
  import "./addresses.mjs";
14
14
  import "./tron.utils.mjs";
15
- import "./get-signature-header.mjs";
16
15
  import "./legacyKeys.mjs";
17
16
  import "./auth.utils.mjs";
18
17
  import "./string.utils.mjs";
@@ -27,16 +26,23 @@ import "../pre-transaction/process-gas-estimates.mjs";
27
26
  import "../pre-transaction/getVolatileTransferAmount.mjs";
28
27
  import "../pre-transaction/constructAdminData.mjs";
29
28
  import "./create-provider.mjs";
29
+ import "../pre-transaction/calculateSolanaNullifierCount.mjs";
30
30
  import "../pre-transaction/convert-okx-instructions.mjs";
31
31
  import "./process.utils.mjs";
32
32
  import "../pre-transaction/sendV0Transaction.mjs";
33
33
  import "./bytes32.utils.mjs";
34
- import "../pre-transaction/recipientUtxoProcessing.mjs";
35
34
  import "../pre-transaction/ensureAmountChanges.mjs";
36
35
  import "../pre-transaction/getFeeStructure.mjs";
36
+ import "../pre-transaction/getExternalSwapAddress.mjs";
37
37
  import "../pre-transaction/waitForDepositedUtxosInMerkleTree.mjs";
38
38
  import "../pre-transaction/buildCommitmentValidationData.mjs";
39
39
  import "../pre-transaction/index.mjs";
40
+ import "./getContractAddress.mjs";
41
+ import "./getSignerFromContract.mjs";
42
+ import "./tronSimulation.utils.mjs";
43
+ import "./tx-confirmation.utils.mjs";
44
+ import "./getUtxosFromReceipt.utils.mjs";
45
+ import "./getRecipientInfoFromUserKeys.mjs";
40
46
  import "./resolve-domain-address.mjs";
41
47
  import "./resolve-sync.utils.mjs";
42
48
  import "./convertIntegrationProviderToExternalActionId.mjs";
@@ -47,7 +53,6 @@ import "./cacheDevice.utils.mjs";
47
53
  import "./getBlockExplorerUrl.mjs";
48
54
  import "./involves-permit2-op.mjs";
49
55
  import "./convertEmporiumOpToCallInfo.mjs";
50
- import "./getRecipientInfoFromUserKeys.mjs";
51
56
  import "./publicBalance.utils.mjs";
52
57
  import "./rpc-int-encode.mjs";
53
58
  import "./walletBalances.utils.mjs";
@@ -58,19 +63,14 @@ import "./postToOffscreen.mjs";
58
63
  import "./solanaSendPreflight.utils.mjs";
59
64
  import "./voidWallets.utils.mjs";
60
65
  import "./prepareHinkal.mjs";
61
- import "./getContractAddress.mjs";
62
- import "./getUtxosFromReceipt.utils.mjs";
63
66
  import "./getUtxosFromReceiptSolana.mjs";
64
67
  import "./fees.utils.mjs";
65
68
  import "./proxyAvatar.utils.mjs";
66
69
  import "./enclave-utxo-storage.mjs";
67
70
  import "./enclave-signature-storage.mjs";
68
- import "./tx-confirmation.utils.mjs";
69
71
  import "./buildClaimableDepositPlan.mjs";
70
- import "./formatter.mjs";
71
- import "./tronSimulation.utils.mjs";
72
- import "./getSignerFromContract.mjs";
73
72
  import "./deposit-claimable.utils.mjs";
73
+ import "./formatter.mjs";
74
74
  import "./transfer-claimable.utils.mjs";
75
75
  import "./bridge-flow.utils.mjs";
76
76
  import "./bridge-claimable.utils.mjs";
@@ -83,3 +83,4 @@ import "./mnemonics.mjs";
83
83
  import "./nearIntents.utils.mjs";
84
84
  import "./enclaveSessionSigning.mjs";
85
85
  import "./validateWalletAddress.mjs";
86
+ import "./waasStamp.mjs";
@@ -1 +1 @@
1
- var e=e=>new Promise(t=>{setTimeout(t,e)}),t=async(e,t=1e4)=>{let n,r=new Promise((e,r)=>{n=setTimeout(()=>r(Error(`Timeout after ${t}ms`)),t)});try{return await Promise.race([e,r])}finally{clearTimeout(n)}},n=async(t,n={})=>{let r=n.intervalMs??5e3,i=n.timeoutMs??6e4,a=Math.floor(i/r)+1;for(let n=0;n<a;n+=1){try{let e=await t();if(e!=null)return e}catch{}n<a-1&&await e(r)}};exports.pollForValue=n,exports.wait=e,exports.withTimeout=t;
1
+ var e=e=>new Promise(t=>{setTimeout(t,e)}),t=async(t,n={})=>{let r=n.intervalMs??5e3,i=n.timeoutMs??6e4,a=Math.floor(i/r)+1;for(let n=0;n<a;n+=1){try{let e=await t();if(e!=null)return e}catch{}n<a-1&&await e(r)}};exports.pollForValue=t,exports.wait=e;
@@ -1,6 +1,5 @@
1
1
  /** pause execution for a number of miliseconds */
2
2
  export declare const wait: (miliseconds: number) => Promise<unknown>;
3
- export declare const withTimeout: <T>(promise: Promise<T>, timeoutMs?: number) => Promise<T>;
4
3
  type PollForValueOptions = {
5
4
  intervalMs?: number;
6
5
  timeoutMs?: number;
@@ -1,16 +1,7 @@
1
1
  //#region libs/shared/common/src/functions/utils/process.utils.ts
2
2
  var e = (e) => new Promise((t) => {
3
3
  setTimeout(t, e);
4
- }), t = async (e, t = 1e4) => {
5
- let n, r = new Promise((e, r) => {
6
- n = setTimeout(() => r(/* @__PURE__ */ Error(`Timeout after ${t}ms`)), t);
7
- });
8
- try {
9
- return await Promise.race([e, r]);
10
- } finally {
11
- clearTimeout(n);
12
- }
13
- }, n = async (t, n = {}) => {
4
+ }), t = async (t, n = {}) => {
14
5
  let r = n.intervalMs ?? 5e3, i = n.timeoutMs ?? 6e4, a = Math.floor(i / r) + 1;
15
6
  for (let n = 0; n < a; n += 1) {
16
7
  try {
@@ -21,4 +12,4 @@ var e = (e) => new Promise((t) => {
21
12
  }
22
13
  };
23
14
  //#endregion
24
- export { n as pollForValue, e as wait, t as withTimeout };
15
+ export { t as pollForValue, e as wait };
@@ -1 +1 @@
1
- require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`);const e=require(`../../constants/protocol.constants.cjs`);require(`../../data-structures/http/index.cjs`),require(`./addresses.cjs`),require(`../../externalABIs/index.cjs`);const t=require(`../../error-handling/logger.cjs`);require(`./erc20tokenFunctions.cjs`);const n=require(`./create-provider.cjs`),r=require(`../../externalABIs/swapAbi.cjs`);require(`./ipfs.cjs`);let i=require(`ethers`);require(`@solana/web3.js`),require(`@solana/spl-token`);var a=async(t,n,a)=>{try{let o=a.erc20TokenAddress,s,c=new i.ethers.Contract(a.erc20TokenAddress,r.ERC20ABI,t);s=o===e.zeroAddress?await t.getBalance(n):await c?.balanceOf(n);let l=s;return l<=0n?null:{token:a,balance:l}}catch{return null}},o=async(a,o,s)=>{try{let t=n.createJsonRpcProvider(a),c=new i.ethers.Contract(s,r.ERC20ABI,t),l;return l=s===e.zeroAddress?await t.getBalance(o):await c?.balanceOf(o),l}catch{return t.Logger.error(`Failed to fetch public balance for address ${o}`),null}};exports.getPublicBalance=a,exports.getPublicBalanceByTokenAddress=o;
1
+ require(`../../../../_virtual/_rolldown/runtime.cjs`),require(`../../constants/chains.constants.cjs`);const e=require(`../../constants/protocol.constants.cjs`);require(`../../data-structures/http/index.cjs`),require(`./addresses.cjs`);const t=require(`../../error-handling/logger.cjs`);require(`./erc20tokenFunctions.cjs`);const n=require(`./create-provider.cjs`);require(`../../externalABIs/index.cjs`);const r=require(`../../externalABIs/swapAbi.cjs`);require(`./ipfs.cjs`),require(`../../data-structures/IndexedDB/key-val-store.cjs`);let i=require(`ethers`);require(`@solana/web3.js`),require(`@solana/spl-token`);var a=async(t,n,a)=>{try{let o=a.erc20TokenAddress,s,c=new i.ethers.Contract(a.erc20TokenAddress,r.ERC20ABI,t);s=o===e.zeroAddress?await t.getBalance(n):await c?.balanceOf(n);let l=s;return l<=0n?null:{token:a,balance:l}}catch{return null}},o=async(a,o,s)=>{try{let t=n.createJsonRpcProvider(a),c=new i.ethers.Contract(s,r.ERC20ABI,t),l;return l=s===e.zeroAddress?await t.getBalance(o):await c?.balanceOf(o),l}catch{return t.Logger.error(`Failed to fetch public balance for address ${o}`),null}};exports.getPublicBalance=a,exports.getPublicBalanceByTokenAddress=o;
@@ -2,12 +2,13 @@ import "../../constants/chains.constants.mjs";
2
2
  import { zeroAddress as e } from "../../constants/protocol.constants.mjs";
3
3
  import "../../data-structures/http/index.mjs";
4
4
  import "./addresses.mjs";
5
- import "../../externalABIs/index.mjs";
6
5
  import { Logger as t } from "../../error-handling/logger.mjs";
7
6
  import "./erc20tokenFunctions.mjs";
8
7
  import { createJsonRpcProvider as n } from "./create-provider.mjs";
8
+ import "../../externalABIs/index.mjs";
9
9
  import { ERC20ABI as r } from "../../externalABIs/swapAbi.mjs";
10
10
  import "./ipfs.mjs";
11
+ import "../../data-structures/IndexedDB/key-val-store.mjs";
11
12
  import { ethers as i } from "ethers";
12
13
  import "@solana/web3.js";
13
14
  import "@solana/spl-token";
@@ -1 +1 @@
1
- require(`./solanaMint.utils.cjs`),require(`./token-check.utils.cjs`),require(`../../error-handling/index.cjs`),require(`../pre-transaction/index.cjs`),require(`../../constants/index.cjs`),require(`../../data-structures/crypto-keys/index.cjs`),require(`./getRecipientInfoFromUserKeys.cjs`),require(`./getUtxosFromReceipt.utils.cjs`),require(`./getUtxosFromReceiptSolana.cjs`),require(`./tx-confirmation.utils.cjs`);
1
+ require(`./solanaMint.utils.cjs`),require(`./token-check.utils.cjs`),require(`../../error-handling/index.cjs`),require(`../pre-transaction/index.cjs`),require(`../../constants/index.cjs`),require(`./tx-confirmation.utils.cjs`),require(`./getUtxosFromReceipt.utils.cjs`),require(`../../data-structures/crypto-keys/index.cjs`),require(`./getRecipientInfoFromUserKeys.cjs`),require(`./getUtxosFromReceiptSolana.cjs`);
@@ -3,8 +3,8 @@ import "./token-check.utils.mjs";
3
3
  import "../../error-handling/index.mjs";
4
4
  import "../pre-transaction/index.mjs";
5
5
  import "../../constants/index.mjs";
6
+ import "./tx-confirmation.utils.mjs";
7
+ import "./getUtxosFromReceipt.utils.mjs";
6
8
  import "../../data-structures/crypto-keys/index.mjs";
7
9
  import "./getRecipientInfoFromUserKeys.mjs";
8
- import "./getUtxosFromReceipt.utils.mjs";
9
10
  import "./getUtxosFromReceiptSolana.mjs";
10
- import "./tx-confirmation.utils.mjs";
@@ -1 +1 @@
1
- require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`./caseInsensitive.utils.cjs`),r=require(`../../error-handling/error-codes.constants.cjs`),i=require(`../snarkjs/constant.cjs`),a=require(`../../data-structures/http/HttpClient.cjs`),o=require(`../../externalABIs/index.cjs`),s=require(`../../error-handling/logger.cjs`);let c=require(`ethers`),l=require(`tronweb`);var u=2000n,d=e=>{let t=e.trim(),n=t.startsWith(`0x`)?t.slice(2):t;if(!/^[0-9a-fA-F]{64}$/.test(n))throw Error(`Tron private key must be 32 bytes (64 hex characters), with or without 0x prefix`);return n},f=(t,n)=>{let r=e.networkRegistry[t].fetchRpcUrl,i=n?d(n):void 0,a=i?new l.TronWeb({fullHost:r,privateKey:i}):new l.TronWeb({fullHost:r});return n||a.setAddress(`T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb`),a},p=e=>e?.startsWith(`T`)?e:l.TronWeb.address.fromHex(e),m=e=>e.startsWith(`0x`)?p(e):e,h=e=>{if(e.startsWith(`0x`))return e;if(e.startsWith(`41`))return e.replace(`41`,`0x`);if(e.startsWith(`T`))return h(l.TronWeb.address.toHex(e));throw Error(`Failed to convert address to hex format`)},g=t=>{if(t===e.chainIds.tronNile)return`https://nile.trongrid.io`;if(t===e.chainIds.tronMainnet)return`https://api.trongrid.io`;throw Error(`Unsupported Tron chain for wallet RPC: ${t}`)},_=(e,t)=>e.map(e=>Array.isArray(e)?_(e,t):t(e)),v=(e,t,n)=>{let r=new c.ethers.Interface(e);if(!r.getFunction(t))throw Error(`${t} ABI is missing for Tron call data creation`);let i=_(n,e=>typeof e==`string`&&e.startsWith(`T`)?h(e):e);return r.encodeFunctionData(t,i)},y=(e,t,n)=>e?BigInt(Math.max((e[t]??0)-(e[n]??0),0)):0n,b=(e,t)=>{let n=e.find(e=>e.key===t);if(!n||typeof n.value!=`number`)throw Error(`Missing Tron chain parameter: ${t}`);return BigInt(n.value)},x=async e=>{let t=`${g(e)}/wallet/getchainparameters`,n=await a.httpClient.post(t,{});if(!n?.chainParameter?.length)throw Error(`Failed to fetch Tron chain parameters from wallet RPC`);return n.chainParameter},S=async(e,t)=>{let n=`${g(e)}/wallet/getaccountresource`,r=h(t),i=r.startsWith(`0x`)?`41${r.slice(2)}`:r;return await a.httpClient.post(n,{address:i,visible:!1})},C=async(e,n,r,i,a,o)=>{let s={input:a,callValue:Number(o),feeLimit:t.TRON_DEFAULT_FEE_LIMIT_SUN},[c,l]=await Promise.all([e.transactionBuilder.estimateEnergy(r,``,s,[],i),e.transactionBuilder.triggerConstantContract(r,``,s,[],i)]),d=await x(n),f=b(d,`getEnergyFee`),p=b(d,`getTransactionFee`),m=await S(n,i),h=BigInt(c?.energy_required??l?.energy_used??0),g=y(m,`EnergyLimit`,`EnergyUsed`),_=(h>g?h-g:0n)*f,v=BigInt(Math.ceil((l?.transaction?.raw_data_hex?.length??0)/2)),C=y(m,`freeNetLimit`,`freeNetUsed`)+y(m,`NetLimit`,`NetUsed`),w=_+(v>C?v-C:0n)*p,T=w+w*u/10000n;return T>BigInt(1e9)?BigInt(t.TRON_DEFAULT_FEE_LIMIT_SUN):T},w=e=>{let t=e[0].map(BigInt),n=e[1][0].map(BigInt),r=e[1][1].map(BigInt),i=e[2].map(BigInt),a=e[3].map(BigInt);return{a:t,b:[[n[1],n[0]],[r[1],r[0]]],c:i,publicSignals:a}},T=(e,t)=>{let n=c.ethers.AbiCoder.defaultAbiCoder().encode([`uint16`,`uint16`,`uint16`,`uint256`],[e.tokenNumber,e.nullifierAmount,e.outputAmount,t]);return BigInt(c.ethers.keccak256(n))},E=async(e,t,n,r,o,s)=>{let l=T(o,s),u=e.map(String),d=n.map(String),f=r.map(String),p={a:u,b:[t[0].map(String),t[1].map(String)],c:d,inputs:f,verifier_id:String(l)},m=await a.httpClient.post(`${i.ENCLAVE_URL}/sign-proof`,p),{v:h,r:g,s:_}=c.ethers.Signature.from(m.signature.trim());return{v:h,r:g,s:_}},D=e=>[e.rootHashHinkal,e.rootHashHinkalIndex,e.erc20TokenAddresses,e.amountChanges,e.onChainCreation,e.slippageValues,e.inputNullifiers,e.outCommitments,e.encryptedOutputs,[e.feeStructure.feeToken,e.feeStructure.flatFee,e.feeStructure.variableRate],e.timeStamp,[e.stealthAddressStructure.H0x,e.stealthAddressStructure.H0y,e.stealthAddressStructure.H1x,e.stealthAddressStructure.H1y,e.stealthAddressStructure.stealthAddress],e.calldataHash,e.emporiumMessage,e.publicSignalCount,e.relay,[e.externalActionData.externalAddress,e.externalActionData.externalActionId,e.externalActionData.externalActionMetadata],[e.hookData.preHookContract,e.hookData.postHookContract,e.hookData.preHookMetadata,e.hookData.postHookMetadata],e.originalSender,e.extraData],O=async(e,t,n,r,i=!0)=>{if(e){let{a:e,b:a,c:o,publicSignals:s}=w(t),c=await E(e,a,o,s,n,BigInt(r.externalActionData.externalActionId)),l={v:c.v,r:c.r,s:c.s};return i&&(t[1]=[[t[1][0][1],t[1][0][0]],[t[1][1][1],t[1][1][0]]]),l}},k=(e,r)=>{let i=0n,a=new Map;for(let o=0;o<e.length;o+=1)if(n.caseInsensitiveEqual(e[o].erc20TokenAddress,t.zeroAddress))i+=r[o];else{let t=p(e[o].erc20TokenAddress);a.set(t,(a.get(t)??0n)+r[o])}return{totalTrxValue:i,tokensNeedingApproval:a}},A=async(e,n,i,a,o,c)=>{let l=BigInt(await e.trx.getBalance(a)),u=BigInt(t.TRON_DEFAULT_FEE_LIMIT_SUN);try{u=await C(e,n,i,a,o,c)}catch(e){s.Logger.error(`Error estimating Tron deposit fee`,e)}if(l<c+u)throw Error(r.insufficientResourcesErrorCodes.INSUFFICIENT_TRON_BALANCE_FOR_FEE)},j=async(e,n,r,i)=>{let a=Array.from(i.entries());for(let i=0;i<a.length;i+=1){let[s,c]=a[i],l=await e.contract(o.ERC20ABI,s).allowance(n,r).call({from:n});if(BigInt(String(l))<c){let{transaction:i}=await e.transactionBuilder.triggerSmartContract(s,`approve(address,uint256)`,{feeLimit:t.TRON_DEFAULT_FEE_LIMIT_SUN},[{type:`address`,value:r},{type:`uint256`,value:c.toString()}],n),a=await e.trx.sign(i),o=await e.trx.sendRawTransaction(a);if(!o.result){let e=o.code??`UNKNOWN`,t=o.message?Buffer.from(o.message,`hex`).toString():`no message`;throw Error(`Tron token approval failed: ${e} - ${t}`)}}}};exports.addressToHexFormat=h,exports.approveTronTokens=j,exports.assertTronSufficientBalance=A,exports.circomDataToArray=D,exports.createTronCallData=v,exports.createTronWeb=f,exports.estimateTronFeeSunWithPadding=C,exports.evmHexToTronBase58Address=p,exports.fetchTronAccountResources=S,exports.fetchTronChainParameters=x,exports.generateProofSignatureRemotely=E,exports.getAvailableResource=y,exports.getChainParameterValue=b,exports.getTronWalletRpcUrl=g,exports.getVerifierId=T,exports.normalizeTronPrivateKey=d,exports.parseZkCalldata=w,exports.reorderZkCallData=O,exports.splitTronTokensByNative=k,exports.toTronBase58IfHex=m;
1
+ require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../snarkjs/constant.cjs`),r=require(`../../data-structures/http/HttpClient.cjs`);let i=require(`ethers`),a=require(`tronweb`);var o=2000n,s=e=>{let t=e.trim(),n=t.startsWith(`0x`)?t.slice(2):t;if(!/^[0-9a-fA-F]{64}$/.test(n))throw Error(`Tron private key must be 32 bytes (64 hex characters), with or without 0x prefix`);return n},c=(t,n)=>{let r=e.networkRegistry[t].fetchRpcUrl,i=n?s(n):void 0,o=i?new a.TronWeb({fullHost:r,privateKey:i}):new a.TronWeb({fullHost:r});return n||o.setAddress(`T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb`),o},l=e=>e?.startsWith(`T`)?e:a.TronWeb.address.fromHex(e),u=e=>e.startsWith(`0x`)?l(e):e,d=e=>{if(e.startsWith(`0x`))return e;if(e.startsWith(`41`))return e.replace(`41`,`0x`);if(e.startsWith(`T`))return d(a.TronWeb.address.toHex(e));throw Error(`Failed to convert address to hex format`)},f=t=>{if(t===e.chainIds.tronNile)return`https://nile.trongrid.io`;if(t===e.chainIds.tronMainnet)return`https://api.trongrid.io`;throw Error(`Unsupported Tron chain for wallet RPC: ${t}`)},p=(e,t)=>e.map(e=>Array.isArray(e)?p(e,t):t(e)),m=(e,t,n)=>{let r=new i.ethers.Interface(e);if(!r.getFunction(t))throw Error(`${t} ABI is missing for Tron call data creation`);let a=p(n,e=>typeof e==`string`&&e.startsWith(`T`)?d(e):e);return r.encodeFunctionData(t,a)},h=(e,t,n)=>e?BigInt(Math.max((e[t]??0)-(e[n]??0),0)):0n,g=(e,t)=>{let n=e.find(e=>e.key===t);if(!n||typeof n.value!=`number`)throw Error(`Missing Tron chain parameter: ${t}`);return BigInt(n.value)},_=async e=>{let t=`${f(e)}/wallet/getchainparameters`,n=await r.httpClient.post(t,{});if(!n?.chainParameter?.length)throw Error(`Failed to fetch Tron chain parameters from wallet RPC`);return n.chainParameter},v=async(e,t)=>{let n=`${f(e)}/wallet/getaccountresource`,i=d(t),a=i.startsWith(`0x`)?`41${i.slice(2)}`:i;return await r.httpClient.post(n,{address:a,visible:!1})},y=async(e,n,r,i,a,s)=>{let c={input:a,callValue:Number(s),feeLimit:t.TRON_DEFAULT_FEE_LIMIT_SUN},[l,u]=await Promise.all([e.transactionBuilder.estimateEnergy(r,``,c,[],i),e.transactionBuilder.triggerConstantContract(r,``,c,[],i)]),d=await _(n),f=g(d,`getEnergyFee`),p=g(d,`getTransactionFee`),m=await v(n,i),y=BigInt(l?.energy_required??u?.energy_used??0),b=h(m,`EnergyLimit`,`EnergyUsed`),x=(y>b?y-b:0n)*f,S=BigInt(Math.ceil((u?.transaction?.raw_data_hex?.length??0)/2)),C=h(m,`freeNetLimit`,`freeNetUsed`)+h(m,`NetLimit`,`NetUsed`),w=x+(S>C?S-C:0n)*p,T=w+w*o/10000n;return T>BigInt(1e9)?BigInt(t.TRON_DEFAULT_FEE_LIMIT_SUN):T},b=e=>{let t=e[0].map(BigInt),n=e[1][0].map(BigInt),r=e[1][1].map(BigInt),i=e[2].map(BigInt),a=e[3].map(BigInt);return{a:t,b:[[n[1],n[0]],[r[1],r[0]]],c:i,publicSignals:a}},x=(e,t)=>{let n=i.ethers.AbiCoder.defaultAbiCoder().encode([`uint16`,`uint16`,`uint16`,`uint256`],[e.tokenNumber,e.nullifierAmount,e.outputAmount,t]);return BigInt(i.ethers.keccak256(n))},S=async(e,t,a,o,s,c,l)=>{let u=x(s,c),d=e.map(String),f=a.map(String),p=o.map(String),m={chainId:l,a:d,b:[t[0].map(String),t[1].map(String)],c:f,inputs:p,verifier_id:String(u),tokenNumber:s.tokenNumber,nullifierAmount:s.nullifierAmount,outputAmount:s.outputAmount},h=await r.httpClient.post(`${n.ENCLAVE_URL}/sign-proof`,m),{v:g,r:_,s:v}=i.ethers.Signature.from(h.signature.trim());return{v:g,r:_,s:v}},C=e=>{if(e.newRootHash===void 0)throw Error(`circomData.newRootHash is required for Tron transactions`);if(e.insertedLeafIndex===void 0)throw Error(`circomData.insertedLeafIndex is required for Tron transactions`);return[e.rootHashHinkal,e.rootHashHinkalIndex,e.erc20TokenAddresses,e.amountChanges,e.newRootHash,e.inputNullifiers,e.outCommitments,e.encryptedOutputs,e.slippageValues,[e.feeStructure.feeToken,e.feeStructure.flatFee,e.feeStructure.variableRate],e.timeStamp,e.calldataHash,e.emporiumMessage,e.publicSignalCount,e.relay,[e.externalActionData.externalAddress,e.externalActionData.externalActionId,e.externalActionData.externalActionMetadata],[e.hookData.preHookContract,e.hookData.postHookContract,e.hookData.preHookMetadata,e.hookData.postHookMetadata],e.originalSender,e.extraData,e.insertedLeafIndex,e.createBlockedUtxos??!1]},w=e=>{e[1]=[[e[1][0][1],e[1][0][0]],[e[1][1][1],e[1][1][0]]]},T=async(e,t,n,r,i,a=!0)=>{if(e){let{a:e,b:o,c:s,publicSignals:c}=b(t),l=await S(e,o,s,c,n,BigInt(r.externalActionData.externalActionId),i),u={v:l.v,r:l.r,s:l.s};return a&&w(t),u}};exports.addressToHexFormat=d,exports.circomDataToArray=C,exports.createTronCallData=m,exports.createTronWeb=c,exports.estimateTronFeeSunWithPadding=y,exports.evmHexToTronBase58Address=l,exports.fetchTronAccountResources=v,exports.fetchTronChainParameters=_,exports.generateProofSignatureRemotely=S,exports.getAvailableResource=h,exports.getChainParameterValue=g,exports.getTronWalletRpcUrl=f,exports.getVerifierId=x,exports.normalizeTronPrivateKey=s,exports.parseZkCalldata=b,exports.reorderZkCallData=T,exports.swapTronBCoordinate=w,exports.toTronBase58IfHex=u;
@@ -2,8 +2,8 @@ import { ethers } from 'ethers';
2
2
  import { CircomDataType, DimDataType } from '../../types/circom-data.types';
3
3
  import { NewZkCallDataType } from '../../types/snark.types';
4
4
  import { TronAccountResources, TronChainParameter } from '../../types/tron.types';
5
+ import { TronProofSignature } from '../../types/transact.types';
5
6
  import { TronWeb } from 'tronweb';
6
- import { ERC20Token } from '../../types/token.types';
7
7
  export declare const detectTronChainIdFromHost: (fullNodeHost: string) => number;
8
8
  export declare const normalizeTronPrivateKey: (privateKey: string) => string;
9
9
  export declare const createTronWeb: (chainId: number, privateKey?: string) => TronWeb;
@@ -25,20 +25,11 @@ export declare const parseZkCalldata: (zkCallData: NewZkCallDataType) => {
25
25
  publicSignals: bigint[];
26
26
  };
27
27
  export declare const getVerifierId: (dimensionsArg: DimDataType, externalActionId: bigint) => bigint;
28
- export declare const generateProofSignatureRemotely: (a: bigint[], b: bigint[][], c: bigint[], input: bigint[], dimensionsArg: DimDataType, externalActionId: bigint) => Promise<{
28
+ export declare const generateProofSignatureRemotely: (a: bigint[], b: bigint[][], c: bigint[], input: bigint[], dimensionsArg: DimDataType, externalActionId: bigint, chainId: number) => Promise<{
29
29
  v: number;
30
30
  r: string;
31
31
  s: string;
32
32
  }>;
33
- export declare const circomDataToArray: (circomData: CircomDataType) => (string | number | bigint | string[][] | boolean[] | (string | bigint)[] | undefined)[];
34
- export declare const reorderZkCallData: (isTron: boolean, zkCallData: NewZkCallDataType, dimData: DimDataType, circomData: CircomDataType, modifyZkCallData?: boolean) => Promise<{
35
- v: number;
36
- r: string;
37
- s: string;
38
- } | undefined>;
39
- export declare const splitTronTokensByNative: (erc20Tokens: ERC20Token[], amountChanges: bigint[]) => {
40
- totalTrxValue: bigint;
41
- tokensNeedingApproval: Map<string, bigint>;
42
- };
43
- export declare const assertTronSufficientBalance: (tronWeb: TronWeb, chainId: number, contractBase58: string, ownerAddress: string, callData: string, totalTrxValue: bigint) => Promise<void>;
44
- export declare const approveTronTokens: (tronWeb: TronWeb, ethereumAddress: string, spenderBase58: string, tokensNeedingApproval: Map<string, bigint>) => Promise<void>;
33
+ export declare const circomDataToArray: (circomData: CircomDataType) => (string | number | bigint | boolean | string[][] | (string | bigint)[] | undefined)[];
34
+ export declare const swapTronBCoordinate: (zkCallData: NewZkCallDataType) => void;
35
+ export declare const reorderZkCallData: (isTron: boolean, zkCallData: NewZkCallDataType, dimData: DimDataType, circomData: CircomDataType, chainId: number, modifyZkCallData?: boolean) => Promise<TronProofSignature | undefined>;