@hinkal/common 0.1.6 → 0.1.7

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 (53) hide show
  1. package/constants/coingecko.constants.cjs +1 -1
  2. package/constants/coingecko.constants.mjs +14 -13
  3. package/constants/vite.constants.cjs +1 -1
  4. package/constants/vite.constants.mjs +22 -21
  5. package/data-structures/Hinkal/Hinkal.cjs +1 -1
  6. package/data-structures/Hinkal/Hinkal.mjs +71 -70
  7. package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
  8. package/data-structures/Hinkal/hinkalPrivateWallet.mjs +8 -7
  9. package/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
  10. package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +35 -34
  11. package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
  12. package/data-structures/transactions-manager/TransactionsManager.mjs +28 -27
  13. package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
  14. package/functions/pre-transaction/outputUtxoProcessing.mjs +3 -2
  15. package/functions/pre-transaction/processAmountChanges.cjs +1 -1
  16. package/functions/pre-transaction/processAmountChanges.mjs +3 -2
  17. package/functions/protocols/pendle.helpers.cjs +1 -1
  18. package/functions/protocols/pendle.helpers.mjs +11 -10
  19. package/functions/snarkjs/common.snarkjs.cjs +1 -1
  20. package/functions/snarkjs/common.snarkjs.mjs +28 -27
  21. package/functions/staking/index.cjs +1 -1
  22. package/functions/staking/index.mjs +25 -24
  23. package/functions/utils/process.utils.cjs +1 -1
  24. package/functions/utils/process.utils.mjs +3 -2
  25. package/functions/utils/requireEnv.cjs +1 -1
  26. package/functions/utils/requireEnv.mjs +5 -4
  27. package/functions/web3/events/balanceChangedHandler.cjs +1 -1
  28. package/functions/web3/events/balanceChangedHandler.mjs +4 -3
  29. package/functions/web3/odosAPI.cjs +1 -1
  30. package/functions/web3/odosAPI.mjs +9 -8
  31. package/functions/web3/oneInchAPI.cjs +1 -1
  32. package/functions/web3/oneInchAPI.mjs +3 -2
  33. package/functions/web3/runContractFunction.cjs +1 -1
  34. package/functions/web3/runContractFunction.mjs +3 -2
  35. package/functions/web3/uniswapAPI.cjs +1 -1
  36. package/functions/web3/uniswapAPI.mjs +3 -2
  37. package/package.json +1 -1
  38. package/providers/prepareEthersHinkal.cjs +1 -1
  39. package/providers/prepareEthersHinkal.mjs +4 -2
  40. package/providers/prepareWagmiv1Hinkal.cjs +1 -1
  41. package/providers/prepareWagmiv1Hinkal.mjs +4 -2
  42. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
  43. package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
  44. package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
  45. package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +11 -10
  46. package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
  47. package/webworker/utxoWorker/utxoWorkerLauncher.mjs +2 -2
  48. package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
  49. package/webworker/utxoWorker/utxoWorkerLogic.mjs +29 -28
  50. package/webworker/workerProxy.cjs +1 -1
  51. package/webworker/workerProxy.mjs +4 -3
  52. package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
  53. package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chains.constants.cjs"),t="https://api.coingecko.com/api/v3",c="https://pro-api.coingecko.com/api/v3",o=process.env.COINGECKO_API_KEY,s="x-cg-pro-api-key",i=o?c:t,r=n=>`${i}/simple/price?ids=${n}&vs_currencies=USD,ETH`,h=(n,a)=>`${i}/simple/token_price/${a}?contract_addresses=${n}&vs_currencies=USD`,l=`${c}/coins/list`,d={[e.chainIds.arbMainnet]:"ethereum",[e.chainIds.localhost]:"ethereum",[e.chainIds.ethMainnet]:"ethereum",[e.chainIds.optimism]:"ethereum",[e.chainIds.avalanche]:"avalanche-2",[e.chainIds.polygon]:"matic-network",[e.chainIds.bnbMainnet]:"binancecoin",[e.chainIds.base]:"ethereum"},I=n=>{switch(e.getNonLocalhostChainId(n)){case e.chainIds.ethMainnet:return"ethereum";case e.chainIds.polygon:return"polygon-pos";case e.chainIds.bnbMainnet:return"binance-smart-chain";case e.chainIds.optimism:return"optimistic-ethereum";case e.chainIds.arbMainnet:return"arbitrum-one";case e.chainIds.avalanche:return"avalanche";case e.chainIds.base:return"base";default:return"ethereum"}},p={[e.chainIds.polygon]:"polygon-pos",[e.chainIds.arbMainnet]:"arbitrum-one",[e.chainIds.ethMainnet]:"ethereum",[e.chainIds.avalanche]:"avalanche",[e.chainIds.bnbMainnet]:"binance-smart-chain",[e.chainIds.optimism]:"optimistic-ethereum",[e.chainIds.base]:"base"};exports.COINGECKO_API_KEY=o;exports.CoinGeckoChainLabels=p;exports.coingeckoPriceUrl=r;exports.coingeckoPriceUrl2=h;exports.coingeckoTokenListUrl=l;exports.getCoingeckoIdForNativeTokens=d;exports.getCoingeckoPlatform=I;exports.proCoingeckoUrl=c;exports.proHeader=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.cjs"),e=require("./chains.constants.cjs"),s="https://api.coingecko.com/api/v3",c="https://pro-api.coingecko.com/api/v3",i=t.default.env.COINGECKO_API_KEY,r="x-cg-pro-api-key",o=i?c:s,h=n=>`${o}/simple/price?ids=${n}&vs_currencies=USD,ETH`,l=(n,a)=>`${o}/simple/token_price/${a}?contract_addresses=${n}&vs_currencies=USD`,d=`${c}/coins/list`,I={[e.chainIds.arbMainnet]:"ethereum",[e.chainIds.localhost]:"ethereum",[e.chainIds.ethMainnet]:"ethereum",[e.chainIds.optimism]:"ethereum",[e.chainIds.avalanche]:"avalanche-2",[e.chainIds.polygon]:"matic-network",[e.chainIds.bnbMainnet]:"binancecoin",[e.chainIds.base]:"ethereum"},u=n=>{switch(e.getNonLocalhostChainId(n)){case e.chainIds.ethMainnet:return"ethereum";case e.chainIds.polygon:return"polygon-pos";case e.chainIds.bnbMainnet:return"binance-smart-chain";case e.chainIds.optimism:return"optimistic-ethereum";case e.chainIds.arbMainnet:return"arbitrum-one";case e.chainIds.avalanche:return"avalanche";case e.chainIds.base:return"base";default:return"ethereum"}},m={[e.chainIds.polygon]:"polygon-pos",[e.chainIds.arbMainnet]:"arbitrum-one",[e.chainIds.ethMainnet]:"ethereum",[e.chainIds.avalanche]:"avalanche",[e.chainIds.bnbMainnet]:"binance-smart-chain",[e.chainIds.optimism]:"optimistic-ethereum",[e.chainIds.base]:"base"};exports.COINGECKO_API_KEY=i;exports.CoinGeckoChainLabels=m;exports.coingeckoPriceUrl=h;exports.coingeckoPriceUrl2=l;exports.coingeckoTokenListUrl=d;exports.getCoingeckoIdForNativeTokens=I;exports.getCoingeckoPlatform=u;exports.proCoingeckoUrl=c;exports.proHeader=r;
