@hinkal/common 0.2.22 → 0.2.23

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 (242) hide show
  1. package/API/proxyAccountsCalls.cjs +1 -1
  2. package/API/proxyAccountsCalls.mjs +13 -13
  3. package/README.md +63 -267
  4. package/constants/activity.constants.cjs +1 -1
  5. package/constants/activity.constants.mjs +0 -1
  6. package/constants/addresses.constants.cjs +1 -1
  7. package/constants/addresses.constants.mjs +9 -10
  8. package/constants/contracts.constants.cjs +1 -1
  9. package/constants/contracts.constants.d.ts +3 -3
  10. package/constants/contracts.constants.mjs +29 -29
  11. package/constants/server.constants.cjs +1 -1
  12. package/constants/server.constants.mjs +28 -29
  13. package/constants/tasks.constants.cjs +1 -1
  14. package/constants/tasks.constants.mjs +4 -5
  15. package/crypto/poseidon.cjs +1 -1
  16. package/crypto/poseidon.mjs +10 -10
  17. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.cjs +1 -1
  18. package/data-structures/ApprovalDBs/EventsPublicApprovalsDB.mjs +24 -24
  19. package/data-structures/Hinkal/Hinkal.cjs +1 -1
  20. package/data-structures/Hinkal/Hinkal.mjs +4 -5
  21. package/data-structures/Hinkal/IHinkal.d.ts +2 -2
  22. package/data-structures/Hinkal/hinkalApprove.cjs +1 -1
  23. package/data-structures/Hinkal/hinkalApprove.mjs +40 -40
  24. package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -1
  25. package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +7 -8
  26. package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
  27. package/data-structures/Hinkal/hinkalDeposit.mjs +4 -5
  28. package/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
  29. package/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +2 -3
  30. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
  31. package/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +18 -19
  32. package/data-structures/Hinkal/hinkalDepostAndBridge.cjs +1 -1
  33. package/data-structures/Hinkal/hinkalDepostAndBridge.mjs +3 -4
  34. package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -1
  35. package/data-structures/Hinkal/hinkalInsideTransact.mjs +14 -13
  36. package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  37. package/data-structures/Hinkal/hinkalPrivateWallet.mjs +2 -3
  38. package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
  39. package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +27 -26
  40. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
  41. package/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +38 -39
  42. package/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
  43. package/data-structures/Hinkal/hinkalSolanaSwap.mjs +16 -17
  44. package/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
  45. package/data-structures/Hinkal/hinkalSolanaTransfer.mjs +24 -25
  46. package/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
  47. package/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +15 -16
  48. package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
  49. package/data-structures/Hinkal/hinkalSwap.mjs +2 -3
  50. package/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
  51. package/data-structures/Hinkal/hinkalTransfer.mjs +2 -3
  52. package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
  53. package/data-structures/Hinkal/hinkalWithdraw.mjs +9 -10
  54. package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
  55. package/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +8 -9
  56. package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
  57. package/data-structures/Hinkal/resetMerkleTrees.mjs +10 -10
  58. package/data-structures/IndexedDB/activity-db.cjs +1 -1
  59. package/data-structures/IndexedDB/activity-db.mjs +39 -41
  60. package/data-structures/IndexedDB/balances-db.cjs +1 -1
  61. package/data-structures/IndexedDB/balances-db.mjs +8 -9
  62. package/data-structures/IndexedDB/contact-db.cjs +1 -1
  63. package/data-structures/IndexedDB/contact-db.mjs +21 -23
  64. package/data-structures/IndexedDB/signatures-db.cjs +1 -1
  65. package/data-structures/IndexedDB/signatures-db.mjs +2 -3
  66. package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
  67. package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +34 -36
  68. package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
  69. package/data-structures/crypto-keys/decodeUTXO.mjs +45 -45
  70. package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
  71. package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +28 -27
  72. package/data-structures/crypto-keys/keys.cjs +1 -1
  73. package/data-structures/crypto-keys/keys.d.ts +2 -3
  74. package/data-structures/crypto-keys/keys.mjs +56 -57
  75. package/data-structures/event-service/evm/AbstractEventService.cjs +1 -1
  76. package/data-structures/event-service/evm/AbstractEventService.mjs +14 -14
  77. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
  78. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.d.ts +2 -3
  79. package/data-structures/event-service/evm/AbstractNullifierSnapshotService.mjs +5 -4
  80. package/data-structures/event-service/evm/AbstractSnapshotService.cjs +1 -1
  81. package/data-structures/event-service/evm/AbstractSnapshotService.mjs +6 -3
  82. package/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
  83. package/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +1 -1
  84. package/data-structures/event-service/evm/BlockchainEventEmitter.mjs +22 -18
  85. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
  86. package/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.mjs +2 -2
  87. package/data-structures/presale/PresaleContractWrapper.cjs +1 -1
  88. package/data-structures/presale/PresaleContractWrapper.d.ts +3 -3
  89. package/data-structures/presale/PresaleContractWrapper.mjs +10 -10
  90. package/data-structures/provider-adapter/IProviderAdapter.d.ts +7 -7
  91. package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.cjs +1 -1
  92. package/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.mjs +16 -14
  93. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.cjs +1 -1
  94. package/data-structures/snapshot/evm-snapshots/ClientApprovalsSnapshotService.mjs +7 -5
  95. package/error-handling/get-error.message.cjs +1 -1
  96. package/error-handling/get-error.message.mjs +2 -3
  97. package/functions/kyc/zkMeHelper.cjs +1 -1
  98. package/functions/kyc/zkMeHelper.mjs +3 -3
  99. package/functions/pre-transaction/getFlatFees.cjs +1 -1
  100. package/functions/pre-transaction/getFlatFees.mjs +2 -3
  101. package/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
  102. package/functions/pre-transaction/getSolanaCalldataHash.mjs +21 -21
  103. package/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
  104. package/functions/pre-transaction/getVolatileTransferAmount.mjs +2 -3
  105. package/functions/pre-transaction/interaction-to-action.cjs +1 -1
  106. package/functions/pre-transaction/interaction-to-action.mjs +2 -3
  107. package/functions/private-wallet/emporium.helpers.cjs +1 -1
  108. package/functions/private-wallet/emporium.helpers.d.ts +6 -7
  109. package/functions/private-wallet/emporium.helpers.mjs +104 -105
  110. package/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
  111. package/functions/private-wallet/emporium.swap.helpers.mjs +44 -43
  112. package/functions/private-wallet/opProducer.cjs +1 -1
  113. package/functions/private-wallet/opProducer.mjs +1 -1
  114. package/functions/snarkjs/common.snarkjs.cjs +1 -1
  115. package/functions/snarkjs/common.snarkjs.mjs +21 -18
  116. package/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
  117. package/functions/snarkjs/constructSolanaZkProof.mjs +11 -12
  118. package/functions/utils/addresses.cjs +1 -1
  119. package/functions/utils/addresses.mjs +6 -6
  120. package/functions/utils/cacheFunctions.cjs +1 -1
  121. package/functions/utils/cacheFunctions.d.ts +1 -1
  122. package/functions/utils/cacheFunctions.mjs +55 -54
  123. package/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -1
  124. package/functions/utils/convertEmporiumOpToCallInfo.mjs +5 -5
  125. package/functions/utils/create-provider.cjs +1 -1
  126. package/functions/utils/create-provider.d.ts +2 -2
  127. package/functions/utils/create-provider.mjs +5 -5
  128. package/functions/utils/encryptInputForEnclave.cjs +1 -1
  129. package/functions/utils/encryptInputForEnclave.mjs +9 -9
  130. package/functions/utils/ethers-formatter.utils.d.ts +1 -1
  131. package/functions/utils/external-action.utils.cjs +1 -1
  132. package/functions/utils/external-action.utils.mjs +2 -2
  133. package/functions/utils/getContractAddress.cjs +1 -0
  134. package/functions/utils/getContractAddress.d.ts +2 -0
  135. package/functions/utils/getContractAddress.mjs +9 -0
  136. package/functions/utils/getDataFromTransaction.cjs +1 -1
  137. package/functions/utils/getDataFromTransaction.d.ts +0 -11
  138. package/functions/utils/getDataFromTransaction.mjs +26 -50
  139. package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
  140. package/functions/utils/getRecipientInfoFromUserKeys.mjs +1 -1
  141. package/functions/utils/getSignerFromContract.cjs +1 -0
  142. package/functions/utils/getSignerFromContract.d.ts +3 -0
  143. package/functions/utils/getSignerFromContract.mjs +16 -0
  144. package/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
  145. package/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
  146. package/functions/utils/getUtxosFromReceipt.utils.mjs +15 -16
  147. package/functions/utils/inLogicMetadata.cjs +1 -1
  148. package/functions/utils/inLogicMetadata.mjs +2 -2
  149. package/functions/utils/nftTokenFunctions.cjs +1 -1
  150. package/functions/utils/nftTokenFunctions.mjs +2 -3
  151. package/functions/utils/publicBalance.utils.cjs +1 -1
  152. package/functions/utils/publicBalance.utils.d.ts +1 -1
  153. package/functions/utils/publicBalance.utils.mjs +42 -42
  154. package/functions/utils/rpc-int-encode.cjs +1 -1
  155. package/functions/utils/rpc-int-encode.d.ts +1 -2
  156. package/functions/utils/rpc-int-encode.mjs +3 -6
  157. package/functions/utils/solanaMint.utils.cjs +1 -1
  158. package/functions/utils/solanaMint.utils.mjs +6 -6
  159. package/functions/web3/EIP-712.cjs +1 -1
  160. package/functions/web3/EIP-712.d.ts +4 -4
  161. package/functions/web3/EIP-712.mjs +1 -1
  162. package/functions/web3/etherFunctions.cjs +1 -1
  163. package/functions/web3/etherFunctions.mjs +32 -29
  164. package/functions/web3/events/balanceChangedCustomHandler.cjs +1 -1
  165. package/functions/web3/events/balanceChangedCustomHandler.mjs +4 -5
  166. package/functions/web3/events/balanceChangedHandler.cjs +1 -1
  167. package/functions/web3/events/balanceChangedHandler.mjs +2 -3
  168. package/functions/web3/events/getApprovedBalance.cjs +1 -1
  169. package/functions/web3/events/getApprovedBalance.mjs +1 -1
  170. package/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
  171. package/functions/web3/events/getInputUtxosEnclave.mjs +20 -20
  172. package/functions/web3/events/getTransactionLogEvents.cjs +1 -1
  173. package/functions/web3/events/getTransactionLogEvents.d.ts +3 -3
  174. package/functions/web3/events/getTransactionLogEvents.mjs +6 -5
  175. package/functions/web3/events/index.d.ts +0 -1
  176. package/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
  177. package/functions/web3/fetchSolanaMerkleTreeRootHash.d.ts +1 -2
  178. package/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +4 -5
  179. package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
  180. package/functions/web3/functionCalls/accessTokenCalls.mjs +10 -11
  181. package/functions/web3/functionCalls/approveToken.cjs +1 -1
  182. package/functions/web3/functionCalls/approveToken.mjs +61 -58
  183. package/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
  184. package/functions/web3/functionCalls/constructBatchCall.d.ts +2 -2
  185. package/functions/web3/functionCalls/constructBatchCall.mjs +10 -9
  186. package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
  187. package/functions/web3/functionCalls/estimateGasRelayer.mjs +1 -1
  188. package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -1
  189. package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +18 -21
  190. package/functions/web3/functionCalls/recoverTransactionFromError.d.ts +1 -1
  191. package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
  192. package/functions/web3/functionCalls/transactCallDirect.mjs +38 -34
  193. package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
  194. package/functions/web3/functionCalls/transactCallRelayer.mjs +8 -10
  195. package/functions/web3/getContractMetadata.cjs +1 -1
  196. package/functions/web3/getContractMetadata.d.ts +1 -1
  197. package/functions/web3/getContractMetadata.mjs +25 -25
  198. package/functions/web3/getPublicAddressBalance.cjs +1 -1
  199. package/functions/web3/getPublicAddressBalance.mjs +7 -6
  200. package/functions/web3/getTokenHolder.cjs +1 -1
  201. package/functions/web3/getTokenHolder.mjs +16 -15
  202. package/functions/web3/odosAPI.cjs +1 -1
  203. package/functions/web3/odosAPI.mjs +6 -7
  204. package/functions/web3/oneInchAPI.cjs +1 -1
  205. package/functions/web3/oneInchAPI.mjs +2 -3
  206. package/functions/web3/runContractFunction.cjs +1 -1
  207. package/functions/web3/runContractFunction.d.ts +6 -5
  208. package/functions/web3/runContractFunction.mjs +41 -45
  209. package/functions/web3/uniswapAPI.cjs +1 -1
  210. package/functions/web3/uniswapAPI.d.ts +2 -2
  211. package/functions/web3/uniswapAPI.mjs +23 -24
  212. package/index.cjs +1 -1
  213. package/index.mjs +336 -340
  214. package/package.json +3 -4
  215. package/providers/CustomEthersProvider.d.ts +1 -1
  216. package/providers/EthersProviderAdapter.cjs +1 -1
  217. package/providers/EthersProviderAdapter.d.ts +7 -7
  218. package/providers/EthersProviderAdapter.mjs +46 -44
  219. package/providers/SolanaProviderAdapter.d.ts +1 -1
  220. package/providers/WagmiProviderAdapter.cjs +1 -1
  221. package/providers/WagmiProviderAdapter.d.ts +5 -5
  222. package/providers/WagmiProviderAdapter.mjs +37 -33
  223. package/providers/prepareEthersHinkal.cjs +1 -1
  224. package/providers/prepareEthersHinkal.d.ts +2 -2
  225. package/providers/prepareEthersHinkal.mjs +3 -5
  226. package/providers/prepareWagmiHinkal.cjs +1 -1
  227. package/providers/prepareWagmiHinkal.mjs +3 -5
  228. package/types/activities.types.d.ts +2 -3
  229. package/types/big-intable.types.d.ts +3 -2
  230. package/types/ethereum-network.types.d.ts +10 -10
  231. package/types/transactions.types.cjs +1 -1
  232. package/types/transactions.types.d.ts +2 -3
  233. package/types/transactions.types.mjs +6 -7
  234. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  235. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
  236. package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
  237. package/webworker/utxoWorker/utxoWorkerLogic.mjs +1 -1
  238. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  239. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
  240. package/functions/web3/events/web3RetrieveEvents.cjs +0 -1
  241. package/functions/web3/events/web3RetrieveEvents.d.ts +0 -14
  242. package/functions/web3/events/web3RetrieveEvents.mjs +0 -9
