@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
@@ -1,64 +1,40 @@
1
- import { BigNumber as n } from "ethers";
2
- const A = (e, a) => {
3
- const s = e.parseTransaction({ data: a }), { circomData: t } = s.args, {
4
- extraRandomization: r,
5
- stealthAddress: d,
6
- H0: o,
7
- H1: u
8
- } = t.stealthAddressStructure;
9
- return {
10
- erc20TokenAddresses: t.erc20TokenAddresses,
11
- amountChanges: t.amountChanges,
12
- flatFees: t.flatFees,
13
- externalActionId: t.externalActionId,
14
- externalActionMetadata: t.externalActionMetadata,
15
- encryptedOutputs: t.encryptedOutputs.map((i) => i[0]),
16
- hookData: t.hookData,
17
- stealthAddressStructure: {
18
- extraRandomization: r.toBigInt(),
19
- stealthAddress: d.toBigInt(),
20
- H0: o.toBigInt(),
21
- H1: u.toBigInt()
22
- }
23
- };
24
- }, p = (e) => ({
25
- ...e,
26
- utxosArray: e.utxosArray?.map((a) => ({ ...a, amount: BigInt(a.amount) })),
1
+ const a = (t) => ({
2
+ ...t,
3
+ utxosArray: t.utxosArray?.map((r) => ({ ...r, amount: BigInt(r.amount) })),
27
4
  decodedInput: {
28
- ...e.decodedInput,
29
- amountChanges: e.decodedInput.amountChanges.map(n.from),
30
- flatFees: e.decodedInput.flatFees.map(n.from),
31
- externalActionId: n.from(e.decodedInput.externalActionId),
5
+ ...t.decodedInput,
6
+ amountChanges: t.decodedInput.amountChanges.map(BigInt),
7
+ flatFees: t.decodedInput.flatFees.map(BigInt),
8
+ externalActionId: BigInt(t.decodedInput.externalActionId),
32
9
  stealthAddressStructure: {
33
- ...e.decodedInput.stealthAddressStructure,
34
- extraRandomization: BigInt(e.decodedInput.stealthAddressStructure.extraRandomization),
35
- stealthAddress: BigInt(e.decodedInput.stealthAddressStructure.stealthAddress),
36
- H0: BigInt(e.decodedInput.stealthAddressStructure.H0),
37
- H1: BigInt(e.decodedInput.stealthAddressStructure.H1)
10
+ ...t.decodedInput.stealthAddressStructure,
11
+ extraRandomization: BigInt(t.decodedInput.stealthAddressStructure.extraRandomization),
12
+ stealthAddress: BigInt(t.decodedInput.stealthAddressStructure.stealthAddress),
13
+ H0: BigInt(t.decodedInput.stealthAddressStructure.H0),
14
+ H1: BigInt(t.decodedInput.stealthAddressStructure.H1)
38
15
  }
39
16
  }
40
- }), h = (e) => e.map((s) => {
41
- const { decodedInput: t } = s;
17
+ }), d = (t) => t.map((n) => {
18
+ const { decodedInput: e } = n;
42
19
  return {
43
- ...s,
20
+ ...n,
44
21
  input: "",
45
22
  decodedInput: {
46
- ...t,
47
- amountChanges: t.amountChanges.map((r) => r.toString()),
48
- flatFees: t.flatFees.map((r) => r.toString()),
49
- externalActionId: t.externalActionId.toString(),
23
+ ...e,
24
+ amountChanges: e.amountChanges.map((s) => s.toString()),
25
+ flatFees: e.flatFees.map((s) => s.toString()),
26
+ externalActionId: e.externalActionId.toString(),
50
27
  stealthAddressStructure: {
51
- ...t.stealthAddressStructure,
52
- extraRandomization: String(t.stealthAddressStructure.extraRandomization),
53
- stealthAddress: String(t.stealthAddressStructure.stealthAddress),
54
- H0: String(t.stealthAddressStructure.H0),
55
- H1: String(t.stealthAddressStructure.H1)
28
+ ...e.stealthAddressStructure,
29
+ extraRandomization: String(e.stealthAddressStructure.extraRandomization),
30
+ stealthAddress: String(e.stealthAddressStructure.stealthAddress),
31
+ H0: String(e.stealthAddressStructure.H0),
32
+ H1: String(e.stealthAddressStructure.H1)
56
33
  }
57
34
  }
58
35
  };
59
36
  });
60
37
  export {
61
- A as decodeTxInput,
62
- p as deserializeDecodedTxs,
63
- h as serializeDecodedTxs
38
+ a as deserializeDecodedTxs,
39
+ d as serializeDecodedTxs
64
40
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../constants/protocol.constants.cjs");require("ethers");require("@solana/web3.js");require("circomlibjs-hinkal-fork");require("../../constants/chains.constants.cjs");const y=require("../../data-structures/utxo/Utxo.cjs"),s=require("../../data-structures/crypto-keys/keys.cjs");require("libsodium-wrappers");const a=o=>{const e=o.getShieldedPrivateKey(),n=s.UserKeys.getEncryptionKeyPair(e).publicKey,t=new y.Utxo({amount:0n,erc20TokenAddress:u.zeroAddress,shieldedPrivateKey:e}),{randomization:r}=t,i=t.getStealthAddress(),{h0:c,h1:d}=s.UserKeys.getStealthAddressCompressedPoints(r,e);return`${r},${i},${n},${c},${d}`};exports.getRecipientInfoFromUserKeys=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../constants/protocol.constants.cjs");require("@solana/web3.js");require("ethers");require("circomlibjs-hinkal-fork");require("../../constants/chains.constants.cjs");const y=require("../../data-structures/utxo/Utxo.cjs"),s=require("../../data-structures/crypto-keys/keys.cjs");require("libsodium-wrappers");const a=o=>{const e=o.getShieldedPrivateKey(),n=s.UserKeys.getEncryptionKeyPair(e).publicKey,t=new y.Utxo({amount:0n,erc20TokenAddress:u.zeroAddress,shieldedPrivateKey:e}),{randomization:r}=t,i=t.getStealthAddress(),{h0:c,h1:d}=s.UserKeys.getStealthAddressCompressedPoints(r,e);return`${r},${i},${n},${c},${d}`};exports.getRecipientInfoFromUserKeys=a;
@@ -1,6 +1,6 @@
1
1
  import { zeroAddress as p } from "../../constants/protocol.constants.mjs";
2
- import "ethers";
3
2
  import "@solana/web3.js";
3
+ import "ethers";
4
4
  import "circomlibjs-hinkal-fork";
5
5
  import "../../constants/chains.constants.mjs";
6
6
  import { Utxo as c } from "../../data-structures/utxo/Utxo.mjs";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ethers"),o=e=>{const{runner:r}=e;if(!(r instanceof t.ethers.AbstractSigner))throw new Error("expected signer");return r},n=e=>{const{runner:r}=e;if(!r)throw new Error("expected provider");return r.provider??r};exports.getProviderFromContract=n;exports.getSignerFromContract=o;
@@ -0,0 +1,3 @@
1
+ import { ethers } from 'ethers';
2
+ export declare const getSignerFromContract: (contract: ethers.Contract) => ethers.AbstractSigner<any>;
3
+ export declare const getProviderFromContract: (contract: ethers.Contract) => ethers.Provider;
@@ -0,0 +1,16 @@
1
+ import { ethers as t } from "ethers";
2
+ const o = (e) => {
3
+ const { runner: r } = e;
4
+ if (!(r instanceof t.AbstractSigner))
5
+ throw new Error("expected signer");
6
+ return r;
7
+ }, c = (e) => {
8
+ const { runner: r } = e;
9
+ if (!r)
10
+ throw new Error("expected provider");
11
+ return r.provider ?? r;
12
+ };
13
+ export {
14
+ c as getProviderFromContract,
15
+ o as getSignerFromContract
16
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../../data-structures/crypto-keys/decodeUTXO.cjs"),i=require("./caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const p=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");const q=require("./amounts.utils.cjs"),y=(o,t,c)=>{const r=t.getContractWithFetcher(p.ContractType.HinkalContract),u=r.interface,a=t.userKeys.getShieldedPrivateKey(),d=t.getCurrentChainId();return o.logs.filter(e=>i.caseInsensitiveEqual(e.address,r.address)).map(e=>{try{const n=u.parseLog(e);if(n.name==="NewCommitment"){const{encryptedOutput:l,index:g}=n.args;if(q.toBigInt(g)<0n){const s=m.decodeUtxo(l,a,d);if(i.caseInsensitiveEqual(s.erc20TokenAddress,c))return s}}}catch{return null}return null}).filter(e=>e!==null)};exports.getUtxosFromReceipt=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../data-structures/crypto-keys/decodeUTXO.cjs"),i=require("./caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const y=require("../../types/ethereum-network.types.cjs");require("../../types/activities.types.cjs");const h=require("./amounts.utils.cjs"),f=async(o,t,c)=>{const r=t.getContractWithFetcher(y.ContractType.HinkalContract),a=r.interface,u=t.userKeys.getShieldedPrivateKey(),d=t.getCurrentChainId(),l=await r.getAddress();return o.logs.filter(e=>i.caseInsensitiveEqual(e.address,l)).map(e=>{try{const n=a.parseLog(e);if(n?.name==="NewCommitment"){const{encryptedOutput:g,index:m}=n.args;if(h.toBigInt(m)<0n){const s=p.decodeUtxo(g,u,d);if(i.caseInsensitiveEqual(s.erc20TokenAddress,c))return s}}}catch{return null}return null}).filter(e=>e!==null)};exports.getUtxosFromReceipt=f;
@@ -1,4 +1,4 @@
1
1
  import { ethers } from 'ethers';
2
2
  import { Utxo } from '../../data-structures/utxo/Utxo';
3
3
  import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
4
- export declare const getUtxosFromReceipt: (receipt: ethers.providers.TransactionReceipt, hinkal: IHinkal, tokenAddress: string) => Utxo[];
4
+ export declare const getUtxosFromReceipt: (receipt: ethers.TransactionReceipt, hinkal: IHinkal, tokenAddress: string) => Promise<Utxo[]>;
@@ -1,21 +1,20 @@
1
- import { decodeUtxo as u } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
2
- import { caseInsensitiveEqual as i } from "./caseInsensitive.utils.mjs";
1
+ import { decodeUtxo as f } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
2
+ import { caseInsensitiveEqual as s } from "./caseInsensitive.utils.mjs";
3
3
  import "../../types/circom-data.types.mjs";
4
- import { ContractType as f } from "../../types/ethereum-network.types.mjs";
5
- import "../../types/transactions.types.mjs";
4
+ import { ContractType as g } from "../../types/ethereum-network.types.mjs";
6
5
  import "../../types/activities.types.mjs";
7
- import { toBigInt as g } from "./amounts.utils.mjs";
8
- const k = (s, e, c) => {
9
- const r = e.getContractWithFetcher(f.HinkalContract), a = r.interface, d = e.userKeys.getShieldedPrivateKey(), m = e.getCurrentChainId();
10
- return s.logs.filter((t) => i(t.address, r.address)).map((t) => {
6
+ import { toBigInt as h } from "./amounts.utils.mjs";
7
+ const A = async (i, e, c) => {
8
+ const r = e.getContractWithFetcher(g.HinkalContract), a = r.interface, d = e.userKeys.getShieldedPrivateKey(), m = e.getCurrentChainId(), l = await r.getAddress();
9
+ return i.logs.filter((t) => s(t.address, l)).map((t) => {
11
10
  try {
12
- const o = a.parseLog(t);
13
- if (o.name === "NewCommitment") {
14
- const { encryptedOutput: p, index: l } = o.args;
15
- if (g(l) < 0n) {
16
- const n = u(p, d, m);
17
- if (i(n.erc20TokenAddress, c))
18
- return n;
11
+ const n = a.parseLog(t);
12
+ if (n?.name === "NewCommitment") {
13
+ const { encryptedOutput: p, index: u } = n.args;
14
+ if (h(u) < 0n) {
15
+ const o = f(p, d, m);
16
+ if (s(o.erc20TokenAddress, c))
17
+ return o;
19
18
  }
20
19
  }
21
20
  } catch {
@@ -25,5 +24,5 @@ const k = (s, e, c) => {
25
24
  }).filter((t) => t !== null);
26
25
  };
27
26
  export {
28
- k as getUtxosFromReceipt
27
+ A as getUtxosFromReceipt
29
28
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("ethers"),s=e=>r.ethers.utils.defaultAbiCoder.encode(["bytes","uint256","address[]","bytes"],[e.signature,e.deadline,e.erc20TokenAddresses,e.externalCallData]);exports.encodeParsedInLogicMetadata=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("ethers"),s=e=>r.ethers.AbiCoder.defaultAbiCoder().encode(["bytes","uint256","address[]","bytes"],[e.signature,e.deadline,e.erc20TokenAddresses,e.externalCallData]);exports.encodeParsedInLogicMetadata=s;
@@ -1,8 +1,8 @@
1
1
  import { ethers as r } from "ethers";
2
- const n = (e) => r.utils.defaultAbiCoder.encode(
2
+ const d = (e) => r.AbiCoder.defaultAbiCoder().encode(
3
3
  ["bytes", "uint256", "address[]", "bytes"],
4
4
  [e.signature, e.deadline, e.erc20TokenAddresses, e.externalCallData]
5
5
  );
6
6
  export {
7
- n as encodeParsedInLogicMetadata
7
+ d as encodeParsedInLogicMetadata
8
8
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../constants/protocol.constants.cjs");require("../../error-handling/error-codes.constants.cjs");require("ethers");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/chains.constants.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("./mutexes.utils.cjs");require("@coral-xyz/anchor");const s=require("../../error-handling/logger.cjs");require("@solana/web3.js");require("../../data-structures/crypto-keys/keys.cjs");const q=u=>{const e={};return u.forEach(({assetInfo:t,id:i})=>{if(o.NFT_TRANSACTION_TYPES.includes(t.standard)&&i)try{if(t?.contractAddress){const r=t.contractAddress.toLowerCase();e[r]||(e[r]=[]),e[r].push(BigInt(i).toString())}}catch(r){s.Logger.error(`Failed to parse tokenId: ${i}`,r)}}),e};exports.extractTokenIdsFromAssetChanges=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../constants/protocol.constants.cjs");require("../../error-handling/error-codes.constants.cjs");require("ethers");require("../../types/circom-data.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../../data-structures/http/HttpClient.cjs");require("axios");require("../../constants/chains.constants.cjs");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/vite.constants.cjs");require("../../constants/save-depths.cjs");require("../../constants/reorg-depths.constants.cjs");require("./mutexes.utils.cjs");require("@coral-xyz/anchor");const s=require("../../error-handling/logger.cjs");require("@solana/web3.js");require("../../data-structures/crypto-keys/keys.cjs");const n=o=>{const e={};return o.forEach(({assetInfo:t,id:i})=>{if(u.NFT_TRANSACTION_TYPES.includes(t.standard)&&i)try{if(t?.contractAddress){const r=t.contractAddress.toLowerCase();e[r]||(e[r]=[]),e[r].push(BigInt(i).toString())}}catch(r){s.Logger.error(`Failed to parse tokenId: ${i}`,r)}}),e};exports.extractTokenIdsFromAssetChanges=n;
@@ -2,7 +2,6 @@ import { NFT_TRANSACTION_TYPES as p } from "../../constants/protocol.constants.m
2
2
  import "../../error-handling/error-codes.constants.mjs";
3
3
  import "ethers";
4
4
  import "../../types/circom-data.types.mjs";
5
- import "../../types/transactions.types.mjs";
6
5
  import "../../types/activities.types.mjs";
7
6
  import "../../constants/server.constants.mjs";
8
7
  import "../../API/getServerURL.mjs";
@@ -21,7 +20,7 @@ import "@coral-xyz/anchor";
21
20
  import { Logger as e } from "../../error-handling/logger.mjs";
22
21
  import "@solana/web3.js";
23
22
  import "../../data-structures/crypto-keys/keys.mjs";
24
- const y = (m) => {
23
+ const w = (m) => {
25
24
  const t = {};
26
25
  return m.forEach(({ assetInfo: o, id: i }) => {
27
26
  if (p.includes(o.standard) && i)
@@ -36,5 +35,5 @@ const y = (m) => {
36
35
  }), t;
37
36
  };
38
37
  export {
39
- y as extractTokenIdsFromAssetChanges
38
+ w as extractTokenIdsFromAssetChanges
40
39
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("ethers"),y=require("../../constants/chains.constants.cjs"),g=require("../../constants/protocol.constants.cjs"),b=require("./erc20tokenFunctions.cjs"),P=require("../../externalABIs/swapAbi.cjs"),m=require("../../error-handling/logger.cjs"),p=require("../../externalABIs/index.cjs"),w=require("./ipfs.cjs"),C=require("./create-provider.cjs"),k=require("../../data-structures/http/HttpClient.cjs");require("axios");const f=require("@solana/web3.js"),d=require("@solana/spl-token"),T=a=>{const{fetchRpcUrl:e}=y.networkRegistry[a];if(!e)throw new Error(`No RPC URL configured for chain ${a}`);return C.createCustomRpcProvider(e)},R=async(a,e,n)=>{try{const s=n.erc20TokenAddress;let r;const o=new B.ethers.Contract(n.erc20TokenAddress,P.ERC20ABI,a);s!==g.zeroAddress?r=await o?.balanceOf(e):r=await o.provider.getBalance(e);const c=r.toBigInt();return c<=0n?null:{token:n,balance:c}}catch{return null}},q=async(a,e)=>{const n=e.nftTokenType===g.TokenType.ERC721,s=new B.ethers.Contract(e.erc20TokenAddress,n?p.ERC721ABI:p.ERC1155ABI,a),{tokenIds:r}=e;if(!r?.length)return null;const o=await Promise.all(r.map(async c=>{try{const t=await s[n?"tokenURI":"uri"](c),l=t.startsWith("ipfs://")?w.getFormattedIpfsUrl(t,!1):t,u=n?l:l.replace("{id}",c);if(u){const i=await k.httpClient.get(u);return i?.image?.startsWith("ipfs://")&&(i.image=w.getFormattedIpfsUrl(i.image,!1)),{image:i.image,tokenId:Number(c),name:i.name}}return{tokenId:Number(c)}}catch{return{tokenId:Number(c)}}}));return{token:e,balance:r?.length?BigInt(r.length):0n,nfts:o}},v=async(a,e,n)=>{const s=n??b.getErc20TokensForChain(a),r=T(a);return(await Promise.all(s.map(async c=>b.isNFTToken(c)?q(r,c):R(r,e,c)))).filter(c=>c!==null)},E=async(a,e,n)=>{try{const s=T(a),r=new B.ethers.Contract(n,P.ERC20ABI,s);let o;return n!==g.zeroAddress?o=await r?.balanceOf(e):o=await s.getBalance(e),o.toBigInt()}catch{return m.Logger.error(`Failed to fetch public balance for address ${e}`),null}},N=async(a,e)=>{try{return await T(a).getTransactionCount(e)}catch(n){return m.Logger.error(`Failed to fetch transaction count for address ${e} on chain ${a}`,n),null}},U=async(a,e,n)=>{const r=y.networkRegistry[a].fetchRpcUrl??"",o=C.createCustomSolanaConnection(r);return(await Promise.all(n.map(async t=>{if(b.isNFTToken(t))return{token:t,balance:1n,nfts:[{image:t.logoURI,tokenId:0,name:t.symbol}]};if(t.erc20TokenAddress===g.solanaNativeAddress){const I=BigInt(await o.getBalance(new f.PublicKey(e)));return{token:t,balance:I}}const l=new f.PublicKey(t.erc20TokenAddress),u=new f.PublicKey(e),i=await d.getAssociatedTokenAddress(l,u,!0,t.is2022Program?d.TOKEN_2022_PROGRAM_ID:d.TOKEN_PROGRAM_ID);if(!await o.getAccountInfo(i))return{token:t,balance:0n};const h=await o.getTokenAccountBalance(i),A=BigInt(h.value.amount);return{token:t,balance:A}}))).filter(t=>t.balance>0n)};exports.getPublicBalance=R;exports.getPublicBalanceByTokenAddress=E;exports.getPublicBalancesOfTokens=v;exports.getPublicTransactionCount=N;exports.getSolanaPublicBalances=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("ethers"),p=require("../../constants/chains.constants.cjs"),g=require("../../constants/protocol.constants.cjs"),d=require("./erc20tokenFunctions.cjs"),P=require("../../externalABIs/swapAbi.cjs"),m=require("../../error-handling/logger.cjs"),w=require("../../externalABIs/index.cjs"),y=require("./ipfs.cjs"),C=require("./create-provider.cjs"),k=require("../../data-structures/http/HttpClient.cjs");require("axios");const f=require("@solana/web3.js"),b=require("@solana/spl-token"),B=n=>{const{fetchRpcUrl:e}=p.networkRegistry[n];if(!e)throw new Error(`No RPC URL configured for chain ${n}`);return C.createCustomRpcProvider(e)},R=async(n,e,t)=>{try{const s=t.erc20TokenAddress;let c;const o=new T.ethers.Contract(t.erc20TokenAddress,P.ERC20ABI,n);s!==g.zeroAddress?c=await o?.balanceOf(e):c=await n.getBalance(e);const r=c;return r<=0n?null:{token:t,balance:r}}catch{return null}},q=async(n,e)=>{const t=e.nftTokenType===g.TokenType.ERC721,s=new T.ethers.Contract(e.erc20TokenAddress,t?w.ERC721ABI:w.ERC1155ABI,n),{tokenIds:c}=e;if(!c?.length)return null;const o=await Promise.all(c.map(async r=>{try{const a=await s[t?"tokenURI":"uri"](r),l=a.startsWith("ipfs://")?y.getFormattedIpfsUrl(a,!1):a,u=t?l:l.replace("{id}",r);if(u){const i=await k.httpClient.get(u);return i?.image?.startsWith("ipfs://")&&(i.image=y.getFormattedIpfsUrl(i.image,!1)),{image:i.image,tokenId:Number(r),name:i.name}}return{tokenId:Number(r)}}catch{return{tokenId:Number(r)}}}));return{token:e,balance:c?.length?BigInt(c.length):0n,nfts:o}},E=async(n,e,t)=>{const s=t??d.getErc20TokensForChain(n),c=B(n);return(await Promise.all(s.map(async r=>d.isNFTToken(r)?q(c,r):R(c,e,r)))).filter(r=>r!==null)},N=async(n,e,t)=>{try{const s=B(n),c=new T.ethers.Contract(t,P.ERC20ABI,s);let o;return t!==g.zeroAddress?o=await c?.balanceOf(e):o=await s.getBalance(e),o}catch{return m.Logger.error(`Failed to fetch public balance for address ${e}`),null}},U=async(n,e)=>{try{return await B(n).getTransactionCount(e)}catch(t){return m.Logger.error(`Failed to fetch transaction count for address ${e} on chain ${n}`,t),null}},v=async(n,e,t)=>{const c=p.networkRegistry[n].fetchRpcUrl??"",o=C.createCustomSolanaConnection(c);return(await Promise.all(t.map(async a=>{if(d.isNFTToken(a))return{token:a,balance:1n,nfts:[{image:a.logoURI,tokenId:0,name:a.symbol}]};if(a.erc20TokenAddress===g.solanaNativeAddress){const I=BigInt(await o.getBalance(new f.PublicKey(e)));return{token:a,balance:I}}const l=new f.PublicKey(a.erc20TokenAddress),u=new f.PublicKey(e),i=await b.getAssociatedTokenAddress(l,u,!0,a.is2022Program?b.TOKEN_2022_PROGRAM_ID:b.TOKEN_PROGRAM_ID);if(!await o.getAccountInfo(i))return{token:a,balance:0n};const h=await o.getTokenAccountBalance(i),A=BigInt(h.value.amount);return{token:a,balance:A}}))).filter(a=>a.balance>0n)};exports.getPublicBalance=R;exports.getPublicBalanceByTokenAddress=N;exports.getPublicBalancesOfTokens=E;exports.getPublicTransactionCount=U;exports.getSolanaPublicBalances=v;
@@ -1,6 +1,6 @@
1
1
  import { ethers } from 'ethers';
2
2
  import { ERC20Token, TokenBalance } from '../../types/token.types';
3
- export declare const getPublicBalance: (provider: ethers.providers.JsonRpcProvider, ethereumAddress: string, token: ERC20Token) => Promise<TokenBalance | null>;
3
+ export declare const getPublicBalance: (provider: ethers.JsonRpcProvider, ethereumAddress: string, token: ERC20Token) => Promise<TokenBalance | null>;
4
4
  export declare const getPublicBalancesOfTokens: (chainId: number, ethereumAddress: string, tokens?: ERC20Token[]) => Promise<TokenBalance[]>;
5
5
  export declare const getPublicBalanceByTokenAddress: (chainId: number, ethereumAddress: string, tokenAddress: string) => Promise<bigint | null>;
6
6
  export declare const getPublicTransactionCount: (chainId: number, ethereumAddress: string) => Promise<number | null>;
@@ -1,42 +1,42 @@
1
1
  import { ethers as m } from "ethers";
2
2
  import { networkRegistry as d } from "../../constants/chains.constants.mjs";
3
- import { zeroAddress as b, solanaNativeAddress as P, TokenType as I } from "../../constants/protocol.constants.mjs";
4
- import { getErc20TokensForChain as h, isNFTToken as w } from "./erc20tokenFunctions.mjs";
3
+ import { zeroAddress as b, solanaNativeAddress as P, TokenType as h } from "../../constants/protocol.constants.mjs";
4
+ import { getErc20TokensForChain as A, isNFTToken as w } from "./erc20tokenFunctions.mjs";
5
5
  import { ERC20ABI as B } from "../../externalABIs/swapAbi.mjs";
6
6
  import { Logger as T } from "../../error-handling/logger.mjs";
7
- import { ERC721ABI as A, ERC1155ABI as v } from "../../externalABIs/index.mjs";
7
+ import { ERC721ABI as I, ERC1155ABI as E } from "../../externalABIs/index.mjs";
8
8
  import { getFormattedIpfsUrl as p } from "./ipfs.mjs";
9
- import { createCustomSolanaConnection as E, createCustomRpcProvider as N } from "./create-provider.mjs";
10
- import { httpClient as U } from "../../data-structures/http/HttpClient.mjs";
9
+ import { createCustomSolanaConnection as N, createCustomRpcProvider as U } from "./create-provider.mjs";
10
+ import { httpClient as k } from "../../data-structures/http/HttpClient.mjs";
11
11
  import "axios";
12
12
  import { PublicKey as u } from "@solana/web3.js";
13
- import { getAssociatedTokenAddress as k, TOKEN_2022_PROGRAM_ID as O, TOKEN_PROGRAM_ID as F } from "@solana/spl-token";
14
- const g = (e) => {
15
- const { fetchRpcUrl: t } = d[e];
13
+ import { getAssociatedTokenAddress as v, TOKEN_2022_PROGRAM_ID as O, TOKEN_PROGRAM_ID as F } from "@solana/spl-token";
14
+ const g = (n) => {
15
+ const { fetchRpcUrl: t } = d[n];
16
16
  if (!t)
17
- throw new Error(`No RPC URL configured for chain ${e}`);
18
- return N(t);
19
- }, _ = async (e, t, n) => {
17
+ throw new Error(`No RPC URL configured for chain ${n}`);
18
+ return U(t);
19
+ }, _ = async (n, t, a) => {
20
20
  try {
21
- const s = n.erc20TokenAddress;
21
+ const s = a.erc20TokenAddress;
22
22
  let r;
23
- const o = new m.Contract(n.erc20TokenAddress, B, e);
24
- s !== b ? r = await o?.balanceOf(t) : r = await o.provider.getBalance(t);
25
- const c = r.toBigInt();
26
- return c <= 0n ? null : { token: n, balance: c };
23
+ const o = new m.Contract(a.erc20TokenAddress, B, n);
24
+ s !== b ? r = await o?.balanceOf(t) : r = await n.getBalance(t);
25
+ const c = r;
26
+ return c <= 0n ? null : { token: a, balance: c };
27
27
  } catch {
28
28
  return null;
29
29
  }
30
- }, $ = async (e, t) => {
31
- const n = t.nftTokenType === I.ERC721, s = new m.Contract(t.erc20TokenAddress, n ? A : v, e), { tokenIds: r } = t;
30
+ }, $ = async (n, t) => {
31
+ const a = t.nftTokenType === h.ERC721, s = new m.Contract(t.erc20TokenAddress, a ? I : E, n), { tokenIds: r } = t;
32
32
  if (!r?.length)
33
33
  return null;
34
34
  const o = await Promise.all(
35
35
  r.map(async (c) => {
36
36
  try {
37
- const a = await s[n ? "tokenURI" : "uri"](c), l = a.startsWith("ipfs://") ? p(a, !1) : a, f = n ? l : l.replace("{id}", c);
37
+ const e = await s[a ? "tokenURI" : "uri"](c), l = e.startsWith("ipfs://") ? p(e, !1) : e, f = a ? l : l.replace("{id}", c);
38
38
  if (f) {
39
- const i = await U.get(f);
39
+ const i = await k.get(f);
40
40
  return i?.image?.startsWith("ipfs://") && (i.image = p(i.image, !1)), { image: i.image, tokenId: Number(c), name: i.name };
41
41
  }
42
42
  return { tokenId: Number(c) };
@@ -50,51 +50,51 @@ const g = (e) => {
50
50
  balance: r?.length ? BigInt(r.length) : 0n,
51
51
  nfts: o
52
52
  };
53
- }, V = async (e, t, n) => {
54
- const s = n ?? h(e), r = g(e);
53
+ }, V = async (n, t, a) => {
54
+ const s = a ?? A(n), r = g(n);
55
55
  return (await Promise.all(
56
56
  s.map(async (c) => w(c) ? $(r, c) : _(r, t, c))
57
57
  )).filter((c) => c !== null);
58
- }, X = async (e, t, n) => {
58
+ }, X = async (n, t, a) => {
59
59
  try {
60
- const s = g(e), r = new m.Contract(n, B, s);
60
+ const s = g(n), r = new m.Contract(a, B, s);
61
61
  let o;
62
- return n !== b ? o = await r?.balanceOf(t) : o = await s.getBalance(t), o.toBigInt();
62
+ return a !== b ? o = await r?.balanceOf(t) : o = await s.getBalance(t), o;
63
63
  } catch {
64
64
  return T.error(`Failed to fetch public balance for address ${t}`), null;
65
65
  }
66
- }, Y = async (e, t) => {
66
+ }, Y = async (n, t) => {
67
67
  try {
68
- return await g(e).getTransactionCount(t);
69
- } catch (n) {
70
- return T.error(`Failed to fetch transaction count for address ${t} on chain ${e}`, n), null;
68
+ return await g(n).getTransactionCount(t);
69
+ } catch (a) {
70
+ return T.error(`Failed to fetch transaction count for address ${t} on chain ${n}`, a), null;
71
71
  }
72
- }, Z = async (e, t, n) => {
73
- const r = d[e].fetchRpcUrl ?? "", o = E(r);
72
+ }, Z = async (n, t, a) => {
73
+ const r = d[n].fetchRpcUrl ?? "", o = N(r);
74
74
  return (await Promise.all(
75
- n.map(async (a) => {
76
- if (w(a))
75
+ a.map(async (e) => {
76
+ if (w(e))
77
77
  return {
78
- token: a,
78
+ token: e,
79
79
  balance: 1n,
80
- nfts: [{ image: a.logoURI, tokenId: 0, name: a.symbol }]
80
+ nfts: [{ image: e.logoURI, tokenId: 0, name: e.symbol }]
81
81
  };
82
- if (a.erc20TokenAddress === P) {
82
+ if (e.erc20TokenAddress === P) {
83
83
  const R = BigInt(await o.getBalance(new u(t)));
84
- return { token: a, balance: R };
84
+ return { token: e, balance: R };
85
85
  }
86
- const l = new u(a.erc20TokenAddress), f = new u(t), i = await k(
86
+ const l = new u(e.erc20TokenAddress), f = new u(t), i = await v(
87
87
  l,
88
88
  f,
89
89
  !0,
90
- a.is2022Program ? O : F
90
+ e.is2022Program ? O : F
91
91
  );
92
92
  if (!await o.getAccountInfo(i))
93
- return { token: a, balance: 0n };
93
+ return { token: e, balance: 0n };
94
94
  const y = await o.getTokenAccountBalance(i), C = BigInt(y.value.amount);
95
- return { token: a, balance: C };
95
+ return { token: e, balance: C };
96
96
  })
97
- )).filter((a) => a.balance > 0n);
97
+ )).filter((e) => e.balance > 0n);
98
98
  };
99
99
  export {
100
100
  _ as getPublicBalance,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ethers"),n=r=>{const t=e.ethers.BigNumber.from(r);return e.ethers.utils.hexValue(t)};exports.rpcIntEncode=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ethers"),r=e=>t.ethers.toBeHex(e);exports.rpcIntEncode=r;
@@ -1,2 +1 @@
1
- import { ethers } from 'ethers';
2
- export declare const rpcIntEncode: (value: ethers.BigNumberish) => string;
1
+ export declare const rpcIntEncode: (value: string | number | bigint) => string;
@@ -1,8 +1,5 @@
1
- import { ethers as e } from "ethers";
2
- const u = (r) => {
3
- const t = e.BigNumber.from(r);
4
- return e.utils.hexValue(t);
5
- };
1
+ import { ethers as r } from "ethers";
2
+ const o = (e) => r.toBeHex(e);
6
3
  export {
7
- u as rpcIntEncode
4
+ o as rpcIntEncode
8
5
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@solana/web3.js"),u=require("../../crypto/poseidon.cjs"),d=require("ethers"),r=t=>{const e=t.toBytes();return d.ethers.BigNumber.from(e).toBigInt()},y=t=>{const e=typeof t=="string"?new i.PublicKey(t):t,n=r(e),o=n/2n**128n,s=n%2n**128n,c=u.poseidonHash(o,s);return{mintAccountPart1:o,mintAccountPart2:s,compressedAddress:c,mintPublicKey:e}};exports.convertPublicKeyToBigint=r;exports.formatMintAddress=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@solana/web3.js"),u=require("../../crypto/poseidon.cjs"),d=require("ethers"),r=t=>{const e=t.toBytes();return BigInt(d.ethers.hexlify(e))},y=t=>{const e=typeof t=="string"?new i.PublicKey(t):t,n=r(e),o=n/2n**128n,s=n%2n**128n,c=u.poseidonHash(o,s);return{mintAccountPart1:o,mintAccountPart2:s,compressedAddress:c,mintPublicKey:e}};exports.convertPublicKeyToBigint=r;exports.formatMintAddress=y;
@@ -1,14 +1,14 @@
1
1
  import { PublicKey as c } from "@solana/web3.js";
2
2
  import { poseidonHash as i } from "../../crypto/poseidon.mjs";
3
3
  import { ethers as m } from "ethers";
4
- const u = (t) => {
5
- const o = t.toBytes();
6
- return m.BigNumber.from(o).toBigInt();
4
+ const y = (t) => {
5
+ const n = t.toBytes();
6
+ return BigInt(m.hexlify(n));
7
7
  }, f = (t) => {
8
- const o = typeof t == "string" ? new c(t) : t, n = u(o), r = n / 2n ** 128n, e = n % 2n ** 128n, s = i(r, e);
9
- return { mintAccountPart1: r, mintAccountPart2: e, compressedAddress: s, mintPublicKey: o };
8
+ const n = typeof t == "string" ? new c(t) : t, o = y(n), e = o / 2n ** 128n, r = o % 2n ** 128n, s = i(e, r);
9
+ return { mintAccountPart1: e, mintAccountPart2: r, compressedAddress: s, mintPublicKey: n };
10
10
  };
11
11
  export {
12
- u as convertPublicKeyToBigint,
12
+ y as convertPublicKeyToBigint,
13
13
  f as formatMintAddress
14
14
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("ethers"),c=(i,s,e)=>s.reduce((n,{name:t,type:r})=>{const a=i[t];if(r.endsWith("[]")){const o=r.slice(0,-2);if(e[o]&&Array.isArray(a)){const m=a.reduce((u,f,d)=>({...u,[d]:{value:c(f,e[o],e),type:o}}),{});return{...n,[t]:{value:m,type:r}}}return{...n,[t]:{value:a,type:r}}}return e[r]?{...n,[t]:{value:c(a,e[r],e),type:r}}:{...n,[t]:{value:a,type:r}}},{}),l=(i,s,e)=>{const n=c(i,s[e],s);return{primaryType:{value:e,type:"string"},...n}},g=["Permit","PermitWithExpiry","PermitBatch","PermitBatchTransferFrom","PermitSingle","PermitTransferFrom","PermitWitnessTransferFrom"],T=(i,s)=>{let e;switch(s){case"PermitSingle":case"PermitBatch":e=i.details;break;case"PermitBatchTransferFrom":case"PermitTransferFrom":case"PermitWitnessTransferFrom":e=i.permitted;break}if(e)return Array.isArray(e)?e:[e]},h=(i,s,e)=>{if(!Object.keys(s).some(r=>g.includes(r)))return{isPermit:!1,tokenDetails:[]};const t=T(i,e);return t?{isPermit:!0,tokenDetails:t}:{isPermit:!0,tokenDetails:[]}},k=(i,s,e,n)=>{const{isPermit:t,tokenDetails:r}=h(i,s,n);if(!t)return{isPermit:!1};let a;if(r.length)a=e.verifyingContract;else{const o=e.verifyingContract;o&&r.push({token:o,amount:P.ethers.constants.MaxUint256.toString()})}return{isPermit:t,tokenDetails:r,spender:a}};exports.decodeMessage=c;exports.getDecodedMessage=l;exports.getPermitInfo=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("ethers"),c=(i,s,e)=>s.reduce((n,{name:t,type:r})=>{const a=i[t];if(r.endsWith("[]")){const o=r.slice(0,-2);if(e[o]&&Array.isArray(a)){const m=a.reduce((u,f,d)=>({...u,[d]:{value:c(f,e[o],e),type:o}}),{});return{...n,[t]:{value:m,type:r}}}return{...n,[t]:{value:a,type:r}}}return e[r]?{...n,[t]:{value:c(a,e[r],e),type:r}}:{...n,[t]:{value:a,type:r}}},{}),l=(i,s,e)=>{const n=c(i,s[e],s);return{primaryType:{value:e,type:"string"},...n}},g=["Permit","PermitWithExpiry","PermitBatch","PermitBatchTransferFrom","PermitSingle","PermitTransferFrom","PermitWitnessTransferFrom"],T=(i,s)=>{let e;switch(s){case"PermitSingle":case"PermitBatch":e=i.details;break;case"PermitBatchTransferFrom":case"PermitTransferFrom":case"PermitWitnessTransferFrom":e=i.permitted;break}if(e)return Array.isArray(e)?e:[e]},h=(i,s,e)=>{if(!Object.keys(s).some(r=>g.includes(r)))return{isPermit:!1,tokenDetails:[]};const t=T(i,e);return t?{isPermit:!0,tokenDetails:t}:{isPermit:!0,tokenDetails:[]}},k=(i,s,e,n)=>{const{isPermit:t,tokenDetails:r}=h(i,s,n);if(!t)return{isPermit:!1};let a;if(r.length)a=e.verifyingContract;else{const o=e.verifyingContract;o&&r.push({token:o,amount:P.ethers.MaxUint256.toString()})}return{isPermit:t,tokenDetails:r,spender:a}};exports.decodeMessage=c;exports.getDecodedMessage=l;exports.getPermitInfo=k;
@@ -1,7 +1,7 @@
1
- import { TypedDataField } from 'ethers';
1
+ import { ethers } from 'ethers';
2
2
  import { DecodedTypedMessageValue } from '../../types/message.types';
3
- export declare const decodeMessage: (message: Record<string, any>, typeDefinition: TypedDataField[], types: Record<string, TypedDataField[]>) => Record<string, DecodedTypedMessageValue>;
4
- export declare const getDecodedMessage: (message: Record<string, any>, types: Record<string, TypedDataField[]>, primaryType: string) => {
3
+ export declare const decodeMessage: (message: Record<string, any>, typeDefinition: ethers.TypedDataField[], types: Record<string, ethers.TypedDataField[]>) => Record<string, DecodedTypedMessageValue>;
4
+ export declare const getDecodedMessage: (message: Record<string, any>, types: Record<string, ethers.TypedDataField[]>, primaryType: string) => {
5
5
  primaryType: {
6
6
  value: string;
7
7
  type: string;
@@ -11,7 +11,7 @@ type TokenDetail = {
11
11
  token: string;
12
12
  amount: string;
13
13
  };
14
- export declare const getPermitInfo: (message: Record<string, any>, types: Record<string, TypedDataField[]>, domain: Record<string, unknown>, primaryType: string) => {
14
+ export declare const getPermitInfo: (message: Record<string, any>, types: Record<string, ethers.TypedDataField[]>, domain: Record<string, unknown>, primaryType: string) => {
15
15
  isPermit: boolean;
16
16
  tokenDetails?: undefined;
17
17
  spender?: undefined;
@@ -97,7 +97,7 @@ const c = (i, n, e) => n.reduce(
97
97
  const o = e.verifyingContract;
98
98
  o && r.push({
99
99
  token: o,
100
- amount: l.constants.MaxUint256.toString()
100
+ amount: l.MaxUint256.toString()
101
101
  });
102
102
  }
103
103
  return {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("ethers"),a=require("../../error-handling/error-codes.constants.cjs"),m=t=>n.ethers.utils.parseEther(t).toBigInt(),I=t=>n.ethers.BigNumber.from(n.ethers.utils.randomBytes(t)).toBigInt(),h=(t,e)=>n.ethers.utils.formatUnits(e,t.decimals),c=(t,e)=>{const r=10**(18-t.decimals);try{return n.ethers.utils.parseUnits(e).div(n.BigNumber.from(r.toString())).toBigInt()}catch{throw new Error(a.transactionErrorCodes.DECIMALS_LIMIT)}},l=t=>{const e=t.toFixed(30),[r,o]=e.split("."),s=o?o.length:0,i=`${r}${o||""}`;return[BigInt(i),s]},d=(t,e)=>{try{return c(t,e)}catch{return BigInt(0)}},u=(t,e,r)=>{const o=n.ethers.utils.formatUnits(t,e.decimals),s=BigInt(10**(18-r));try{const i=n.ethers.utils.parseUnits(o).div(n.BigNumber.from(s.toString())).toBigInt();return n.ethers.utils.formatUnits(i,r)}catch{throw new Error(a.transactionErrorCodes.DECIMALS_LIMIT)}},B=(t,e,r,o)=>{const[s,i]=l(r);return{totalValueDollarsBigInt:e*s/BigInt(10**(t.decimals-o))/BigInt(10**i),precision:o}},P=(t,e)=>!t||!e?"0":u(e??0n,t,t.decimals).toString()??"0";exports.calculateDollarValue=B;exports.ethToWei=m;exports.getAmountInToken=h;exports.getAmountInWei=c;exports.getAmountInWeiOrZero=d;exports.getAmountWithPrecision=u;exports.getAmountWithPrecisionOrZero=P;exports.randomBigInt=I;exports.toBigIntWithDecimals=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("ethers"),c=require("../../error-handling/error-codes.constants.cjs"),m=t=>o.ethers.parseEther(t),I=t=>[...o.ethers.randomBytes(t)].reduce((e,n)=>e<<8n|BigInt(n),0n),h=(t,e)=>o.ethers.formatUnits(e,t.decimals),a=(t,e)=>{const n=10**(18-t.decimals);try{return o.ethers.parseUnits(e)/BigInt(n)}catch{throw new Error(c.transactionErrorCodes.DECIMALS_LIMIT)}},l=t=>{const e=t.toFixed(30),[n,r]=e.split("."),s=r?r.length:0,i=`${n}${r||""}`;return[BigInt(i),s]},d=(t,e)=>{try{return a(t,e)}catch{return BigInt(0)}},u=(t,e,n)=>{const r=o.ethers.formatUnits(t,e.decimals),s=BigInt(10**(18-n));try{const i=o.ethers.parseUnits(r)/s;return o.ethers.formatUnits(i,n)}catch{throw new Error(c.transactionErrorCodes.DECIMALS_LIMIT)}},B=(t,e,n,r)=>{const[s,i]=l(n);return{totalValueDollarsBigInt:e*s/BigInt(10**(t.decimals-r))/BigInt(10**i),precision:r}},P=(t,e)=>!t||!e?"0":u(e??0n,t,t.decimals).toString()??"0";exports.calculateDollarValue=B;exports.ethToWei=m;exports.getAmountInToken=h;exports.getAmountInWei=a;exports.getAmountInWeiOrZero=d;exports.getAmountWithPrecision=u;exports.getAmountWithPrecisionOrZero=P;exports.randomBigInt=I;exports.toBigIntWithDecimals=l;
@@ -1,41 +1,44 @@
1
- import { ethers as i, BigNumber as a } from "ethers";
2
- import { transactionErrorCodes as c } from "../../error-handling/error-codes.constants.mjs";
3
- const h = (t) => i.utils.parseEther(t).toBigInt(), P = (t) => i.BigNumber.from(i.utils.randomBytes(t)).toBigInt(), f = (t, n) => i.utils.formatUnits(n, t.decimals), m = (t, n) => {
4
- const r = 10 ** (18 - t.decimals);
1
+ import { ethers as o } from "ethers";
2
+ import { transactionErrorCodes as a } from "../../error-handling/error-codes.constants.mjs";
3
+ const B = (t) => o.parseEther(t), h = (t) => (
4
+ // eslint-disable-next-line no-bitwise
5
+ [...o.randomBytes(t)].reduce((n, e) => n << 8n | BigInt(e), 0n)
6
+ ), P = (t, n) => o.formatUnits(n, t.decimals), l = (t, n) => {
7
+ const e = 10 ** (18 - t.decimals);
5
8
  try {
6
- return i.utils.parseUnits(n).div(a.from(r.toString())).toBigInt();
9
+ return o.parseUnits(n) / BigInt(e);
7
10
  } catch {
8
- throw new Error(c.DECIMALS_LIMIT);
11
+ throw new Error(a.DECIMALS_LIMIT);
9
12
  }
10
- }, g = (t) => {
11
- const n = t.toFixed(30), [r, e] = n.split("."), s = e ? e.length : 0, o = `${r}${e || ""}`;
12
- return [BigInt(o), s];
13
- }, v = (t, n) => {
13
+ }, m = (t) => {
14
+ const n = t.toFixed(30), [e, r] = n.split("."), c = r ? r.length : 0, i = `${e}${r || ""}`;
15
+ return [BigInt(i), c];
16
+ }, D = (t, n) => {
14
17
  try {
15
- return m(t, n);
18
+ return l(t, n);
16
19
  } catch {
17
20
  return BigInt(0);
18
21
  }
19
- }, u = (t, n, r) => {
20
- const e = i.utils.formatUnits(t, n.decimals), s = BigInt(10 ** (18 - r));
22
+ }, g = (t, n, e) => {
23
+ const r = o.formatUnits(t, n.decimals), c = BigInt(10 ** (18 - e));
21
24
  try {
22
- const o = i.utils.parseUnits(e).div(a.from(s.toString())).toBigInt();
23
- return i.utils.formatUnits(o, r);
25
+ const i = o.parseUnits(r) / c;
26
+ return o.formatUnits(i, e);
24
27
  } catch {
25
- throw new Error(c.DECIMALS_LIMIT);
28
+ throw new Error(a.DECIMALS_LIMIT);
26
29
  }
27
- }, D = (t, n, r, e) => {
28
- const [s, o] = g(r);
29
- return { totalValueDollarsBigInt: n * s / BigInt(10 ** (t.decimals - e)) / BigInt(10 ** o), precision: e };
30
- }, E = (t, n) => !t || !n ? "0" : u(n ?? 0n, t, t.decimals).toString() ?? "0";
30
+ }, E = (t, n, e, r) => {
31
+ const [c, i] = m(e);
32
+ return { totalValueDollarsBigInt: n * c / BigInt(10 ** (t.decimals - r)) / BigInt(10 ** i), precision: r };
33
+ }, v = (t, n) => !t || !n ? "0" : g(n ?? 0n, t, t.decimals).toString() ?? "0";
31
34
  export {
32
- D as calculateDollarValue,
33
- h as ethToWei,
34
- f as getAmountInToken,
35
- m as getAmountInWei,
36
- v as getAmountInWeiOrZero,
37
- u as getAmountWithPrecision,
38
- E as getAmountWithPrecisionOrZero,
39
- P as randomBigInt,
40
- g as toBigIntWithDecimals
35
+ E as calculateDollarValue,
36
+ B as ethToWei,
37
+ P as getAmountInToken,
38
+ l as getAmountInWei,
39
+ D as getAmountInWeiOrZero,
40
+ g as getAmountWithPrecision,
41
+ v as getAmountWithPrecisionOrZero,
42
+ h as randomBigInt,
43
+ m as toBigIntWithDecimals
41
44
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../types/circom-data.types.cjs");const a=require("../../../types/hinkal.types.cjs");require("../../../types/transactions.types.cjs");require("../../../types/activities.types.cjs");const o=n=>{const t=a.EventType.BalanceChange,e=new CustomEvent(t,{detail:n});typeof document<"u"?document.dispatchEvent(e):process?.emit("message",e,void 0)};exports.balanceChangedCustomHandler=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../types/circom-data.types.cjs");const a=require("../../../types/hinkal.types.cjs");require("../../../types/activities.types.cjs");const o=n=>{const t=a.EventType.BalanceChange,e=new CustomEvent(t,{detail:n});typeof document<"u"?document.dispatchEvent(e):process?.emit("message",e,void 0)};exports.balanceChangedCustomHandler=o;