@hinkal/common 0.1.65 → 0.1.67

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.
@@ -0,0 +1,207 @@
1
+ import { networkRegistry as s, chainIds as c, localhostNetwork as g } from "../constants/chains.constants.mjs";
2
+ import { contractMetadataMapping as w } from "../constants/contracts.constants.mjs";
3
+ import { transactionErrorCodes as o } from "../error-handling/error-codes.constants.mjs";
4
+ import { providers as a, utils as f, ethers as h } from "ethers";
5
+ import { ConnectorAlreadyConnectedError as l } from "wagmi2";
6
+ import { disconnect as v, connect as u, signMessage as p, switchChain as C, getAccount as P, watchAccount as E, watchChainId as I } from "wagmi2/actions";
7
+ class d {
8
+ connector;
9
+ chainId;
10
+ originalProvider;
11
+ fetchProvider;
12
+ signer;
13
+ chainEventListener;
14
+ config;
15
+ unsubscribeFns = [];
16
+ initConnector(t) {
17
+ this.connector = t;
18
+ }
19
+ requireConnector() {
20
+ if (!this.connector)
21
+ throw Error("No Connector In Provider Adapter");
22
+ }
23
+ initConfig(t) {
24
+ this.config = t;
25
+ }
26
+ async init(t) {
27
+ this.requireConnector(), t && (this.chainId = t), this.originalProvider = await this.connector.getProvider(), this.fetchProvider = this.createFetchProvider() ?? this.originalProvider, this.fetchProvider === this.originalProvider && console.warn("fetchProvider not available");
28
+ const r = await this.connector.getProvider(), e = await this.connector.getAccounts();
29
+ this.signer = await this.walletClientToSigner({ transport: r, account: e[0] }, this.chainId);
30
+ }
31
+ async disconnectFromConnector() {
32
+ if (!this.config)
33
+ throw new Error("No Config In Provider Adapter");
34
+ this.release(), await v(this.config);
35
+ }
36
+ async connectToConnector(t) {
37
+ if (!this.config)
38
+ throw new Error("No Config In Provider Adapter");
39
+ try {
40
+ return (await u(this.config, { connector: t })).chainId;
41
+ } catch (r) {
42
+ if (r instanceof l)
43
+ return t.getChainId();
44
+ throw console.log(r), new Error(o.CONNECTION_FAILED);
45
+ }
46
+ }
47
+ async waitForTransaction(t, r) {
48
+ if ((await this.fetchProvider?.waitForTransaction(t, r))?.status)
49
+ return !0;
50
+ throw Error(o.TRANSACTION_NOT_CONFIRMED);
51
+ }
52
+ async signMessage(t) {
53
+ if (!this.config)
54
+ throw new Error("No Config In Provider Adapter");
55
+ const r = await p(this.config, { message: t });
56
+ if (!r)
57
+ throw new Error(o.SIGNING_FAILED);
58
+ if (r.includes("error"))
59
+ throw new Error(o.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);
60
+ return r;
61
+ }
62
+ async signTypedData(t, r, e) {
63
+ return this.signer._signTypedData(t, r, e);
64
+ }
65
+ getSelectedNetwork = () => {
66
+ if (!this.chainId)
67
+ throw new Error("Illegal state: no chaindId");
68
+ return s[this.chainId];
69
+ };
70
+ async switchNetwork(t) {
71
+ if (!this.config)
72
+ throw new Error("No Config In Provider Adapter");
73
+ return C(this.config, { chainId: t.chainId });
74
+ }
75
+ createFetchProvider() {
76
+ try {
77
+ const r = s[this.chainId]?.fetchRpcUrl;
78
+ return r ? r.includes("wss") ? new a.WebSocketProvider(r) : new a.StaticJsonRpcProvider(r) : void 0;
79
+ } catch (t) {
80
+ console.log("create Fetch Provider error", t);
81
+ return;
82
+ }
83
+ }
84
+ async getAddress() {
85
+ if (!this.config)
86
+ throw new Error("No Config In Provider Adapter");
87
+ const { address: t } = P(this.config);
88
+ if (!t)
89
+ throw new Error("IllegalState");
90
+ return f.getAddress(t);
91
+ }
92
+ setChainEventListener(t) {
93
+ if (!this.config)
94
+ throw new Error("No Config In Provider Adapter");
95
+ this.chainEventListener = t, this.chainEventListener && (this.unsubscribeFns.push(
96
+ E(this.config, {
97
+ onChange: ({ address: r }, { address: e }) => {
98
+ if (!this.chainEventListener) {
99
+ console.warn("chainEventListener is not set");
100
+ return;
101
+ }
102
+ console.log("Account changed"), r !== e && (console.log("Account changed"), this.chainEventListener.onAccountChanged());
103
+ }
104
+ })
105
+ ), this.unsubscribeFns.push(
106
+ I(this.config, {
107
+ onChange: (r) => {
108
+ if (!this.chainEventListener) {
109
+ console.warn("chainEventListener is not set");
110
+ return;
111
+ }
112
+ console.log("Chain ID changed!", r), this.chainEventListener.onChainChanged(r);
113
+ }
114
+ })
115
+ ));
116
+ }
117
+ onAccountChanged() {
118
+ return this.init();
119
+ }
120
+ onChainChanged(t) {
121
+ return this.init(t);
122
+ }
123
+ release() {
124
+ this.removeListeners();
125
+ }
126
+ removeListeners() {
127
+ this.unsubscribeFns.forEach((t) => t()), this.unsubscribeFns = [];
128
+ }
129
+ getContractMetadata(t, r) {
130
+ const e = r ?? this.chainId;
131
+ if (!e)
132
+ throw new Error("No chainId provided in context");
133
+ const n = s[e];
134
+ if (!n)
135
+ throw new Error(o.UNSUPPORTED_NETWORK);
136
+ const i = w[t];
137
+ if (!i)
138
+ throw new Error(`Unsupported contractType: ${t}`);
139
+ return i(n.contractData);
140
+ }
141
+ getContract(t, r = void 0, e) {
142
+ const n = this.getContractMetadata(t, e);
143
+ if (!n.abi)
144
+ throw new Error(`No ABI configured for contractType: ${t}`);
145
+ if (n.address && r)
146
+ throw new Error(`Overriding address is not supported for contractType: ${t}`);
147
+ const i = n.address ?? r;
148
+ if (!i)
149
+ throw new Error(`No contractAddress configured for contractType: ${t}`);
150
+ return new h.Contract(i, n.abi);
151
+ }
152
+ getContractWithSigner(t, r = void 0) {
153
+ if (!this.signer)
154
+ throw new Error("IllegalState: no signer");
155
+ return this.getContract(t, r).connect(this.signer);
156
+ }
157
+ getContractWithFetcher(t, r = void 0) {
158
+ if (!this.fetchProvider)
159
+ throw new Error("fetchProvider not initialized");
160
+ return this.getContract(t, r).connect(this.fetchProvider);
161
+ }
162
+ getContractWithFetcherForEthereum(t, r = void 0) {
163
+ const e = this.chainId === c.localhost && g === c.ethMainnet ? c.localhost : c.ethMainnet;
164
+ return this.getContract(t, r).connect(
165
+ new h.providers.StaticJsonRpcProvider(s[e].fetchRpcUrl)
166
+ );
167
+ }
168
+ async sendTransaction(t) {
169
+ if (!this.signer)
170
+ throw new Error("IllegalState: no signer");
171
+ return await this.signer.sendTransaction(t);
172
+ }
173
+ async patchExternalProvider(t) {
174
+ const r = await t.getProvider();
175
+ let e;
176
+ if (r instanceof h.providers.Web3Provider ? e = r.provider : e = r, "isWalletConnect" in e) {
177
+ const n = await t.getChainId();
178
+ e.http = e.setHttpProvider?.(n);
179
+ }
180
+ }
181
+ async connectAndPatchProvider(t) {
182
+ const r = await this.connectToConnector(t);
183
+ return await this.patchExternalProvider(t), r;
184
+ }
185
+ isPermitterAvailable() {
186
+ return !!this.getSelectedNetwork()?.contractData?.permitterAddress;
187
+ }
188
+ async getGasPrice() {
189
+ const t = await this.fetchProvider?.getGasPrice();
190
+ if (!t)
191
+ throw Error("Could not fetch gas price in getGasPrice");
192
+ return t.toBigInt();
193
+ }
194
+ async walletClientToSigner(t, r) {
195
+ const { account: e, transport: n } = t, i = {
196
+ chainId: r,
197
+ name: ""
198
+ };
199
+ return new a.Web3Provider(n, i).getSigner(e);
200
+ }
201
+ }
202
+ const L = new d(), k = () => new d();
203
+ export {
204
+ d as Wagmiv2ProviderAdapter,
205
+ k as default,
206
+ L as wagmiv2ProviderAdapter
207
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");const u=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../constants/vite.constants.cjs");require("axios");require("../constants/coingecko.constants.cjs");require("../constants/contracts.constants.cjs");require("../constants/kyc.constants.cjs");require("../constants/axelar.constants.cjs");require("../constants/rewards.constants.cjs");require("../constants/reorg-depths.constants.cjs");const q=require("../crypto/preProcessing.cjs");require("../functions/utils/external-action.utils.cjs");require("../functions/web3/events/getShieldedBalance.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");require("idb-keyval");const r=require("./EthersProviderAdapter.cjs"),a=async(i,t)=>{await q.preProcessing();const e=new u.Hinkal(t);return r.ethersProvierAdapter.initSigner?.(i),await e.initProviderAdapter(void 0,r.ethersProvierAdapter),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareEthersHinkal=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");const u=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../constants/vite.constants.cjs");require("axios");require("../constants/coingecko.constants.cjs");require("../constants/contracts.constants.cjs");require("../constants/kyc.constants.cjs");require("../constants/axelar.constants.cjs");require("../constants/rewards.constants.cjs");require("../constants/reorg-depths.constants.cjs");const q=require("../crypto/preProcessing.cjs");require("../functions/utils/external-action.utils.cjs");require("../functions/web3/events/getShieldedBalance.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");require("idb-keyval");const a=require("./EthersProviderAdapter.cjs"),n=async(i,t)=>{await q.preProcessing();const e=new u.Hinkal(t),r=a.default();return r.initSigner?.(i),await e.initProviderAdapter(void 0,r),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareEthersHinkal=n;
@@ -20,12 +20,12 @@ import "../functions/utils/external-action.utils.mjs";
20
20
  import "../functions/web3/events/getShieldedBalance.mjs";
21
21
  import "../data-structures/volatile-helper/VolatileHelper.mjs";
22
22
  import "idb-keyval";
23
- import { ethersProvierAdapter as i } from "./EthersProviderAdapter.mjs";
24
- const U = async (t, o) => {
23
+ import e from "./EthersProviderAdapter.mjs";
24
+ const b = async (t, o) => {
25
25
  await m();
26
- const r = new p(o);
26
+ const r = new p(o), i = e();
27
27
  return i.initSigner?.(t), await r.initProviderAdapter(void 0, i), await r.initUserKeys(), await r.resetMerkle(), r;
28
28
  };
29
29
  export {
30
- U as prepareEthersHinkal
30
+ b as prepareEthersHinkal
31
31
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs-hinkal-fork");require("libsodium-wrappers");const u=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../constants/vite.constants.cjs");require("axios");require("../constants/coingecko.constants.cjs");require("../constants/contracts.constants.cjs");require("../constants/kyc.constants.cjs");require("../constants/axelar.constants.cjs");require("../constants/rewards.constants.cjs");require("../constants/reorg-depths.constants.cjs");const t=require("../crypto/preProcessing.cjs");require("../functions/utils/external-action.utils.cjs");require("../functions/web3/events/getShieldedBalance.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");require("idb-keyval");const r=require("./Wagmiv2ProviderAdapter.cjs"),q=async(i,a)=>{await t.preProcessing();const e=new u.Hinkal;return r.wagmiv2ProviderAdapter.initConfig(a),await e.initProviderAdapter(i,r.wagmiv2ProviderAdapter),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareWagmiv2EthersHinkal=q;
@@ -0,0 +1,2 @@
1
+ import { Hinkal } from '../data-structures';
2
+ export declare const prepareWagmiv2EthersHinkal: (connector: Connector, config: Config) => Promise<Hinkal<unknown>>;
@@ -0,0 +1,31 @@
1
+ import "ethers";
2
+ import "circomlibjs-hinkal-fork";
3
+ import "libsodium-wrappers";
4
+ import { Hinkal as p } from "../data-structures/Hinkal/Hinkal.mjs";
5
+ import "../constants/chains.constants.mjs";
6
+ import "../types/circom-data.types.mjs";
7
+ import "../types/transactions.types.mjs";
8
+ import "../types/curve.types.mjs";
9
+ import "../data-structures/custom-token-registry/CustomTokenRegistry.mjs";
10
+ import "../constants/vite.constants.mjs";
11
+ import "axios";
12
+ import "../constants/coingecko.constants.mjs";
13
+ import "../constants/contracts.constants.mjs";
14
+ import "../constants/kyc.constants.mjs";
15
+ import "../constants/axelar.constants.mjs";
16
+ import "../constants/rewards.constants.mjs";
17
+ import "../constants/reorg-depths.constants.mjs";
18
+ import { preProcessing as m } from "../crypto/preProcessing.mjs";
19
+ import "../functions/utils/external-action.utils.mjs";
20
+ import "../functions/web3/events/getShieldedBalance.mjs";
21
+ import "../data-structures/volatile-helper/VolatileHelper.mjs";
22
+ import "idb-keyval";
23
+ import { wagmiv2ProviderAdapter as i } from "./Wagmiv2ProviderAdapter.mjs";
24
+ const U = async (t, o) => {
25
+ await m();
26
+ const r = new p();
27
+ return i.initConfig(o), await r.initProviderAdapter(t, i), await r.initUserKeys(), await r.resetMerkle(), r;
28
+ };
29
+ export {
30
+ U as prepareWagmiv2EthersHinkal
31
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var a=(r=>(r.Internal="Internal",r.External="External",r))(a||{}),s=(r=>(r.Deposit="Deposit",r.WithdrawWithRelayer="Withdraw With Relayer",r.WithdrawWithoutRelayer="Withdraw Without Relayer",r.MintAccessToken="Mint Access Token",r.Aave="Aave",r.Odos="Odos",r.Uniswap="Uniswap",r.OneInch="1Inch",r.Curve="Curve",r.Convex="Convex",r.Transact="Transact",r.Beefy="Beefy",r.Volatile="Volatile",r.Lido="Lido",r.Pendle="Pendle",r.HinkalStake="HinkalStake",r))(s||{});exports.AdminActionType=a;exports.AdminDetailedActionType=s;
@@ -0,0 +1,22 @@
1
+ export declare enum AdminActionType {
2
+ Internal = "Internal",
3
+ External = "External"
4
+ }
5
+ export declare enum AdminDetailedActionType {
6
+ Deposit = "Deposit",
7
+ WithdrawWithRelayer = "Withdraw With Relayer",
8
+ WithdrawWithoutRelayer = "Withdraw Without Relayer",
9
+ MintAccessToken = "Mint Access Token",
10
+ Aave = "Aave",
11
+ Odos = "Odos",
12
+ Uniswap = "Uniswap",
13
+ OneInch = "1Inch",
14
+ Curve = "Curve",
15
+ Convex = "Convex",
16
+ Transact = "Transact",
17
+ Beefy = "Beefy",
18
+ Volatile = "Volatile",
19
+ Lido = "Lido",
20
+ Pendle = "Pendle",
21
+ HinkalStake = "HinkalStake"
22
+ }
@@ -0,0 +1,5 @@
1
+ var a = /* @__PURE__ */ ((r) => (r.Internal = "Internal", r.External = "External", r))(a || {}), s = /* @__PURE__ */ ((r) => (r.Deposit = "Deposit", r.WithdrawWithRelayer = "Withdraw With Relayer", r.WithdrawWithoutRelayer = "Withdraw Without Relayer", r.MintAccessToken = "Mint Access Token", r.Aave = "Aave", r.Odos = "Odos", r.Uniswap = "Uniswap", r.OneInch = "1Inch", r.Curve = "Curve", r.Convex = "Convex", r.Transact = "Transact", r.Beefy = "Beefy", r.Volatile = "Volatile", r.Lido = "Lido", r.Pendle = "Pendle", r.HinkalStake = "HinkalStake", r))(s || {});
2
+ export {
3
+ a as AdminActionType,
4
+ s as AdminDetailedActionType
5
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var E=(a=>(a.BalanceChange="BalanceChange",a.NetworkChange="NetworkChange",a.KycNeeded="KycNeeded",a.AccountChanged="AccountChanged",a.ShowConnect="ShowConnect",a.ShowNetworkPopup="ShowNetworkPopup",a.MerkleTreeUpdated="MerkleTreeUpdated",a.MerkleTreeResetStarted="MerkleTreeResetStarted",a.MerkleTreeResetFinished="MerkleTreeResetFinished",a))(E||{}),S=(a=>(a[a.UNISWAP=1]="UNISWAP",a[a.ODOS=2]="ODOS",a[a.ONEINCH=3]="ONEINCH",a[a.PENDLE=4]="PENDLE",a[a.ALL=5]="ALL",a[a.NONE=6]="NONE",a))(S||{}),D=(a=>(a[a.CurveAavePool=0]="CurveAavePool",a))(D||{}),_=(a=>(a[a.Deposit=0]="Deposit",a[a.WithdrawInt=11]="WithdrawInt",a[a.WithdrawUint=12]="WithdrawUint",a[a.WithdrawImbalance=13]="WithdrawImbalance",a[a.Stake=2]="Stake",a[a.Unstake=3]="Unstake",a[a.GetCRV=4]="GetCRV",a))(_||{}),r=(a=>(a[a.StakeLP=0]="StakeLP",a[a.UnStakeLP=1]="UnStakeLP",a[a.ClaimRewardsLP=2]="ClaimRewardsLP",a))(r||{}),L=(a=>(a[a.Deposit=0]="Deposit",a[a.DepositRegular=1]="DepositRegular",a[a.DepositOneInchSingle=2]="DepositOneInchSingle",a[a.DepositOneInchUniswap=3]="DepositOneInchUniswap",a[a.DepositOneInchSolidly=4]="DepositOneInchSolidly",a[a.Withdraw=5]="Withdraw",a[a.WithdrawRegular=6]="WithdrawRegular",a[a.WithdrawOneInchSingle=7]="WithdrawOneInchSingle",a[a.WithdrawOneInchUniswapAndSolidly=8]="WithdrawOneInchUniswapAndSolidly",a[a.WithdrawBoth=9]="WithdrawBoth",a[a.Stake=10]="Stake",a[a.Unstake=11]="Unstake",a[a.GetRewards=12]="GetRewards",a))(L||{}),h=(a=>(a.Ethereum="Ethereum",a.Polygon="Polygon",a))(h||{}),W=(a=>(a[a.Stake=0]="Stake",a[a.Request=1]="Request",a[a.Claim=2]="Claim",a))(W||{}),w=(a=>(a[a.Deposit=0]="Deposit",a[a.Withdraw=1]="Withdraw",a[a.SwapFromYt=2]="SwapFromYt",a[a.SwapToYt=3]="SwapToYt",a[a.SwapPt=4]="SwapPt",a[a.Mint=5]="Mint",a[a.Redeem=6]="Redeem",a[a.Checkpoint=7]="Checkpoint",a[a.PoolRemove=8]="PoolRemove",a))(w||{}),s=(a=>(a[a.AddOrRemoveLiquidity=0]="AddOrRemoveLiquidity",a[a.Checkpoint=1]="Checkpoint",a[a.Invalid=99]="Invalid",a))(s||{}),p=(a=>(a[a.Persist=0]="Persist",a[a.Deposit=1]="Deposit",a[a.Withdraw=2]="Withdraw",a[a.Swap=3]="Swap",a))(p||{}),U=(a=>(a.WITHDRAW="WITHDRAW",a.SWAP="SWAP",a.CURVE_DEPOSIT="CURVE_DEPOSIT",a.CURVE_WITHDRAW="CURVE_WITHDRAW",a.CURVE_WITHDRAW_INBALANCED="CURVE_WITHDRAW_INBALANCED",a.STAKING="STAKING",a.UNSTAKING="UNSTAKING",a.CLAIMING="CLAIMING",a.BEEFY="BEEFY",a.BEEFY_STAKE="BEEFY_STAKE",a.BEEFY_UNSTAKE="BEEFY_UNSTAKE",a.BEEFY_GET_REWARDS="BEEFY_GET_REWARDS",a.LIDO_STAKE="LIDO_STAKE",a.LIDO_REQUEST="LIDO_REQUEST",a.LIDO_CLAIM="LIDO_CLAIM",a.PENDLE_TRANSACT="PENDLE_TRANSACT",a.PENDLE_YT_IN_SWAP="PENDLE_YT_IN_SWAP",a.PENDLE_YT_OUT_SWAP="PENDLE_YT_OUT_SWAP",a.PENDLE_PT_SWAP="PENDLE_PT_SWAP",a.PENDLE_MINT="PENDLE_MINT",a.PENDLE_REDEEM="PENDLE_REDEEM",a.PENDLE_CLAIM="PENDLE_CLAIM",a.PENDLE_LP="PENDLE_LP",a.PENDLE_LP_CLAIM="PENDLE_LP_CLAIM",a.VOLATILE_WITHDRAW="VOLATILE_WITHDRAW",a.VOLATILE_SWAP="VOLATILE_SWAP",a.EMPORIUM="EMPORIUM",a.NONE="NONE",a))(U||{});exports.BeefyAction=L;exports.ConvexAction=r;exports.CurveAction=_;exports.EventType=E;exports.INTERACTION=U;exports.IntegrationProvider=S;exports.LidoAction=W;exports.LidoVariant=h;exports.PendleAction=w;exports.PendleLPAction=s;exports.StakeProvider=D;exports.VolatileAction=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var E=(a=>(a.BalanceChange="BalanceChange",a.NetworkChange="NetworkChange",a.KycNeeded="KycNeeded",a.AccountChanged="AccountChanged",a.ShowConnect="ShowConnect",a.ShowNetworkPopup="ShowNetworkPopup",a.MerkleTreeUpdated="MerkleTreeUpdated",a.MerkleTreeResetStarted="MerkleTreeResetStarted",a.MerkleTreeResetFinished="MerkleTreeResetFinished",a))(E||{}),S=(a=>(a[a.UNISWAP=1]="UNISWAP",a[a.ODOS=2]="ODOS",a[a.ONEINCH=3]="ONEINCH",a[a.PENDLE=4]="PENDLE",a[a.ALL=5]="ALL",a[a.NONE=6]="NONE",a))(S||{}),D=(a=>(a[a.CurveAavePool=0]="CurveAavePool",a))(D||{}),r=(a=>(a[a.Deposit=0]="Deposit",a[a.WithdrawInt=11]="WithdrawInt",a[a.WithdrawUint=12]="WithdrawUint",a[a.WithdrawImbalance=13]="WithdrawImbalance",a[a.Stake=2]="Stake",a[a.Unstake=3]="Unstake",a[a.GetCRV=4]="GetCRV",a))(r||{}),_=(a=>(a[a.StakeLP=0]="StakeLP",a[a.UnStakeLP=1]="UnStakeLP",a[a.ClaimRewardsLP=2]="ClaimRewardsLP",a))(_||{}),L=(a=>(a[a.Deposit=0]="Deposit",a[a.DepositRegular=1]="DepositRegular",a[a.DepositOneInchSingle=2]="DepositOneInchSingle",a[a.DepositOneInchUniswap=3]="DepositOneInchUniswap",a[a.DepositOneInchSolidly=4]="DepositOneInchSolidly",a[a.Withdraw=5]="Withdraw",a[a.WithdrawRegular=6]="WithdrawRegular",a[a.WithdrawOneInchSingle=7]="WithdrawOneInchSingle",a[a.WithdrawOneInchUniswapAndSolidly=8]="WithdrawOneInchUniswapAndSolidly",a[a.WithdrawBoth=9]="WithdrawBoth",a[a.Stake=10]="Stake",a[a.Unstake=11]="Unstake",a[a.GetRewards=12]="GetRewards",a))(L||{}),h=(a=>(a.Ethereum="Ethereum",a.Polygon="Polygon",a))(h||{}),W=(a=>(a[a.Stake=0]="Stake",a[a.Request=1]="Request",a[a.Claim=2]="Claim",a))(W||{}),s=(a=>(a[a.Deposit=0]="Deposit",a[a.Withdraw=1]="Withdraw",a[a.SwapFromYt=2]="SwapFromYt",a[a.SwapToYt=3]="SwapToYt",a[a.SwapPt=4]="SwapPt",a[a.Mint=5]="Mint",a[a.Redeem=6]="Redeem",a[a.Checkpoint=7]="Checkpoint",a[a.PoolRemove=8]="PoolRemove",a))(s||{}),w=(a=>(a[a.AddOrRemoveLiquidity=0]="AddOrRemoveLiquidity",a[a.Checkpoint=1]="Checkpoint",a[a.Invalid=99]="Invalid",a))(w||{}),p=(a=>(a[a.Persist=0]="Persist",a[a.Deposit=1]="Deposit",a[a.Withdraw=2]="Withdraw",a[a.Swap=3]="Swap",a))(p||{}),U=(a=>(a[a.DepositOrStake=0]="DepositOrStake",a[a.Unstake=1]="Unstake",a))(U||{}),e=(a=>(a.WITHDRAW="WITHDRAW",a.SWAP="SWAP",a.CURVE_DEPOSIT="CURVE_DEPOSIT",a.CURVE_WITHDRAW="CURVE_WITHDRAW",a.CURVE_WITHDRAW_INBALANCED="CURVE_WITHDRAW_INBALANCED",a.STAKING="STAKING",a.UNSTAKING="UNSTAKING",a.CLAIMING="CLAIMING",a.BEEFY="BEEFY",a.BEEFY_STAKE="BEEFY_STAKE",a.BEEFY_UNSTAKE="BEEFY_UNSTAKE",a.BEEFY_GET_REWARDS="BEEFY_GET_REWARDS",a.LIDO_STAKE="LIDO_STAKE",a.LIDO_REQUEST="LIDO_REQUEST",a.LIDO_CLAIM="LIDO_CLAIM",a.PENDLE_TRANSACT="PENDLE_TRANSACT",a.PENDLE_YT_IN_SWAP="PENDLE_YT_IN_SWAP",a.PENDLE_YT_OUT_SWAP="PENDLE_YT_OUT_SWAP",a.PENDLE_PT_SWAP="PENDLE_PT_SWAP",a.PENDLE_MINT="PENDLE_MINT",a.PENDLE_REDEEM="PENDLE_REDEEM",a.PENDLE_CLAIM="PENDLE_CLAIM",a.PENDLE_LP="PENDLE_LP",a.PENDLE_LP_CLAIM="PENDLE_LP_CLAIM",a.VOLATILE_WITHDRAW="VOLATILE_WITHDRAW",a.VOLATILE_SWAP="VOLATILE_SWAP",a.EMPORIUM="EMPORIUM",a.NONE="NONE",a))(e||{});exports.BeefyAction=L;exports.ConvexAction=_;exports.CurveAction=r;exports.EventType=E;exports.HinkalStakeAction=U;exports.INTERACTION=e;exports.IntegrationProvider=S;exports.LidoAction=W;exports.LidoVariant=h;exports.PendleAction=s;exports.PendleLPAction=w;exports.StakeProvider=D;exports.VolatileAction=p;
@@ -8,6 +8,11 @@ export type HinkalConfig = {
8
8
  * It should be a valid file path string.
9
9
  */
10
10
  cacheFilePath?: string;
11
+ /**
12
+ * Indicator to use caching on a file level.
13
+ * Node only.
14
+ */
15
+ useFileCache?: boolean;
11
16
  };
12
17
  export declare enum EventType {
13
18
  BalanceChange = "BalanceChange",
@@ -91,6 +96,10 @@ export declare enum VolatileAction {
91
96
  Withdraw = 2,
92
97
  Swap = 3
93
98
  }
99
+ export declare enum HinkalStakeAction {
100
+ DepositOrStake = 0,
101
+ Unstake = 1
102
+ }
94
103
  export type VolatileHelperData = {
95
104
  action: VolatileAction;
96
105
  isRelayerOff?: boolean;
@@ -1,15 +1,16 @@
1
- var E = /* @__PURE__ */ ((a) => (a.BalanceChange = "BalanceChange", a.NetworkChange = "NetworkChange", a.KycNeeded = "KycNeeded", a.AccountChanged = "AccountChanged", a.ShowConnect = "ShowConnect", a.ShowNetworkPopup = "ShowNetworkPopup", a.MerkleTreeUpdated = "MerkleTreeUpdated", a.MerkleTreeResetStarted = "MerkleTreeResetStarted", a.MerkleTreeResetFinished = "MerkleTreeResetFinished", a))(E || {}), S = /* @__PURE__ */ ((a) => (a[a.UNISWAP = 1] = "UNISWAP", a[a.ODOS = 2] = "ODOS", a[a.ONEINCH = 3] = "ONEINCH", a[a.PENDLE = 4] = "PENDLE", a[a.ALL = 5] = "ALL", a[a.NONE = 6] = "NONE", a))(S || {}), D = /* @__PURE__ */ ((a) => (a[a.CurveAavePool = 0] = "CurveAavePool", a))(D || {}), _ = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.WithdrawInt = 11] = "WithdrawInt", a[a.WithdrawUint = 12] = "WithdrawUint", a[a.WithdrawImbalance = 13] = "WithdrawImbalance", a[a.Stake = 2] = "Stake", a[a.Unstake = 3] = "Unstake", a[a.GetCRV = 4] = "GetCRV", a))(_ || {}), h = /* @__PURE__ */ ((a) => (a[a.StakeLP = 0] = "StakeLP", a[a.UnStakeLP = 1] = "UnStakeLP", a[a.ClaimRewardsLP = 2] = "ClaimRewardsLP", a))(h || {}), W = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.DepositRegular = 1] = "DepositRegular", a[a.DepositOneInchSingle = 2] = "DepositOneInchSingle", a[a.DepositOneInchUniswap = 3] = "DepositOneInchUniswap", a[a.DepositOneInchSolidly = 4] = "DepositOneInchSolidly", a[a.Withdraw = 5] = "Withdraw", a[a.WithdrawRegular = 6] = "WithdrawRegular", a[a.WithdrawOneInchSingle = 7] = "WithdrawOneInchSingle", a[a.WithdrawOneInchUniswapAndSolidly = 8] = "WithdrawOneInchUniswapAndSolidly", a[a.WithdrawBoth = 9] = "WithdrawBoth", a[a.Stake = 10] = "Stake", a[a.Unstake = 11] = "Unstake", a[a.GetRewards = 12] = "GetRewards", a))(W || {}), L = /* @__PURE__ */ ((a) => (a.Ethereum = "Ethereum", a.Polygon = "Polygon", a))(L || {}), r = /* @__PURE__ */ ((a) => (a[a.Stake = 0] = "Stake", a[a.Request = 1] = "Request", a[a.Claim = 2] = "Claim", a))(r || {}), w = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.Withdraw = 1] = "Withdraw", a[a.SwapFromYt = 2] = "SwapFromYt", a[a.SwapToYt = 3] = "SwapToYt", a[a.SwapPt = 4] = "SwapPt", a[a.Mint = 5] = "Mint", a[a.Redeem = 6] = "Redeem", a[a.Checkpoint = 7] = "Checkpoint", a[a.PoolRemove = 8] = "PoolRemove", a))(w || {}), s = /* @__PURE__ */ ((a) => (a[a.AddOrRemoveLiquidity = 0] = "AddOrRemoveLiquidity", a[a.Checkpoint = 1] = "Checkpoint", a[a.Invalid = 99] = "Invalid", a))(s || {}), U = /* @__PURE__ */ ((a) => (a[a.Persist = 0] = "Persist", a[a.Deposit = 1] = "Deposit", a[a.Withdraw = 2] = "Withdraw", a[a.Swap = 3] = "Swap", a))(U || {}), p = /* @__PURE__ */ ((a) => (a.WITHDRAW = "WITHDRAW", a.SWAP = "SWAP", a.CURVE_DEPOSIT = "CURVE_DEPOSIT", a.CURVE_WITHDRAW = "CURVE_WITHDRAW", a.CURVE_WITHDRAW_INBALANCED = "CURVE_WITHDRAW_INBALANCED", a.STAKING = "STAKING", a.UNSTAKING = "UNSTAKING", a.CLAIMING = "CLAIMING", a.BEEFY = "BEEFY", a.BEEFY_STAKE = "BEEFY_STAKE", a.BEEFY_UNSTAKE = "BEEFY_UNSTAKE", a.BEEFY_GET_REWARDS = "BEEFY_GET_REWARDS", a.LIDO_STAKE = "LIDO_STAKE", a.LIDO_REQUEST = "LIDO_REQUEST", a.LIDO_CLAIM = "LIDO_CLAIM", a.PENDLE_TRANSACT = "PENDLE_TRANSACT", a.PENDLE_YT_IN_SWAP = "PENDLE_YT_IN_SWAP", a.PENDLE_YT_OUT_SWAP = "PENDLE_YT_OUT_SWAP", a.PENDLE_PT_SWAP = "PENDLE_PT_SWAP", a.PENDLE_MINT = "PENDLE_MINT", a.PENDLE_REDEEM = "PENDLE_REDEEM", a.PENDLE_CLAIM = "PENDLE_CLAIM", a.PENDLE_LP = "PENDLE_LP", a.PENDLE_LP_CLAIM = "PENDLE_LP_CLAIM", a.VOLATILE_WITHDRAW = "VOLATILE_WITHDRAW", a.VOLATILE_SWAP = "VOLATILE_SWAP", a.EMPORIUM = "EMPORIUM", a.NONE = "NONE", a))(p || {});
1
+ var E = /* @__PURE__ */ ((a) => (a.BalanceChange = "BalanceChange", a.NetworkChange = "NetworkChange", a.KycNeeded = "KycNeeded", a.AccountChanged = "AccountChanged", a.ShowConnect = "ShowConnect", a.ShowNetworkPopup = "ShowNetworkPopup", a.MerkleTreeUpdated = "MerkleTreeUpdated", a.MerkleTreeResetStarted = "MerkleTreeResetStarted", a.MerkleTreeResetFinished = "MerkleTreeResetFinished", a))(E || {}), D = /* @__PURE__ */ ((a) => (a[a.UNISWAP = 1] = "UNISWAP", a[a.ODOS = 2] = "ODOS", a[a.ONEINCH = 3] = "ONEINCH", a[a.PENDLE = 4] = "PENDLE", a[a.ALL = 5] = "ALL", a[a.NONE = 6] = "NONE", a))(D || {}), S = /* @__PURE__ */ ((a) => (a[a.CurveAavePool = 0] = "CurveAavePool", a))(S || {}), _ = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.WithdrawInt = 11] = "WithdrawInt", a[a.WithdrawUint = 12] = "WithdrawUint", a[a.WithdrawImbalance = 13] = "WithdrawImbalance", a[a.Stake = 2] = "Stake", a[a.Unstake = 3] = "Unstake", a[a.GetCRV = 4] = "GetCRV", a))(_ || {}), h = /* @__PURE__ */ ((a) => (a[a.StakeLP = 0] = "StakeLP", a[a.UnStakeLP = 1] = "UnStakeLP", a[a.ClaimRewardsLP = 2] = "ClaimRewardsLP", a))(h || {}), W = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.DepositRegular = 1] = "DepositRegular", a[a.DepositOneInchSingle = 2] = "DepositOneInchSingle", a[a.DepositOneInchUniswap = 3] = "DepositOneInchUniswap", a[a.DepositOneInchSolidly = 4] = "DepositOneInchSolidly", a[a.Withdraw = 5] = "Withdraw", a[a.WithdrawRegular = 6] = "WithdrawRegular", a[a.WithdrawOneInchSingle = 7] = "WithdrawOneInchSingle", a[a.WithdrawOneInchUniswapAndSolidly = 8] = "WithdrawOneInchUniswapAndSolidly", a[a.WithdrawBoth = 9] = "WithdrawBoth", a[a.Stake = 10] = "Stake", a[a.Unstake = 11] = "Unstake", a[a.GetRewards = 12] = "GetRewards", a))(W || {}), r = /* @__PURE__ */ ((a) => (a.Ethereum = "Ethereum", a.Polygon = "Polygon", a))(r || {}), L = /* @__PURE__ */ ((a) => (a[a.Stake = 0] = "Stake", a[a.Request = 1] = "Request", a[a.Claim = 2] = "Claim", a))(L || {}), s = /* @__PURE__ */ ((a) => (a[a.Deposit = 0] = "Deposit", a[a.Withdraw = 1] = "Withdraw", a[a.SwapFromYt = 2] = "SwapFromYt", a[a.SwapToYt = 3] = "SwapToYt", a[a.SwapPt = 4] = "SwapPt", a[a.Mint = 5] = "Mint", a[a.Redeem = 6] = "Redeem", a[a.Checkpoint = 7] = "Checkpoint", a[a.PoolRemove = 8] = "PoolRemove", a))(s || {}), w = /* @__PURE__ */ ((a) => (a[a.AddOrRemoveLiquidity = 0] = "AddOrRemoveLiquidity", a[a.Checkpoint = 1] = "Checkpoint", a[a.Invalid = 99] = "Invalid", a))(w || {}), U = /* @__PURE__ */ ((a) => (a[a.Persist = 0] = "Persist", a[a.Deposit = 1] = "Deposit", a[a.Withdraw = 2] = "Withdraw", a[a.Swap = 3] = "Swap", a))(U || {}), p = /* @__PURE__ */ ((a) => (a[a.DepositOrStake = 0] = "DepositOrStake", a[a.Unstake = 1] = "Unstake", a))(p || {}), k = /* @__PURE__ */ ((a) => (a.WITHDRAW = "WITHDRAW", a.SWAP = "SWAP", a.CURVE_DEPOSIT = "CURVE_DEPOSIT", a.CURVE_WITHDRAW = "CURVE_WITHDRAW", a.CURVE_WITHDRAW_INBALANCED = "CURVE_WITHDRAW_INBALANCED", a.STAKING = "STAKING", a.UNSTAKING = "UNSTAKING", a.CLAIMING = "CLAIMING", a.BEEFY = "BEEFY", a.BEEFY_STAKE = "BEEFY_STAKE", a.BEEFY_UNSTAKE = "BEEFY_UNSTAKE", a.BEEFY_GET_REWARDS = "BEEFY_GET_REWARDS", a.LIDO_STAKE = "LIDO_STAKE", a.LIDO_REQUEST = "LIDO_REQUEST", a.LIDO_CLAIM = "LIDO_CLAIM", a.PENDLE_TRANSACT = "PENDLE_TRANSACT", a.PENDLE_YT_IN_SWAP = "PENDLE_YT_IN_SWAP", a.PENDLE_YT_OUT_SWAP = "PENDLE_YT_OUT_SWAP", a.PENDLE_PT_SWAP = "PENDLE_PT_SWAP", a.PENDLE_MINT = "PENDLE_MINT", a.PENDLE_REDEEM = "PENDLE_REDEEM", a.PENDLE_CLAIM = "PENDLE_CLAIM", a.PENDLE_LP = "PENDLE_LP", a.PENDLE_LP_CLAIM = "PENDLE_LP_CLAIM", a.VOLATILE_WITHDRAW = "VOLATILE_WITHDRAW", a.VOLATILE_SWAP = "VOLATILE_SWAP", a.EMPORIUM = "EMPORIUM", a.NONE = "NONE", a))(k || {});
2
2
  export {
3
3
  W as BeefyAction,
4
4
  h as ConvexAction,
5
5
  _ as CurveAction,
6
6
  E as EventType,
7
- p as INTERACTION,
8
- S as IntegrationProvider,
9
- r as LidoAction,
10
- L as LidoVariant,
11
- w as PendleAction,
12
- s as PendleLPAction,
13
- D as StakeProvider,
7
+ p as HinkalStakeAction,
8
+ k as INTERACTION,
9
+ D as IntegrationProvider,
10
+ L as LidoAction,
11
+ r as LidoVariant,
12
+ s as PendleAction,
13
+ w as PendleLPAction,
14
+ S as StakeProvider,
14
15
  U as VolatileAction
15
16
  };
package/types/index.d.ts CHANGED
@@ -22,5 +22,6 @@ export * from './pendle.api.types';
22
22
  export * from './curve.types';
23
23
  export * from './hinkal.stake.types';
24
24
  export * from './duneAPI.types';
25
+ export * from './admin.types';
25
26
  export * from './ICacheDevice';
26
27
  export * from './hinkalTvl.types';