@@ -5,7 +5,7 @@ import { UserKeys as S } from "../../data-structures/crypto-keys/keys.mjs";
5
5
  import { encryptUtxo as y } from "../../data-structures/crypto-keys/encryptDecryptUtxo.mjs";
6
6
  import { defaultHookData as O } from "../../types/circom-data.types.mjs";
7
7
  import { getExternalActionIdHash as f } from "../utils/external-action.utils.mjs";
8
- import { HinkalLogicAction as d } from "../../types/hinkal.types.mjs";
8
+ import { HinkalLogicAction as g } from "../../types/hinkal.types.mjs";
9
9
  import { calculateBigIntSum as T } from "../utils/amounts.utils.mjs";
10
10
  import { getOriginalSender as R } from "./getOriginalSender.mjs";
11
11
  const $ = (e, s) => e.map((t, r) => t.map((n) => s[r] ? "0" : n.getNullifier())), q = (e, s, t) => {
@@ -25,10 +25,10 @@ const $ = (e, s) => e.map((t, r) => t.map((n) => s[r] ? "0" : n.getNullifier()))
25
25
  }
26
26
  return r;
27
27
  }, L = (e) => e.useApprovalUtxoData.reduce((s, t) => [...s, T(t.approvalChanges)], []), Q = (e, s) => {
28
- const t = L(s), r = s.hinkalLogicAction, n = e.map((a, l) => r === d.NONE || r === d.APPROVE ? a + t[l] >= 0n ? 0n : a + t[l] : a >= 0n ? 0n : a);
29
- return r === d.RELEASE_BUFFER ? e.forEach((a, l) => {
28
+ const t = L(s), r = s.hinkalLogicAction, n = e.map((a, l) => r === g.NONE || r === g.APPROVE ? a + t[l] >= 0n ? 0n : a + t[l] : a >= 0n ? 0n : a);
29
+ return r === g.RELEASE_BUFFER ? e.forEach((a, l) => {
30
30
  n[l] = a > 0n ? -a : a;
31
- }) : r === d.EXECUTE && s.executeApprovalChanges.forEach((a, l) => {
31
+ }) : r === g.EXECUTE && s.executeApprovalChanges.forEach((a, l) => {
32
32
  n[l] = a + e[l] < 0n ? a + e[l] : 0n;
33
33
  }), n;
34
34
  }, Y = (e) => {
@@ -89,10 +89,10 @@ const $ = (e, s) => e.map((t, r) => t.map((n) => s[r] ? "0" : n.getNullifier()))
89
89
  })
90
90
  ), t;
91
91
  }