@@ -1,5 +1,6 @@
1
- import { chainIds as e, getNonLocalhostChainId as c } from "./chains.constants.mjs";
2
- const i = "https://api.coingecko.com/api/v3", t = "https://pro-api.coingecko.com/api/v3", r = process.env.COINGECKO_API_KEY, h = "x-cg-pro-api-key", a = r ? t : i, m = (n) => `${a}/simple/price?ids=${n}&vs_currencies=USD,ETH`, p = (n, o) => `${a}/simple/token_price/${o}?contract_addresses=${n}&vs_currencies=USD`, l = `${t}/coins/list`, u = {
1
+ import c from "../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.mjs";
2
+ import { chainIds as e, getNonLocalhostChainId as r } from "./chains.constants.mjs";
3
+ const i = "https://api.coingecko.com/api/v3", t = "https://pro-api.coingecko.com/api/v3", s = c.env.COINGECKO_API_KEY, p = "x-cg-pro-api-key", a = s ? t : i, l = (n) => `${a}/simple/price?ids=${n}&vs_currencies=USD,ETH`, u = (n, o) => `${a}/simple/token_price/${o}?contract_addresses=${n}&vs_currencies=USD`, b = `${t}/coins/list`, g = {
3
4
  [e.arbMainnet]: "ethereum",
4
5
  [e.localhost]: "ethereum",
5
6
  [e.ethMainnet]: "ethereum",
@@ -8,8 +9,8 @@ const i = "https://api.coingecko.com/api/v3", t = "https://pro-api.coingecko.com
8
9
  [e.polygon]: "matic-network",
9
10
  [e.bnbMainnet]: "binancecoin",
10
11
  [e.base]: "ethereum"
11
- }, b = (n) => {
12
- switch (c(n)) {
12
+ }, k = (n) => {
13
+ switch (r(n)) {
13
14
  case e.ethMainnet:
14
15
  return "ethereum";
15
16
  case e.polygon:
@@ -27,7 +28,7 @@ const i = "https://api.coingecko.com/api/v3", t = "https://pro-api.coingecko.com
27
28
  default:
28
29
  return "ethereum";
29
30
  }
30
- }, g = {
31
+ }, C = {
31
32
  [e.polygon]: "polygon-pos",
32
33
  [e.arbMainnet]: "arbitrum-one",
33
34
  [e.ethMainnet]: "ethereum",
@@ -37,13 +38,13 @@ const i = "https://api.coingecko.com/api/v3", t = "https://pro-api.coingecko.com
37
38
  [e.base]: "base"
38
39
  };
39
40
  export {
40
- r as COINGECKO_API_KEY,
41
- g as CoinGeckoChainLabels,
42
- m as coingeckoPriceUrl,
43
- p as coingeckoPriceUrl2,
44
- l as coingeckoTokenListUrl,
45
- u as getCoingeckoIdForNativeTokens,
46
- b as getCoingeckoPlatform,
41
+ s as COINGECKO_API_KEY,
42
+ C as CoinGeckoChainLabels,
43
+ l as coingeckoPriceUrl,
44
+ u as coingeckoPriceUrl2,
45
+ b as coingeckoTokenListUrl,
46
+ g as getCoingeckoIdForNativeTokens,
47
+ k as getCoingeckoPlatform,
47
48
  t as proCoingeckoUrl,
48
- h as proHeader
49
+ p as proHeader
49
50
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../functions/utils/enum.utils.cjs"),s=require("../functions/utils/process.utils.cjs");var r=(e=>(e.DEVELOPMENT="development",e.STAGING="staging",e.PLAYGROUND="playground",e.PRODUCTION="production",e))(r||{});const o={development:["localhost","192.","127."],playground:["playground"],staging:["working-branch"]};function t(e,l){return l.some(c=>e.includes(c))}const g=()=>(require("dotenv").config({path:"DOTENV_OVERRIDE"in process.env?process.env.DOTENV_OVERRIDE:void 0}),p.toEnumValue(r,process.env.DEPLOYMENT_MODE)||"development"),a=()=>{if(!s.isOnServer()&&typeof window>"u")return;if(s.isOnServer())return g();const e=window?.location?.host;return t(e,o.development)?"development":t(e,o.playground)?"playground":t(e,o.staging)?"staging":"production"},v=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,y=typeof __webpack_require__<"u",n=a(),i=n==="staging",d=n==="playground",u=n==="development",m=i||u||d;exports.DEPLOYMENT_MODE=r;exports.deploymentMode=n;exports.isDevelopment=u;exports.isNode=v;exports.isNotProduction=m;exports.isPlayground=d;exports.isStaging=i;exports.isWebpack=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.cjs"),p=require("../functions/utils/enum.utils.cjs"),d=require("../functions/utils/process.utils.cjs");var r=(e=>(e.DEVELOPMENT="development",e.STAGING="staging",e.PLAYGROUND="playground",e.PRODUCTION="production",e))(r||{});const t={development:["localhost","192.","127."],playground:["playground"],staging:["working-branch"]};function i(e,a){return a.some(c=>e.includes(c))}const g=()=>(require("dotenv").config({path:"DOTENV_OVERRIDE"in n.default.env?n.default.env.DOTENV_OVERRIDE:void 0}),p.toEnumValue(r,n.default.env.DEPLOYMENT_MODE)||"development"),f=()=>{if(!d.isOnServer()&&typeof window>"u")return;if(d.isOnServer())return g();const e=window?.location?.host;return i(e,t.development)?"development":i(e,t.playground)?"playground":i(e,t.staging)?"staging":"production"},v=typeof n.default<"u"&&n.default.versions!=null&&n.default.versions.node!=null,y=typeof __webpack_require__<"u",o=f(),s=o==="staging",u=o==="playground",l=o==="development",m=s||l||u;exports.DEPLOYMENT_MODE=r;exports.deploymentMode=o;exports.isDevelopment=l;exports.isNode=v;exports.isNotProduction=m;exports.isPlayground=u;exports.isStaging=s;exports.isWebpack=y;
@@ -1,34 +1,35 @@
1
+ import n from "../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.mjs";
1
2
  import { toEnumValue as p } from "../functions/utils/enum.utils.mjs";
2
- import { isOnServer as r } from "../functions/utils/process.utils.mjs";
3
- var s = /* @__PURE__ */ ((e) => (e.DEVELOPMENT = "development", e.STAGING = "staging", e.PLAYGROUND = "playground", e.PRODUCTION = "production", e))(s || {});
4
- const n = {
3
+ import { isOnServer as i } from "../functions/utils/process.utils.mjs";
4
+ var d = /* @__PURE__ */ ((e) => (e.DEVELOPMENT = "development", e.STAGING = "staging", e.PLAYGROUND = "playground", e.PRODUCTION = "production", e))(d || {});
5
+ const o = {
5
6
  development: ["localhost", "192.", "127."],
6
7
  playground: ["playground"],
7
8
  // The code deployed to the 'playground' branch is hosted by Netlify at 'hinkal-playground.netlify.app'
8
9
  staging: ["working-branch"]
9
10
  // The code deployed to the 'new' branch is hosted by Netlify at 'working-branch.netlify.app'
10
11
  };
11
- function o(e, i) {
12
- return i.some((d) => e.includes(d));
12
+ function t(e, s) {
13
+ return s.some((u) => e.includes(u));
13
14
  }
14
- const u = () => (require("dotenv").config({
15
+ const l = () => (require("dotenv").config({
15
16
  // allow overriding .env file path, see startServer.sh script for explenation on why it is needed
16
- path: "DOTENV_OVERRIDE" in process.env ? process.env.DOTENV_OVERRIDE : void 0
17
- }), p(s, process.env.DEPLOYMENT_MODE) || "development"), c = () => {
18
- if (!r() && typeof window > "u")
17
+ path: "DOTENV_OVERRIDE" in n.env ? n.env.DOTENV_OVERRIDE : void 0
18
+ }), p(d, n.env.DEPLOYMENT_MODE) || "development"), c = () => {
19
+ if (!i() && typeof window > "u")
19
20
  return;
20
- if (r())
21
- return u();
21
+ if (i())
22
+ return l();
22
23
  const e = window?.location?.host;
23
- return o(e, n.development) ? "development" : o(e, n.playground) ? "playground" : o(e, n.staging) ? "staging" : "production";
24
- }, y = typeof process < "u" && process.versions != null && process.versions.node != null, f = typeof __webpack_require__ < "u", t = c(), l = t === "staging", g = t === "playground", a = t === "development", R = l || a || g;
24
+ return t(e, o.development) ? "development" : t(e, o.playground) ? "playground" : t(e, o.staging) ? "staging" : "production";
25
+ }, R = typeof n < "u" && n.versions != null && n.versions.node != null, w = typeof __webpack_require__ < "u", r = c(), g = r === "staging", a = r === "playground", m = r === "development", D = g || m || a;
25
26
  export {
26
- s as DEPLOYMENT_MODE,
27
- t as deploymentMode,
28
- a as isDevelopment,
29
- y as isNode,
30
- R as isNotProduction,
31
- g as isPlayground,
32
- l as isStaging,
33
- f as isWebpack
27
+ d as DEPLOYMENT_MODE,
28
+ r as deploymentMode,
29
+ m as isDevelopment,
30
+ R as isNode,
31
+ D as isNotProduction,
32
+ a as isPlayground,
33
+ g as isStaging,
34
+ w as isWebpack
34
35
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../types/hinkal.types.cjs"),h=require("../../types/ethereum-network.types.cjs"),a=require("../../functions/web3/functionCalls/accessTokenCalls.cjs"),y=require("../../functions/web3/events/getShieldedBalance.cjs"),o=require("../crypto-keys/keys.cjs"),v=require("./hinkalActionBeefy.cjs"),C=require("./hinkalActionConvex.cjs"),P=require("./hinkalActionCurve.cjs"),w=require("./hinkalActionPendle.cjs"),d=require("./hinkalDeposit.cjs"),T=require("./hinkalSwap.cjs"),m=require("./hinkalWithdraw.cjs"),q=require("./resetMerkleTrees.cjs"),l=require("../merkle-tree/MerkleTree.cjs"),u=require("../../crypto/poseidon.cjs");require("circomlibjs");const S=require("../../constants/chains.constants.cjs"),g=require("../../error-handling/error-codes.constants.cjs"),f=require("../../API/callMonitor.cjs"),E=require("./hinkalActionLidoEth.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const F=require("../../API/getAxelarGasEstimate.cjs"),p=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.cjs");require("../../constants/contracts.constants.cjs");const H=require("../../constants/kyc.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const I=require("../transactions-manager/TransactionsManager.cjs");require("../../functions/utils/external-action.utils.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");const M=require("../../functions/utils/reloadPage.cjs"),R=require("./hinkalActionVolatile.cjs"),k=require("./hinkalActionPendleLP.cjs"),L=require("../../API/getConnextReceiveFee.cjs"),W=require("./hinkalActionStake.cjs"),K=require("../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs"),N=require("./hinkalPrivateWallet.cjs");class x{providerAdapter;userKeys;signingMessage="Login to Hinkal Protocol";merkleTreeHinkal;merkleTreeAccessToken;nullifiers;encryptedOutputs;commitmentsSnapshotService;nullifierSnapshotService;accessTokenSnapshotService;transactionsManager;utxoUtils=K.multiThreadedUtxoUtils;constructor(){this.userKeys=new o.UserKeys(void 0),this.merkleTreeHinkal=l.MerkleTree.create(u.poseidonFunction,25n,0n),this.merkleTreeAccessToken=l.MerkleTree.create(u.poseidonFunction,25n,0n),this.nullifiers=new Set,this.encryptedOutputs=[],this.transactionsManager=new I.TransactionsManager}async initProviderAdapter(e,t){await this.updateProviderAdapter(t),this.providerAdapter?.initConnector(e);const r=await this.connectAndPatchProvider(e);await t.init(r),await this.setListeners()}async initUserKeys(){this.userKeys=new o.UserKeys(await this.getProviderAdapter().signMessage(this.signingMessage))}async initUserKeysWithPassword(e){this.userKeys=new o.UserKeys(e)}async resetMerkle(){this.isSelectedNetworkSupported()&&await q.resetMerkleTrees(this)}getProviderAdapter(){if(!this.providerAdapter)throw new Error("ProviderAdapter is not initialized");return this.providerAdapter}async waitForTransaction(e,t=1){return!!await this.providerAdapter?.waitForTransaction(e,t)}getContractMetadata(e,t){return this.getProviderAdapter().getContractMetadata(e,t)}getContract(e,t=void 0,r){return this.getProviderAdapter().getContract(e,t,r)}async signMessage(e){return await this.getProviderAdapter().signMessage(e)}async signTypedData(e,t,r){return await this.getProviderAdapter().signTypedData(e,t,r)}getContractWithSigner(e,t=""){return this.getProviderAdapter().getContractWithSigner(e,t)}getContractWithFetcher(e,t=""){return this.getProviderAdapter().getContractWithFetcher(e,t)}getContractWithFetcherForEthereum(e,t){return this.getProviderAdapter().getContractWithFetcherForEthereum(e,t)}isSelectedNetworkSupported(){return!!S.networkRegistry[this.getCurrentChainId()]}async switchNetwork(e){try{await this.getProviderAdapter().switchNetwork(e)}catch{throw new Error(g.transactionErrorCodes.FAILED_TO_SWITCH_NETWORKS)}}getCurrentChainId(){const{chainId:e}=this.getProviderAdapter();if(!e)throw new Error("Illegal State: no chainId");return e}getSelectedNetwork(){return this.providerAdapter?.getSelectedNetwork()}isPermitterAvailable(){return this.getProviderAdapter().isPermitterAvailable()}async connectAndPatchProvider(e){return await this.getProviderAdapter().connectAndPatchProvider(e)}async disconnectFromConnector(){await this.getProviderAdapter().disconnectFromConnector()}async updateProviderAdapter(e){try{this.providerAdapter&&this.providerAdapter.release(),this.providerAdapter=e}catch(t){throw console.error(t),Error("updateProviderAdapter failed, please try again.")}}async setListeners(){this.providerAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}})}async onAccountChanged(){await this.getProviderAdapter().onAccountChanged();const e=c.EventType.AccountChanged;typeof document<"u"?document?.dispatchEvent(new Event(e)):process?.emit("message",e,void 0)}async onChainChanged(e){if(e){await this.getProviderAdapter().onChainChanged(e);const t=c.EventType.NetworkChange;typeof document<"u"?document.dispatchEvent(new Event(t)):process?.emit("message",t,void 0)}else await this.disconnectFromConnector(),M.reloadPage()}async monitorConnectedAddress(){f.monitor(await this.getEthereumAddress(),this.getCurrentChainId())}async getBalances(){return y.getShieldedBalance(this)}getSupportedPassportLinks(){return H.supportedPassportLinks}checkAccessToken(){return a.checkHinkalAccessToken(this)}async getAxelarEstimate(e,t,r,n){return F.getAxelarGasEstimate(e,t,r,n,this.userKeys.getAccessKey())}async getConnextReceiveFee(e,t){return L.getConnextReceiveFee(this.getCurrentChainId(),e,t)}async mintHinkalAccessToken(e){return a.mintAccessToken(this,e)}async mintHinkalAccessTokenCrossChain(e,t){return a.mintTokenCrossChain(this,e,t)}async getHinkalTreeRootHash(){return this.getContractWithFetcher(h.ContractType.HinkalContract).getRootHash()}async getAccessTokenTreeRootHash(){return this.getContractWithFetcher(h.ContractType.CrossChainAccessTokenContract).getRootHash()}async resetMerkleTreesIfNecessary(){if(!this.isSelectedNetworkSupported())throw new Error(g.transactionErrorCodes.UNSUPPORTED_NETWORK);const[e,t]=await Promise.all([this.getHinkalTreeRootHash(),this.getAccessTokenTreeRootHash()]);(e.toBigInt()!==this.merkleTreeHinkal.getRootHash()||t.toBigInt()!==this.merkleTreeAccessToken.getRootHash())&&await this.resetMerkle()}async getEventsFromHinkal(){await Promise.all([this.accessTokenSnapshotService?.retrieveEventsFromLatestBlock(),this.commitmentsSnapshotService?.retrieveEventsFromLatestBlock(),this.nullifierSnapshotService?.retrieveEventsFromLatestBlock()])}getEthereumAddress(){return this.getProviderAdapter().getAddress()}async getRandomRelay(){return(await p.API.getIdleRelay(this.getCurrentChainId())).relay}getGasPrice(){if(!this.providerAdapter?.chainId)throw new Error("Illegal State of providerAdapter in Hinkal: no chainId");return this.providerAdapter.getGasPrice()}getAPI(){return p.API}async deposit(e,t){return d.hinkalDeposit(this,e,t)}async depositForOther(e,t,r){return d.hinkalDepositForOther(this,e,t,r)}async withdraw(e,t,r,n,i=!1){return m.hinkalWithdraw(this,e,t,r,n,i)}async swap(e,t,r,n,i=!1,s=!1){return T.hinkalSwap(this,e,t,r,n,i,s)}async actionCurve(e,t,r,n,i,s=!1){return P.hinkalActionCurve(this,e,t,r,n,i,s)}async actionConvex(e,t,r,n,i=!1){return C.hinkalActionConvex(this,e,t,r,n,i)}async actionBeefy(e,t,r,n,i,s,A=!1){return v.hinkalActionBeefy(this,e,t,r,n,i,s,A)}async actionLido(e,t,r,n,i,s=!1){return E.hinkalActionLido(this,e,t,r,n,i,s)}async actionPendle(e,t,r,n,i=!1){return w.hinkalActionPendle(this,e,t,r,n,i)}async actionPendleLP(e,t,r,n,i=!1){return k.hinkalActionPendleLP(this,e,t,r,n,i)}async actionVolatile(e,t,r,n=!1){return R.hinkalActionVolatile(this,e,t,r,n)}async actionStake(e,t,r,n){return W.hinkalActionStake(this,e,t,r,n)}async actionPrivateWallet(e,t,r,n=[],i,s=!1){return N.hinkalPrivateWallet(this,e,t,r,n,i,s)}async getPendleLPClaimableParams(e,t){return k.hinkalGetPendleLPClaimableParams(this,e,t)}}exports.Hinkal=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.cjs"),h=require("../../types/hinkal.types.cjs"),d=require("../../types/ethereum-network.types.cjs"),a=require("../../functions/web3/functionCalls/accessTokenCalls.cjs"),v=require("../../functions/web3/events/getShieldedBalance.cjs"),o=require("../crypto-keys/keys.cjs"),C=require("./hinkalActionBeefy.cjs"),P=require("./hinkalActionConvex.cjs"),w=require("./hinkalActionCurve.cjs"),T=require("./hinkalActionPendle.cjs"),l=require("./hinkalDeposit.cjs"),m=require("./hinkalSwap.cjs"),q=require("./hinkalWithdraw.cjs"),f=require("./resetMerkleTrees.cjs"),u=require("../merkle-tree/MerkleTree.cjs"),g=require("../../crypto/poseidon.cjs");require("circomlibjs");const S=require("../../constants/chains.constants.cjs"),p=require("../../error-handling/error-codes.constants.cjs"),E=require("../../API/callMonitor.cjs"),F=require("./hinkalActionLidoEth.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const H=require("../../API/getAxelarGasEstimate.cjs"),k=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.cjs");require("../../constants/contracts.constants.cjs");const I=require("../../constants/kyc.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const M=require("../transactions-manager/TransactionsManager.cjs");require("../../functions/utils/external-action.utils.cjs");require("../../types/circom-data.types.cjs");require("../../types/transactions.types.cjs");const R=require("../../functions/utils/reloadPage.cjs"),L=require("./hinkalActionVolatile.cjs"),A=require("./hinkalActionPendleLP.cjs"),W=require("../../API/getConnextReceiveFee.cjs"),x=require("./hinkalActionStake.cjs"),K=require("../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs"),N=require("./hinkalPrivateWallet.cjs");class U{providerAdapter;userKeys;signingMessage="Login to Hinkal Protocol";merkleTreeHinkal;merkleTreeAccessToken;nullifiers;encryptedOutputs;commitmentsSnapshotService;nullifierSnapshotService;accessTokenSnapshotService;transactionsManager;utxoUtils=K.multiThreadedUtxoUtils;constructor(){this.userKeys=new o.UserKeys(void 0),this.merkleTreeHinkal=u.MerkleTree.create(g.poseidonFunction,25n,0n),this.merkleTreeAccessToken=u.MerkleTree.create(g.poseidonFunction,25n,0n),this.nullifiers=new Set,this.encryptedOutputs=[],this.transactionsManager=new M.TransactionsManager}async initProviderAdapter(e,t){await this.updateProviderAdapter(t),this.providerAdapter?.initConnector(e);const r=await this.connectAndPatchProvider(e);await t.init(r),await this.setListeners()}async initUserKeys(){this.userKeys=new o.UserKeys(await this.getProviderAdapter().signMessage(this.signingMessage))}async initUserKeysWithPassword(e){this.userKeys=new o.UserKeys(e)}async resetMerkle(){this.isSelectedNetworkSupported()&&await f.resetMerkleTrees(this)}getProviderAdapter(){if(!this.providerAdapter)throw new Error("ProviderAdapter is not initialized");return this.providerAdapter}async waitForTransaction(e,t=1){return!!await this.providerAdapter?.waitForTransaction(e,t)}getContractMetadata(e,t){return this.getProviderAdapter().getContractMetadata(e,t)}getContract(e,t=void 0,r){return this.getProviderAdapter().getContract(e,t,r)}async signMessage(e){return await this.getProviderAdapter().signMessage(e)}async signTypedData(e,t,r){return await this.getProviderAdapter().signTypedData(e,t,r)}getContractWithSigner(e,t=""){return this.getProviderAdapter().getContractWithSigner(e,t)}getContractWithFetcher(e,t=""){return this.getProviderAdapter().getContractWithFetcher(e,t)}getContractWithFetcherForEthereum(e,t){return this.getProviderAdapter().getContractWithFetcherForEthereum(e,t)}isSelectedNetworkSupported(){return!!S.networkRegistry[this.getCurrentChainId()]}async switchNetwork(e){try{await this.getProviderAdapter().switchNetwork(e)}catch{throw new Error(p.transactionErrorCodes.FAILED_TO_SWITCH_NETWORKS)}}getCurrentChainId(){const{chainId:e}=this.getProviderAdapter();if(!e)throw new Error("Illegal State: no chainId");return e}getSelectedNetwork(){return this.providerAdapter?.getSelectedNetwork()}isPermitterAvailable(){return this.getProviderAdapter().isPermitterAvailable()}async connectAndPatchProvider(e){return await this.getProviderAdapter().connectAndPatchProvider(e)}async disconnectFromConnector(){await this.getProviderAdapter().disconnectFromConnector()}async updateProviderAdapter(e){try{this.providerAdapter&&this.providerAdapter.release(),this.providerAdapter=e}catch(t){throw console.error(t),Error("updateProviderAdapter failed, please try again.")}}async setListeners(){this.providerAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}})}async onAccountChanged(){await this.getProviderAdapter().onAccountChanged();const e=h.EventType.AccountChanged;typeof document<"u"?document?.dispatchEvent(new Event(e)):c.default?.emit("message",e,void 0)}async onChainChanged(e){if(e){await this.getProviderAdapter().onChainChanged(e);const t=h.EventType.NetworkChange;typeof document<"u"?document.dispatchEvent(new Event(t)):c.default?.emit("message",t,void 0)}else await this.disconnectFromConnector(),R.reloadPage()}async monitorConnectedAddress(){E.monitor(await this.getEthereumAddress(),this.getCurrentChainId())}async getBalances(){return v.getShieldedBalance(this)}getSupportedPassportLinks(){return I.supportedPassportLinks}checkAccessToken(){return a.checkHinkalAccessToken(this)}async getAxelarEstimate(e,t,r,n){return H.getAxelarGasEstimate(e,t,r,n,this.userKeys.getAccessKey())}async getConnextReceiveFee(e,t){return W.getConnextReceiveFee(this.getCurrentChainId(),e,t)}async mintHinkalAccessToken(e){return a.mintAccessToken(this,e)}async mintHinkalAccessTokenCrossChain(e,t){return a.mintTokenCrossChain(this,e,t)}async getHinkalTreeRootHash(){return this.getContractWithFetcher(d.ContractType.HinkalContract).getRootHash()}async getAccessTokenTreeRootHash(){return this.getContractWithFetcher(d.ContractType.CrossChainAccessTokenContract).getRootHash()}async resetMerkleTreesIfNecessary(){if(!this.isSelectedNetworkSupported())throw new Error(p.transactionErrorCodes.UNSUPPORTED_NETWORK);const[e,t]=await Promise.all([this.getHinkalTreeRootHash(),this.getAccessTokenTreeRootHash()]);(e.toBigInt()!==this.merkleTreeHinkal.getRootHash()||t.toBigInt()!==this.merkleTreeAccessToken.getRootHash())&&await this.resetMerkle()}async getEventsFromHinkal(){await Promise.all([this.accessTokenSnapshotService?.retrieveEventsFromLatestBlock(),this.commitmentsSnapshotService?.retrieveEventsFromLatestBlock(),this.nullifierSnapshotService?.retrieveEventsFromLatestBlock()])}getEthereumAddress(){return this.getProviderAdapter().getAddress()}async getRandomRelay(){return(await k.API.getIdleRelay(this.getCurrentChainId())).relay}getGasPrice(){if(!this.providerAdapter?.chainId)throw new Error("Illegal State of providerAdapter in Hinkal: no chainId");return this.providerAdapter.getGasPrice()}getAPI(){return k.API}async deposit(e,t){return l.hinkalDeposit(this,e,t)}async depositForOther(e,t,r){return l.hinkalDepositForOther(this,e,t,r)}async withdraw(e,t,r,n,i=!1){return q.hinkalWithdraw(this,e,t,r,n,i)}async swap(e,t,r,n,i=!1,s=!1){return m.hinkalSwap(this,e,t,r,n,i,s)}async actionCurve(e,t,r,n,i,s=!1){return w.hinkalActionCurve(this,e,t,r,n,i,s)}async actionConvex(e,t,r,n,i=!1){return P.hinkalActionConvex(this,e,t,r,n,i)}async actionBeefy(e,t,r,n,i,s,y=!1){return C.hinkalActionBeefy(this,e,t,r,n,i,s,y)}async actionLido(e,t,r,n,i,s=!1){return F.hinkalActionLido(this,e,t,r,n,i,s)}async actionPendle(e,t,r,n,i=!1){return T.hinkalActionPendle(this,e,t,r,n,i)}async actionPendleLP(e,t,r,n,i=!1){return A.hinkalActionPendleLP(this,e,t,r,n,i)}async actionVolatile(e,t,r,n=!1){return L.hinkalActionVolatile(this,e,t,r,n)}async actionStake(e,t,r,n){return x.hinkalActionStake(this,e,t,r,n)}async actionPrivateWallet(e,t,r,n=[],i,s=!1){return N.hinkalPrivateWallet(this,e,t,r,n,i,s)}async getPendleLPClaimableParams(e,t){return A.hinkalGetPendleLPClaimableParams(this,e,t)}}exports.Hinkal=U;
@@ -1,47 +1,48 @@
1
- import { EventType as o } from "../../types/hinkal.types.mjs";
2
- import { ContractType as c } from "../../types/ethereum-network.types.mjs";
3
- import { checkHinkalAccessToken as g, mintAccessToken as u, mintTokenCrossChain as k } from "../../functions/web3/functionCalls/accessTokenCalls.mjs";
4
- import { getShieldedBalance as A } from "../../functions/web3/events/getShieldedBalance.mjs";
1
+ import o from "../../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.mjs";
2
+ import { EventType as c } from "../../types/hinkal.types.mjs";
3
+ import { ContractType as h } from "../../types/ethereum-network.types.mjs";
4
+ import { checkHinkalAccessToken as u, mintAccessToken as k, mintTokenCrossChain as A } from "../../functions/web3/functionCalls/accessTokenCalls.mjs";
5
+ import { getShieldedBalance as v } from "../../functions/web3/events/getShieldedBalance.mjs";
5
6
  import { UserKeys as s } from "../crypto-keys/keys.mjs";
