h_test_1 0.0.28 → 0.0.29

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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Hinkal is a privacy middleware and smart-contract SDK for public blockchains that enables confidential transactions and settlement flows without changing wallets, custody, or chains.
4
4
 
5
- The SDK allows wallets, dApps, and payment platforms to integrate protocol-level privacy on Ethereum, Solana, Polygon, Base, Arbitrum, and Optimism. It hides transaction history, wallet relationships, and asset flows on-chain while preserving public-chain finality and compliance.
5
+ The SDK allows wallets, dApps, and payment platforms to integrate protocol-level privacy on Ethereum, Solana, Tron, Polygon, Base, Arbitrum, and Optimism. It hides transaction history, wallet relationships, and asset flows on-chain while preserving public-chain finality and compliance.
6
6
 
7
7
  With Hinkal SDK, developers can:
8
8
  • Enable private sends between public wallets
@@ -109,6 +109,7 @@ function deposit(
109
109
  ```
110
110
 
111
111
  where:
112
+
112
113
  - `erc20Tokens` is an array of tokens to deposit
113
114
  - `amountChanges` represents the corresponding token amounts for the deposit
114
115
  - `preEstimateGas` If true (default), the gas needed for the operation will be estimated before executing the deposit. This can help avoid failed transactions due to "out of gas" error.
@@ -363,14 +364,15 @@ After passing the compliance check with one of the supported providers, the acce
363
364
 
364
365
  Hinkal SDK is available on the following blockchain networks:
365
366
 
366
- | Chain | Chain ID | Status |
367
- | -------- | -------- | -------------- |
368
- | Ethereum | 1 | ✅ Live |
369
- | Polygon | 137 | ✅ Live |
370
- | Base | 8453 | ✅ Live |
371
- | Arbitrum | 42161 | ✅ Live |
372
- | Optimism | 10 | ✅ Live |
373
- | Solana | - | 🚧 In Progress |
367
+ | Chain | Chain ID | Status |
368
+ | -------- | -------- | ------- |
369
+ | Ethereum | 1 | ✅ Live |
370
+ | Polygon | 137 | ✅ Live |
371
+ | Base | 8453 | ✅ Live |
372
+ | Arbitrum | 42161 | ✅ Live |
373
+ | Optimism | 10 | ✅ Live |
374
+ | Solana | - | Live |
375
+ | Tron | - | ✅ Live |
374
376
 
375
377
  Each chain supports the full suite of Hinkal privacy features including shielding, transfers, and confidential interactions with DeFi protocols.
376
378
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../types/ethereum-network.types.cjs"),e=require("../web3/getContractMetadata.cjs"),r=async t=>{const a=e.getContractWithFetcherByChainId(t,o.ContractType.HinkalContract),n=e.getContractWithFetcherByChainId(t,o.ContractType.AccessTokenContract),[c,s]=await Promise.all([a.getRootHash(),n.getRootHash()]);return{hinkalRootHash:c.toBigInt(),accessTokenRootHash:s.toBigInt()}};exports.fetchOnChainRootHashes=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../types/ethereum-network.types.cjs"),o=require("../web3/getContractMetadata.cjs"),r=async t=>{const a=o.getContractWithFetcherByChainId(t,e.ContractType.HinkalContract),n=o.getContractWithFetcherByChainId(t,e.ContractType.AccessTokenContract),[c,s]=await Promise.all([a.getRootHash(),n.getRootHash()]);return{hinkalRootHash:c,accessTokenRootHash:s}};exports.fetchOnChainRootHashes=r;
@@ -1,13 +1,13 @@
1
1
  import { ContractType as o } from "../../types/ethereum-network.types.mjs";
2
2
  import { getContractWithFetcherByChainId as a } from "../web3/getContractMetadata.mjs";
3
3
  const i = async (t) => {
4
- const n = a(t, o.HinkalContract), s = a(t, o.AccessTokenContract), [c, e] = await Promise.all([
4
+ const n = a(t, o.HinkalContract), c = a(t, o.AccessTokenContract), [s, e] = await Promise.all([
5
5
  n.getRootHash(),
6
- s.getRootHash()
6
+ c.getRootHash()
7
7
  ]);
8
8
  return {
9
- hinkalRootHash: c.toBigInt(),
10
- accessTokenRootHash: e.toBigInt()
9
+ hinkalRootHash: s,
10
+ accessTokenRootHash: e
11
11
  };
12
12
  };
13
13
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("ethers");require("../../constants/token-data/index.cjs");const d=require("../../constants/chains.constants.cjs"),C=require("../../constants/protocol.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("../../constants/schedule.constants.cjs");require("../../constants/tokens.constants.cjs");const l=require("../../error-handling/error-codes.constants.cjs"),P=require("./etherFunctions.cjs");require("../../types/circom-data.types.cjs");const u=require("../../types/ethereum-network.types.cjs");require("../../types/activities.types.cjs");const h=require("../../error-handling/logError.cjs"),w=async(s,t,c,r)=>{const o=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await t.getPool(c,r,e),fee:e})))).filter(({poolAddress:e})=>e!==C.zeroAddress),n=await Promise.all(o.map(async e=>({poolAddress:e.poolAddress,fee:e.fee,token1Balance:(await s.balanceOf(e.poolAddress)).toBigInt()}))),i=n.map(e=>e.token1Balance).reduce((e,p)=>p>=e?p:e,0n);if(i===0n)throw new Error(l.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return n.find(e=>e.token1Balance===i)},q=async(s,t,c,r,o,n)=>{try{if(!d.networkRegistry[t].quoterV2Address)throw Error("No Quoter Contract Provided");return(await s.getContractWithFetcherByChainId(t,u.ContractType.UniswapV3QuoterContract,d.networkRegistry[t].quoterV2Address).quoteExactInputSingle.staticCall({tokenIn:c.wrappedErc20TokenAddress??c.erc20TokenAddress,tokenOut:r.wrappedErc20TokenAddress??r.erc20TokenAddress,fee:o,amountIn:n,sqrtPriceLimitX96:0})).amountOut}catch(a){throw h.logError(a),a}},A=async(s,t,c,r)=>{try{const o=s.getContractWithFetcherByChainId(t,u.ContractType.UniswapV3FactoryContract,d.networkRegistry[t].uniswapV3FactoryAddress),n=s.getContractWithFetcherByChainId(t,u.ContractType.ERC20Contract,r.wrappedErc20TokenAddress??r.erc20TokenAddress),{fee:a}=await w(n,o,c.wrappedErc20TokenAddress??c.erc20TokenAddress,r.wrappedErc20TokenAddress??r.erc20TokenAddress);return a}catch(o){throw console.log("Error in getUniswapFee",o),o}},E=async(s,t,c,r,o)=>{try{const n=await A(s,t,r,o),a=g.ethers.AbiCoder.defaultAbiCoder().encode(["uint24"],[n]),i=P.getAmountInWei(r,c);return{tokenPrice:await q(s,t,r,o,n,i),poolFee:a}}catch{throw Error(l.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=A;exports.getUniswapPrice=E;exports.getUniswapPriceHelper=q;exports.searchPoolAndFee=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("ethers");require("../../constants/token-data/index.cjs");const d=require("../../constants/chains.constants.cjs"),g=require("../../constants/protocol.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");require("../../constants/server.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/reorg-depths.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../constants/presale.constants.cjs");require("../../constants/activity.constants.cjs");require("../../constants/tasks.constants.cjs");require("../../constants/events.constants.cjs");require("../../constants/schedule.constants.cjs");require("../../constants/tokens.constants.cjs");const l=require("../../error-handling/error-codes.constants.cjs"),P=require("./etherFunctions.cjs");require("../../types/circom-data.types.cjs");const u=require("../../types/ethereum-network.types.cjs");require("../../types/activities.types.cjs");const h=require("../../error-handling/logError.cjs"),w=async(n,t,c,r)=>{const o=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await t.getPool(c,r,e),fee:e})))).filter(({poolAddress:e})=>e!==g.zeroAddress),s=await Promise.all(o.map(async e=>({poolAddress:e.poolAddress,fee:e.fee,token1Balance:await n.balanceOf(e.poolAddress)}))),i=s.map(e=>e.token1Balance).reduce((e,p)=>p>=e?p:e,0n);if(i===0n)throw new Error(l.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return s.find(e=>e.token1Balance===i)},q=async(n,t,c,r,o,s)=>{try{if(!d.networkRegistry[t].quoterV2Address)throw Error("No Quoter Contract Provided");return(await n.getContractWithFetcherByChainId(t,u.ContractType.UniswapV3QuoterContract,d.networkRegistry[t].quoterV2Address).quoteExactInputSingle.staticCall({tokenIn:c.wrappedErc20TokenAddress??c.erc20TokenAddress,tokenOut:r.wrappedErc20TokenAddress??r.erc20TokenAddress,fee:o,amountIn:s,sqrtPriceLimitX96:0})).amountOut}catch(a){throw h.logError(a),a}},A=async(n,t,c,r)=>{try{const o=n.getContractWithFetcherByChainId(t,u.ContractType.UniswapV3FactoryContract,d.networkRegistry[t].uniswapV3FactoryAddress),s=n.getContractWithFetcherByChainId(t,u.ContractType.ERC20Contract,r.wrappedErc20TokenAddress??r.erc20TokenAddress),{fee:a}=await w(s,o,c.wrappedErc20TokenAddress??c.erc20TokenAddress,r.wrappedErc20TokenAddress??r.erc20TokenAddress);return a}catch(o){throw console.log("Error in getUniswapFee",o),o}},E=async(n,t,c,r,o)=>{try{const s=await A(n,t,r,o),a=C.ethers.AbiCoder.defaultAbiCoder().encode(["uint24"],[s]),i=P.getAmountInWei(r,c);return{tokenPrice:await q(n,t,r,o,s,i),poolFee:a}}catch{throw Error(l.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=A;exports.getUniswapPrice=E;exports.getUniswapPriceHelper=q;exports.searchPoolAndFee=w;
@@ -22,27 +22,27 @@ import "../../types/circom-data.types.mjs";
22
22
  import { ContractType as d } from "../../types/ethereum-network.types.mjs";
23
23
  import "../../types/activities.types.mjs";
24
24
  import { logError as y } from "../../error-handling/logError.mjs";
25
- const C = async (s, o, a, t) => {
25
+ const C = async (n, o, a, t) => {
26
26
  const e = (await Promise.all(
27
27
  [100, 500, 3e3, 1e4].map(async (r) => ({
28
28
  poolAddress: await o.getPool(a, t, r),
29
29
  fee: r
30
30
  }))
31
- )).filter(({ poolAddress: r }) => r !== u), n = await Promise.all(
31
+ )).filter(({ poolAddress: r }) => r !== u), s = await Promise.all(
32
32
  e.map(async (r) => ({
33
33
  poolAddress: r.poolAddress,
34
34
  fee: r.fee,
35
- token1Balance: (await s.balanceOf(r.poolAddress)).toBigInt()
35
+ token1Balance: await n.balanceOf(r.poolAddress)
36
36
  }))
37
- ), i = n.map((r) => r.token1Balance).reduce((r, m) => m >= r ? m : r, 0n);
37
+ ), i = s.map((r) => r.token1Balance).reduce((r, m) => m >= r ? m : r, 0n);
38
38
  if (i === 0n)
39
39
  throw new Error(l.UNISWAP_NOT_ENOUGH_LIQUIDITY);
40
- return n.find((r) => r.token1Balance === i);
41
- }, E = async (s, o, a, t, e, n) => {
40
+ return s.find((r) => r.token1Balance === i);
41
+ }, E = async (n, o, a, t, e, s) => {
42
42
  try {
43
43
  if (!p[o].quoterV2Address)
44
44
  throw Error("No Quoter Contract Provided");
45
- return (await s.getContractWithFetcherByChainId(
45
+ return (await n.getContractWithFetcherByChainId(
46
46
  o,
47
47
  d.UniswapV3QuoterContract,
48
48
  p[o].quoterV2Address
@@ -50,24 +50,24 @@ const C = async (s, o, a, t) => {
50
50
  tokenIn: a.wrappedErc20TokenAddress ?? a.erc20TokenAddress,
51
51
  tokenOut: t.wrappedErc20TokenAddress ?? t.erc20TokenAddress,
52
52
  fee: e,
53
- amountIn: n,
53
+ amountIn: s,
54
54
  sqrtPriceLimitX96: 0
55
55
  })).amountOut;
56
56
  } catch (c) {
57
57
  throw y(c), c;
58
58
  }
59
- }, P = async (s, o, a, t) => {
59
+ }, P = async (n, o, a, t) => {
60
60
  try {
61
- const e = s.getContractWithFetcherByChainId(
61
+ const e = n.getContractWithFetcherByChainId(
62
62
  o,
63
63
  d.UniswapV3FactoryContract,
64
64
  p[o].uniswapV3FactoryAddress
65
- ), n = s.getContractWithFetcherByChainId(
65
+ ), s = n.getContractWithFetcherByChainId(
66
66
  o,
67
67
  d.ERC20Contract,
68
68
  t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
69
69
  ), { fee: c } = await C(
70
- n,
70
+ s,
71
71
  e,
72
72
  a.wrappedErc20TokenAddress ?? a.erc20TokenAddress,
73
73
  t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
@@ -76,15 +76,15 @@ const C = async (s, o, a, t) => {
76
76
  } catch (e) {
77
77
  throw console.log("Error in getUniswapFee", e), e;
78
78
  }
79
- }, X = async (s, o, a, t, e) => {
79
+ }, X = async (n, o, a, t, e) => {
80
80
  try {
81
- const n = await P(s, o, t, e), c = w.AbiCoder.defaultAbiCoder().encode(["uint24"], [n]), i = f(t, a);
81
+ const s = await P(n, o, t, e), c = w.AbiCoder.defaultAbiCoder().encode(["uint24"], [s]), i = f(t, a);
82
82
  return { tokenPrice: await E(
83
- s,
83
+ n,
84
84
  o,
85
85
  t,
86
86
  e,
87
- n,
87
+ s,
88
88
  i
89
89
  ), poolFee: c };
90
90
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h_test_1",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"