92
- }, se = (e, s, t, r, n, a, l, i, m, H, C, u, g, k, b) => {
92
+ }, se = (e, s, t, r, n, a, l, i, m, C, H, d, u, k, b) => {
93
93
  const h = Object.values(m || O), v = b ?? R(r ?? E, t);
94
94
  if (e === "v1x0") {
95
- const p = o.utils.defaultAbiCoder.encode(
95
+ const p = o.AbiCoder.defaultAbiCoder().encode(
96
96
  [
97
97
  "uint16",
98
98
  "address",
@@ -114,9 +114,9 @@ const $ = (e, s) => e.map((t, r) => t.map((n) => s[r] ? "0" : n.getNullifier()))
114
114
  i
115
115
  ]
116
116
  );
117
- return BigInt(o.utils.keccak256(p)) % c;
117
+ return BigInt(o.keccak256(p)) % c;
118
118
  } else {
119
- const p = o.utils.defaultAbiCoder.encode(
119
+ const p = o.AbiCoder.defaultAbiCoder().encode(
120
120
  ["uint16", "address", "address", "uint256", "bytes"],
121
121
  [
122
122
  s,
@@ -125,7 +125,7 @@ const $ = (e, s) => e.map((t, r) => t.map((n) => s[r] ? "0" : n.getNullifier()))
125
125
  typeof n == "bigint" ? n : f(n),
126
126
  a
127
127
  ]
128
- ), A = o.utils.defaultAbiCoder.encode(
128
+ ), A = o.AbiCoder.defaultAbiCoder().encode(
129
129
  [
130
130
  "tuple(address, address, bytes, bytes)",
131
131
  "bytes[][]",
@@ -139,21 +139,24 @@ const $ = (e, s) => e.map((t, r) => t.map((n) => s[r] ? "0" : n.getNullifier()))
139
139
  [
140
140
  h,
141
141
  l,
142
- [g.feeToken, g.flatFee, g.variableRate],
143
- H,
142
+ [u.feeToken, u.flatFee, u.variableRate],
144
143
  C,
144
+ H,
145
145
  [
146
- u.hinkalLogicAction,
147
- u.inHinkalAddress,
148
- u.executeApprovalChanges,
149
- u.doPreTxApproval,
150
- u.useApprovalUtxoData
146
+ d.hinkalLogicAction,
147
+ d.inHinkalAddress,
148
+ d.executeApprovalChanges,
149
+ d.doPreTxApproval,
150
+ d.useApprovalUtxoData
151
151
  ],
152
152
  k,
153
153
  v
154
154
  ]
155
- ), I = BigInt(o.utils.keccak256(p)), B = BigInt(o.utils.keccak256(A)), V = o.utils.defaultAbiCoder.encode(["uint256", "uint256"], [I, B]);
156
- return BigInt(o.utils.keccak256(V)) % c;
155
+ ), I = BigInt(o.keccak256(p)), B = BigInt(o.keccak256(A)), V = o.AbiCoder.defaultAbiCoder().encode(
156
+ ["uint256", "uint256"],
157
+ [I, B]
158
+ );
159
+ return BigInt(o.keccak256(V)) % c;
157
160
  }
158
161
  }, x = (e) => e.startsWith("swapperMO") || e.startsWith("swapperME") ? 2 : e.startsWith("swapperMW") ? 1 : (e.startsWith("swapperMHA"), 0), ne = (e, s, t, r, n, a) => {
159
162
  if (e.startsWith("swapperMWMin0"))
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("../../error-handling/error-codes.constants.cjs");require("../../data-structures/crypto-keys/keys.cjs");const te=require("../../constants/chains.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/token-data/index.cjs");require("../../API/getServerURL.cjs");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("../utils/mutexes.utils.cjs");require("@coral-xyz/anchor");const i=require("@solana/web3.js"),o=require("../pre-transaction/solana.cjs");require("@solana/spl-token");const ne=require("../utils/solanaMint.utils.cjs"),ae=require("./common.snarkjs.cjs"),oe=require("../../data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.cjs"),ie=require("./generateZkProof.cjs"),ce=require("../../webworker/worker.registry.cjs"),se=require("../../webworker/performTaskWithWorker.cjs"),me=require("../../webworker/zkProofWorker/zkProofWorker.types.cjs"),ue=require("../pre-transaction/getSolanaCalldataHash.cjs"),le=require("./getMerkleTreeSiblingsAndRootHashes.cjs"),pe=async(g,k,S,d,c,f,s,t,n,P,b,h,y,T,a,A,m=te.chainIds.solanaLocalnet,C=!1,B=t.map(()=>!1),I=0n,w=[],K=[],H=!0)=>{const u="v1x1",_=new i.PublicKey(y),R=new i.PublicKey(T),W=c.getShieldedPrivateKey(),l=s.map(e=>ne.formatMintAddress(e)),Z=l.map(e=>e.mintAccountPart1),v=l.map(e=>e.mintAccountPart2),z=ue.getSolanaCalldataHash(a,_,R,A,b,h,w,K),M=`${a.tokenNumber}x${a.nullifierAmount}x${a.outputAmount}`,p=ae.calcAmountChanges(t,n),L=await oe.hinkalCheckSolanaTokenRegistry(f,new i.PublicKey(k),s,p),q=t.map(e=>e.map(r=>r.getConstructableParams())),{inCommitmentSiblings:N,inCommitmentSiblingSides:$,accessTokenSiblings:j,accessTokenSiblingSides:D,rootHashHinkal:V,rootHashAccessToken:E}=await le.getMerkleTreeSiblingsAndRootHashes(m,c,q,C,L,S,d,H),F=await se.performTaskWithWorker({type:ce.WorkerVariant.ZKProof,payload:{type:me.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:q,onChainCreation:B,proverVersion:u}}}),O={rootHashHinkal:V,shieldedPrivateKey:W,rootHashAccessToken:E,accessTokenSiblings:j,accessTokenSiblingSides:D,mintAccountPart1:Z,mintAccountPart2:v,inAmounts:t.map(e=>e.map(r=>r.amount)),inTimeStamps:t.map(e=>e.map(r=>r.timeStamp)),inRandomizations:t.map(e=>e.map(r=>r.randomization)),inNullifiers:F,inCommitmentSiblings:N,inCommitmentSiblingSides:$,outAmounts:n.map(e=>e.map(r=>r.amount.toString())),outTimeStamp:BigInt(n[0][0].timeStamp),outPublicKeys:n.map(e=>e.map(r=>r.getStealthAddress())),extraRandomization:P,amountChanges:p,outCommitments:n.map(e=>e.map(r=>r.amount===0n?0n:r.getCommitment())),calldataHash:z,swapperAccountSalt:I},{publicSignals:G,zkCallData:J}=await ie.generateZkProof(u,m,`basicSolana${M}`,O,g),[Q,X,Y]=J,x=Q.map(BigInt).map(o.encodeToByte32Array).flat(),U=X.flat().map(BigInt).map(o.encodeToByte32Array).flat(),ee=Y.map(BigInt).map(o.encodeToByte32Array).flat(),re=G.map(BigInt).map(o.encodeToByte32Array);return{proofAArr:x,proofBArr:U,proofCArr:ee,publicInputsArr:re}};exports.constructSolanaZkProof=pe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");require("../../types/activities.types.cjs");require("ethers");require("circomlibjs-hinkal-fork");require("../../error-handling/error-codes.constants.cjs");require("../../data-structures/crypto-keys/keys.cjs");const re=require("../../constants/chains.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/token-data/index.cjs");require("../../API/getServerURL.cjs");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("../utils/mutexes.utils.cjs");require("@coral-xyz/anchor");const i=require("@solana/web3.js"),o=require("../pre-transaction/solana.cjs");require("@solana/spl-token");const ne=require("../utils/solanaMint.utils.cjs"),ae=require("./common.snarkjs.cjs"),oe=require("../../data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.cjs"),ie=require("./generateZkProof.cjs"),ce=require("../../webworker/worker.registry.cjs"),se=require("../../webworker/performTaskWithWorker.cjs"),me=require("../../webworker/zkProofWorker/zkProofWorker.types.cjs"),ue=require("../pre-transaction/getSolanaCalldataHash.cjs"),le=require("./getMerkleTreeSiblingsAndRootHashes.cjs"),pe=async(g,k,S,d,c,f,s,r,n,P,b,h,y,T,a,A,m=re.chainIds.solanaLocalnet,C=!1,B=r.map(()=>!1),I=0n,w=[],K=[],H=!0)=>{const u="v1x1",_=new i.PublicKey(y),R=new i.PublicKey(T),W=c.getShieldedPrivateKey(),l=s.map(e=>ne.formatMintAddress(e)),Z=l.map(e=>e.mintAccountPart1),v=l.map(e=>e.mintAccountPart2),z=ue.getSolanaCalldataHash(a,_,R,A,b,h,w,K),M=`${a.tokenNumber}x${a.nullifierAmount}x${a.outputAmount}`,p=ae.calcAmountChanges(r,n),L=await oe.hinkalCheckSolanaTokenRegistry(f,new i.PublicKey(k),s,p),q=r.map(e=>e.map(t=>t.getConstructableParams())),{inCommitmentSiblings:N,inCommitmentSiblingSides:$,accessTokenSiblings:j,accessTokenSiblingSides:D,rootHashHinkal:V,rootHashAccessToken:E}=await le.getMerkleTreeSiblingsAndRootHashes(m,c,q,C,L,S,d,H),F=await se.performTaskWithWorker({type:ce.WorkerVariant.ZKProof,payload:{type:me.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:q,onChainCreation:B,proverVersion:u}}}),O={rootHashHinkal:V,shieldedPrivateKey:W,rootHashAccessToken:E,accessTokenSiblings:j,accessTokenSiblingSides:D,mintAccountPart1:Z,mintAccountPart2:v,inAmounts:r.map(e=>e.map(t=>t.amount)),inTimeStamps:r.map(e=>e.map(t=>t.timeStamp)),inRandomizations:r.map(e=>e.map(t=>t.randomization)),inNullifiers:F,inCommitmentSiblings:N,inCommitmentSiblingSides:$,outAmounts:n.map(e=>e.map(t=>t.amount.toString())),outTimeStamp:BigInt(n[0][0].timeStamp),outPublicKeys:n.map(e=>e.map(t=>t.getStealthAddress())),extraRandomization:P,amountChanges:p,outCommitments:n.map(e=>e.map(t=>t.amount===0n?0n:t.getCommitment())),calldataHash:z,swapperAccountSalt:I},{publicSignals:G,zkCallData:J}=await ie.generateZkProof(u,m,`basicSolana${M}`,O,g),[Q,X,Y]=J,x=Q.map(BigInt).map(o.encodeToByte32Array).flat(),U=X.flat().map(BigInt).map(o.encodeToByte32Array).flat(),ee=Y.map(BigInt).map(o.encodeToByte32Array).flat(),te=G.map(BigInt).map(o.encodeToByte32Array);return{proofAArr:x,proofBArr:U,proofCArr:ee,publicInputsArr:te}};exports.constructSolanaZkProof=pe;
@@ -1,5 +1,4 @@
1
1
  import "../../types/circom-data.types.mjs";
2
- import "../../types/transactions.types.mjs";
3
2
  import "../../types/activities.types.mjs";
4
3
  import "ethers";
5
4
  import "circomlibjs-hinkal-fork";
@@ -22,8 +21,8 @@ import "@coral-xyz/anchor";
22
21
  import { PublicKey as r } from "@solana/web3.js";
23
22
  import { encodeToByte32Array as n } from "../pre-transaction/solana.mjs";
24
23
  import "@solana/spl-token";
25
- import { formatMintAddress as it } from "../utils/solanaMint.utils.mjs";
26
- import { calcAmountChanges as at } from "./common.snarkjs.mjs";
24
+ import { formatMintAddress as at } from "../utils/solanaMint.utils.mjs";
25
+ import { calcAmountChanges as it } from "./common.snarkjs.mjs";
27
26
  import { hinkalCheckSolanaTokenRegistry as nt } from "../../data-structures/Hinkal/hinkalCheckSolanaTokenRegistry.mjs";
28
27
  import { generateZkProof as rt } from "./generateZkProof.mjs";
29
28
  import { WorkerVariant as et } from "../../webworker/worker.registry.mjs";
@@ -31,9 +30,9 @@ import { performTaskWithWorker as pt } from "../../webworker/performTaskWithWork
31
30
  import { ZKProofWorkerActionType as ct } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
32
31
  import { getSolanaCalldataHash as st } from "../pre-transaction/getSolanaCalldataHash.mjs";
33
32
  import { getMerkleTreeSiblingsAndRootHashes as lt } from "./getMerkleTreeSiblingsAndRootHashes.mjs";
34
- const jt = async (u, S, k, d, e, P, p, m, i, b, h, A, C, I, a, T, c = mt.solanaLocalnet, B = !1, w = m.map(() => !1), K = 0n, H = [], y = [], R = !0) => {
35
- const s = "v1x1", v = new r(C), z = new r(I), L = e.getShieldedPrivateKey(), l = p.map((t) => it(t)), N = l.map((t) => t.mintAccountPart1), W = l.map((t) => t.mintAccountPart2), Z = st(
36
- a,
33
+ const Ft = async (u, S, k, d, e, P, p, m, a, b, h, A, C, I, i, T, c = mt.solanaLocalnet, B = !1, w = m.map(() => !1), K = 0n, H = [], y = [], R = !0) => {
34
+ const s = "v1x1", v = new r(C), z = new r(I), L = e.getShieldedPrivateKey(), l = p.map((t) => at(t)), N = l.map((t) => t.mintAccountPart1), W = l.map((t) => t.mintAccountPart2), Z = st(
35
+ i,
37
36
  v,
38
37
  z,
39
38
  T,
@@ -41,7 +40,7 @@ const jt = async (u, S, k, d, e, P, p, m, i, b, h, A, C, I, a, T, c = mt.solanaL
41
40
  A,
42
41
  H,
43
42
  y
44
- ), $ = `${a.tokenNumber}x${a.nullifierAmount}x${a.outputAmount}`, f = at(m, i), D = await nt(
43
+ ), $ = `${i.tokenNumber}x${i.nullifierAmount}x${i.outputAmount}`, f = it(m, a), D = await nt(
45
44
  P,
46
45
  new r(S),
47
46
  p,
@@ -82,12 +81,12 @@ const jt = async (u, S, k, d, e, P, p, m, i, b, h, A, C, I, a, T, c = mt.solanaL
82
81
  inNullifiers: j,
83
82
  inCommitmentSiblings: M,
84
83
  inCommitmentSiblingSides: V,
85
- outAmounts: i.map((t) => t.map((o) => o.amount.toString())),
86
- outTimeStamp: BigInt(i[0][0].timeStamp),
87
- outPublicKeys: i.map((t) => t.map((o) => o.getStealthAddress())),
84
+ outAmounts: a.map((t) => t.map((o) => o.amount.toString())),
85
+ outTimeStamp: BigInt(a[0][0].timeStamp),
86
+ outPublicKeys: a.map((t) => t.map((o) => o.getStealthAddress())),
88
87
  extraRandomization: b,
89
88
  amountChanges: f,
90
- outCommitments: i.map(
89
+ outCommitments: a.map(
91
90
  (t) => t.map((o) => o.amount === 0n ? 0n : o.getCommitment())
92
91
  ),
93
92
  calldataHash: Z,
@@ -102,5 +101,5 @@ const jt = async (u, S, k, d, e, P, p, m, i, b, h, A, C, I, a, T, c = mt.solanaL
102
101
  return { proofAArr: x, proofBArr: U, proofCArr: tt, publicInputsArr: ot };
103
102
  };
104
103
  export {
105
- jt as constructSolanaZkProof
104
+ Ft as constructSolanaZkProof
106
105
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("ethers"),u=require("@solana/web3.js"),h=t=>{const[r,e,s,n,o]=t.split(","),c=!r||!e||!s||!n||!o,a=e?.substring(0,2)!=="0x"||s?.substring(0,2)!=="0x",d=s?.length!==66||e?.length>66||e?.length<64,l=t?.includes('"');return!(c||a||d||l)},g=t=>{const[r,e,,s,n]=t.split(",");return{extraRandomization:BigInt(r),stealthAddress:BigInt(e),H0:BigInt(s),H1:BigInt(n)}},b=t=>i.ethers.utils.keccak256(i.ethers.utils.toUtf8Bytes(t.toLowerCase())),y=t=>{try{return new u.PublicKey(t).toBase58()===t}catch{return!1}};exports.constructStealthAddressStructure=g;exports.hashEthereumAddress=b;exports.isValidPrivateAddress=h;exports.isValidSolanaPublicKey=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("ethers"),u=require("@solana/web3.js"),h=t=>{const[r,e,s,n,o]=t.split(","),c=!r||!e||!s||!n||!o,a=e?.substring(0,2)!=="0x"||s?.substring(0,2)!=="0x",d=s?.length!==66||e?.length>66||e?.length<64,l=t?.includes('"');return!(c||a||d||l)},g=t=>{const[r,e,,s,n]=t.split(",");return{extraRandomization:BigInt(r),stealthAddress:BigInt(e),H0:BigInt(s),H1:BigInt(n)}},b=t=>i.ethers.keccak256(i.ethers.toUtf8Bytes(t.toLowerCase())),y=t=>{try{return new u.PublicKey(t).toBase58()===t}catch{return!1}};exports.constructStealthAddressStructure=g;exports.hashEthereumAddress=b;exports.isValidPrivateAddress=h;exports.isValidSolanaPublicKey=y;
@@ -1,17 +1,17 @@
1
1
  import { ethers as o } from "ethers";
2
2
  import { PublicKey as u } from "@solana/web3.js";
3
3
  const m = (t) => {
4
- const [n, s, e, r, i] = t.split(","), c = !n || !s || !e || !r || !i, a = s?.substring(0, 2) !== "0x" || e?.substring(0, 2) !== "0x", l = e?.length !== 66 || s?.length > 66 || s?.length < 64, d = t?.includes('"');
5
- return !(c || a || l || d);
4
+ const [n, e, s, r, i] = t.split(","), c = !n || !e || !s || !r || !i, a = e?.substring(0, 2) !== "0x" || s?.substring(0, 2) !== "0x", d = s?.length !== 66 || e?.length > 66 || e?.length < 64, l = t?.includes('"');
5
+ return !(c || a || d || l);
6
6
  }, y = (t) => {
7
- const [n, s, , e, r] = t.split(",");
7
+ const [n, e, , s, r] = t.split(",");
8
8
  return {
9
9
  extraRandomization: BigInt(n),
10
- stealthAddress: BigInt(s),
11
- H0: BigInt(e),
10
+ stealthAddress: BigInt(e),
11
+ H0: BigInt(s),
12
12
  H1: BigInt(r)
13
13
  };
14
- }, b = (t) => o.utils.keccak256(o.utils.toUtf8Bytes(t.toLowerCase())), p = (t) => {
14
+ }, b = (t) => o.keccak256(o.toUtf8Bytes(t.toLowerCase())), p = (t) => {
15
15
  try {
16
16
  return new u(t).toBase58() === t;
17
17
  } catch {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../../types/ethereum-network.types.cjs"),y=require("./getDataFromTransaction.cjs"),A=require("idb-keyval"),T=require("../../constants/chains.constants.cjs"),C={encryptedOutputs:[],lastOutput:""},o=(s,t)=>{const e=s.substring(0,25),r=t.substring(0,25);return{shortPublicKey:e,shortHinkalAddress:r}},k=(s,t,e)=>`hinkalCache-${s}-${t}-${e}`,D=(s,t,e)=>{const{hinkalAddress:r}=T.networkRegistry[t].contractData;if(!t||!e||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(e,r);return JSON.parse(s.cacheDevice.get(k(t,a,n))??JSON.stringify(C))},x=(s,t,e,r)=>{const{hinkalAddress:a}=T.networkRegistry[e].contractData;if(!e||!r||!a)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:c}=o(r,a);t.cacheDevice.set(k(e,n,c),JSON.stringify(s))},S=(s,t,e)=>{x(C,s,t,e)},p=(s,t,e)=>`txsCache-${s}-${t}-${e}`,f=async(s,t,e,r,a,n)=>{if(!t||!e||!r)throw Error("saveTxsCache: incorrect arguments");const{shortPublicKey:c,shortHinkalAddress:i}=o(e,r),l=y.serializeDecodedTxs(s),h=p(t,c,i),g=JSON.stringify({serializedTxs:l,lastHash:a});try{await A.set(h,g)}catch{n.cacheDevice.set(h,g)}},m={serializedTxs:[],lastHash:""},w=async(s,t,e,r)=>{if(!s||!t||!e)throw Error("loadTxsCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(t,e),c=p(s,a,n);let i;try{const d=await A.get(c);if(!d)throw new Error("Empty indexedDB cache");i=d}catch{i=r.cacheDevice.get(c)}const{serializedTxs:l,lastHash:h}=JSON.parse(i??JSON.stringify(m));return{decodedTxs:l.map(d=>y.deserializeDecodedTxs(d)),lastHash:h===""?void 0:h}},u=(s,t,e)=>`hinkalApprovalsCache-${s}-${t}-${e}`,v=(s,t,e,r)=>{const a=t.getContract(H.ContractType.HinkalContract,void 0,e).address;if(!e||!r||!a)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:c}=o(r,a);t.cacheDevice.set(u(e,n,c),JSON.stringify(s))},O=(s,t,e)=>{const r=s.getContract(H.ContractType.HinkalContract,void 0,t).address;if(!t||!e||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:n}=o(e,r);return JSON.parse(s.cacheDevice.get(u(t,a,n))??JSON.stringify(C))},N=(s,t,e)=>{v({},s,t,e)};exports.getFilePath=k;exports.getHinkalCache=D;exports.getInHinkalAddressesCache=O;exports.getInHinkalAddressesFilePath=u;exports.loadTxsCache=w;exports.resetCache=S;exports.resetInHinkalAddressesCache=N;exports.saveTxsCache=f;exports.setHinkalCache=x;exports.setInHinkalAddressesCache=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../../types/ethereum-network.types.cjs"),y=require("./getDataFromTransaction.cjs"),A=require("idb-keyval"),T=require("../../constants/chains.constants.cjs"),x=require("./getContractAddress.cjs"),C={encryptedOutputs:[],lastOutput:""},o=(s,e)=>{const t=s.substring(0,25),r=e.substring(0,25);return{shortPublicKey:t,shortHinkalAddress:r}},k=(s,e,t)=>`hinkalCache-${s}-${e}-${t}`,S=(s,e,t)=>{const{hinkalAddress:r}=T.networkRegistry[e].contractData;if(!e||!t||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:a}=o(t,r);return JSON.parse(s.cacheDevice.get(k(e,n,a))??JSON.stringify(C))},p=(s,e,t,r)=>{const{hinkalAddress:n}=T.networkRegistry[t].contractData;if(!t||!r||!n)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:c}=o(r,n);e.cacheDevice.set(k(t,a,c),JSON.stringify(s))},f=(s,e,t)=>{p(C,s,e,t)},v=(s,e,t)=>`txsCache-${s}-${e}-${t}`,m=async(s,e,t,r,n,a)=>{if(!e||!t||!r)throw Error("saveTxsCache: incorrect arguments");const{shortPublicKey:c,shortHinkalAddress:i}=o(t,r),l=y.serializeDecodedTxs(s),h=v(e,c,i),g=JSON.stringify({serializedTxs:l,lastHash:n});try{await A.set(h,g)}catch{a.cacheDevice.set(h,g)}},w={serializedTxs:[],lastHash:""},O=async(s,e,t,r)=>{if(!s||!e||!t)throw Error("loadTxsCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:a}=o(e,t),c=v(s,n,a);let i;try{const d=await A.get(c);if(!d)throw new Error("Empty indexedDB cache");i=d}catch{i=r.cacheDevice.get(c)}const{serializedTxs:l,lastHash:h}=JSON.parse(i??JSON.stringify(w));return{decodedTxs:l.map(d=>y.deserializeDecodedTxs(d)),lastHash:h===""?void 0:h}},u=(s,e,t)=>`hinkalApprovalsCache-${s}-${e}-${t}`,D=(s,e,t,r)=>{const n=x.getContractAddress(e.getContract(H.ContractType.HinkalContract,void 0,t));if(!t||!r||!n)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:c}=o(r,n);e.cacheDevice.set(u(t,a,c),JSON.stringify(s))},N=(s,e,t)=>{const r=x.getContractAddress(s.getContract(H.ContractType.HinkalContract,void 0,e));if(!e||!t||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:n,shortHinkalAddress:a}=o(t,r);return JSON.parse(s.cacheDevice.get(u(e,n,a))??JSON.stringify(C))},J=(s,e,t)=>{D({},s,e,t)};exports.getFilePath=k;exports.getHinkalCache=S;exports.getInHinkalAddressesCache=N;exports.getInHinkalAddressesFilePath=u;exports.loadTxsCache=O;exports.resetCache=f;exports.resetInHinkalAddressesCache=J;exports.saveTxsCache=m;exports.setHinkalCache=p;exports.setInHinkalAddressesCache=D;
@@ -11,7 +11,7 @@ export declare const setHinkalCache: (hinkalCache: HinkalCacheInterface, hinkal:
11
11
  export declare const resetCache: (hinkal: IHinkal, chainId: number, shieldedPublicKey: string) => void;
12
12
  export declare const saveTxsCache: (txs: DecodedTx[], chainId: number, shieldedPublicKey: string, hinkalAddress: string, lastHash: string, hinkal: IHinkal) => Promise<void>;
13
13
  export declare const loadTxsCache: (chainId: number, shieldedPublicKey: string, hinkalAddress: string, hinkal: IHinkal) => Promise<{
14
- decodedTxs: import("../../types/transactions.types").DecodedTxWithUtxos<bigint, import("ethers").BigNumber>[];
14
+ decodedTxs: import("../../types/transactions.types").DecodedTxWithUtxos<bigint, bigint>[];
15
15
  lastHash: string | undefined;
16
16
  }>;
17
17
  export declare const getInHinkalAddressesFilePath: (chainId: number, shortPublicKey: string, shortHinkalAddress: string) => string;
@@ -1,82 +1,83 @@
1
- import { ContractType as C } from "../../types/ethereum-network.types.mjs";
2
- import { serializeDecodedTxs as p, deserializeDecodedTxs as f } from "./getDataFromTransaction.mjs";
3
- import { set as x, get as A } from "idb-keyval";
1
+ import { ContractType as k } from "../../types/ethereum-network.types.mjs";
2
+ import { serializeDecodedTxs as f, deserializeDecodedTxs as A } from "./getDataFromTransaction.mjs";
3
+ import { set as x, get as D } from "idb-keyval";
4
4
  import { networkRegistry as H } from "../../constants/chains.constants.mjs";
5
- const k = {
5
+ import { getContractAddress as u } from "./getContractAddress.mjs";
6
+ const C = {
6
7
  encryptedOutputs: [],
7
8
  lastOutput: ""
8
- }, a = (e, s) => {
9
- const t = e.substring(0, 25), r = s.substring(0, 25);
10
- return { shortPublicKey: t, shortHinkalAddress: r };
11
- }, u = (e, s, t) => `hinkalCache-${e}-${s}-${t}`, N = (e, s, t) => {
12
- const { hinkalAddress: r } = H[s].contractData;
13
- if (!s || !t || !r)
9
+ }, a = (s, r) => {
10
+ const t = s.substring(0, 25), e = r.substring(0, 25);
11
+ return { shortPublicKey: t, shortHinkalAddress: e };
12
+ }, y = (s, r, t) => `hinkalCache-${s}-${r}-${t}`, E = (s, r, t) => {
13
+ const { hinkalAddress: e } = H[r].contractData;
14
+ if (!r || !t || !e)
14
15
  throw Error("GetHinkalCache: incorrect arguments");
15
- const { shortPublicKey: c, shortHinkalAddress: n } = a(t, r);
16
+ const { shortPublicKey: c, shortHinkalAddress: n } = a(t, e);
16
17
  return JSON.parse(
17
- e.cacheDevice.get(u(s, c, n)) ?? JSON.stringify(k)
18
+ s.cacheDevice.get(y(r, c, n)) ?? JSON.stringify(C)
18
19
  );
19
- }, D = (e, s, t, r) => {
20
+ }, S = (s, r, t, e) => {
20
21
  const { hinkalAddress: c } = H[t].contractData;
21
- if (!t || !r || !c)
22
+ if (!t || !e || !c)
22
23
  throw Error("SetHinkalCache: incorrect arguments");
23
- const { shortPublicKey: n, shortHinkalAddress: o } = a(r, c);
24
- s.cacheDevice.set(u(t, n, o), JSON.stringify(e));
25
- }, $ = (e, s, t) => {
26
- D(k, e, s, t);
27
- }, y = (e, s, t) => `txsCache-${e}-${s}-${t}`, E = async (e, s, t, r, c, n) => {
28
- if (!s || !t || !r)
24
+ const { shortPublicKey: n, shortHinkalAddress: o } = a(e, c);
25
+ r.cacheDevice.set(y(t, n, o), JSON.stringify(s));
26
+ }, z = (s, r, t) => {
27
+ S(C, s, r, t);
28
+ }, m = (s, r, t) => `txsCache-${s}-${r}-${t}`, b = async (s, r, t, e, c, n) => {
29
+ if (!r || !t || !e)
29
30
  throw Error("saveTxsCache: incorrect arguments");
30
- const { shortPublicKey: o, shortHinkalAddress: i } = a(t, r), l = p(e), h = y(s, o, i), g = JSON.stringify({ serializedTxs: l, lastHash: c });
31
+ const { shortPublicKey: o, shortHinkalAddress: i } = a(t, e), d = f(s), h = m(r, o, i), g = JSON.stringify({ serializedTxs: d, lastHash: c });
31
32
  try {
32
33
  await x(h, g);
33
34
  } catch {
34
35
  n.cacheDevice.set(h, g);
35
36
  }
36
- }, S = { serializedTxs: [], lastHash: "" }, z = async (e, s, t, r) => {
37
- if (!e || !s || !t)
37
+ }, T = { serializedTxs: [], lastHash: "" }, P = async (s, r, t, e) => {
38
+ if (!s || !r || !t)
38
39
  throw Error("loadTxsCache: incorrect arguments");
39
- const { shortPublicKey: c, shortHinkalAddress: n } = a(s, t), o = y(e, c, n);
40
+ const { shortPublicKey: c, shortHinkalAddress: n } = a(r, t), o = m(s, c, n);
40
41
  let i;
41
42
  try {
42
- const d = await A(o);
43
- if (!d)
43
+ const l = await D(o);
44
+ if (!l)
44
45
  throw new Error("Empty indexedDB cache");
45
- i = d;
46
+ i = l;
46
47
  } catch {
47
- i = r.cacheDevice.get(o);
48
+ i = e.cacheDevice.get(o);
48
49
  }
49
- const { serializedTxs: l, lastHash: h } = JSON.parse(i ?? JSON.stringify(S));
50
- return { decodedTxs: l.map((d) => f(d)), lastHash: h === "" ? void 0 : h };
51
- }, m = (e, s, t) => `hinkalApprovalsCache-${e}-${s}-${t}`, T = (e, s, t, r) => {
52
- const c = s.getContract(C.HinkalContract, void 0, t).address;
53
- if (!t || !r || !c)
50
+ const { serializedTxs: d, lastHash: h } = JSON.parse(i ?? JSON.stringify(T));
51
+ return { decodedTxs: d.map((l) => A(l)), lastHash: h === "" ? void 0 : h };
52
+ }, p = (s, r, t) => `hinkalApprovalsCache-${s}-${r}-${t}`, v = (s, r, t, e) => {
53
+ const c = u(r.getContract(k.HinkalContract, void 0, t));
54
+ if (!t || !e || !c)
54
55
  throw Error("SetHinkalCache: incorrect arguments");
55
- const { shortPublicKey: n, shortHinkalAddress: o } = a(r, c);
56
- s.cacheDevice.set(
57
- m(t, n, o),
58
- JSON.stringify(e)
56
+ const { shortPublicKey: n, shortHinkalAddress: o } = a(e, c);
57
+ r.cacheDevice.set(
58
+ p(t, n, o),
59
+ JSON.stringify(s)
59
60
  );
60
- }, b = (e, s, t) => {
61
- const r = e.getContract(C.HinkalContract, void 0, s).address;
62
- if (!s || !t || !r)
61
+ }, K = (s, r, t) => {
62
+ const e = u(s.getContract(k.HinkalContract, void 0, r));
63
+ if (!r || !t || !e)
63
64
  throw Error("GetHinkalCache: incorrect arguments");
64
- const { shortPublicKey: c, shortHinkalAddress: n } = a(t, r);
65
+ const { shortPublicKey: c, shortHinkalAddress: n } = a(t, e);
65
66
  return JSON.parse(
66
- e.cacheDevice.get(m(s, c, n)) ?? JSON.stringify(k)
67
+ s.cacheDevice.get(p(r, c, n)) ?? JSON.stringify(C)
67
68
  );
68
- }, P = (e, s, t) => {
69
- T({}, e, s, t);
69
+ }, B = (s, r, t) => {
70
+ v({}, s, r, t);
70
71
  };
71
72
  export {
72
- u as getFilePath,
73
- N as getHinkalCache,
74
- b as getInHinkalAddressesCache,
75
- m as getInHinkalAddressesFilePath,
76
- z as loadTxsCache,
77
- $ as resetCache,
78
- P as resetInHinkalAddressesCache,
79
- E as saveTxsCache,
80
- D as setHinkalCache,
81
- T as setInHinkalAddressesCache
73
+ y as getFilePath,
74
+ E as getHinkalCache,
75
+ K as getInHinkalAddressesCache,
76
+ p as getInHinkalAddressesFilePath,
77
+ P as loadTxsCache,
78
+ z as resetCache,
79
+ B as resetInHinkalAddressesCache,
80
+ b as saveTxsCache,
81
+ S as setHinkalCache,
82
+ v as setInHinkalAddressesCache
82
83
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),B=require("../../constants/chains.constants.cjs"),d=(s,o,n)=>{const{hinkalAddress:l}=B.networkRegistry[n].contractData,t=e.ethers.utils.arrayify(s),a=t.slice(0,20),c=t.slice(20,21),r=t.slice(21,37),i=t.slice(37),[u,y,v,m]=[a,r,c,i].map(p=>e.ethers.utils.hexlify(p));return{from:BigInt(v)>0?o:l,to:u,value:BigInt(y),calldata:m}};exports.convertEmporiumOpToCallInfo=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),p=require("../../constants/chains.constants.cjs"),d=(o,s,n)=>{const{hinkalAddress:c}=p.networkRegistry[n].contractData,t=e.ethers.getBytes(o),l=t.slice(0,20),a=t.slice(20,21),r=t.slice(21,37),i=t.slice(37),[u,y,v,B]=[l,r,a,i].map(m=>e.ethers.hexlify(m));return{from:BigInt(v)>0?s:c,to:u,value:BigInt(y),calldata:B}};exports.convertEmporiumOpToCallInfo=d;
@@ -1,11 +1,11 @@
1
1
  import { ethers as e } from "ethers";
2
2
  import { networkRegistry as f } from "../../constants/chains.constants.mjs";
3
- const k = (o, s, l) => {
4
- const { hinkalAddress: a } = f[l].contractData, t = e.utils.arrayify(o), n = t.slice(0, 20), c = t.slice(20, 21), i = t.slice(21, 37), r = t.slice(37), [y, m, p, u] = [n, i, c, r].map(
5
- (B) => e.utils.hexlify(B)
3
+ const g = (o, s, l) => {
4
+ const { hinkalAddress: n } = f[l].contractData, t = e.getBytes(o), a = t.slice(0, 20), c = t.slice(20, 21), r = t.slice(21, 37), i = t.slice(37), [m, y, B, p] = [a, r, c, i].map(
5
+ (v) => e.hexlify(v)
6
6
  );
7
- return { from: BigInt(p) > 0 ? s : a, to: y, value: BigInt(m), calldata: u };
7
+ return { from: BigInt(B) > 0 ? s : n, to: m, value: BigInt(y), calldata: p };
8
8
  };
9
9
  export {
10
- k as convertEmporiumOpToCallInfo
10
+ g as convertEmporiumOpToCallInfo
11
11
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../providers/CustomSolanaConnection.cjs"),n=require("../../providers/CustomEthersProvider.cjs"),o=require("ethers"),s=e=>new o.ethers.providers.JsonRpcProvider(e),c=e=>{const r=new n.CustomEthersProvider(e);return new o.ethers.providers.Web3Provider(r)},i=(e,r="confirmed")=>new t.CustomSolanaConnection(e,r);exports.createCustomRpcProvider=c;exports.createCustomSolanaConnection=i;exports.createProvider=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../providers/CustomSolanaConnection.cjs"),n=require("../../providers/CustomEthersProvider.cjs"),o=require("ethers"),s=e=>new o.ethers.JsonRpcProvider(e),c=e=>{const r=new n.CustomEthersProvider(e);return new o.ethers.BrowserProvider(r)},i=(e,r="confirmed")=>new t.CustomSolanaConnection(e,r);exports.createCustomRpcProvider=c;exports.createCustomSolanaConnection=i;exports.createProvider=s;
@@ -1,6 +1,6 @@
1
1
  import { CustomSolanaConnection } from '../../providers/CustomSolanaConnection';
2
2
  import { Commitment, ConnectionConfig } from '@solana/web3.js';
3
3
  import { ethers } from 'ethers';
4
- export declare const createProvider: (rpcUrl: string) => ethers.providers.JsonRpcProvider;
5
- export declare const createCustomRpcProvider: (rpcUrl: string) => ethers.providers.Web3Provider;
4
+ export declare const createProvider: (rpcUrl: string) => ethers.JsonRpcProvider;
5
+ export declare const createCustomRpcProvider: (rpcUrl: string) => ethers.BrowserProvider;
6
6
  export declare const createCustomSolanaConnection: (endpoint: string, commitmentOrConfig?: Commitment | ConnectionConfig) => CustomSolanaConnection;
@@ -1,12 +1,12 @@
1
1
  import { CustomSolanaConnection as t } from "../../providers/CustomSolanaConnection.mjs";
2
2
  import { CustomEthersProvider as n } from "../../providers/CustomEthersProvider.mjs";
3
3
  import { ethers as e } from "ethers";
4
- const m = (r) => new e.providers.JsonRpcProvider(r), d = (r) => {
4
+ const m = (r) => new e.JsonRpcProvider(r), u = (r) => {
5
5
  const o = new n(r);
6
- return new e.providers.Web3Provider(o);
7
- }, p = (r, o = "confirmed") => new t(r, o);
6
+ return new e.BrowserProvider(o);
7
+ }, a = (r, o = "confirmed") => new t(r, o);
8
8
  export {
9
- d as createCustomRpcProvider,
10
- p as createCustomSolanaConnection,
9
+ u as createCustomRpcProvider,
10
+ a as createCustomSolanaConnection,
11
11
  m as createProvider
12
12
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("node-forge"),m=require("../snarkjs/constant.cjs"),a=require("ethers"),o=require("libsodium-wrappers"),h=require("../../data-structures/http/HttpClient.cjs");require("axios");function b(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const c=b(l),f=214,p=async()=>{const t=(await h.httpClient.get(`${m.ENCLAVE_EC2_URL}/handshake`)).public_key,n=c.util.decode64(t),r=c.asn1.fromDer(n);return c.pki.publicKeyFromAsn1(r)},i=e=>typeof e=="bigint"||typeof e=="number"?e.toString():e,y=e=>c.util.hexToBytes(e.replace("0x","")),E=e=>{const t=structuredClone(e);return Object.entries(t).forEach(([n,r])=>{t[n]=i(r),Array.isArray(r)&&(Array.isArray(r[0])?t[n]=r.map(s=>s.map(i)):t[n]=r.map(i))}),t},k=(e,t)=>{const n=a.ethers.utils.hexlify(t).slice(2),r=y(n);if(r.length>f)throw new Error("too many bytes passed to assymetric_encrypt");const s=e.encrypt(r,"RSA-OAEP",{md:c.md.sha1.create(),mgf1:{md:c.md.sha1.create()},label:null});return c.util.encode64(s)},A=(e,t)=>{const n=o.randombytes_buf(o.crypto_secretbox_NONCEBYTES),r=o.crypto_secretbox_easy(t,n,e),s=a.ethers.utils.hexlify(n)+a.ethers.utils.hexlify(r).slice(2),d=y(s);return c.util.encode64(d)},u=(e,t)=>{const n=o.randombytes_buf(o.crypto_secretbox_KEYBYTES),r=k(t,n),s=A(n,e);return{keyCiphertext:r,inputCiphertext:s}},g=(e,t)=>{const n=E(e),r=JSON.stringify(n),s=new TextEncoder().encode(r);return u(s,t)},x=async e=>{const t=await p();return g(e,t)},_=async e=>{const t=await p();return u(e,t)};exports.makeEnclaveHandshakeAndEncryptInput=x;exports.makeEnclaveHandshakeAndEncryptUint8Array=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("node-forge"),m=require("../snarkjs/constant.cjs"),a=require("ethers"),o=require("libsodium-wrappers"),h=require("../../data-structures/http/HttpClient.cjs");require("axios");function b(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const s=b(l),f=214,p=async()=>{const t=(await h.httpClient.get(`${m.ENCLAVE_EC2_URL}/handshake`)).public_key,n=s.util.decode64(t),r=s.asn1.fromDer(n);return s.pki.publicKeyFromAsn1(r)},i=e=>typeof e=="bigint"||typeof e=="number"?e.toString():e,y=e=>s.util.hexToBytes(e.replace("0x","")),E=e=>{const t=structuredClone(e);return Object.entries(t).forEach(([n,r])=>{t[n]=i(r),Array.isArray(r)&&(Array.isArray(r[0])?t[n]=r.map(c=>c.map(i)):t[n]=r.map(i))}),t},k=(e,t)=>{const n=a.ethers.hexlify(t).slice(2),r=y(n);if(r.length>f)throw new Error("too many bytes passed to assymetric_encrypt");const c=e.encrypt(r,"RSA-OAEP",{md:s.md.sha1.create(),mgf1:{md:s.md.sha1.create()},label:null});return s.util.encode64(c)},A=(e,t)=>{const n=o.randombytes_buf(o.crypto_secretbox_NONCEBYTES),r=o.crypto_secretbox_easy(t,n,e),c=a.ethers.hexlify(n)+a.ethers.hexlify(r).slice(2),d=y(c);return s.util.encode64(d)},u=(e,t)=>{const n=o.randombytes_buf(o.crypto_secretbox_KEYBYTES),r=k(t,n),c=A(n,e);return{keyCiphertext:r,inputCiphertext:c}},g=(e,t)=>{const n=E(e),r=JSON.stringify(n),c=new TextEncoder().encode(r);return u(c,t)},x=async e=>{const t=await p();return g(e,t)},_=async e=>{const t=await p();return u(e,t)};exports.makeEnclaveHandshakeAndEncryptInput=x;exports.makeEnclaveHandshakeAndEncryptUint8Array=_;
@@ -1,20 +1,20 @@
1
1
  import * as s from "node-forge";
2
- import { ENCLAVE_EC2_URL as d } from "../snarkjs/constant.mjs";
2
+ import { ENCLAVE_EC2_URL as u } from "../snarkjs/constant.mjs";
3
3
  import { ethers as a } from "ethers";
4
4
  import c from "libsodium-wrappers";
5
5
  import { httpClient as h } from "../../data-structures/http/HttpClient.mjs";
6
6
  import "axios";
7
- const l = 214, p = async () => {
8
- const e = (await h.get(`${d}/handshake`)).public_key, r = s.util.decode64(e), n = s.asn1.fromDer(r);
7
+ const f = 214, p = async () => {
8
+ const e = (await h.get(`${u}/handshake`)).public_key, r = s.util.decode64(e), n = s.asn1.fromDer(r);
9
9
  return s.pki.publicKeyFromAsn1(n);
10
- }, i = (t) => typeof t == "bigint" || typeof t == "number" ? t.toString() : t, y = (t) => s.util.hexToBytes(t.replace("0x", "")), f = (t) => {
10
+ }, i = (t) => typeof t == "bigint" || typeof t == "number" ? t.toString() : t, y = (t) => s.util.hexToBytes(t.replace("0x", "")), l = (t) => {
11
11
  const e = structuredClone(t);
12
12
  return Object.entries(e).forEach(([r, n]) => {
13
13
  e[r] = i(n), Array.isArray(n) && (Array.isArray(n[0]) ? e[r] = n.map((o) => o.map(i)) : e[r] = n.map(i));
14
14
  }), e;
15
15
  }, E = (t, e) => {
16
- const r = a.utils.hexlify(e).slice(2), n = y(r);
17
- if (n.length > l)
16
+ const r = a.hexlify(e).slice(2), n = y(r);
17
+ if (n.length > f)
18
18
  throw new Error("too many bytes passed to assymetric_encrypt");
19
19
  const o = t.encrypt(n, "RSA-OAEP", {
20
20
  md: s.md.sha1.create(),
@@ -23,13 +23,13 @@ const l = 214, p = async () => {
23
23
  });
24
24
  return s.util.encode64(o);
25
25
  }, b = (t, e) => {
26
- const r = c.randombytes_buf(c.crypto_secretbox_NONCEBYTES), n = c.crypto_secretbox_easy(e, r, t), o = a.utils.hexlify(r) + a.utils.hexlify(n).slice(2), u = y(o);
27
- return s.util.encode64(u);
26
+ const r = c.randombytes_buf(c.crypto_secretbox_NONCEBYTES), n = c.crypto_secretbox_easy(e, r, t), o = a.hexlify(r) + a.hexlify(n).slice(2), d = y(o);
27
+ return s.util.encode64(d);
28
28
  }, m = (t, e) => {
29
29
  const r = c.randombytes_buf(c.crypto_secretbox_KEYBYTES), n = E(e, r), o = b(r, t);
30
30
  return { keyCiphertext: n, inputCiphertext: o };
31
31
  }, x = (t, e) => {
32
- const r = f(t), n = JSON.stringify(r), o = new TextEncoder().encode(n);
32
+ const r = l(t), n = JSON.stringify(r), o = new TextEncoder().encode(n);
33
33
  return m(o, e);
34
34
  }, g = async (t) => {
35
35
  const e = await p();
@@ -1,4 +1,4 @@
1
- import { ethers as ethersV6 } from 'ethers-v6h';
1
+ import { ethers as ethersV6 } from 'ethers';
2
2
  import { RelayerTransaction } from '../../types/relayer.types';
3
3
  import { Connection } from '@solana/web3.js';
4
4
  export declare const convertV6ReceiptToRelayer: (v6Receipt: ethersV6.TransactionReceipt) => RelayerTransaction;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("ethers"),i=require("../../constants/protocol.constants.cjs"),e=require("../../types/external-action.types.cjs"),n=t=>t===0n?0n:BigInt(o.ethers.utils.id(t))%i.CIRCOM_P,s=t=>BigInt(t)===0n?e.ExternalActionId.Transact:Object.values(e.ExternalActionId).find(r=>BigInt(t)===n(r));exports.getExternalActionIdFromNumber=s;exports.getExternalActionIdHash=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("ethers"),i=require("../../constants/protocol.constants.cjs"),e=require("../../types/external-action.types.cjs"),n=t=>t===0n?0n:BigInt(o.ethers.id(t))%i.CIRCOM_P,c=t=>BigInt(t)===0n?e.ExternalActionId.Transact:Object.values(e.ExternalActionId).find(r=>BigInt(t)===n(r));exports.getExternalActionIdFromNumber=c;exports.getExternalActionIdHash=n;
@@ -1,10 +1,10 @@
1
1
  import { ethers as i } from "ethers";
2
2
  import { CIRCOM_P as o } from "../../constants/protocol.constants.mjs";
3
3
  import { ExternalActionId as r } from "../../types/external-action.types.mjs";
4
- const e = (t) => t === 0n ? 0n : BigInt(i.utils.id(t)) % o, u = (t) => BigInt(t) === 0n ? r.Transact : Object.values(r).find(
4
+ const e = (t) => t === 0n ? 0n : BigInt(i.id(t)) % o, a = (t) => BigInt(t) === 0n ? r.Transact : Object.values(r).find(
5
5
  (n) => BigInt(t) === e(n)
6
6
  );
7
7
  export {
8
- u as getExternalActionIdFromNumber,
8
+ a as getExternalActionIdFromNumber,
9
9
  e as getExternalActionIdHash
10
10
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=r=>{const{target:t}=r;if(typeof t!="string")throw new Error("ENS contract addresses not supported");return t};exports.getContractAddress=e;
@@ -0,0 +1,2 @@
1
+ import { ethers } from 'ethers';
2
+ export declare const getContractAddress: (contract: ethers.BaseContract) => string;
@@ -0,0 +1,9 @@
1
+ const e = (r) => {
2
+ const { target: t } = r;
3
+ if (typeof t != "string")
4
+ throw new Error("ENS contract addresses not supported");
5
+ return t;
6
+ };
7
+ export {
8
+ e as getContractAddress
9
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("ethers"),c=(e,r)=>{const a=e.parseTransaction({data:r}),{circomData:t}=a.args,{extraRandomization:s,stealthAddress:d,H0:o,H1:u}=t.stealthAddressStructure;return{erc20TokenAddresses:t.erc20TokenAddresses,amountChanges:t.amountChanges,flatFees:t.flatFees,externalActionId:t.externalActionId,externalActionMetadata:t.externalActionMetadata,encryptedOutputs:t.encryptedOutputs.map(i=>i[0]),hookData:t.hookData,stealthAddressStructure:{extraRandomization:s.toBigInt(),stealthAddress:d.toBigInt(),H0:o.toBigInt(),H1:u.toBigInt()}}},l=e=>({...e,utxosArray:e.utxosArray?.map(r=>({...r,amount:BigInt(r.amount)})),decodedInput:{...e.decodedInput,amountChanges:e.decodedInput.amountChanges.map(n.BigNumber.from),flatFees:e.decodedInput.flatFees.map(n.BigNumber.from),externalActionId:n.BigNumber.from(e.decodedInput.externalActionId),stealthAddressStructure:{...e.decodedInput.stealthAddressStructure,extraRandomization:BigInt(e.decodedInput.stealthAddressStructure.extraRandomization),stealthAddress:BigInt(e.decodedInput.stealthAddressStructure.stealthAddress),H0:BigInt(e.decodedInput.stealthAddressStructure.H0),H1:BigInt(e.decodedInput.stealthAddressStructure.H1)}}}),A=e=>e.map(a=>{const{decodedInput:t}=a;return{...a,input:"",decodedInput:{...t,amountChanges:t.amountChanges.map(s=>s.toString()),flatFees:t.flatFees.map(s=>s.toString()),externalActionId:t.externalActionId.toString(),stealthAddressStructure:{...t.stealthAddressStructure,extraRandomization:String(t.stealthAddressStructure.extraRandomization),stealthAddress:String(t.stealthAddressStructure.stealthAddress),H0:String(t.stealthAddressStructure.H0),H1:String(t.stealthAddressStructure.H1)}}}});exports.decodeTxInput=c;exports.deserializeDecodedTxs=l;exports.serializeDecodedTxs=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=t=>({...t,utxosArray:t.utxosArray?.map(s=>({...s,amount:BigInt(s.amount)})),decodedInput:{...t.decodedInput,amountChanges:t.decodedInput.amountChanges.map(BigInt),flatFees:t.decodedInput.flatFees.map(BigInt),externalActionId:BigInt(t.decodedInput.externalActionId),stealthAddressStructure:{...t.decodedInput.stealthAddressStructure,extraRandomization:BigInt(t.decodedInput.stealthAddressStructure.extraRandomization),stealthAddress:BigInt(t.decodedInput.stealthAddressStructure.stealthAddress),H0:BigInt(t.decodedInput.stealthAddressStructure.H0),H1:BigInt(t.decodedInput.stealthAddressStructure.H1)}}}),d=t=>t.map(n=>{const{decodedInput:e}=n;return{...n,input:"",decodedInput:{...e,amountChanges:e.amountChanges.map(r=>r.toString()),flatFees:e.flatFees.map(r=>r.toString()),externalActionId:e.externalActionId.toString(),stealthAddressStructure:{...e.stealthAddressStructure,extraRandomization:String(e.stealthAddressStructure.extraRandomization),stealthAddress:String(e.stealthAddressStructure.stealthAddress),H0:String(e.stealthAddressStructure.H0),H1:String(e.stealthAddressStructure.H1)}}}});exports.deserializeDecodedTxs=a;exports.serializeDecodedTxs=d;
@@ -1,15 +1,4 @@
1
- import { BigNumber, utils } from 'ethers';
2
1
  import { DecodedTx, DecodedTxWithUtxos } from '../../types';
3
- export declare const decodeTxInput: (iface: utils.Interface, input: string) => {
4
- erc20TokenAddresses: string[];
5
- amountChanges: BigNumber[];
6
- flatFees: BigNumber[];
7
- externalActionId: BigNumber;
8
- externalActionMetadata: string;
9
- encryptedOutputs: string[];
10
- hookData: import('../../types/circom-data.types').HookDataType;
11
- stealthAddressStructure: import('../../types/circom-data.types').StealthAddressStructure<bigint>;
12
- };
13
2
  export declare const deserializeDecodedTxs: (decodedTx: DecodedTxWithUtxos<string, string>) => DecodedTxWithUtxos;
14
3
  export declare const serializeDecodedTxs: (decodedTxs: DecodedTx[]) => {
15
4
  input: string;