6
- import { hinkalActionBeefy as v } from "./hinkalActionBeefy.mjs";
7
- import { hinkalActionConvex as y } from "./hinkalActionConvex.mjs";
8
- import { hinkalActionCurve as f } from "./hinkalActionCurve.mjs";
9
- import { hinkalActionPendle as C } from "./hinkalActionPendle.mjs";
10
- import { hinkalDeposit as w, hinkalDepositForOther as P } from "./hinkalDeposit.mjs";
11
- import { hinkalSwap as T } from "./hinkalSwap.mjs";
12
- import { hinkalWithdraw as S } from "./hinkalWithdraw.mjs";
13
- import { resetMerkleTrees as E } from "./resetMerkleTrees.mjs";
14
- import { MerkleTree as h } from "../merkle-tree/MerkleTree.mjs";
15
- import { poseidonFunction as d } from "../../crypto/poseidon.mjs";
7
+ import { hinkalActionBeefy as y } from "./hinkalActionBeefy.mjs";
8
+ import { hinkalActionConvex as f } from "./hinkalActionConvex.mjs";
9
+ import { hinkalActionCurve as C } from "./hinkalActionCurve.mjs";
10
+ import { hinkalActionPendle as w } from "./hinkalActionPendle.mjs";
11
+ import { hinkalDeposit as P, hinkalDepositForOther as T } from "./hinkalDeposit.mjs";
12
+ import { hinkalSwap as S } from "./hinkalSwap.mjs";
13
+ import { hinkalWithdraw as E } from "./hinkalWithdraw.mjs";
14
+ import { resetMerkleTrees as H } from "./resetMerkleTrees.mjs";
15
+ import { MerkleTree as d } from "../merkle-tree/MerkleTree.mjs";
16
+ import { poseidonFunction as p } from "../../crypto/poseidon.mjs";
16
17
  import "circomlibjs";
