@hinkal/common 0.1.2 → 0.1.4
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/API/duneAPI.cjs +1 -0
- package/API/duneAPI.d.ts +11 -0
- package/API/duneAPI.mjs +20 -0
- package/API/getRelayerURL.cjs +1 -1
- package/API/getRelayerURL.mjs +4 -4
- package/API/getServerURL.cjs +1 -1
- package/API/getServerURL.mjs +8 -10
- package/API/index.d.ts +1 -0
- package/README.md +0 -56
- package/constants/axelar.constants.cjs +1 -1
- package/constants/axelar.constants.mjs +10 -16
- package/constants/backend.constants.cjs +1 -1
- package/constants/backend.constants.d.ts +0 -1
- package/constants/backend.constants.mjs +0 -1
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +0 -1
- package/constants/chains.constants.mjs +40 -57
- package/constants/coingecko.constants.cjs +1 -1
- package/constants/coingecko.constants.d.ts +1 -1
- package/constants/coingecko.constants.mjs +8 -12
- package/constants/crvCvx.registry.cjs +1 -1
- package/constants/crvCvx.registry.mjs +7 -5
- package/constants/deploy-data/index.d.ts +1 -2
- package/constants/protocol.constants.mjs +0 -1
- package/constants/reorg-depths.constants.cjs +1 -1
- package/constants/reorg-depths.constants.mjs +11 -12
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +3 -7
- package/constants/server.constants.mjs +36 -40
- package/constants/token-data/ERC20Registry.cjs +1 -1
- package/constants/token-data/ERC20Registry.mjs +9 -17
- package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistry.json.mjs +17 -0
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +8 -0
- package/constants/token-data/index.d.ts +1 -5
- package/constants/token-data/tokenPricing.consts.cjs +1 -1
- package/constants/token-data/tokenPricing.consts.mjs +3 -5
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +9 -6
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +2 -2
- package/data-structures/Hinkal/Hinkal.mjs +25 -21
- package/data-structures/Hinkal/hinkalActionPendleLP.d.ts +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +11 -6
- package/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
- package/data-structures/token-price-fetcher/TokenChecker.d.ts +1 -2
- package/data-structures/token-price-fetcher/TokenChecker.mjs +7 -9
- package/data-structures/token-price-fetcher/index.d.ts +0 -1
- package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
- package/data-structures/transactions-manager/TransactionsManager.mjs +97 -93
- package/data-structures/transactions-manager/history/getPendleData.cjs +1 -1
- package/data-structures/transactions-manager/history/getPendleData.mjs +15 -20
- package/data-structures/transactions-manager/history/getVolatileData.d.ts +3 -3
- package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
- package/functions/pre-transaction/process-gas-estimates.mjs +17 -12
- package/functions/protocols/convex.protocols.d.ts +1 -1
- package/functions/snarkjs/constant.cjs +1 -1
- package/functions/snarkjs/constant.mjs +1 -4
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.d.ts +4 -4
- package/functions/utils/cacheFunctions.mjs +40 -26
- package/functions/utils/getDataFromTransaction.d.ts +3 -3
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +46 -49
- package/index.cjs +1 -1
- package/index.mjs +613 -621
- package/package.json +1 -1
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +7 -4
- package/providers/prepareWagmiv1Hinkal.cjs +1 -1
- package/providers/prepareWagmiv1Hinkal.mjs +7 -4
- package/types/curve.types.cjs +1 -1
- package/types/curve.types.mjs +5 -6
- package/types/duneAPI.types.d.ts +9 -0
- package/types/index.d.ts +1 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/viteWorkerURL.constant.cjs +21 -1
- package/webworker/viteWorkerURL.constant.mjs +1 -3
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/assets/snarkjsWorkerLauncher-CG86wN85.js +0 -1202
- package/assets/snarkjsWorkerLogic-C3huMBha.js +0 -17967
- package/assets/utxoWorkerLauncher-Bu-W3EAj.js +0 -1204
- package/assets/utxoWorkerLogic-CBkU2odl.js +0 -51883
- package/assets/zkProofWorkerLauncher-1qQFujaL.js +0 -1204
- package/assets/zkProofWorkerLogic-Bs68aPkV.js +0 -51396
- package/constants/deploy-data/deploy-data-blast.json.cjs +0 -1
- package/constants/deploy-data/deploy-data-blast.json.mjs +0 -9604
- package/constants/token-data/blastRegistry.json.cjs +0 -1
- package/constants/token-data/blastRegistry.json.mjs +0 -137
- package/constants/token-data/blastRegistryFixed.json.cjs +0 -1
- package/constants/token-data/blastRegistryFixed.json.mjs +0 -137
- package/constants/token-data/coingeckoRegistry.json.cjs +0 -1
- package/constants/token-data/coingeckoRegistry.json.mjs +0 -115623
- package/constants/token-data/index.cjs +0 -1
- package/constants/token-data/index.mjs +0 -6
- package/data-structures/token-price-fetcher/TokenPriceFetcher.cjs +0 -1
- package/data-structures/token-price-fetcher/TokenPriceFetcher.d.ts +0 -40
- package/data-structures/token-price-fetcher/TokenPriceFetcher.mjs +0 -198
|
@@ -25,19 +25,23 @@ import { getAxelarGasEstimate as R } from "../../API/getAxelarGasEstimate.mjs";
|
|
|
25
25
|
import { API as l } from "../../API/API.mjs";
|
|
26
26
|
import "ethers";
|
|
27
27
|
import "../../types/curve.types.mjs";
|
|
28
|
-
import
|
|
28
|
+
import "../../constants/contracts.constants.mjs";
|
|
29
|
+
import { supportedPassportLinks as L } from "../../constants/kyc.constants.mjs";
|
|
30
|
+
import "../../constants/axelar.constants.mjs";
|
|
31
|
+
import "../../constants/rewards.constants.mjs";
|
|
32
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
33
|
+
import { TransactionsManager as M } from "../transactions-manager/TransactionsManager.mjs";
|
|
29
34
|
import "../../functions/utils/external-action.utils.mjs";
|
|
30
35
|
import "../../types/circom-data.types.mjs";
|
|
31
36
|
import "../../types/transactions.types.mjs";
|
|
32
|
-
import { reloadPage as
|
|
33
|
-
import { hinkalActionVolatile as
|
|
34
|
-
import { hinkalActionPendleLP as
|
|
35
|
-
import { getConnextReceiveFee as
|
|
36
|
-
import { hinkalActionStake as
|
|
37
|
-
import { multiThreadedUtxoUtils as
|
|
38
|
-
import { hinkalPrivateWallet as
|
|
39
|
-
|
|
40
|
-
class He {
|
|
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 {
|
|
41
45
|
providerAdapter;
|
|
42
46
|
userKeys;
|
|
43
47
|
signingMessage = "Login to Hinkal Protocol";
|
|
@@ -49,9 +53,9 @@ class He {
|
|
|
49
53
|
nullifierSnapshotService;
|
|
50
54
|
accessTokenSnapshotService;
|
|
51
55
|
transactionsManager;
|
|
52
|
-
utxoUtils =
|
|
56
|
+
utxoUtils = U;
|
|
53
57
|
constructor() {
|
|
54
|
-
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
|
|
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();
|
|
55
59
|
}
|
|
56
60
|
async initProviderAdapter(e, t) {
|
|
57
61
|
await this.updateProviderAdapter(t), this.providerAdapter?.initConnector(e);
|
|
@@ -152,7 +156,7 @@ class He {
|
|
|
152
156
|
const t = o.NetworkChange;
|
|
153
157
|
typeof document < "u" ? document.dispatchEvent(new Event(t)) : process?.emit("message", t, void 0);
|
|
154
158
|
} else
|
|
155
|
-
await this.disconnectFromConnector(),
|
|
159
|
+
await this.disconnectFromConnector(), W();
|
|
156
160
|
}
|
|
157
161
|
async monitorConnectedAddress() {
|
|
158
162
|
F(await this.getEthereumAddress(), this.getCurrentChainId());
|
|
@@ -161,7 +165,7 @@ class He {
|
|
|
161
165
|
return A(this);
|
|
162
166
|
}
|
|
163
167
|
getSupportedPassportLinks() {
|
|
164
|
-
return
|
|
168
|
+
return L;
|
|
165
169
|
}
|
|
166
170
|
checkAccessToken() {
|
|
167
171
|
return g(this);
|
|
@@ -176,7 +180,7 @@ class He {
|
|
|
176
180
|
);
|
|
177
181
|
}
|
|
178
182
|
async getConnextReceiveFee(e, t) {
|
|
179
|
-
return
|
|
183
|
+
return x(this.getCurrentChainId(), e, t);
|
|
180
184
|
}
|
|
181
185
|
async mintHinkalAccessToken(e) {
|
|
182
186
|
return u(this, e);
|
|
@@ -268,7 +272,7 @@ class He {
|
|
|
268
272
|
return C(this, e, t, r, i, n);
|
|
269
273
|
}
|
|
270
274
|
async actionPendleLP(e, t, r, i, n = !1) {
|
|
271
|
-
return
|
|
275
|
+
return K(
|
|
272
276
|
this,
|
|
273
277
|
e,
|
|
274
278
|
t,
|
|
@@ -278,18 +282,18 @@ class He {
|
|
|
278
282
|
);
|
|
279
283
|
}
|
|
280
284
|
async actionVolatile(e, t, r, i = !1) {
|
|
281
|
-
return
|
|
285
|
+
return N(this, e, t, r, i);
|
|
282
286
|
}
|
|
283
287
|
async actionStake(e, t, r, i) {
|
|
284
|
-
return
|
|
288
|
+
return B(this, e, t, r, i);
|
|
285
289
|
}
|
|
286
290
|
async actionPrivateWallet(e, t, r, i = [], n, a = !1) {
|
|
287
|
-
return
|
|
291
|
+
return b(this, e, t, r, i, n, a);
|
|
288
292
|
}
|
|
289
293
|
async getPendleLPClaimableParams(e, t) {
|
|
290
|
-
return
|
|
294
|
+
return O(this, e, t);
|
|
291
295
|
}
|
|
292
296
|
}
|
|
293
297
|
export {
|
|
294
|
-
|
|
298
|
+
Le as Hinkal
|
|
295
299
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PendleLPMetadata } from '../../types';
|
|
2
2
|
import { IHinkal } from './IHinkal';
|
|
3
|
-
export declare const hinkalActionPendleLP: (hinkal: IHinkal, erc20Addresses: string[], amountChanges: bigint[], pendleLPMetadata: PendleLPMetadata, gasTokenAddress?: string, onlyGasEstimate?: boolean) => Promise<bigint | import(
|
|
3
|
+
export declare const hinkalActionPendleLP: (hinkal: IHinkal, erc20Addresses: string[], amountChanges: bigint[], pendleLPMetadata: PendleLPMetadata, gasTokenAddress?: string, onlyGasEstimate?: boolean) => Promise<bigint | import('../../types/relayer.types').RelayerTransaction>;
|
|
4
4
|
export declare const hinkalGetPendleLPClaimableParams: (hinkal: IHinkal, wlpTokenAddress: string, wlpTokenBalance: bigint) => Promise<{
|
|
5
5
|
amount: bigint;
|
|
6
6
|
timestamp: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const i=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.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 a=r=>({async getAccessToken(){const e=r.getCurrentChainId();return i.API.getZkMeAccessToken(e)},async getUserAccounts(){return[await r.getEthereumAddress()]},async delegateTransaction(e){const t=await r.getProviderAdapter(),s={...e,chainId:Number(e.chainId),type:e.type?e.type:void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?e.maxPriorityFeePerGas:void 0,maxFeePerGas:e.maxFeePerGas?e.maxFeePerGas:void 0};return(await t.sendTransaction(s)).hash}});exports.getHinkalZkMeProvider=a;
|
|
@@ -2,28 +2,33 @@ import "../../constants/chains.constants.mjs";
|
|
|
2
2
|
import "../../constants/vite.constants.mjs";
|
|
3
3
|
import "axios";
|
|
4
4
|
import "../../constants/coingecko.constants.mjs";
|
|
5
|
-
import { API as
|
|
5
|
+
import { API as s } from "../../API/API.mjs";
|
|
6
6
|
import "ethers";
|
|
7
7
|
import "../../types/curve.types.mjs";
|
|
8
|
-
|
|
8
|
+
import "../../constants/contracts.constants.mjs";
|
|
9
|
+
import "../../constants/kyc.constants.mjs";
|
|
10
|
+
import "../../constants/axelar.constants.mjs";
|
|
11
|
+
import "../../constants/rewards.constants.mjs";
|
|
12
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
13
|
+
const F = (r) => ({
|
|
9
14
|
async getAccessToken() {
|
|
10
15
|
const e = r.getCurrentChainId();
|
|
11
|
-
return
|
|
16
|
+
return s.getZkMeAccessToken(e);
|
|
12
17
|
},
|
|
13
18
|
async getUserAccounts() {
|
|
14
19
|
return [await r.getEthereumAddress()];
|
|
15
20
|
},
|
|
16
21
|
async delegateTransaction(e) {
|
|
17
|
-
const t = await r.getProviderAdapter(),
|
|
22
|
+
const t = await r.getProviderAdapter(), o = {
|
|
18
23
|
...e,
|
|
19
24
|
chainId: Number(e.chainId),
|
|
20
25
|
type: e.type ? e.type : void 0,
|
|
21
26
|
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? e.maxPriorityFeePerGas : void 0,
|
|
22
27
|
maxFeePerGas: e.maxFeePerGas ? e.maxFeePerGas : void 0
|
|
23
28
|
};
|
|
24
|
-
return (await t.sendTransaction(
|
|
29
|
+
return (await t.sendTransaction(o)).hash;
|
|
25
30
|
}
|
|
26
31
|
});
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
F as getHinkalZkMeProvider
|
|
29
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../functions/utils/caseInsensitive.utils.cjs"),i=require("../../constants/lido.constants.cjs");class o{static isCurveLPToken=(e,s)=>a.lowerCaseIncludes(s,e.erc20TokenAddress);static isCurveStakeToken=e=>e.name.includes("Gauge")&&e.symbol.includes("-gauge");static isConvexToken=e=>e.name.includes("Convex")&&e.symbol.includes("cvx");static isBeefyLpToken=e=>e.name.startsWith("moo")&&e.symbol.startsWith("moo");static isBeefyStakeToken=e=>e.name.includes("-Boost")&&e.symbol.includes("-Boost");static isLidoToken=e=>e.symbol===i.wstEthSymbol||e.symbol===i.stMaticSymbol;static isCurveOrConvex=(e,s)=>this.isCurveLPToken(e,s)||this.isCurveStakeToken(e)||this.isConvexToken(e);static isBeefyToken=e=>this.isBeefyLpToken(e)||this.isBeefyStakeToken(e);static isStakeToken=e=>this.isCurveStakeToken(e)||this.isConvexToken(e)||this.isBeefyStakeToken(e);static isPendleYtToken=e=>e.name.startsWith("Pendle-YT-")&&e.symbol.startsWith("Pendle-YT-");static isPendleLPToken=e=>e.name.startsWith("Pendle-LP-")&&e.symbol.startsWith("Pendle-LP-");static isPendleSyToken=e=>e.name.startsWith("SY ")&&e.symbol.includes("SY-");static isPendleNativeToken=e=>{const s=e.name.startsWith("YT ")&&e.symbol.includes("YT-"),t=this.isPendleSyToken(e),n=e.name.startsWith("PT ")&&e.symbol.includes("PT-"),r=e.name.startsWith("LP ")&&e.symbol.includes("LP-");return s||t||n||r};static isPendleToken=e=>this.isPendleYtToken(e)||this.isPendleLPToken(e)||this.isPendleNativeToken(e);static isAaveToken=e=>e.aaveToken;static isKinzaToken=e=>e.name.startsWith("Kinza");static isProtocolToken=(e,s)=>this.isCurveLPToken(e,s)||this.isCurveStakeToken(e)||this.isConvexToken(e)||this.isBeefyLpToken(e)||this.isBeefyStakeToken(e)||this.isLidoToken(e)||this.isPendleToken(e)||this.isAaveToken(e)}exports.TokenChecker=o;
|
|
@@ -15,7 +15,6 @@ export declare class TokenChecker {
|
|
|
15
15
|
static isPendleNativeToken: (token: ERC20Token) => boolean;
|
|
16
16
|
static isPendleToken: (token: ERC20Token) => boolean;
|
|
17
17
|
static isAaveToken: (token: ERC20Token) => boolean | undefined;
|
|
18
|
-
static isNonRebasingBlastToken: (token: ERC20Token) => boolean;
|
|
19
18
|
static isKinzaToken: (token: ERC20Token) => boolean;
|
|
20
|
-
static isProtocolToken: (token: ERC20Token, curveTokens: string[]) => boolean;
|
|
19
|
+
static isProtocolToken: (token: ERC20Token, curveTokens: string[]) => boolean | undefined;
|
|
21
20
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { lowerCaseIncludes as
|
|
2
|
-
import { wstEthSymbol as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
static isCurveLPToken = (s, e) => a(e, s.erc20TokenAddress);
|
|
1
|
+
import { lowerCaseIncludes as r } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
2
|
+
import { wstEthSymbol as a, stMaticSymbol as o } from "../../constants/lido.constants.mjs";
|
|
3
|
+
class u {
|
|
4
|
+
static isCurveLPToken = (s, e) => r(e, s.erc20TokenAddress);
|
|
6
5
|
static isCurveStakeToken = (s) => s.name.includes("Gauge") && s.symbol.includes("-gauge");
|
|
7
6
|
static isConvexToken = (s) => s.name.includes("Convex") && s.symbol.includes("cvx");
|
|
8
7
|
static isBeefyLpToken = (s) => s.name.startsWith("moo") && s.symbol.startsWith("moo");
|
|
9
8
|
static isBeefyStakeToken = (s) => s.name.includes("-Boost") && s.symbol.includes("-Boost");
|
|
10
|
-
static isLidoToken = (s) => s.symbol ===
|
|
9
|
+
static isLidoToken = (s) => s.symbol === a || s.symbol === o;
|
|
11
10
|
static isCurveOrConvex = (s, e) => this.isCurveLPToken(s, e) || this.isCurveStakeToken(s) || this.isConvexToken(s);
|
|
12
11
|
static isBeefyToken = (s) => this.isBeefyLpToken(s) || this.isBeefyStakeToken(s);
|
|
13
12
|
static isStakeToken = (s) => this.isCurveStakeToken(s) || this.isConvexToken(s) || this.isBeefyStakeToken(s);
|
|
@@ -20,10 +19,9 @@ class m {
|
|
|
20
19
|
};
|
|
21
20
|
static isPendleToken = (s) => this.isPendleYtToken(s) || this.isPendleLPToken(s) || this.isPendleNativeToken(s);
|
|
22
21
|
static isAaveToken = (s) => s.aaveToken;
|
|
23
|
-
static isNonRebasingBlastToken = (s) => s.chainId === T.blast && s.symbol.startsWith("nr");
|
|
24
22
|
static isKinzaToken = (s) => s.name.startsWith("Kinza");
|
|
25
|
-
static isProtocolToken = (s, e) => this.isCurveLPToken(s, e) || this.isCurveStakeToken(s) || this.isConvexToken(s) || this.isBeefyLpToken(s) || this.isBeefyStakeToken(s) || this.isLidoToken(s) || this.isPendleToken(s) || this.isAaveToken(s)
|
|
23
|
+
static isProtocolToken = (s, e) => this.isCurveLPToken(s, e) || this.isCurveStakeToken(s) || this.isConvexToken(s) || this.isBeefyLpToken(s) || this.isBeefyStakeToken(s) || this.isLidoToken(s) || this.isPendleToken(s) || this.isAaveToken(s);
|
|
26
24
|
}
|
|
27
25
|
export {
|
|
28
|
-
|
|
26
|
+
u as TokenChecker
|
|
29
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const f=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.cjs");const A=require("../../functions/snarkjs/generateZkProof.cjs");require("../../types/circom-data.types.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("axios");require("../../constants/coingecko.constants.cjs");const f=require("../../API/API.cjs");require("ethers");require("../../types/curve.types.cjs");const A=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 k=require("../../functions/snarkjs/generateZkProof.cjs");require("../../types/circom-data.types.cjs");const q=require("../../types/transactions.types.cjs"),I=require("../../types/time.types.cjs"),x=require("./history/getTxDetails.cjs");require("circomlibjs");const P=require("../../error-handling/error-codes.constants.cjs"),C=require("../crypto-keys/keys.cjs"),w=require("../crypto-keys/encryptDecryptUtxo.cjs"),p=require("../../functions/utils/getDataFromTransaction.cjs"),S=require("../../functions/utils/cacheFunctions.cjs");class v{circuitSize=50;hinkalContract;init(e){this.hinkalContract=e}requireInit(){if(!this.hinkalContract)throw Error("TransactionsManager not initialized")}filterOwnTransactions=async(e,r,t,a)=>{const{transactMethodId:s,transactWithExternalActionMethodId:n,hinkalInterface:i}=A.getHinkalParameters(T.getNonLocalhostChainId(e)),c=o=>"decodedInput"in o,l=r.filter(o=>o.methodId===s||o.methodId===n).map(o=>c(o)?o:{...o,decodedInput:p.decodeTxInput(i,o.input),status:o.isError==="0"?"SUCCESS":"FAILURE"}),h=t.getShieldedPrivateKey();return l.filter(o=>{try{if(c(o)){if(w.decryptUtxo(Buffer.from(o.decodedInput.encryptedOutputs[0].slice(2),"hex"),t),!a&&o.methodId===s){const{extraRandomization:g,H0:y,H1:m}=o.decodedInput.stealthAddressStructure;return C.UserKeys.checkSignature(g,y,m,h)}return!0}return!1}catch{return!1}})};saveTxsInStorage=(e,r,t,a)=>{const s=t.getShieldedPublicKey();return S.saveTxsCache(e,r,s,this.hinkalContract.address,a)};loadTxsFromStorage=async(e,r)=>{const t=r.getShieldedPublicKey();return await S.loadTxsCache(e,t,this.hinkalContract.address)};getAllTransactions=async(e,r,t)=>{if(t){const{transactions:i}=await f.API.userGetTransactions(e,t);return i}const{decodedTxs:a,lastHash:s}=await this.loadTxsFromStorage(e,r),{transactions:n}=await f.API.userGetTransactions(e,t,s);return[...n,...a]};getHinkalHistoryBase=async(e,r,t,a=!1)=>{this.requireInit();const s=await this.getAllTransactions(e,r,t)??[];s.sort((i,c)=>c.timeStamp-i.timeStamp);const n=await this.filterOwnTransactions(e,s,r,a);return!t&&s.length>0&&await this.saveTxsInStorage(n,e,r,s[0].hash),n};getHinkalHistory=async(e,r)=>{const t=await this.getHinkalHistoryBase(e,r,void 0,!0),a=p.decodeTxLogs(e,t);return await Promise.all(a.map(async n=>({...n,status:n.status,details:await x.getTxDetails(e,n.decodedInput,n.utxosArray)})))};sortInBatches=e=>{const r=[];let t=0,a=0;e.forEach(i=>{t===0&&r.push([]),r[a].push(i),t+=1,t===this.circuitSize&&(t=0,a+=1)});const s=r[r.length-1],n=s.length;if(n<this.circuitSize){const i=this.circuitSize-n,c=new Array(i).fill(q.emptyDecodedTx);r[r.length-1]=s.concat(c)}return r};generateTransactionsProof=async(e,r,t)=>{const a=this.sortInBatches(r),s=new Array(a.length).fill([]);for(let n=0;n<a.length;n+=1){const i=a[n].map(d=>d.decodedInput.stealthAddressStructure),c=i.map(d=>d.extraRandomization),u=i.map(d=>d.stealthAddress);console.log({extraRandomizations:c,stealthAddresses:u});const l={shieldedPrivateKey:t,extraRandomizations:c,stealthAddresses:u};console.log({chainId:e,input:l});const{zkCallData:h}=await k.generateZkProof(e,"transactionsProver",l);console.log({zkCallData:h}),s[n]=h}return{zkCallDataArray:s}};userVerifyTransactions=async(e,r,t,a,s,n)=>await f.API.userVerifyTransactions(e,r,t,a,s,n);processAndSendTransactionsForVerification=async(e,r,t,a)=>{this.requireInit();const s=I.getCurrentWeek(),n=a?s-1:s;console.log("retrieving transactions in processAndSendTransactionsForVerification",{week:n});const i=await this.getHinkalHistoryBase(e,r,n);console.log("retrieved transactions",i);let c=[],u=[];i.length>0&&({zkCallDataArray:u}=await this.generateTransactionsProof(e,i,r.getShieldedPrivateKey()),c=i.map(y=>y.hash));const l=r.getBackendToken(),{trade:h,transactions:d,lockedDeposit:o,verification:g}=await this.userVerifyTransactions(e,c,u,l,t,n);return{trade:h,transactions:d,lockedDeposit:o,verification:g}};multiProcessAndSendTransactionsForVerification=async(e,r)=>{console.log("Multi Certify Starts");const t=T.chainIdsByType[T.EthereumNetworkType.Mainnet];let a=!0;for(let s=0;s<t.length;s+=1)try{const{hasCertified:n}=await f.API.verificationStartDate(t[s],r);if(console.log(`certification status for chain ${t[s]} is ${n}`),n)continue;const{trade:i,transactions:c,lockedDeposit:u,verification:l}=await this.processAndSendTransactionsForVerification(t[s],e,r,!0);if(console.log({chainId:t[s],trade:i,totalTransactions:c,lockedDeposit:u,verification:l}),a=a&&l,!a)break}catch(n){console.log(`current chain ${t[s]} certification error`,{err:n}),a=!1;break}if(!a)throw Error(P.transactionErrorCodes.MULTI_VERIFICATION_FAILED);return!0}}exports.TransactionsManager=v;
|
|
@@ -5,44 +5,48 @@ import "../../constants/coingecko.constants.mjs";
|
|
|
5
5
|
import { API as m } from "../../API/API.mjs";
|
|
6
6
|
import "ethers";
|
|
7
7
|
import "../../types/curve.types.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { getHinkalParameters as k } from "../../constants/contracts.constants.mjs";
|
|
9
|
+
import "../../constants/kyc.constants.mjs";
|
|
10
|
+
import "../../constants/axelar.constants.mjs";
|
|
11
|
+
import "../../constants/rewards.constants.mjs";
|
|
12
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
13
|
+
import { generateZkProof as A } from "../../functions/snarkjs/generateZkProof.mjs";
|
|
9
14
|
import "../../types/circom-data.types.mjs";
|
|
10
|
-
import { emptyDecodedTx as
|
|
11
|
-
import { getCurrentWeek as
|
|
12
|
-
import { getTxDetails as
|
|
15
|
+
import { emptyDecodedTx as I } from "../../types/transactions.types.mjs";
|
|
16
|
+
import { getCurrentWeek as x } from "../../types/time.types.mjs";
|
|
17
|
+
import { getTxDetails as w } from "./history/getTxDetails.mjs";
|
|
13
18
|
import "circomlibjs";
|
|
14
19
|
import { transactionErrorCodes as C } from "../../error-handling/error-codes.constants.mjs";
|
|
15
|
-
import { UserKeys as
|
|
16
|
-
import { decryptUtxo as
|
|
17
|
-
import { getHinkalParameters as v } from "../../constants/contracts.constants.mjs";
|
|
20
|
+
import { UserKeys as P } from "../crypto-keys/keys.mjs";
|
|
21
|
+
import { decryptUtxo as v } from "../crypto-keys/encryptDecryptUtxo.mjs";
|
|
18
22
|
import { decodeTxInput as H, decodeTxLogs as z } from "../../functions/utils/getDataFromTransaction.mjs";
|
|
19
23
|
import { saveTxsCache as E, loadTxsCache as b } from "../../functions/utils/cacheFunctions.mjs";
|
|
20
|
-
class
|
|
24
|
+
class et {
|
|
21
25
|
circuitSize = 50;
|
|
22
26
|
hinkalContract;
|
|
23
|
-
init(
|
|
24
|
-
this.hinkalContract =
|
|
27
|
+
init(r) {
|
|
28
|
+
this.hinkalContract = r;
|
|
25
29
|
}
|
|
26
30
|
requireInit() {
|
|
27
31
|
if (!this.hinkalContract)
|
|
28
32
|
throw Error("TransactionsManager not initialized");
|
|
29
33
|
}
|
|
30
|
-
filterOwnTransactions = async (
|
|
31
|
-
const { transactMethodId:
|
|
32
|
-
T(
|
|
33
|
-
), c = (
|
|
34
|
-
(
|
|
35
|
-
).map((
|
|
36
|
-
...
|
|
37
|
-
decodedInput: H(
|
|
38
|
-
status:
|
|
34
|
+
filterOwnTransactions = async (r, e, t, n) => {
|
|
35
|
+
const { transactMethodId: a, transactWithExternalActionMethodId: s, hinkalInterface: i } = k(
|
|
36
|
+
T(r)
|
|
37
|
+
), c = (o) => "decodedInput" in o, l = e.filter(
|
|
38
|
+
(o) => o.methodId === a || o.methodId === s
|
|
39
|
+
).map((o) => c(o) ? o : {
|
|
40
|
+
...o,
|
|
41
|
+
decodedInput: H(i, o.input),
|
|
42
|
+
status: o.isError === "0" ? "SUCCESS" : "FAILURE"
|
|
39
43
|
}), u = t.getShieldedPrivateKey();
|
|
40
|
-
return l.filter((
|
|
44
|
+
return l.filter((o) => {
|
|
41
45
|
try {
|
|
42
|
-
if (c(
|
|
43
|
-
if (
|
|
44
|
-
const { extraRandomization: f, H0: p, H1: g } =
|
|
45
|
-
return
|
|
46
|
+
if (c(o)) {
|
|
47
|
+
if (v(Buffer.from(o.decodedInput.encryptedOutputs[0].slice(2), "hex"), t), !n && o.methodId === a) {
|
|
48
|
+
const { extraRandomization: f, H0: p, H1: g } = o.decodedInput.stealthAddressStructure;
|
|
49
|
+
return P.checkSignature(f, p, g, u);
|
|
46
50
|
}
|
|
47
51
|
return !0;
|
|
48
52
|
}
|
|
@@ -52,124 +56,124 @@ class X {
|
|
|
52
56
|
}
|
|
53
57
|
});
|
|
54
58
|
};
|
|
55
|
-
saveTxsInStorage = (
|
|
56
|
-
const
|
|
57
|
-
E(
|
|
59
|
+
saveTxsInStorage = (r, e, t, n) => {
|
|
60
|
+
const a = t.getShieldedPublicKey();
|
|
61
|
+
return E(r, e, a, this.hinkalContract.address, n);
|
|
58
62
|
};
|
|
59
|
-
loadTxsFromStorage = (
|
|
60
|
-
const t =
|
|
61
|
-
return b(
|
|
63
|
+
loadTxsFromStorage = async (r, e) => {
|
|
64
|
+
const t = e.getShieldedPublicKey();
|
|
65
|
+
return await b(r, t, this.hinkalContract.address);
|
|
62
66
|
};
|
|
63
|
-
getAllTransactions = async (
|
|
67
|
+
getAllTransactions = async (r, e, t) => {
|
|
64
68
|
if (t) {
|
|
65
|
-
const { transactions:
|
|
66
|
-
return
|
|
69
|
+
const { transactions: i } = await m.userGetTransactions(r, t);
|
|
70
|
+
return i;
|
|
67
71
|
}
|
|
68
|
-
const { decodedTxs: n, lastHash:
|
|
69
|
-
return [...
|
|
72
|
+
const { decodedTxs: n, lastHash: a } = await this.loadTxsFromStorage(r, e), { transactions: s } = await m.userGetTransactions(r, t, a);
|
|
73
|
+
return [...s, ...n];
|
|
70
74
|
};
|
|
71
|
-
getHinkalHistoryBase = async (
|
|
75
|
+
getHinkalHistoryBase = async (r, e, t, n = !1) => {
|
|
72
76
|
this.requireInit();
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
return !t &&
|
|
77
|
+
const a = await this.getAllTransactions(r, e, t) ?? [];
|
|
78
|
+
a.sort((i, c) => c.timeStamp - i.timeStamp);
|
|
79
|
+
const s = await this.filterOwnTransactions(r, a, e, n);
|
|
80
|
+
return !t && a.length > 0 && await this.saveTxsInStorage(s, r, e, a[0].hash), s;
|
|
77
81
|
};
|
|
78
|
-
getHinkalHistory = async (
|
|
79
|
-
const t = await this.getHinkalHistoryBase(
|
|
82
|
+
getHinkalHistory = async (r, e) => {
|
|
83
|
+
const t = await this.getHinkalHistoryBase(r, e, void 0, !0), n = z(r, t);
|
|
80
84
|
return await Promise.all(
|
|
81
|
-
n.map(async (
|
|
82
|
-
...
|
|
83
|
-
status:
|
|
84
|
-
details: await
|
|
85
|
+
n.map(async (s) => ({
|
|
86
|
+
...s,
|
|
87
|
+
status: s.status,
|
|
88
|
+
details: await w(r, s.decodedInput, s.utxosArray)
|
|
85
89
|
}))
|
|
86
90
|
);
|
|
87
91
|
};
|
|
88
|
-
sortInBatches = (
|
|
89
|
-
const
|
|
92
|
+
sortInBatches = (r) => {
|
|
93
|
+
const e = [];
|
|
90
94
|
let t = 0, n = 0;
|
|
91
|
-
|
|
92
|
-
t === 0 &&
|
|
95
|
+
r.forEach((i) => {
|
|
96
|
+
t === 0 && e.push([]), e[n].push(i), t += 1, t === this.circuitSize && (t = 0, n += 1);
|
|
93
97
|
});
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
+
const a = e[e.length - 1], s = a.length;
|
|
99
|
+
if (s < this.circuitSize) {
|
|
100
|
+
const i = this.circuitSize - s, c = new Array(i).fill(I);
|
|
101
|
+
e[e.length - 1] = a.concat(c);
|
|
98
102
|
}
|
|
99
|
-
return
|
|
103
|
+
return e;
|
|
100
104
|
};
|
|
101
|
-
generateTransactionsProof = async (
|
|
102
|
-
const n = this.sortInBatches(
|
|
103
|
-
for (let
|
|
104
|
-
const
|
|
105
|
+
generateTransactionsProof = async (r, e, t) => {
|
|
106
|
+
const n = this.sortInBatches(e), a = new Array(n.length).fill([]);
|
|
107
|
+
for (let s = 0; s < n.length; s += 1) {
|
|
108
|
+
const i = n[s].map(
|
|
105
109
|
(h) => h.decodedInput.stealthAddressStructure
|
|
106
|
-
), c =
|
|
110
|
+
), c = i.map((h) => h.extraRandomization), d = i.map((h) => h.stealthAddress);
|
|
107
111
|
console.log({ extraRandomizations: c, stealthAddresses: d });
|
|
108
112
|
const l = {
|
|
109
113
|
shieldedPrivateKey: t,
|
|
110
114
|
extraRandomizations: c,
|
|
111
115
|
stealthAddresses: d
|
|
112
116
|
};
|
|
113
|
-
console.log({ chainId:
|
|
114
|
-
const { zkCallData: u } = await
|
|
115
|
-
console.log({ zkCallData: u }), s
|
|
117
|
+
console.log({ chainId: r, input: l });
|
|
118
|
+
const { zkCallData: u } = await A(r, "transactionsProver", l);
|
|
119
|
+
console.log({ zkCallData: u }), a[s] = u;
|
|
116
120
|
}
|
|
117
|
-
return { zkCallDataArray:
|
|
121
|
+
return { zkCallDataArray: a };
|
|
118
122
|
};
|
|
119
|
-
userVerifyTransactions = async (
|
|
120
|
-
e,
|
|
123
|
+
userVerifyTransactions = async (r, e, t, n, a, s) => await m.userVerifyTransactions(
|
|
121
124
|
r,
|
|
125
|
+
e,
|
|
122
126
|
t,
|
|
123
127
|
n,
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
a,
|
|
129
|
+
s
|
|
126
130
|
);
|
|
127
|
-
processAndSendTransactionsForVerification = async (
|
|
131
|
+
processAndSendTransactionsForVerification = async (r, e, t, n) => {
|
|
128
132
|
this.requireInit();
|
|
129
|
-
const
|
|
130
|
-
console.log("retrieving transactions in processAndSendTransactionsForVerification", { week:
|
|
131
|
-
const
|
|
132
|
-
console.log("retrieved transactions",
|
|
133
|
+
const a = x(), s = n ? a - 1 : a;
|
|
134
|
+
console.log("retrieving transactions in processAndSendTransactionsForVerification", { week: s });
|
|
135
|
+
const i = await this.getHinkalHistoryBase(r, e, s);
|
|
136
|
+
console.log("retrieved transactions", i);
|
|
133
137
|
let c = [], d = [];
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
), c =
|
|
139
|
-
const l =
|
|
138
|
+
i.length > 0 && ({ zkCallDataArray: d } = await this.generateTransactionsProof(
|
|
139
|
+
r,
|
|
140
|
+
i,
|
|
141
|
+
e.getShieldedPrivateKey()
|
|
142
|
+
), c = i.map((p) => p.hash));
|
|
143
|
+
const l = e.getBackendToken(), {
|
|
140
144
|
trade: u,
|
|
141
145
|
transactions: h,
|
|
142
|
-
lockedDeposit:
|
|
146
|
+
lockedDeposit: o,
|
|
143
147
|
verification: f
|
|
144
148
|
} = await this.userVerifyTransactions(
|
|
145
|
-
|
|
149
|
+
r,
|
|
146
150
|
c,
|
|
147
151
|
d,
|
|
148
152
|
l,
|
|
149
153
|
t,
|
|
150
|
-
|
|
154
|
+
s
|
|
151
155
|
);
|
|
152
|
-
return { trade: u, transactions: h, lockedDeposit:
|
|
156
|
+
return { trade: u, transactions: h, lockedDeposit: o, verification: f };
|
|
153
157
|
};
|
|
154
|
-
multiProcessAndSendTransactionsForVerification = async (
|
|
158
|
+
multiProcessAndSendTransactionsForVerification = async (r, e) => {
|
|
155
159
|
console.log("Multi Certify Starts");
|
|
156
160
|
const t = y[S.Mainnet];
|
|
157
161
|
let n = !0;
|
|
158
|
-
for (let
|
|
162
|
+
for (let a = 0; a < t.length; a += 1)
|
|
159
163
|
try {
|
|
160
|
-
const { hasCertified:
|
|
161
|
-
if (console.log(`certification status for chain ${t[
|
|
164
|
+
const { hasCertified: s } = await m.verificationStartDate(t[a], e);
|
|
165
|
+
if (console.log(`certification status for chain ${t[a]} is ${s}`), s)
|
|
162
166
|
continue;
|
|
163
167
|
const {
|
|
164
|
-
trade:
|
|
168
|
+
trade: i,
|
|
165
169
|
transactions: c,
|
|
166
170
|
lockedDeposit: d,
|
|
167
171
|
verification: l
|
|
168
|
-
} = await this.processAndSendTransactionsForVerification(t[
|
|
169
|
-
if (console.log({ chainId: t[
|
|
172
|
+
} = await this.processAndSendTransactionsForVerification(t[a], r, e, !0);
|
|
173
|
+
if (console.log({ chainId: t[a], trade: i, totalTransactions: c, lockedDeposit: d, verification: l }), n = n && l, !n)
|
|
170
174
|
break;
|
|
171
|
-
} catch (
|
|
172
|
-
console.log(`current chain ${t[
|
|
175
|
+
} catch (s) {
|
|
176
|
+
console.log(`current chain ${t[a]} certification error`, { err: s }), n = !1;
|
|
173
177
|
break;
|
|
174
178
|
}
|
|
175
179
|
if (!n)
|
|
@@ -178,5 +182,5 @@ class X {
|
|
|
178
182
|
};
|
|
179
183
|
}
|
|
180
184
|
export {
|
|
181
|
-
|
|
185
|
+
et as TransactionsManager
|
|
182
186
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./history.types.cjs");require("../../../types/circom-data.types.cjs");const m=require("../../../types/external-action.types.cjs"),n=require("../../../types/hinkal.types.cjs");require("../../../types/transactions.types.cjs");require("../../../types/curve.types.cjs");const p=require("../../../functions/utils/erc20tokenFunctions.cjs"),q=require("../../../functions/utils/external-action.utils.cjs"),g=require("../../../functions/utils/enum.utils.cjs"),C=require("./history.utils.cjs"),c=require("../../token-price-fetcher/TokenChecker.cjs"),f=(o,r,T)=>{const P=q.getActionFromMetadata(m.ExternalActionId.Pendle,C.txHistoryToBigInt(o)),t=g.toEnumValue(n.PendleAction,P),l=[],a=[];let d;const u=r[0],A=r[1];return o.amountChanges.forEach((h,k)=>{let s=h.toBigInt(),i=0n;(t===n.PendleAction.SwapToYt||t===n.PendleAction.Mint)&&(s+=u.amount,i=A.amount),t&&[n.PendleAction.Deposit,n.PendleAction.Withdraw,n.PendleAction.Redeem,n.PendleAction.SwapFromYt,n.PendleAction.Checkpoint].includes(t)&&(i=u.amount);const e=p.getERC20Token(o.erc20TokenAddresses[k],T)??{erc20TokenAddress:o.erc20TokenAddresses[k]};"decimals"in e&&c.TokenChecker.isPendleToken(e)&&!c.TokenChecker.isPendleSyToken(e)?a.push({token:e,balance:s}):"decimals"in e&&c.TokenChecker.isPendleSyToken(e)?d={token:e,balance:i}:l.push({token:e,balance:s})}),{pendleTokens:a,nonPendleTokens:l,pendleAction:t,syToken:d,type:y.TransactionType.PENDLE}};exports.getPendleData=f;
|
|
@@ -8,37 +8,32 @@ import { getERC20Token as g } from "../../../functions/utils/erc20tokenFunctions
|
|
|
8
8
|
import { getActionFromMetadata as y } from "../../../functions/utils/external-action.utils.mjs";
|
|
9
9
|
import { toEnumValue as A } from "../../../functions/utils/enum.utils.mjs";
|
|
10
10
|
import { txHistoryToBigInt as E } from "./history.utils.mjs";
|
|
11
|
-
import { TokenChecker as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let p;
|
|
20
|
-
const l = s[0], f = s[1];
|
|
21
|
-
return n.amountChanges.forEach((u, d) => {
|
|
22
|
-
let r = u.toBigInt(), i = 0n;
|
|
23
|
-
(t === o.SwapToYt || t === o.Mint) && (r += l.amount, i = f.amount), t && [
|
|
11
|
+
import { TokenChecker as i } from "../../token-price-fetcher/TokenChecker.mjs";
|
|
12
|
+
const Y = (t, m, T) => {
|
|
13
|
+
const k = y(h.Pendle, E(t)), n = A(o, k), a = [], c = [];
|
|
14
|
+
let l;
|
|
15
|
+
const d = m[0], f = m[1];
|
|
16
|
+
return t.amountChanges.forEach((u, p) => {
|
|
17
|
+
let r = u.toBigInt(), s = 0n;
|
|
18
|
+
(n === o.SwapToYt || n === o.Mint) && (r += d.amount, s = f.amount), n && [
|
|
24
19
|
o.Deposit,
|
|
25
20
|
o.Withdraw,
|
|
26
21
|
o.Redeem,
|
|
27
22
|
o.SwapFromYt,
|
|
28
23
|
o.Checkpoint
|
|
29
|
-
].includes(
|
|
30
|
-
const e = g(
|
|
31
|
-
erc20TokenAddress:
|
|
24
|
+
].includes(n) && (s = d.amount);
|
|
25
|
+
const e = g(t.erc20TokenAddresses[p], T) ?? {
|
|
26
|
+
erc20TokenAddress: t.erc20TokenAddresses[p]
|
|
32
27
|
};
|
|
33
|
-
"decimals" in e &&
|
|
28
|
+
"decimals" in e && i.isPendleToken(e) && !i.isPendleSyToken(e) ? c.push({ token: e, balance: r }) : "decimals" in e && i.isPendleSyToken(e) ? l = { token: e, balance: s } : a.push({ token: e, balance: r });
|
|
34
29
|
}), {
|
|
35
30
|
pendleTokens: c,
|
|
36
31
|
nonPendleTokens: a,
|
|
37
|
-
pendleAction:
|
|
38
|
-
syToken:
|
|
32
|
+
pendleAction: n,
|
|
33
|
+
syToken: l,
|
|
39
34
|
type: P.PENDLE
|
|
40
35
|
};
|
|
41
36
|
};
|
|
42
37
|
export {
|
|
43
|
-
|
|
38
|
+
Y as getPendleData
|
|
44
39
|
};
|
|
@@ -2,7 +2,7 @@ import { PastTransaction, TransactionType } from './history.types';
|
|
|
2
2
|
import { OnChainUtxo } from '../../../types';
|
|
3
3
|
export declare const getVolatileData: (input: PastTransaction, utxosArray: OnChainUtxo[], chainId: number) => Promise<{
|
|
4
4
|
tokenWithBalance: {
|
|
5
|
-
token: import(
|
|
5
|
+
token: import('../../../types/token.types').ERC20Token | {
|
|
6
6
|
erc20TokenAddress: string;
|
|
7
7
|
};
|
|
8
8
|
balance: bigint;
|
|
@@ -13,11 +13,11 @@ export declare const getVolatileData: (input: PastTransaction, utxosArray: OnCha
|
|
|
13
13
|
protocol?: undefined;
|
|
14
14
|
} | {
|
|
15
15
|
tokenIn: {
|
|
16
|
-
token: import(
|
|
16
|
+
token: import('../../../types/token.types').ERC20Token | undefined;
|
|
17
17
|
balance: bigint;
|
|
18
18
|
};
|
|
19
19
|
tokenOut: {
|
|
20
|
-
token: import(
|
|
20
|
+
token: import('../../../types/token.types').ERC20Token | undefined;
|
|
21
21
|
balance: bigint | undefined;
|
|
22
22
|
};
|
|
23
23
|
type: TransactionType;
|