h_test_1 0.0.28 → 0.0.30

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"});var n=(o=>(o.DEVELOPMENT="development",o.PLAYGROUND="playground",o.PRODUCTION="production",o.STAGING="staging",o))(n||{});const c=typeof process<"u"&&process?.release?.name==="node",t=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,p=!t&&typeof window<"u"&&window.origin==="null",l=typeof __webpack_require__<"u",u=typeof window<"u"&&window?.location?.protocol==="chrome-extension:",a=()=>"production",e=a(),i=e==="development",s=e==="playground",d=e==="staging",r=d||i||s,g=r||c&&e==="production";exports.DEPLOYMENT_MODE=n;exports.deploymentMode=e;exports.isDevelopment=i;exports.isExtension=u;exports.isNode=t;exports.isNotClientProduction=g;exports.isNotProduction=r;exports.isPlayground=s;exports.isSandbox=p;exports.isStaging=d;exports.isWebpack=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../functions/utils/enum.utils.cjs");var t=(e=>(e.DEVELOPMENT="development",e.PLAYGROUND="playground",e.PRODUCTION="production",e.STAGING="staging",e))(t||{});const i={development:["localhost","192.","127."],playground:["playground"],staging:["working","staging"]},r=typeof process<"u"&&process?.release?.name==="node",u=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,y=!u&&typeof window<"u"&&window.origin==="null",f=typeof __webpack_require__<"u",m=typeof window<"u"&&window?.location?.protocol==="chrome-extension:";function s(e,n){return n.some(g=>e.includes(g))}const v=()=>(require("dotenv").config({path:"DOTENV_OVERRIDE"in process.env?process.env.DOTENV_OVERRIDE:void 0}),process.env.DEPLOYMENT_MODE?.startsWith("production")?"production":d.toEnumValue(t,process.env.DEPLOYMENT_MODE)||"development"),E=()=>{if(!r&&typeof window>"u")return;if(r)return v();if(window?.location?.protocol==="chrome-extension:"){const n=d.toEnumValue(t,WALLET_DEPLOYMENT_MODE);return n||"staging"}const e=window?.location?.host;return s(e,i.development)?"development":s(e,i.playground)?"playground":s(e,i.staging)?"staging":"production"},o=E(),c=o==="development",l=o==="playground",p=o==="staging",a=p||c||l,w=a||r&&o==="production";exports.DEPLOYMENT_MODE=t;exports.deploymentMode=o;exports.isDevelopment=c;exports.isExtension=m;exports.isNode=u;exports.isNotClientProduction=w;exports.isNotProduction=a;exports.isPlayground=l;exports.isSandbox=y;exports.isStaging=p;exports.isWebpack=f;
@@ -1,15 +1,38 @@
1
- var e = /* @__PURE__ */ ((o) => (o.DEVELOPMENT = "development", o.PLAYGROUND = "playground", o.PRODUCTION = "production", o.STAGING = "staging", o))(e || {});
2
- const s = typeof process < "u" && process?.release?.name === "node", t = typeof process < "u" && process.versions != null && process.versions.node != null, u = !t && typeof window < "u" && window.origin === "null", l = typeof __webpack_require__ < "u", a = typeof window < "u" && window?.location?.protocol === "chrome-extension:", i = () => "production", n = i(), d = n === "development", r = n === "playground", c = n === "staging", p = c || d || r, g = p || s && n === "production";
1
+ import { toEnumValue as d } from "../functions/utils/enum.utils.mjs";
2
+ var s = /* @__PURE__ */ ((n) => (n.DEVELOPMENT = "development", n.PLAYGROUND = "playground", n.PRODUCTION = "production", n.STAGING = "staging", n))(s || {});
3
+ const t = {
4
+ development: ["localhost", "192.", "127."],
5
+ playground: ["playground"],
6
+ staging: ["working", "staging"]
7
+ }, i = typeof process < "u" && process?.release?.name === "node", p = typeof process < "u" && process.versions != null && process.versions.node != null, v = !p && typeof window < "u" && window.origin === "null", w = typeof __webpack_require__ < "u", E = typeof window < "u" && window?.location?.protocol === "chrome-extension:";
8
+ function r(n, o) {
9
+ return o.some((c) => n.includes(c));
10
+ }
11
+ const u = () => (require("dotenv").config({
12
+ // allow overriding .env file path, see startServer.sh script for explenation on why it is needed
13
+ path: "DOTENV_OVERRIDE" in process.env ? process.env.DOTENV_OVERRIDE : void 0
14
+ }), process.env.DEPLOYMENT_MODE?.startsWith("production") ? "production" : d(s, process.env.DEPLOYMENT_MODE) || "development"), l = () => {
15
+ if (!i && typeof window > "u")
16
+ return;
17
+ if (i)
18
+ return u();
19
+ if (window?.location?.protocol === "chrome-extension:") {
20
+ const o = d(s, WALLET_DEPLOYMENT_MODE);
21
+ return o || "staging";
22
+ }
23
+ const n = window?.location?.host;
24
+ return r(n, t.development) ? "development" : r(n, t.playground) ? "playground" : r(n, t.staging) ? "staging" : "production";
25
+ }, e = l(), a = e === "development", g = e === "playground", f = e === "staging", m = f || a || g, D = m || i && e === "production";
3
26
  export {
4
- e as DEPLOYMENT_MODE,
5
- n as deploymentMode,
6
- d as isDevelopment,
7
- a as isExtension,
8
- t as isNode,
9
- g as isNotClientProduction,
10
- p as isNotProduction,
11
- r as isPlayground,
12
- u as isSandbox,
13
- c as isStaging,
14
- l as isWebpack
27
+ s as DEPLOYMENT_MODE,
28
+ e as deploymentMode,
29
+ a as isDevelopment,
30
+ E as isExtension,
31
+ p as isNode,
32
+ D as isNotClientProduction,
33
+ m as isNotProduction,
34
+ g as isPlayground,
35
+ v as isSandbox,
36
+ f as isStaging,
37
+ w as isWebpack
15
38
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("../../error-handling/error-codes.constants.cjs"),_=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),E=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),U=require("../../functions/web3/events/getShieldedBalance.cjs"),R=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),L=require("../../functions/pre-transaction/getFeeStructure.cjs"),k=require("../../functions/pre-transaction/merge-with-fee-structure.cjs"),H=require("../../types/external-action.types.cjs"),I=require("../../types/hinkal.types.cjs"),B=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),K=require("../../types/ethereum-network.types.cjs"),F=require("../../functions/pre-transaction/getKycAndSignatureData.cjs"),M=require("../../functions/pre-transaction/getExternalSwapAddress.cjs"),N=require("../../functions/utils/time.utils.cjs"),W=require("../../constants/protocol.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");require("ethers");require("../../constants/token-data/index.cjs");require("../../constants/tokens.constants.cjs");require("../../constants/chains.constants.cjs");const O=require("../../functions/pre-transaction/constructAdminData.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("circomlibjs-hinkal-fork");require("@solana/spl-token");require("tweetnacl");require("bs58");require("buffer");require("../crypto-keys/keys.cjs");require("libsodium-wrappers");require("lodash");const b=require("../../functions/utils/token-check.utils.cjs"),G=async(r,s,t,o)=>{const n=[...await U.addPaddingToUtxos(r,s,t,o)],u=[],i=I.defaultHinkalLogicArgs(o.length,r.userKeys),l=N.getCurrentTimeInSeconds().toString();for(let e=0;e<t.length;e+=1){const{outputUtxos:a}=_.outputUtxoProcessing(r.userKeys,n[e],o[e],l,void 0,!1);u.push(a);const{useApprovalUtxoData:c}=B.outputApprovalDataProcessing(r,s,n[e],o[e]);c&&(i.useApprovalUtxoData[e]=c,i.doPreTxApproval=!0)}return{inputUtxosArray:n,outputUtxosArray:u,hinkalLogicArgs:i}},V=async(r,s,t,o,n,u,i,l)=>{const e=b.validateAndGetChainId(s),a=s.map(f=>f.erc20TokenAddress),c=await r.getEthereumAddressByChain(e),g=i??await L.getFeeStructure(e,u,a,H.ExternalActionId.Transact,void 0,W.HINKAL_SWAP_VARIABLE_RATE);k.mergeWithFeeStructure(e,a,t,g);const A=M.getExternalSwapAddress(e,o),d={externalActionId:o,externalAddress:A,externalActionMetadata:n},[p,{patchAccessTokenMerkleTree:x,signatureData:y},{inputUtxosArray:q,outputUtxosArray:S,hinkalLogicArgs:h}]=await Promise.all([r.getRandomRelay(e,!0),F.getKycAndSignatureData(r,e,a,t,c),G(r,e,a,t)]);if(!p)throw Error(P.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const C=`swapperM${t.length.toString()}x${q[0].length}x1`,v=[!1,!0,!1].slice(0,t.length),{zkCallData:m,circomData:D,dimData:T}=await E.constructZkProof("v1x1",r.merkleTreeHinkalByChain[e],r.merkleTreeAccessTokenByChain[e],q,S,r.userKeys,C,d.externalActionId,d.externalAddress,d.externalActionMetadata,r.generateProofRemotely,p,e,v,void 0,void 0,x,h,void 0,g,r.getContractWithFetcher(e,K.ContractType.HinkalHelperContract),y),w=O.constructAdminData(l,e,a,t,c,s);return await R.transactCallRelayer(e,m,T,D,void 0,void 0,w)};exports.hinkalSwap=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("../../error-handling/error-codes.constants.cjs"),U=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),_=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),E=require("../../functions/web3/events/getShieldedBalance.cjs"),R=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),L=require("../../functions/pre-transaction/getFeeStructure.cjs"),k=require("../../functions/pre-transaction/merge-with-fee-structure.cjs"),H=require("../../types/hinkal.types.cjs"),B=require("../../functions/pre-transaction/outputApprovalDataProcessing.cjs"),K=require("../../types/ethereum-network.types.cjs"),F=require("../../functions/pre-transaction/getKycAndSignatureData.cjs"),I=require("../../functions/pre-transaction/getExternalSwapAddress.cjs"),M=require("../../functions/utils/time.utils.cjs"),N=require("../../constants/protocol.constants.cjs");require("../../types/circom-data.types.cjs");require("../../types/activities.types.cjs");require("../../constants/server.constants.cjs");require("../../API/getServerURL.cjs");require("../http/HttpClient.cjs");require("axios");require("../../constants/vite.constants.cjs");require("ethers");require("../../constants/token-data/index.cjs");require("../../constants/tokens.constants.cjs");require("../../constants/chains.constants.cjs");const W=require("../../functions/pre-transaction/constructAdminData.cjs");require("@coral-xyz/anchor");require("@solana/web3.js");require("circomlibjs-hinkal-fork");require("@solana/spl-token");require("tweetnacl");require("bs58");require("buffer");require("../crypto-keys/keys.cjs");require("libsodium-wrappers");require("lodash");const O=require("../../functions/utils/token-check.utils.cjs"),b=async(r,s,t,o)=>{const i=[...await E.addPaddingToUtxos(r,s,t,o)],c=[],n=H.defaultHinkalLogicArgs(o.length,r.userKeys),d=M.getCurrentTimeInSeconds().toString();for(let e=0;e<t.length;e+=1){const{outputUtxos:a}=U.outputUtxoProcessing(r.userKeys,i[e],o[e],d,void 0,!1);c.push(a);const{useApprovalUtxoData:u}=B.outputApprovalDataProcessing(r,s,i[e],o[e]);u&&(n.useApprovalUtxoData[e]=u,n.doPreTxApproval=!0)}return{inputUtxosArray:i,outputUtxosArray:c,hinkalLogicArgs:n}},G=async(r,s,t,o,i,c,n,d)=>{const e=O.validateAndGetChainId(s),a=s.map(f=>f.erc20TokenAddress),u=await r.getEthereumAddressByChain(e),l=n??await L.getFeeStructure(e,c,a,o,void 0,N.HINKAL_SWAP_VARIABLE_RATE);k.mergeWithFeeStructure(e,a,t,l);const A=I.getExternalSwapAddress(e,o),g={externalActionId:o,externalAddress:A,externalActionMetadata:i},[p,{patchAccessTokenMerkleTree:y,signatureData:x},{inputUtxosArray:q,outputUtxosArray:S,hinkalLogicArgs:h}]=await Promise.all([r.getRandomRelay(e,!0),F.getKycAndSignatureData(r,e,a,t,u),b(r,e,a,t)]);if(!p)throw Error(P.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const C=`swapperM${t.length.toString()}x${q[0].length}x1`,v=[!1,!0,!1].slice(0,t.length),{zkCallData:m,circomData:D,dimData:w}=await _.constructZkProof("v1x1",r.merkleTreeHinkalByChain[e],r.merkleTreeAccessTokenByChain[e],q,S,r.userKeys,C,g.externalActionId,g.externalAddress,g.externalActionMetadata,r.generateProofRemotely,p,e,v,void 0,void 0,y,h,void 0,l,r.getContractWithFetcher(e,K.ContractType.HinkalHelperContract),x),T=W.constructAdminData(d,e,a,t,u,s);return await R.transactCallRelayer(e,m,w,D,void 0,void 0,T)};exports.hinkalSwap=G;
@@ -1,18 +1,17 @@
1
- import { transactionErrorCodes as U } from "../../error-handling/error-codes.constants.mjs";
1
+ import { transactionErrorCodes as E } from "../../error-handling/error-codes.constants.mjs";
2
2
  import { outputUtxoProcessing as L } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
3
3
  import { constructZkProof as P } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
4
4
  import { addPaddingToUtxos as R } from "../../functions/web3/events/getShieldedBalance.mjs";
5
5
  import { transactCallRelayer as H } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
6
- import { getFeeStructure as I } from "../../functions/pre-transaction/getFeeStructure.mjs";
7
- import { mergeWithFeeStructure as B } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
8
- import { ExternalActionId as K } from "../../types/external-action.types.mjs";
9
- import { defaultHinkalLogicArgs as _ } from "../../types/hinkal.types.mjs";
10
- import { outputApprovalDataProcessing as M } from "../../functions/pre-transaction/outputApprovalDataProcessing.mjs";
11
- import { ContractType as F } from "../../types/ethereum-network.types.mjs";
12
- import { getKycAndSignatureData as N } from "../../functions/pre-transaction/getKycAndSignatureData.mjs";
13
- import { getExternalSwapAddress as W } from "../../functions/pre-transaction/getExternalSwapAddress.mjs";
14
- import { getCurrentTimeInSeconds as O } from "../../functions/utils/time.utils.mjs";
15
- import { HINKAL_SWAP_VARIABLE_RATE as V } from "../../constants/protocol.constants.mjs";
6
+ import { getFeeStructure as B } from "../../functions/pre-transaction/getFeeStructure.mjs";
7
+ import { mergeWithFeeStructure as I } from "../../functions/pre-transaction/merge-with-fee-structure.mjs";
8
+ import { defaultHinkalLogicArgs as K } from "../../types/hinkal.types.mjs";
9
+ import { outputApprovalDataProcessing as _ } from "../../functions/pre-transaction/outputApprovalDataProcessing.mjs";
10
+ import { ContractType as M } from "../../types/ethereum-network.types.mjs";
11
+ import { getKycAndSignatureData as F } from "../../functions/pre-transaction/getKycAndSignatureData.mjs";
12
+ import { getExternalSwapAddress as N } from "../../functions/pre-transaction/getExternalSwapAddress.mjs";
13
+ import { getCurrentTimeInSeconds as W } from "../../functions/utils/time.utils.mjs";
14
+ import { HINKAL_SWAP_VARIABLE_RATE as O } from "../../constants/protocol.constants.mjs";
16
15
  import "../../types/circom-data.types.mjs";
17
16
  import "../../types/activities.types.mjs";
18
17
  import "../../constants/server.constants.mjs";
@@ -24,7 +23,7 @@ import "ethers";
24
23
  import "../../constants/token-data/index.mjs";
25
24
  import "../../constants/tokens.constants.mjs";
26
25
  import "../../constants/chains.constants.mjs";
27
- import { constructAdminData as $ } from "../../functions/pre-transaction/constructAdminData.mjs";
26
+ import { constructAdminData as V } from "../../functions/pre-transaction/constructAdminData.mjs";
28
27
  import "@coral-xyz/anchor";
29
28
  import "@solana/web3.js";
30
29
  import "circomlibjs-hinkal-fork";
@@ -35,9 +34,9 @@ import "buffer";
35
34
  import "../crypto-keys/keys.mjs";
36
35
  import "libsodium-wrappers";
37
36
  import "lodash";
38
- import { validateAndGetChainId as k } from "../../functions/utils/token-check.utils.mjs";
39
- const z = async (r, i, o, e) => {
40
- const s = [...await R(r, i, o, e)], n = [], p = _(e.length, r.userKeys), c = O().toString();
37
+ import { validateAndGetChainId as $ } from "../../functions/utils/token-check.utils.mjs";
38
+ const k = async (r, i, o, e) => {
39
+ const s = [...await R(r, i, o, e)], n = [], p = K(e.length, r.userKeys), c = W().toString();
41
40
  for (let t = 0; t < o.length; t += 1) {
42
41
  const { outputUtxos: a } = L(
43
42
  r.userKeys,
@@ -48,36 +47,29 @@ const z = async (r, i, o, e) => {
48
47
  !1
49
48
  );
50
49
  n.push(a);
51
- const { useApprovalUtxoData: m } = M(r, i, s[t], e[t]);
50
+ const { useApprovalUtxoData: m } = _(r, i, s[t], e[t]);
52
51
  m && (p.useApprovalUtxoData[t] = m, p.doPreTxApproval = !0);
53
52
  }
54
53
  return { inputUtxosArray: s, outputUtxosArray: n, hinkalLogicArgs: p };
55
- }, Rt = async (r, i, o, e, s, n, p, c) => {
56
- const t = k(i), a = i.map((E) => E.erc20TokenAddress), m = await r.getEthereumAddressByChain(t), d = p ?? await I(
57
- t,
58
- n,
59
- a,
60
- K.Transact,
61
- void 0,
62
- V
63
- );
64
- B(t, a, o, d);
65
- const f = W(t, e), u = {
54
+ }, Lt = async (r, i, o, e, s, n, p, c) => {
55
+ const t = $(i), a = i.map((U) => U.erc20TokenAddress), m = await r.getEthereumAddressByChain(t), d = p ?? await B(t, n, a, e, void 0, O);
56
+ I(t, a, o, d);
57
+ const A = N(t, e), u = {
66
58
  externalActionId: e,
67
- externalAddress: f,
59
+ externalAddress: A,
68
60
  externalActionMetadata: s
69
- }, [g, { patchAccessTokenMerkleTree: l, signatureData: x }, { inputUtxosArray: A, outputUtxosArray: y, hinkalLogicArgs: v }] = await Promise.all([
61
+ }, [g, { patchAccessTokenMerkleTree: l, signatureData: x }, { inputUtxosArray: f, outputUtxosArray: y, hinkalLogicArgs: v }] = await Promise.all([
70
62
  r.getRandomRelay(t, !0),
71
- N(r, t, a, o, m),
72
- z(r, t, a, o)
63
+ F(r, t, a, o, m),
64
+ k(r, t, a, o)
73
65
  ]);
74
66
  if (!g)
75
- throw Error(U.RELAYER_NOT_AVAILABLE);
76
- const C = `swapperM${o.length.toString()}x${A[0].length}x1`, T = [!1, !0, !1].slice(0, o.length), { zkCallData: h, circomData: D, dimData: S } = await P(
67
+ throw Error(E.RELAYER_NOT_AVAILABLE);
68
+ const C = `swapperM${o.length.toString()}x${f[0].length}x1`, h = [!1, !0, !1].slice(0, o.length), { zkCallData: T, circomData: D, dimData: S } = await P(
77
69
  "v1x1",
78
70
  r.merkleTreeHinkalByChain[t],
79
71
  r.merkleTreeAccessTokenByChain[t],
80
- A,
72
+ f,
81
73
  y,
82
74
  r.userKeys,
83
75
  C,
@@ -87,18 +79,18 @@ const z = async (r, i, o, e) => {
87
79
  r.generateProofRemotely,
88
80
  g,
89
81
  t,
90
- T,
82
+ h,
91
83
  void 0,
92
84
  void 0,
93
85
  l,
94
86
  v,
95
87
  void 0,
96
88
  d,
97
- r.getContractWithFetcher(t, F.HinkalHelperContract),
89
+ r.getContractWithFetcher(t, M.HinkalHelperContract),
98
90
  x
99
- ), w = $(c, t, a, o, m, i);
100
- return await H(t, h, S, D, void 0, void 0, w);
91
+ ), w = V(c, t, a, o, m, i);
92
+ return await H(t, T, S, D, void 0, void 0, w);
101
93
  };
102
94
  export {
103
- Rt as hinkalSwap
95
+ Lt as hinkalSwap
104
96
  };
@@ -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 {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e,n){return Object.values(e).includes(n)}function u(e,n,t=!1){if(r(e,n))return n;const i=`Value ${JSON.stringify(n)} is not a valid member of enum ${JSON.stringify(e)}.`;if(t)throw new Error(i)}exports.isInEnum=r;exports.toEnumValue=u;
@@ -0,0 +1,14 @@
1
+ function e(r, n) {
2
+ return Object.values(r).includes(n);
3
+ }
4
+ function o(r, n, i = !1) {
5
+ if (e(r, n))
6
+ return n;
7
+ const t = `Value ${JSON.stringify(n)} is not a valid member of enum ${JSON.stringify(r)}.`;
8
+ if (i)
9
+ throw new Error(t);
10
+ }
11
+ export {
12
+ e as isInEnum,
13
+ o as toEnumValue
14
+ };
@@ -1 +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.30",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -36,22 +36,12 @@
36
36
  "types": "./providers/prepareWagmiHinkal.d.ts",
37
37
  "import": "./providers/prepareWagmiHinkal.mjs",
38
38
  "default": "./providers/prepareWagmiHinkal.cjs"
39
- },
40
- "./providers/SolanaProviderAdapter": {
41
- "types": "./providers/SolanaProviderAdapter.d.ts",
42
- "import": "./providers/SolanaProviderAdapter.mjs",
43
- "default": "./providers/SolanaProviderAdapter.cjs"
44
- },
45
- "./providers/TronProviderAdapter": {
46
- "types": "./providers/TronProviderAdapter.d.ts",
47
- "import": "./providers/TronProviderAdapter.mjs",
48
- "default": "./providers/TronProviderAdapter.cjs"
49
39
  }
50
40
  },
51
41
  "types": "./index.d.ts",
52
42
  "scripts": {
53
- "prebuild": "npx nx prebuild:workers",
54
- "build": "npx nx build",
43
+ "prebuild": "nx prebuild:workers",
44
+ "build": "nx build",
55
45
  "lint": "nx lint",
56
46
  "test": "nx test"
57
47
  },
@@ -1 +1 @@
1
- "use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/snarkjsWorkerLauncher-BaRacf89.js").href:new URL("../../assets/snarkjsWorkerLauncher-BaRacf89.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
1
+ "use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/snarkjsWorkerLauncher-B6wGkEBo.js").href:new URL("../../assets/snarkjsWorkerLauncher-B6wGkEBo.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
@@ -1,4 +1,4 @@
1
- const r = "" + new URL("../../assets/snarkjsWorkerLauncher-BaRacf89.js", import.meta.url).href;
1
+ const r = "" + new URL("../../assets/snarkjsWorkerLauncher-B6wGkEBo.js", import.meta.url).href;
2
2
  export {
3
3
  r as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/utxoWorkerLauncher-BbQ2bJD6.js").href:new URL("../../assets/utxoWorkerLauncher-BbQ2bJD6.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
1
+ "use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/utxoWorkerLauncher-CFkGjOsh.js").href:new URL("../../assets/utxoWorkerLauncher-CFkGjOsh.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
@@ -1,4 +1,4 @@
1
- const e = "" + new URL("../../assets/utxoWorkerLauncher-BbQ2bJD6.js", import.meta.url).href;
1
+ const e = "" + new URL("../../assets/utxoWorkerLauncher-CFkGjOsh.js", import.meta.url).href;
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/zkProofWorkerLauncher-2cfKnA2L.js").href:new URL("../../assets/zkProofWorkerLauncher-2cfKnA2L.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
1
+ "use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/zkProofWorkerLauncher-BgtIIi8u.js").href:new URL("../../assets/zkProofWorkerLauncher-BgtIIi8u.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
@@ -1,4 +1,4 @@
1
- const r = "" + new URL("../../assets/zkProofWorkerLauncher-2cfKnA2L.js", import.meta.url).href;
1
+ const r = "" + new URL("../../assets/zkProofWorkerLauncher-BgtIIi8u.js", import.meta.url).href;
2
2
  export {
3
3
  r as default
4
4
  };