17
- import { networkRegistry as H } from "../../constants/chains.constants.mjs";
18
- import { transactionErrorCodes as p } from "../../error-handling/error-codes.constants.mjs";
19
- import { monitor as F } from "../../API/callMonitor.mjs";
20
- import { hinkalActionLido as I } from "./hinkalActionLidoEth.mjs";
18
+ import { networkRegistry as F } from "../../constants/chains.constants.mjs";
19
+ import { transactionErrorCodes as l } from "../../error-handling/error-codes.constants.mjs";
20
+ import { monitor as I } from "../../API/callMonitor.mjs";
21
+ import { hinkalActionLido as R } from "./hinkalActionLidoEth.mjs";
21
22
  import "../../constants/vite.constants.mjs";
22
23
  import "axios";
23
24
  import "../../constants/coingecko.constants.mjs";
24
- import { getAxelarGasEstimate as R } from "../../API/getAxelarGasEstimate.mjs";
25
- import { API as l } from "../../API/API.mjs";
25
+ import { getAxelarGasEstimate as L } from "../../API/getAxelarGasEstimate.mjs";
26
+ import { API as m } from "../../API/API.mjs";
26
27
  import "ethers";
27
28
  import "../../types/curve.types.mjs";
28
29
  import "../../constants/contracts.constants.mjs";
29
- import { supportedPassportLinks as L } from "../../constants/kyc.constants.mjs";
30
+ import { supportedPassportLinks as M } from "../../constants/kyc.constants.mjs";
30
31
  import "../../constants/axelar.constants.mjs";
31
32
  import "../../constants/rewards.constants.mjs";
32
33
  import "../../constants/reorg-depths.constants.mjs";
33
- import { TransactionsManager as M } from "../transactions-manager/TransactionsManager.mjs";
34
+ import { TransactionsManager as W } from "../transactions-manager/TransactionsManager.mjs";
34
35
  import "../../functions/utils/external-action.utils.mjs";
35
36
  import "../../types/circom-data.types.mjs";
36
37
  import "../../types/transactions.types.mjs";
37
- import { reloadPage as W } from "../../functions/utils/reloadPage.mjs";
38
- import { hinkalActionVolatile as N } from "./hinkalActionVolatile.mjs";
39
- import { hinkalActionPendleLP as K, hinkalGetPendleLPClaimableParams as O } from "./hinkalActionPendleLP.mjs";
40
- import { getConnextReceiveFee as x } from "../../API/getConnextReceiveFee.mjs";
41
- import { hinkalActionStake as B } from "./hinkalActionStake.mjs";
42
- import { multiThreadedUtxoUtils as U } from "../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs";
43
- import { hinkalPrivateWallet as b } from "./hinkalPrivateWallet.mjs";
44
- class Le {
38
+ import { reloadPage as N } from "../../functions/utils/reloadPage.mjs";
39
+ import { hinkalActionVolatile as K } from "./hinkalActionVolatile.mjs";
40
+ import { hinkalActionPendleLP as O, hinkalGetPendleLPClaimableParams as x } from "./hinkalActionPendleLP.mjs";
41
+ import { getConnextReceiveFee as B } from "../../API/getConnextReceiveFee.mjs";
42
+ import { hinkalActionStake as U } from "./hinkalActionStake.mjs";
43
+ import { multiThreadedUtxoUtils as b } from "../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs";
44
+ import { hinkalPrivateWallet as D } from "./hinkalPrivateWallet.mjs";
45
+ class We {
45
46
  providerAdapter;
46
47
  userKeys;
47
48
  signingMessage = "Login to Hinkal Protocol";
@@ -53,9 +54,9 @@ class Le {
53
54
  nullifierSnapshotService;
54
55
  accessTokenSnapshotService;
55
56
  transactionsManager;
56
- utxoUtils = U;
57
+ utxoUtils = b;
57
58
  constructor() {
58
- this.userKeys = new s(void 0), this.merkleTreeHinkal = h.create(d, 25n, 0n), this.merkleTreeAccessToken = h.create(d, 25n, 0n), this.nullifiers = /* @__PURE__ */ new Set(), this.encryptedOutputs = [], this.transactionsManager = new M();
59
+ this.userKeys = new s(void 0), this.merkleTreeHinkal = d.create(p, 25n, 0n), this.merkleTreeAccessToken = d.create(p, 25n, 0n), this.nullifiers = /* @__PURE__ */ new Set(), this.encryptedOutputs = [], this.transactionsManager = new W();
59
60
  }
60
61
  async initProviderAdapter(e, t) {
61
62
  await this.updateProviderAdapter(t), this.providerAdapter?.initConnector(e);
@@ -69,7 +70,7 @@ class Le {
69
70
  this.userKeys = new s(e);
70
71
  }
71
72
  async resetMerkle() {
72
- this.isSelectedNetworkSupported() && await E(this);
73
+ this.isSelectedNetworkSupported() && await H(this);
73
74
  }
74
75
  getProviderAdapter() {
75
76
  if (!this.providerAdapter)
@@ -101,13 +102,13 @@ class Le {
101
102
  return this.getProviderAdapter().getContractWithFetcherForEthereum(e, t);
102
103
  }
103
104
  isSelectedNetworkSupported() {
104
- return !!H[this.getCurrentChainId()];
105
+ return !!F[this.getCurrentChainId()];
105
106
  }
106
107
  async switchNetwork(e) {
107
108
  try {
108
109
  await this.getProviderAdapter().switchNetwork(e);
109
110
  } catch {
110
- throw new Error(p.FAILED_TO_SWITCH_NETWORKS);
111
+ throw new Error(l.FAILED_TO_SWITCH_NETWORKS);
111
112
  }
112
113
  }
113
114
  getCurrentChainId() {
@@ -147,31 +148,31 @@ class Le {
147
148
  }
148
149
  async onAccountChanged() {
149
150
  await this.getProviderAdapter().onAccountChanged();
150
- const e = o.AccountChanged;
151
- typeof document < "u" ? document?.dispatchEvent(new Event(e)) : process?.emit("message", e, void 0);
151
+ const e = c.AccountChanged;
152
+ typeof document < "u" ? document?.dispatchEvent(new Event(e)) : o?.emit("message", e, void 0);
152
153
  }
153
154
  async onChainChanged(e) {
154
155
  if (e) {
155
156
  await this.getProviderAdapter().onChainChanged(e);
156
- const t = o.NetworkChange;
157
- typeof document < "u" ? document.dispatchEvent(new Event(t)) : process?.emit("message", t, void 0);
157
+ const t = c.NetworkChange;
158
+ typeof document < "u" ? document.dispatchEvent(new Event(t)) : o?.emit("message", t, void 0);
158
159
  } else
159
- await this.disconnectFromConnector(), W();
160
+ await this.disconnectFromConnector(), N();
160
161
  }
161
162
  async monitorConnectedAddress() {
162
- F(await this.getEthereumAddress(), this.getCurrentChainId());
163
+ I(await this.getEthereumAddress(), this.getCurrentChainId());
163
164
  }
164
165
  async getBalances() {
165
- return A(this);
166
+ return v(this);
166
167
  }
167
168
  getSupportedPassportLinks() {
168
- return L;
169
+ return M;
169
170
  }
170
171
  checkAccessToken() {
171
- return g(this);
172
+ return u(this);
172
173
  }
173
174
  async getAxelarEstimate(e, t, r, i) {
174
- return R(
175
+ return L(
175
176
  e,
176
177
  t,
177
178
  r,
@@ -180,23 +181,23 @@ class Le {
180
181
  );
181
182
  }
182
183
  async getConnextReceiveFee(e, t) {
183
- return x(this.getCurrentChainId(), e, t);
184
+ return B(this.getCurrentChainId(), e, t);
184
185
  }
185
186
  async mintHinkalAccessToken(e) {
186
- return u(this, e);
187
+ return k(this, e);
187
188
  }
188
189
  async mintHinkalAccessTokenCrossChain(e, t) {
189
- return k(this, e, t);
190
+ return A(this, e, t);
190
191
  }
191
192
  async getHinkalTreeRootHash() {
192
- return this.getContractWithFetcher(c.HinkalContract).getRootHash();
193
+ return this.getContractWithFetcher(h.HinkalContract).getRootHash();
193
194
  }
194
195
  async getAccessTokenTreeRootHash() {
195
- return this.getContractWithFetcher(c.CrossChainAccessTokenContract).getRootHash();
196
+ return this.getContractWithFetcher(h.CrossChainAccessTokenContract).getRootHash();
196
197
  }
197
198
  async resetMerkleTreesIfNecessary() {
198
199
  if (!this.isSelectedNetworkSupported())
199
- throw new Error(p.UNSUPPORTED_NETWORK);
200
+ throw new Error(l.UNSUPPORTED_NETWORK);
200
201
  const [e, t] = await Promise.all([
201
202
  this.getHinkalTreeRootHash(),
202
203
  this.getAccessTokenTreeRootHash()
@@ -214,7 +215,7 @@ class Le {
214
215
  return this.getProviderAdapter().getAddress();
215
216
  }
216
217
  async getRandomRelay() {
217
- return (await l.getIdleRelay(this.getCurrentChainId())).relay;
218
+ return (await m.getIdleRelay(this.getCurrentChainId())).relay;
218
219
  }
219
220
  getGasPrice() {
220
221
  if (!this.providerAdapter?.chainId)
@@ -222,22 +223,22 @@ class Le {
222
223
  return this.providerAdapter.getGasPrice();
223
224
  }
224
225
  getAPI() {
225
- return l;
226
+ return m;
226
227
  }
227
228
  async deposit(e, t) {
228
- return w(this, e, t);
229
+ return P(this, e, t);
229
230
  }
230
231
  async depositForOther(e, t, r) {
231
- return P(this, e, t, r);
232
+ return T(this, e, t, r);
232
233
  }
233
234
  // async transfer(token: ERC20Token, amount: bigint, recipientAddress: string): Promise<ethers.ContractTransaction> {
234
235
  // return hinkalTransfer(this, token, amount, recipientAddress);
235
236
  // }
236
237
  async withdraw(e, t, r, i, n = !1) {
237
- return S(this, e, t, r, i, n);
238
+ return E(this, e, t, r, i, n);
238
239
  }
239
240
  async swap(e, t, r, i, n = !1, a = !1) {
240
- return T(
241
+ return S(
241
242
  this,
242
243
  e,
243
244
  t,
@@ -248,13 +249,13 @@ class Le {
248
249
  );
249
250
  }
250
251
  async actionCurve(e, t, r, i, n, a = !1) {
251
- return f(this, e, t, r, i, n, a);
252
+ return C(this, e, t, r, i, n, a);
252
253
  }
253
254
  async actionConvex(e, t, r, i, n = !1) {
254
- return y(this, e, t, r, i, n);
255
+ return f(this, e, t, r, i, n);
255
256
  }
256
- async actionBeefy(e, t, r, i, n, a, m = !1) {
257
- return v(
257
+ async actionBeefy(e, t, r, i, n, a, g = !1) {
258
+ return y(
258
259
  this,
259
260
  e,
260
261
  t,
@@ -262,17 +263,17 @@ class Le {
262
263
  i,
263
264
  n,
264
265
  a,
265
- m
266
+ g
266
267
  );
267
268
  }
268
269
  async actionLido(e, t, r, i, n, a = !1) {
269
- return I(this, e, t, r, i, n, a);
270
+ return R(this, e, t, r, i, n, a);
270
271
  }
271
272
  async actionPendle(e, t, r, i, n = !1) {
272
- return C(this, e, t, r, i, n);
273
+ return w(this, e, t, r, i, n);
273
274
  }
274
275
  async actionPendleLP(e, t, r, i, n = !1) {
275
- return K(
276
+ return O(
276
277
  this,
277
278
  e,
278
279
  t,
@@ -282,18 +283,18 @@ class Le {
282
283
  );
283
284
  }
284
285
  async actionVolatile(e, t, r, i = !1) {
285
- return N(this, e, t, r, i);
286
+ return K(this, e, t, r, i);
286
287
  }
287
288
  async actionStake(e, t, r, i) {
288
- return B(this, e, t, r, i);
289
+ return U(this, e, t, r, i);
289
290
  }
290
291
  async actionPrivateWallet(e, t, r, i = [], n, a = !1) {
291
- return b(this, e, t, r, i, n, a);
292
+ return D(this, e, t, r, i, n, a);
292
293
  }
293
294
  async getPendleLPClaimableParams(e, t) {
294
- return O(this, e, t);
295
+ return x(this, e, t);
295
296
  }
296
297
  }
297
298
  export {
298
- Le as Hinkal
299
+ We as Hinkal
299
300
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../constants/chains.constants.cjs"),x=require("../../error-handling/error-codes.constants.cjs");require("ethers");require("axios");require("../../constants/vite.constants.cjs");require("../../types/circom-data.types.cjs");const A=require("../../types/external-action.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs");require("../../constants/reorg-depths.constants.cjs");const C=require("../../functions/snarkjs/constructEmporiumProof.cjs"),P=require("../../functions/pre-transaction/processAmountChanges.cjs"),R=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),w=require("../../functions/web3/events/getShieldedBalance.cjs"),U=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),I=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),T=async(e,o,r,d,q=[],p,y=!1)=>{const a=o.map(t=>0n);r=P.processAmountChanges({erc20Addresses:o,amountChanges:r,flatFees:a,feeUnit:void 0,externalActionId:A.ExternalActionId.Emporium});const s=[...await w.addPaddingToUtxos(e,o,r)],i=[];for(let t=0;t<o.length;t+=1){const{outputUtxos:E}=R.outputUtxoProcessing(e.userKeys,s[t],r[t]);i.push(E)}const n=await e.getRandomRelay();if(!n)throw Error(x.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{contractData:g}=f.networkRegistry[e.getCurrentChainId()],{emporiumAddress:c}=g;if(!c)throw Error("No Emporium Address Provided");const{zkCallData:u,circomData:l,dimData:m}=await C.constructEmporiumProof(e.merkleTreeHinkal,e.merkleTreeAccessToken,s,i,e.userKeys,r.length,s[0].length,c,q,n,e.getCurrentChainId(),d,a,p);return y?await U.estimateGasRelayer(e,u,m,l):await I.transactCallRelayer(e.getCurrentChainId(),u,m,l)};exports.hinkalPrivateWallet=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../constants/chains.constants.cjs"),x=require("../../error-handling/error-codes.constants.cjs");require("ethers");require("axios");require("../../constants/vite.constants.cjs");require("../../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.cjs");require("../../types/circom-data.types.cjs");const A=require("../../types/external-action.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs");require("../../constants/reorg-depths.constants.cjs");const C=require("../../functions/snarkjs/constructEmporiumProof.cjs"),P=require("../../functions/pre-transaction/processAmountChanges.cjs"),R=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),w=require("../../functions/web3/events/getShieldedBalance.cjs"),U=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),I=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),T=async(e,o,r,d,q=[],p,y=!1)=>{const a=o.map(t=>0n);r=P.processAmountChanges({erc20Addresses:o,amountChanges:r,flatFees:a,feeUnit:void 0,externalActionId:A.ExternalActionId.Emporium});const s=[...await w.addPaddingToUtxos(e,o,r)],i=[];for(let t=0;t<o.length;t+=1){const{outputUtxos:E}=R.outputUtxoProcessing(e.userKeys,s[t],r[t]);i.push(E)}const n=await e.getRandomRelay();if(!n)throw Error(x.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{contractData:g}=f.networkRegistry[e.getCurrentChainId()],{emporiumAddress:c}=g;if(!c)throw Error("No Emporium Address Provided");const{zkCallData:u,circomData:l,dimData:m}=await C.constructEmporiumProof(e.merkleTreeHinkal,e.merkleTreeAccessToken,s,i,e.userKeys,r.length,s[0].length,c,q,n,e.getCurrentChainId(),d,a,p);return y?await U.estimateGasRelayer(e,u,m,l):await I.transactCallRelayer(e.getCurrentChainId(),u,m,l)};exports.hinkalPrivateWallet=T;
@@ -3,6 +3,7 @@ import { transactionErrorCodes as A } from "../../error-handling/error-codes.con
3
3
  import "ethers";
4
4
  import "axios";
5
5
  import "../../constants/vite.constants.mjs";
6
+ import "../../node_modules/vite-plugin-node-polyfills/shims/process/dist/index.mjs";
6
7
  import "../../types/circom-data.types.mjs";
7
8
  import { ExternalActionId as w } from "../../types/external-action.types.mjs";
8
9
  import "../../types/transactions.types.mjs";
@@ -15,7 +16,7 @@ import { outputUtxoProcessing as C } from "../../functions/pre-transaction/outpu
15
16
  import { addPaddingToUtxos as I } from "../../functions/web3/events/getShieldedBalance.mjs";
16
17
  import { estimateGasRelayer as P } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
17
18
  import { transactCallRelayer as T } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
18
- const M = async (t, e, o, u, d = [], l, E = !1) => {
19
+ const Q = async (t, e, o, u, d = [], l, E = !1) => {
19
20
  const m = e.map((r) => 0n);
20
21
  o = U({
21
22
  erc20Addresses: e,
@@ -32,10 +33,10 @@ const M = async (t, e, o, u, d = [], l, E = !1) => {
32
33
  const s = await t.getRandomRelay();
33
34
  if (!s)
34
35
  throw Error(A.RELAYER_NOT_AVAILABLE);
35
- const { contractData: x } = g[t.getCurrentChainId()], { emporiumAddress: n } = x;
36
- if (!n)
36
+ const { contractData: x } = g[t.getCurrentChainId()], { emporiumAddress: p } = x;
37
+ if (!p)
37
38
  throw Error("No Emporium Address Provided");
38
- const { zkCallData: p, circomData: c, dimData: f } = await R(
39
+ const { zkCallData: n, circomData: c, dimData: f } = await R(
39
40
  t.merkleTreeHinkal,
40
41
  t.merkleTreeAccessToken,
41
42
  i,
@@ -43,7 +44,7 @@ const M = async (t, e, o, u, d = [], l, E = !1) => {
43
44
  t.userKeys,
44
45
  o.length,
45
46
  i[0].length,
46
- n,
47
+ p,
47
48
  d,
48
49
  s,
49
50
  t.getCurrentChainId(),
@@ -51,8 +52,8 @@ const M = async (t, e, o, u, d = [], l, E = !1) => {
51
52
  m,
52
53
  l
53
54
  );
54
- return E ? await P(t, p, f, c) : await T(t.getCurrentChainId(), p, f, c);
55
+ return E ? await P(t, n, f, c) : await T(t.getCurrentChainId(), n, f, c);
55
56
  };
56
57
  export {
57
- M as hinkalPrivateWallet
58
+ Q as hinkalPrivateWallet
58
59
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ethers"),f=require("libsodium-wrappers"),l=require("../utxo/Utxo.cjs"),u=require("./keys.cjs");(async()=>await f.ready)();const p=(e,s)=>{const i=[Buffer.from(t.ethers.utils.hexlify(s?0n:e.amount)),Buffer.from(t.ethers.utils.hexlify(e.erc20TokenAddress)),Buffer.from(t.ethers.utils.hexlify(e.randomization)),Buffer.from(e.getStealthAddress()),Buffer.from(t.ethers.utils.hexlify(BigInt(e.timeStamp)))];e.tokenId>0&&i.push(Buffer.from(t.ethers.utils.hexlify(e.tokenId)));const n=Buffer.concat(i);return f.crypto_box_seal(n,t.ethers.utils.arrayify(e.getEncryptionKey()))},d=(e,s)=>{const{publicKey:i,privateKey:n}=u.UserKeys.getEncryptionKeyPair(s.getShieldedPrivateKey()),c=f.crypto_box_seal_open(e,t.ethers.utils.arrayify(i),t.ethers.utils.arrayify(n)),r=Buffer.from(c).toString("utf-8").split("0x").filter(o=>o.length!==0).map((o,y)=>{let a;return[0,2,4,5].includes(y)?a=BigInt(`0x${o}`):[1,3].includes(y)&&(a=`0x${o}`),a});return{amount:r[0],erc20TokenAddress:r[1],randomization:r[2],stealthAddress:r[3],shieldedPrivateKey:s.getShieldedPrivateKey(),timeStamp:r[4].toString(),tokenId:r[5]?Number(r[5]):0}},h=(e,s)=>new l.Utxo(d(e,s));exports.decryptUtxo=h;exports.decryptUtxoConstructorArgs=d;exports.encryptUtxo=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.cjs"),r=require("ethers"),y=require("libsodium-wrappers"),p=require("../utxo/Utxo.cjs"),u=require("./keys.cjs");(async()=>await y.ready)();const h=(e,i)=>{const n=[t.from(r.ethers.utils.hexlify(i?0n:e.amount)),t.from(r.ethers.utils.hexlify(e.erc20TokenAddress)),t.from(r.ethers.utils.hexlify(e.randomization)),t.from(e.getStealthAddress()),t.from(r.ethers.utils.hexlify(BigInt(e.timeStamp)))];e.tokenId>0&&n.push(t.from(r.ethers.utils.hexlify(e.tokenId)));const a=t.concat(n);return y.crypto_box_seal(a,r.ethers.utils.arrayify(e.getEncryptionKey()))},f=(e,i)=>{const{publicKey:n,privateKey:a}=u.UserKeys.getEncryptionKeyPair(i.getShieldedPrivateKey()),d=y.crypto_box_seal_open(e,r.ethers.utils.arrayify(n),r.ethers.utils.arrayify(a)),s=t.from(d).toString("utf-8").split("0x").filter(o=>o.length!==0).map((o,l)=>{let c;return[0,2,4,5].includes(l)?c=BigInt(`0x${o}`):[1,3].includes(l)&&(c=`0x${o}`),c});return{amount:s[0],erc20TokenAddress:s[1],randomization:s[2],stealthAddress:s[3],shieldedPrivateKey:i.getShieldedPrivateKey(),timeStamp:s[4].toString(),tokenId:s[5]?Number(s[5]):0}},m=(e,i)=>new p.Utxo(f(e,i));exports.decryptUtxo=m;exports.decryptUtxoConstructorArgs=f;exports.encryptUtxo=h;
@@ -1,41 +1,42 @@
1
- import { ethers as t } from "ethers";
2
- import a from "libsodium-wrappers";
3
- import { Utxo as d } from "../utxo/Utxo.mjs";
4
- import { UserKeys as l } from "./keys.mjs";
5
- (async () => await a.ready)();
6
- const B = (e, i) => {
7
- const o = [
8
- Buffer.from(t.utils.hexlify(i ? 0n : e.amount)),
9
- Buffer.from(t.utils.hexlify(e.erc20TokenAddress)),
10
- Buffer.from(t.utils.hexlify(e.randomization)),
11
- Buffer.from(e.getStealthAddress()),
12
- Buffer.from(t.utils.hexlify(BigInt(e.timeStamp)))
1
+ import e from "../../node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.mjs";
2
+ import { ethers as r } from "ethers";
3
+ import f from "libsodium-wrappers";
4
+ import { Utxo as l } from "../utxo/Utxo.mjs";
5
+ import { UserKeys as m } from "./keys.mjs";
6
+ (async () => await f.ready)();
7
+ const S = (t, o) => {
8
+ const n = [
9
+ e.from(r.utils.hexlify(o ? 0n : t.amount)),
10
+ e.from(r.utils.hexlify(t.erc20TokenAddress)),
11
+ e.from(r.utils.hexlify(t.randomization)),
12
+ e.from(t.getStealthAddress()),
13
+ e.from(r.utils.hexlify(BigInt(t.timeStamp)))
13
14
  ];
14
- e.tokenId > 0 && o.push(Buffer.from(t.utils.hexlify(e.tokenId)));
15
- const n = Buffer.concat(o);
16
- return a.crypto_box_seal(n, t.utils.arrayify(e.getEncryptionKey()));
17
- }, m = (e, i) => {
18
- const { publicKey: o, privateKey: n } = l.getEncryptionKeyPair(i.getShieldedPrivateKey()), y = a.crypto_box_seal_open(
19
- e,
20
- t.utils.arrayify(o),
21
- t.utils.arrayify(n)
22
- ), r = Buffer.from(y).toString("utf-8").split("0x").filter((f) => f.length !== 0).map((f, c) => {
23
- let s;
24
- return [0, 2, 4, 5].includes(c) ? s = BigInt(`0x${f}`) : [1, 3].includes(c) && (s = `0x${f}`), s;
15
+ t.tokenId > 0 && n.push(e.from(r.utils.hexlify(t.tokenId)));
16
+ const a = e.concat(n);
17
+ return f.crypto_box_seal(a, r.utils.arrayify(t.getEncryptionKey()));
18
+ }, p = (t, o) => {
19
+ const { publicKey: n, privateKey: a } = m.getEncryptionKeyPair(o.getShieldedPrivateKey()), c = f.crypto_box_seal_open(
20
+ t,
21
+ r.utils.arrayify(n),
22
+ r.utils.arrayify(a)
23
+ ), i = e.from(c).toString("utf-8").split("0x").filter((s) => s.length !== 0).map((s, d) => {
24
+ let y;
25
+ return [0, 2, 4, 5].includes(d) ? y = BigInt(`0x${s}`) : [1, 3].includes(d) && (y = `0x${s}`), y;
25
26
  });
26
27
  return {
27
- amount: r[0],
28
- erc20TokenAddress: r[1],
29
- randomization: r[2],
30
- stealthAddress: r[3],
31
- shieldedPrivateKey: i.getShieldedPrivateKey(),
32
- timeStamp: r[4].toString(),
33
- tokenId: r[5] ? Number(r[5]) : 0
28
+ amount: i[0],
29
+ erc20TokenAddress: i[1],
30
+ randomization: i[2],
31
+ stealthAddress: i[3],
32
+ shieldedPrivateKey: o.getShieldedPrivateKey(),
33
+ timeStamp: i[4].toString(),
34
+ tokenId: i[5] ? Number(i[5]) : 0
34
35
  // tokenId
35
36
  };
36
- }, x = (e, i) => new d(m(e, i));
37
+ }, b = (t, o) => new l(p(t, o));
37
38
  export {
38
- x as decryptUtxo,
39
- m as decryptUtxoConstructorArgs,
40
- B as encryptUtxo
39
+ b as decryptUtxo,
40
+ p as decryptUtxoConstructorArgs,
41
+ S as encryptUtxo
41
42
  };