@hinkal/common 0.0.110 → 0.0.112
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/index-DXElTGy9.mjs +254449 -0
- package/index.js +455 -642
- package/package.json +1 -1
- package/{webworker/snarkjsWorker/snarkjsWorkerLogic.js → snarkjsWorkerLogic-CVna_BW9.mjs} +1 -1
- package/utxoWorkerLogic-B1Hh-bq4.mjs +64 -0
- package/{webworker/workerProxy.js → workerProxy-BDj498Ht.mjs} +1 -1
- package/zkProofWorkerLogic-D9rxuuiK.mjs +60 -0
- package/API/API.js +0 -58
- package/API/HinkalPointsCalls.js +0 -38
- package/API/callBeefyGraphAPI.js +0 -37
- package/API/callCurveAPI.js +0 -156
- package/API/callMonitor.js +0 -30
- package/API/callOdosAPI.js +0 -44
- package/API/callOneInchAPI.js +0 -37
- package/API/callRelayer.js +0 -32
- package/API/checkRisk.js +0 -30
- package/API/dataServerCalls.js +0 -32
- package/API/fetchCommitmentsCache.js +0 -31
- package/API/fetchNullifiers.js +0 -30
- package/API/getAxelarGasEstimate.js +0 -37
- package/API/getCoingeckoPrice.js +0 -27
- package/API/getConnextReceiveFee.js +0 -30
- package/API/getGasEstimates.js +0 -38
- package/API/getRelayerURL.js +0 -32
- package/API/getServerURL.js +0 -67
- package/API/getTokenPrice.js +0 -41
- package/API/kycCalls.js +0 -32
- package/API/passwordCalls.js +0 -36
- package/API/referralProgramCalls.js +0 -58
- package/API/relayCalls.js +0 -30
- package/API/restoreSnapshots.js +0 -32
- package/API/rewardsPointsCalls.js +0 -40
- package/API/userVerifyTransactions.js +0 -45
- package/constants/assets.constants.js +0 -16
- package/constants/axelar.constants.js +0 -55
- package/constants/backend.constants.js +0 -18
- package/constants/beefy.registry.js +0 -24
- package/constants/chains.constants.js +0 -204
- package/constants/coingecko.constants.js +0 -53
- package/constants/contracts.constants.js +0 -276
- package/constants/crvCvx.registry.js +0 -636
- package/constants/crvDynamic.registry.js +0 -24
- package/constants/deploy-data/deploy-data-arbMainnet.json.js +0 -7415
- package/constants/deploy-data/deploy-data-avalanche.json.js +0 -7411
- package/constants/deploy-data/deploy-data-axelar1.json.js +0 -4329
- package/constants/deploy-data/deploy-data-axelar2.json.js +0 -4329
- package/constants/deploy-data/deploy-data-base.json.js +0 -8425
- package/constants/deploy-data/deploy-data-blast.json.js +0 -9600
- package/constants/deploy-data/deploy-data-bnbMainnet.json.js +0 -6877
- package/constants/deploy-data/deploy-data-ethMainnet.json.js +0 -11427
- package/constants/deploy-data/deploy-data-localhost.json.js +0 -13283
- package/constants/deploy-data/deploy-data-optimism.json.js +0 -7417
- package/constants/deploy-data/deploy-data-polygon.json.js +0 -7439
- package/constants/fees.constants.js +0 -57
- package/constants/kyc.constants.js +0 -118
- package/constants/lido.constants.js +0 -13
- package/constants/pendle.registry.js +0 -253
- package/constants/protocol.constants.js +0 -26
- package/constants/reorg-depths.constants.js +0 -15
- package/constants/rewards.constants.js +0 -27
- package/constants/server.constants.js +0 -157
- package/constants/token-data/ERC20Registry.js +0 -85
- package/constants/token-data/arbMainnetRegistry.json.js +0 -946
- package/constants/token-data/arbMainnetRegistryFixed.json.js +0 -856
- package/constants/token-data/avalancheRegistry.json.js +0 -591
- package/constants/token-data/avalancheRegistryFixed.json.js +0 -591
- package/constants/token-data/baseRegistry.json.js +0 -490
- package/constants/token-data/baseRegistryFixed.json.js +0 -463
- package/constants/token-data/blastRegistry.json.js +0 -137
- package/constants/token-data/blastRegistryFixed.json.js +0 -137
- package/constants/token-data/bnbMainnetRegistry.json.js +0 -973
- package/constants/token-data/bnbMainnetRegistryFixed.json.js +0 -973
- package/constants/token-data/coingeckoRegistry.json.js +0 -115623
- package/constants/token-data/ethMainnetRegistry.json.js +0 -2700
- package/constants/token-data/ethMainnetRegistryFixed.json.js +0 -2251
- package/constants/token-data/index.js +0 -6
- package/constants/token-data/localhostRegistry.json.js +0 -2768
- package/constants/token-data/optimismRegistry.json.js +0 -1455
- package/constants/token-data/optimismRegistryFixed.json.js +0 -1392
- package/constants/token-data/polygonRegistry.json.js +0 -1327
- package/constants/token-data/polygonRegistryFixed.json.js +0 -1255
- package/constants/token-data/popularTokens.constants.js +0 -14
- package/constants/token-data/tokenPricing.consts.js +0 -8
- package/constants/vite.constants.js +0 -29
- package/crypto/babyJub.js +0 -15
- package/crypto/poseidon.js +0 -26
- package/crypto/preProcessing.js +0 -9
- package/data-structures/Hinkal/Hinkal.js +0 -299
- package/data-structures/Hinkal/hinkalActionBeefy.js +0 -101
- package/data-structures/Hinkal/hinkalActionConvex.js +0 -83
- package/data-structures/Hinkal/hinkalActionCurve.js +0 -112
- package/data-structures/Hinkal/hinkalActionLidoEth.js +0 -91
- package/data-structures/Hinkal/hinkalActionPendle.js +0 -140
- package/data-structures/Hinkal/hinkalActionPendleLP.js +0 -96
- package/data-structures/Hinkal/hinkalActionStake.js +0 -138
- package/data-structures/Hinkal/hinkalActionVolatile.js +0 -112
- package/data-structures/Hinkal/hinkalDeposit.js +0 -95
- package/data-structures/Hinkal/hinkalGetZkMeProvider.js +0 -47
- package/data-structures/Hinkal/hinkalPrivateWallet.js +0 -66
- package/data-structures/Hinkal/hinkalSwap.js +0 -98
- package/data-structures/Hinkal/hinkalTransfer.js +0 -5
- package/data-structures/Hinkal/hinkalWithdraw.js +0 -91
- package/data-structures/Hinkal/resetMerkleTrees.js +0 -49
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.js +0 -83
- package/data-structures/ValueCache/ValueCache.js +0 -25
- package/data-structures/crypto-keys/decodeUTXO.js +0 -40
- package/data-structures/crypto-keys/encryptDecryptUtxo.js +0 -41
- package/data-structures/crypto-keys/keyUtils.js +0 -10
- package/data-structures/crypto-keys/keys.js +0 -90
- package/data-structures/custom-token-registry/CustomTokenRegistry.js +0 -33
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.js +0 -131
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.js +0 -132
- package/data-structures/event-service/AbstractEventService.js +0 -118
- package/data-structures/event-service/AbstractNullifierSnapshotService.js +0 -59
- package/data-structures/event-service/AbstractSnapshotService.js +0 -35
- package/data-structures/merkle-tree/MerkleTree.js +0 -177
- package/data-structures/merkle-tree/MerkleTreeIncompleteError.js +0 -8
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.js +0 -48
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.js +0 -47
- package/data-structures/snapshot/ClientNullifierSnapshotService.js +0 -44
- package/data-structures/token-price-fetcher/TokenChecker.js +0 -29
- package/data-structures/token-price-fetcher/TokenPriceFetcher.js +0 -218
- package/data-structures/transactions-manager/TransactionsManager.js +0 -194
- package/data-structures/transactions-manager/history/getBeefyData.js +0 -68
- package/data-structures/transactions-manager/history/getConvexData.js +0 -57
- package/data-structures/transactions-manager/history/getCurveData.js +0 -97
- package/data-structures/transactions-manager/history/getDepositData.js +0 -36
- package/data-structures/transactions-manager/history/getLidoData.js +0 -44
- package/data-structures/transactions-manager/history/getPendleData.js +0 -59
- package/data-structures/transactions-manager/history/getSwapData.js +0 -43
- package/data-structures/transactions-manager/history/getTxDetails.js +0 -74
- package/data-structures/transactions-manager/history/getVolatileData.js +0 -75
- package/data-structures/transactions-manager/history/history.types.js +0 -62
- package/data-structures/transactions-manager/history/history.utils.js +0 -8
- package/data-structures/utxo/Utxo.js +0 -134
- package/data-structures/volatile-helper/VolatileHelper.js +0 -181
- package/error-handling/customErrors/ErrorWithAmount.js +0 -9
- package/error-handling/customErrors/FeeOverTransactionValueError.js +0 -9
- package/error-handling/customErrors/customErrors.helpers.js +0 -21
- package/error-handling/error-codes.constants.js +0 -184
- package/error-handling/get-error.message.js +0 -53
- package/error-handling/handleErrorRestore.js +0 -35
- package/error-handling/logError.js +0 -7
- package/error-handling/types.js +0 -4
- package/externalABIs/BUSD.js +0 -519
- package/externalABIs/BabPassport.json.js +0 -24
- package/externalABIs/BeefyRouterAbi.json.js +0 -1022
- package/externalABIs/BeefyStrategyAbi.json.js +0 -1423
- package/externalABIs/BeefyVaultAbi.json.js +0 -570
- package/externalABIs/BeefyZapAbi.json.js +0 -208
- package/externalABIs/BeefyZapOneInchAbi.json.js +0 -340
- package/externalABIs/ConvexBoosterAbi.json.js +0 -674
- package/externalABIs/ConvexBoosterAbiMainnet.json.js +0 -1002
- package/externalABIs/ConvexRewardPoolAbi.json.js +0 -883
- package/externalABIs/CurveReadingWrapperAbi.json.js +0 -1422
- package/externalABIs/CurveWrappedMainPool.json.js +0 -1136
- package/externalABIs/CurveZap.json.js +0 -262
- package/externalABIs/CvxCrvUtilities.json.js +0 -264
- package/externalABIs/DAI.js +0 -334
- package/externalABIs/ERC20.json.js +0 -291
- package/externalABIs/GalxePassport.json.js +0 -41
- package/externalABIs/IQuoterV2.json.js +0 -205
- package/externalABIs/ISwapRouter.json.js +0 -568
- package/externalABIs/IUniswapV3Factory.json.js +0 -201
- package/externalABIs/IUniswapV3Pool.json.js +0 -999
- package/externalABIs/LidoStEthAbi.json.js +0 -1603
- package/externalABIs/LidoStMaticAbi.json.js +0 -1764
- package/externalABIs/LidoStakeManagerAbi.json.js +0 -2082
- package/externalABIs/LidoWithdrawalQueueERC721Abi.json.js +0 -2030
- package/externalABIs/LidoWstEthAbi.json.js +0 -480
- package/externalABIs/OptimismGasPriceOracle.json.js +0 -206
- package/externalABIs/PendleRouterAbi.json.js +0 -173
- package/externalABIs/PoLidoNftAbi.json.js +0 -701
- package/externalABIs/SanctionsList.js +0 -89
- package/externalABIs/USDC.js +0 -721
- package/externalABIs/USDR.js +0 -346
- package/externalABIs/USDR3CRV.js +0 -542
- package/externalABIs/USDT.js +0 -393
- package/externalABIs/UniswapV2PoolAbi.json.js +0 -80
- package/externalABIs/WETH.js +0 -156
- package/externalABIs/amToken.js +0 -350
- package/externalABIs/transactionsProver.json.js +0 -39
- package/functions/kyc/authentoHelper.js +0 -42
- package/functions/kyc/passportHelper.js +0 -39
- package/functions/kyc/zkMeHelper.js +0 -56
- package/functions/pre-transaction/getFlatFees.js +0 -203
- package/functions/pre-transaction/interaction-to-action.js +0 -57
- package/functions/pre-transaction/outputUtxoProcessing.js +0 -45
- package/functions/pre-transaction/process-gas-estimates.js +0 -57
- package/functions/pre-transaction/processAmountChanges.js +0 -229
- package/functions/private-wallet/emporium.helpers.js +0 -19
- package/functions/private-wallet/opProducer.js +0 -24
- package/functions/protocols/convex.protocols.js +0 -41
- package/functions/protocols/curve.protocols.js +0 -45
- package/functions/protocols/pendle.helpers.js +0 -108
- package/functions/snarkjs/common.snarkjs.js +0 -96
- package/functions/snarkjs/constant.js +0 -211
- package/functions/snarkjs/constructEmporiumProof.js +0 -105
- package/functions/snarkjs/constructGeneralZkProof.js +0 -129
- package/functions/snarkjs/generateCircomData.js +0 -60
- package/functions/snarkjs/generateZkProof.js +0 -18
- package/functions/snarkjs/getZKFiles.js +0 -30
- package/functions/staking/index.js +0 -40
- package/functions/utils/amounts.utils.js +0 -70
- package/functions/utils/axelar.utils.js +0 -38
- package/functions/utils/cacheFunctions.js +0 -67
- package/functions/utils/caseInsensitive.utils.js +0 -6
- package/functions/utils/convertIntegrationProviderToExternalActionId.js +0 -16
- package/functions/utils/create-provider.js +0 -5
- package/functions/utils/enum.utils.js +0 -14
- package/functions/utils/erc20tokenFunctions.js +0 -20
- package/functions/utils/evmNetworkFunctions.js +0 -29
- package/functions/utils/external-action.utils.js +0 -61
- package/functions/utils/getDataFromTransaction.js +0 -105
- package/functions/utils/memoize.utils.js +0 -14
- package/functions/utils/nickname.utils.js +0 -7
- package/functions/utils/process.utils.js +0 -4
- package/functions/utils/reloadPage.js +0 -4
- package/functions/utils/requireEnv.js +0 -7
- package/functions/utils/resolve-sync.utils.js +0 -22
- package/functions/utils/serialize.utils.js +0 -4
- package/functions/utils/string.utils.js +0 -14
- package/functions/utils/time.utils.js +0 -8
- package/functions/utils/userAgent.js +0 -15
- package/functions/utils/volatile-patcher.utils.js +0 -40
- package/functions/web3/etherFunctions.js +0 -41
- package/functions/web3/events/balanceChangedHandler.js +0 -10
- package/functions/web3/events/getInputUtxoAndBalance.js +0 -72
- package/functions/web3/events/getShieldedBalance.js +0 -107
- package/functions/web3/events/web3RetrieveEvents.js +0 -9
- package/functions/web3/functionCalls/accessTokenCalls.js +0 -48
- package/functions/web3/functionCalls/approveToken.js +0 -153
- package/functions/web3/functionCalls/estimateGasRelayer.js +0 -18
- package/functions/web3/functionCalls/transactCallDirect.js +0 -60
- package/functions/web3/functionCalls/transactCallRelayer.js +0 -42
- package/functions/web3/odosAPI.js +0 -65
- package/functions/web3/oneInchAPI.js +0 -61
- package/functions/web3/runContractFunction.js +0 -95
- package/functions/web3/uniswapAPI.js +0 -97
- package/types/beefy.types.js +0 -21
- package/types/circom-data.types.js +0 -22
- package/types/curve.types.js +0 -25
- package/types/ethereum-network.types.js +0 -4
- package/types/external-action.types.js +0 -4
- package/types/hinkal.stake.types.js +0 -4
- package/types/hinkal.types.js +0 -15
- package/types/kyc.types.js +0 -13
- package/types/pendle.types.js +0 -15
- package/types/rewards.types.js +0 -27
- package/types/slippage.types.js +0 -15
- package/types/time.types.js +0 -58
- package/types/token.types.js +0 -4
- package/types/transactions.types.js +0 -36
- package/webworker/performTaskWithWorker.js +0 -62
- package/webworker/snarkjsWorker/snarkjsWorker.types.js +0 -4
- package/webworker/utxoWorker/utxoWorker.types.js +0 -4
- package/webworker/utxoWorker/utxoWorkerLogic.js +0 -70
- package/webworker/worker.registry.js +0 -4
- package/webworker/workerFactory.js +0 -42
- package/webworker/zkProofWorker/zkProofWorker.types.js +0 -4
- package/webworker/zkProofWorker/zkProofWorkerLogic.js +0 -66
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { utils as V } from "ethers";
|
|
2
|
-
import { getNonLocalhostChainId as L, networkRegistry as U } from "../../constants/chains.constants.js";
|
|
3
|
-
import "../../types/circom-data.types.js";
|
|
4
|
-
import { ExternalActionId as i } from "../../types/external-action.types.js";
|
|
5
|
-
import { CurveAction as n } from "../../types/hinkal.types.js";
|
|
6
|
-
import "../../types/transactions.types.js";
|
|
7
|
-
import "../../types/curve.types.js";
|
|
8
|
-
import { transactionErrorCodes as h } from "../../error-handling/error-codes.constants.js";
|
|
9
|
-
import { curveWithdrawGasTokenAddress as T } from "../../constants/protocol.constants.js";
|
|
10
|
-
import "circomlibjs";
|
|
11
|
-
import "../crypto-keys/keys.js";
|
|
12
|
-
import "axios";
|
|
13
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
14
|
-
import { addPaddingToUtxos as M } from "../../functions/web3/events/getShieldedBalance.js";
|
|
15
|
-
import { outputUtxoProcessing as S } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
16
|
-
import { constructZkProof as F } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
17
|
-
import { estimateGasRelayer as W } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
18
|
-
import { transactCallRelayer as k } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
19
|
-
import "../../functions/utils/external-action.utils.js";
|
|
20
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
21
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
22
|
-
import "../../constants/coingecko.constants.js";
|
|
23
|
-
import "../../constants/vite.constants.js";
|
|
24
|
-
import { processAmountChanges as G } from "../../functions/pre-transaction/processAmountChanges.js";
|
|
25
|
-
import { getFlatFees as N } from "../../functions/pre-transaction/getFlatFees.js";
|
|
26
|
-
import "../../functions/utils/userAgent.js";
|
|
27
|
-
import "../../constants/reorg-depths.constants.js";
|
|
28
|
-
import "../../constants/kyc.constants.js";
|
|
29
|
-
import "../../webworker/workerFactory.js";
|
|
30
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
31
|
-
import { getCRV as $ } from "../../functions/protocols/curve.protocols.js";
|
|
32
|
-
import "libsodium-wrappers";
|
|
33
|
-
import "../../constants/contracts.constants.js";
|
|
34
|
-
import "../../constants/axelar.constants.js";
|
|
35
|
-
import { getCalcTokenAmountWithDynamicArray as b } from "../../constants/crvDynamic.registry.js";
|
|
36
|
-
import "../../constants/rewards.constants.js";
|
|
37
|
-
const O = (t, o, r, a) => o ? a ? i.CurveCRVRewards : i.CurveCRV : b(t).includes(r.toLowerCase()) ? i.CurveDynamic : i.Curve, P = (t, o) => {
|
|
38
|
-
const { contractData: r } = U[t.getCurrentChainId()];
|
|
39
|
-
switch (o) {
|
|
40
|
-
case i.Curve:
|
|
41
|
-
return r.curveExternalActionInstanceAddress;
|
|
42
|
-
case i.CurveDynamic:
|
|
43
|
-
return r.curveExternalActionDynamicInstanceAddress;
|
|
44
|
-
case i.CurveCRV:
|
|
45
|
-
return r.curveExternalActionInstanceAddress;
|
|
46
|
-
case i.CurveCRVRewards:
|
|
47
|
-
return r.curveStakeExternalActionInstanceAddress;
|
|
48
|
-
default:
|
|
49
|
-
return r.curveExternalActionInstanceAddress;
|
|
50
|
-
}
|
|
51
|
-
}, K = (t, o, r) => V.defaultAbiCoder.encode(
|
|
52
|
-
["uint8", "address", "uint256", "uint256"],
|
|
53
|
-
[Number(t), o, r[0][0].amount, r[0][0].timeStamp]
|
|
54
|
-
), _ = (t, o, r, a) => {
|
|
55
|
-
if ([n.Deposit, n.WithdrawInt, n.WithdrawUint].includes(a))
|
|
56
|
-
return t.map((e) => e > 0n);
|
|
57
|
-
if (a === n.WithdrawImbalance)
|
|
58
|
-
return t.map(() => !1);
|
|
59
|
-
if ([n.Stake, n.Unstake, n.GetCRV].includes(a)) {
|
|
60
|
-
let e = !1;
|
|
61
|
-
return o.map((p) => (p.toLowerCase() === $(r).toLowerCase() && (e = !0), e));
|
|
62
|
-
}
|
|
63
|
-
return t.map((e) => e > 0n);
|
|
64
|
-
}, Lt = async (t, o, r, a, e, p, I = !1) => {
|
|
65
|
-
const s = [...await M(t, o, r)];
|
|
66
|
-
let u = `swapperM${r.length.toString()}x${s[0].length}x1`;
|
|
67
|
-
const d = e === n.GetCRV || e === n.Stake || e === n.Unstake;
|
|
68
|
-
d && (u = `swapperMO${r.length.toString()}x${s[0].length}x1`);
|
|
69
|
-
const l = L(t.getCurrentChainId()), c = O(l, d, a, p), { flatFees: C, feeUnit: R } = await N(
|
|
70
|
-
t.getCurrentChainId(),
|
|
71
|
-
o,
|
|
72
|
-
c,
|
|
73
|
-
r,
|
|
74
|
-
e,
|
|
75
|
-
T?.current
|
|
76
|
-
);
|
|
77
|
-
r = G({
|
|
78
|
-
erc20Addresses: o,
|
|
79
|
-
amountChanges: r,
|
|
80
|
-
flatFees: C,
|
|
81
|
-
feeUnit: R,
|
|
82
|
-
externalActionId: c,
|
|
83
|
-
action: e
|
|
84
|
-
});
|
|
85
|
-
const y = _(r, o, l, e), f = [];
|
|
86
|
-
for (let m = 0; m < o.length; m += 1) {
|
|
87
|
-
const { outputUtxos: v } = S(t.userKeys, s[m], r[m]);
|
|
88
|
-
f.push(v);
|
|
89
|
-
}
|
|
90
|
-
const E = P(t, c), D = K(e, a, s), x = await t.getRandomRelay();
|
|
91
|
-
if (!x)
|
|
92
|
-
throw Error(h.RELAYER_NOT_AVAILABLE);
|
|
93
|
-
const { zkCallData: A, circomData: w, dimData: g } = await F(
|
|
94
|
-
t.merkleTreeHinkal,
|
|
95
|
-
t.merkleTreeAccessToken,
|
|
96
|
-
s,
|
|
97
|
-
f,
|
|
98
|
-
t.userKeys,
|
|
99
|
-
u,
|
|
100
|
-
c,
|
|
101
|
-
E,
|
|
102
|
-
D,
|
|
103
|
-
x,
|
|
104
|
-
t.getCurrentChainId(),
|
|
105
|
-
y,
|
|
106
|
-
C
|
|
107
|
-
);
|
|
108
|
-
return I ? await W(t, A, g, w) : await k(t.getCurrentChainId(), A, g, w);
|
|
109
|
-
};
|
|
110
|
-
export {
|
|
111
|
-
Lt as hinkalActionCurve
|
|
112
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { ethers as M } from "ethers";
|
|
2
|
-
import { networkRegistry as U } from "../../constants/chains.constants.js";
|
|
3
|
-
import "../../types/circom-data.types.js";
|
|
4
|
-
import { ExternalActionId as m } from "../../types/external-action.types.js";
|
|
5
|
-
import { LidoAction as s, LidoVariant as u } from "../../types/hinkal.types.js";
|
|
6
|
-
import "../../types/transactions.types.js";
|
|
7
|
-
import "../../types/curve.types.js";
|
|
8
|
-
import { transactionErrorCodes as N } from "../../error-handling/error-codes.constants.js";
|
|
9
|
-
import "circomlibjs";
|
|
10
|
-
import "../crypto-keys/keys.js";
|
|
11
|
-
import "axios";
|
|
12
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
13
|
-
import { addPaddingToUtxos as D } from "../../functions/web3/events/getShieldedBalance.js";
|
|
14
|
-
import { outputUtxoProcessing as P } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
15
|
-
import { constructZkProof as H } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
16
|
-
import { estimateGasRelayer as S } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
17
|
-
import { transactCallRelayer as b } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
18
|
-
import "../../functions/utils/external-action.utils.js";
|
|
19
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
20
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
21
|
-
import "../../constants/coingecko.constants.js";
|
|
22
|
-
import "../../constants/vite.constants.js";
|
|
23
|
-
import { processAmountChanges as v } from "../../functions/pre-transaction/processAmountChanges.js";
|
|
24
|
-
import { getFlatFees as K } from "../../functions/pre-transaction/getFlatFees.js";
|
|
25
|
-
import "../../functions/utils/userAgent.js";
|
|
26
|
-
import "../../constants/reorg-depths.constants.js";
|
|
27
|
-
import "../../constants/kyc.constants.js";
|
|
28
|
-
import "../../webworker/workerFactory.js";
|
|
29
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
30
|
-
import "libsodium-wrappers";
|
|
31
|
-
import "../../constants/contracts.constants.js";
|
|
32
|
-
import "../../constants/axelar.constants.js";
|
|
33
|
-
import "../../constants/rewards.constants.js";
|
|
34
|
-
const _ = (t, i) => {
|
|
35
|
-
if (t === u.Ethereum)
|
|
36
|
-
return i === s.Stake ? m.LidoETH : m.LidoETHNFT;
|
|
37
|
-
if (t === u.Polygon)
|
|
38
|
-
return i === s.Stake ? m.LidoMATIC : m.LidoMATICNFT;
|
|
39
|
-
throw new Error("Invalid LidoVariant used");
|
|
40
|
-
}, $ = (t) => M.utils.defaultAbiCoder.encode(["uint8"], [Number(t)]), Ct = async (t, i, e, a, o, f, A = !1) => {
|
|
41
|
-
const p = [...await D(t, a, o, 6, f)], y = p[0].length, C = `${e === s.Stake ? "swapperM" : "swapperToken"}2x${y}x1`, n = _(i, e), { flatFees: x, feeUnit: L } = await K(
|
|
42
|
-
t.getCurrentChainId(),
|
|
43
|
-
a,
|
|
44
|
-
n,
|
|
45
|
-
o,
|
|
46
|
-
e
|
|
47
|
-
);
|
|
48
|
-
o = v({
|
|
49
|
-
erc20Addresses: a,
|
|
50
|
-
amountChanges: o,
|
|
51
|
-
flatFees: x,
|
|
52
|
-
feeUnit: L,
|
|
53
|
-
externalActionId: n,
|
|
54
|
-
action: e
|
|
55
|
-
});
|
|
56
|
-
const g = e === s.Request ? o.map(() => !1) : o.map((r) => r > 0n), l = [];
|
|
57
|
-
for (let r = 0; r < a.length; r += 1) {
|
|
58
|
-
const { outputUtxos: F } = P(
|
|
59
|
-
t.userKeys,
|
|
60
|
-
p[r],
|
|
61
|
-
o[r],
|
|
62
|
-
void 0,
|
|
63
|
-
f[r]
|
|
64
|
-
);
|
|
65
|
-
l.push(F);
|
|
66
|
-
}
|
|
67
|
-
if (!await t.getRandomRelay())
|
|
68
|
-
throw Error(N.RELAYER_NOT_AVAILABLE);
|
|
69
|
-
const { lidoExternalActionEthAddress: T, lidoExternalActionMaticAddress: I } = U[t.getCurrentChainId()].contractData, c = i === u.Ethereum ? T : I;
|
|
70
|
-
if (!c)
|
|
71
|
-
throw new Error("Can't find external action address");
|
|
72
|
-
const R = $(e), { zkCallData: E, circomData: d, dimData: w } = await H(
|
|
73
|
-
t.merkleTreeHinkal,
|
|
74
|
-
t.merkleTreeAccessToken,
|
|
75
|
-
p,
|
|
76
|
-
l,
|
|
77
|
-
t.userKeys,
|
|
78
|
-
C,
|
|
79
|
-
n,
|
|
80
|
-
c,
|
|
81
|
-
R,
|
|
82
|
-
await t.getRandomRelay(),
|
|
83
|
-
t.getCurrentChainId(),
|
|
84
|
-
g,
|
|
85
|
-
x
|
|
86
|
-
);
|
|
87
|
-
return console.log({ externalActionAddress: c, externalActionId: n, circomData: d }), A ? await S(t, E, w, d) : await b(t.getCurrentChainId(), E, w, d);
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
Ct as hinkalActionLido
|
|
91
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as W } from "../../constants/chains.constants.js";
|
|
2
|
-
import { defaultHookData as H } from "../../types/circom-data.types.js";
|
|
3
|
-
import { ContractType as A } from "../../types/ethereum-network.types.js";
|
|
4
|
-
import { ExternalActionId as O } from "../../types/external-action.types.js";
|
|
5
|
-
import { PendleAction as o } from "../../types/hinkal.types.js";
|
|
6
|
-
import "../../types/transactions.types.js";
|
|
7
|
-
import "../../types/curve.types.js";
|
|
8
|
-
import { utils as U } from "ethers";
|
|
9
|
-
import { transactionErrorCodes as b } from "../../error-handling/error-codes.constants.js";
|
|
10
|
-
import { zeroAddress as R } from "../../constants/protocol.constants.js";
|
|
11
|
-
import "circomlibjs";
|
|
12
|
-
import "../crypto-keys/keys.js";
|
|
13
|
-
import "axios";
|
|
14
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
15
|
-
import { addPaddingToUtxos as z } from "../../functions/web3/events/getShieldedBalance.js";
|
|
16
|
-
import { outputUtxoProcessing as L } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
17
|
-
import { constructZkProof as N } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
18
|
-
import { estimateGasRelayer as $ } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
19
|
-
import { transactCallRelayer as v } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
20
|
-
import { transactCallDirect as D } from "../../functions/web3/functionCalls/transactCallDirect.js";
|
|
21
|
-
import "../../functions/utils/external-action.utils.js";
|
|
22
|
-
import { getERC20Token as E } from "../../functions/utils/erc20tokenFunctions.js";
|
|
23
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
24
|
-
import "../../constants/coingecko.constants.js";
|
|
25
|
-
import "../../constants/vite.constants.js";
|
|
26
|
-
import { processAmountChanges as G } from "../../functions/pre-transaction/processAmountChanges.js";
|
|
27
|
-
import { getFlatFees as K } from "../../functions/pre-transaction/getFlatFees.js";
|
|
28
|
-
import "../../functions/utils/userAgent.js";
|
|
29
|
-
import "../../constants/reorg-depths.constants.js";
|
|
30
|
-
import "../../constants/kyc.constants.js";
|
|
31
|
-
import "../../webworker/workerFactory.js";
|
|
32
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
33
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
34
|
-
import "libsodium-wrappers";
|
|
35
|
-
import "../../constants/contracts.constants.js";
|
|
36
|
-
import "../../constants/axelar.constants.js";
|
|
37
|
-
import "../../constants/rewards.constants.js";
|
|
38
|
-
const _ = (t) => {
|
|
39
|
-
let r = [];
|
|
40
|
-
return t === o.Deposit ? r = [!1, !0] : t === o.Withdraw ? r = [!1, !0] : t === o.SwapFromYt ? r = [!1, !0, !0] : t === o.SwapToYt ? r = [!1, !1, !0] : t === o.SwapPt ? r = [!1, !0] : t === o.Mint ? r = [!1, !0, !1, !0] : t === o.Redeem ? r = [!1, !1, !0, !0] : t === o.Checkpoint && (r = [!1, !0]), r;
|
|
41
|
-
}, B = (t, r) => {
|
|
42
|
-
const { pendleAction: i, ytAddress: n, userAddress: l, evmData: d } = t, a = d ?? "0x00", s = l ?? R;
|
|
43
|
-
if ([
|
|
44
|
-
o.Deposit,
|
|
45
|
-
o.Withdraw,
|
|
46
|
-
o.SwapFromYt,
|
|
47
|
-
o.SwapToYt,
|
|
48
|
-
o.SwapPt,
|
|
49
|
-
o.Mint,
|
|
50
|
-
o.Redeem,
|
|
51
|
-
o.Checkpoint
|
|
52
|
-
].includes(t.pendleAction))
|
|
53
|
-
return U.defaultAbiCoder.encode(
|
|
54
|
-
["uint8", "address", "uint256", "uint256", "address", "bool", "bytes"],
|
|
55
|
-
[
|
|
56
|
-
i,
|
|
57
|
-
n,
|
|
58
|
-
r[0][0].amount,
|
|
59
|
-
r[0][0].timeStamp,
|
|
60
|
-
s,
|
|
61
|
-
!0,
|
|
62
|
-
a
|
|
63
|
-
]
|
|
64
|
-
);
|
|
65
|
-
throw new Error("Not implemented");
|
|
66
|
-
}, Ft = async (t, r, i, n, l, d = !1) => {
|
|
67
|
-
const a = O.Pendle, { pendleAction: s } = n, c = [...await z(t, r, i)], C = `swapperMO${i.length.toString()}x${c[0].length}x1`;
|
|
68
|
-
console.log({ inputUtxosArray: c, circuitName: C, pendleMetadata: n });
|
|
69
|
-
const { flatFees: w, feeUnit: T } = await K(
|
|
70
|
-
t.getCurrentChainId(),
|
|
71
|
-
r,
|
|
72
|
-
a,
|
|
73
|
-
i,
|
|
74
|
-
s,
|
|
75
|
-
l
|
|
76
|
-
);
|
|
77
|
-
console.log("hinkalActionPendle flatFees:", w), i = G({
|
|
78
|
-
erc20Addresses: r,
|
|
79
|
-
amountChanges: i,
|
|
80
|
-
flatFees: w,
|
|
81
|
-
feeUnit: T,
|
|
82
|
-
externalActionId: a,
|
|
83
|
-
action: s,
|
|
84
|
-
gasTokenAddress: l
|
|
85
|
-
});
|
|
86
|
-
const g = [];
|
|
87
|
-
for (let e = 0; e < r.length; e += 1) {
|
|
88
|
-
const { outputUtxos: u } = L(t.userKeys, c[e], i[e]);
|
|
89
|
-
g.push(u);
|
|
90
|
-
}
|
|
91
|
-
const P = _(s), { contractData: S } = W[t.getCurrentChainId()], I = S?.pendleExternalActionInstanceAddress, h = B(n, c), x = s === o.Deposit || n.isRelayerOff ? R : await t.getRandomRelay();
|
|
92
|
-
if (!x)
|
|
93
|
-
throw Error(b.RELAYER_NOT_AVAILABLE);
|
|
94
|
-
const Y = `0x0${s.toString(16)}`, k = { ...H, preHookMetadata: Y }, { zkCallData: m, circomData: p, dimData: f } = await N(
|
|
95
|
-
t.merkleTreeHinkal,
|
|
96
|
-
t.merkleTreeAccessToken,
|
|
97
|
-
c,
|
|
98
|
-
g,
|
|
99
|
-
t.userKeys,
|
|
100
|
-
C,
|
|
101
|
-
a,
|
|
102
|
-
I,
|
|
103
|
-
h,
|
|
104
|
-
x,
|
|
105
|
-
t.getCurrentChainId(),
|
|
106
|
-
P,
|
|
107
|
-
w,
|
|
108
|
-
k
|
|
109
|
-
);
|
|
110
|
-
if (console.log("hinkalActionPendle: zkCallData, dimData, circomData:", { zkCallData: m, dimData: f, circomData: p }), d)
|
|
111
|
-
return await $(t, m, f, p);
|
|
112
|
-
const y = t.getCurrentChainId();
|
|
113
|
-
if (s === o.Deposit) {
|
|
114
|
-
console.log("inside pendle deposit");
|
|
115
|
-
const e = E(n.ytAddress, y);
|
|
116
|
-
if (!e)
|
|
117
|
-
throw Error("Yt Token not found");
|
|
118
|
-
const u = t.getContractWithSigner(A.PendleGeneralExternalAction), F = t.getContractWithSigner(A.HinkalWrapper);
|
|
119
|
-
return await D(
|
|
120
|
-
t,
|
|
121
|
-
i[0],
|
|
122
|
-
e,
|
|
123
|
-
m,
|
|
124
|
-
p,
|
|
125
|
-
f,
|
|
126
|
-
u,
|
|
127
|
-
F
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
if (s === o.Withdraw && n.isRelayerOff) {
|
|
131
|
-
const e = E(n.ytAddress, y);
|
|
132
|
-
if (!e)
|
|
133
|
-
throw Error("Yt Token not found");
|
|
134
|
-
return await D(t, i[0], e, m, p, f);
|
|
135
|
-
}
|
|
136
|
-
return await v(t.getCurrentChainId(), m, f, p);
|
|
137
|
-
};
|
|
138
|
-
export {
|
|
139
|
-
Ft as hinkalActionPendle
|
|
140
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { ethers as I } from "ethers";
|
|
2
|
-
import { defaultHookData as U } from "../../types/circom-data.types.js";
|
|
3
|
-
import { ExternalActionId as h } from "../../types/external-action.types.js";
|
|
4
|
-
import { PendleLPAction as A } from "../../types/hinkal.types.js";
|
|
5
|
-
import "../../types/transactions.types.js";
|
|
6
|
-
import "../../types/curve.types.js";
|
|
7
|
-
import { networkRegistry as k } from "../../constants/chains.constants.js";
|
|
8
|
-
import "../../constants/vite.constants.js";
|
|
9
|
-
import "../../constants/contracts.constants.js";
|
|
10
|
-
import "../../constants/kyc.constants.js";
|
|
11
|
-
import "../../constants/coingecko.constants.js";
|
|
12
|
-
import "../../constants/axelar.constants.js";
|
|
13
|
-
import "../../constants/rewards.constants.js";
|
|
14
|
-
import "../../constants/reorg-depths.constants.js";
|
|
15
|
-
import { transactionErrorCodes as F } from "../../error-handling/error-codes.constants.js";
|
|
16
|
-
import "circomlibjs";
|
|
17
|
-
import "../crypto-keys/keys.js";
|
|
18
|
-
import "axios";
|
|
19
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
20
|
-
import { addPaddingToUtxos as P } from "../../functions/web3/events/getShieldedBalance.js";
|
|
21
|
-
import { outputUtxoProcessing as O } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
22
|
-
import { constructZkProof as T } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
23
|
-
import { estimateGasRelayer as b } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
24
|
-
import { transactCallRelayer as S } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
25
|
-
import "../../functions/utils/external-action.utils.js";
|
|
26
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
27
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
28
|
-
import { processAmountChanges as v } from "../../functions/pre-transaction/processAmountChanges.js";
|
|
29
|
-
import { getFlatFees as z } from "../../functions/pre-transaction/getFlatFees.js";
|
|
30
|
-
import "../../functions/utils/userAgent.js";
|
|
31
|
-
import "../../webworker/workerFactory.js";
|
|
32
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
33
|
-
import "libsodium-wrappers";
|
|
34
|
-
const G = (t, o) => {
|
|
35
|
-
if (t === A.AddOrRemoveLiquidity)
|
|
36
|
-
return o.length === 3 ? [!1, !0, !1] : [!1, !0, !1, !1];
|
|
37
|
-
if (t === A.Checkpoint)
|
|
38
|
-
return [!1, !0];
|
|
39
|
-
throw new Error("Unknown PendleLPAction not implemented");
|
|
40
|
-
}, H = (t, o) => {
|
|
41
|
-
const { pendleLPAction: r, lpAddress: e, evmData: a } = t;
|
|
42
|
-
return I.utils.defaultAbiCoder.encode(
|
|
43
|
-
["uint8", "address", "uint256", "uint256", "bytes"],
|
|
44
|
-
[r, e, o[0][0].amount, o[0][0].timeStamp, a]
|
|
45
|
-
);
|
|
46
|
-
}, Ct = async (t, o, r, e, a, g = !1) => {
|
|
47
|
-
const m = h.PendleLP, { pendleLPAction: s } = e, i = [...await P(t, o, r)], y = `swapperMO${r.length.toString()}x${i[0].length}x1`, { flatFees: c, feeUnit: C } = await z(
|
|
48
|
-
t.getCurrentChainId(),
|
|
49
|
-
o,
|
|
50
|
-
m,
|
|
51
|
-
r,
|
|
52
|
-
s,
|
|
53
|
-
a
|
|
54
|
-
);
|
|
55
|
-
console.log("hinkalActionPendle flatFees:", c), r = v({
|
|
56
|
-
erc20Addresses: o,
|
|
57
|
-
amountChanges: r,
|
|
58
|
-
flatFees: c,
|
|
59
|
-
feeUnit: C,
|
|
60
|
-
externalActionId: m,
|
|
61
|
-
action: s,
|
|
62
|
-
gasTokenAddress: a
|
|
63
|
-
});
|
|
64
|
-
const u = [];
|
|
65
|
-
for (let n = 0; n < o.length; n += 1) {
|
|
66
|
-
const { outputUtxos: R } = O(t.userKeys, i[n], r[n]);
|
|
67
|
-
u.push(R);
|
|
68
|
-
}
|
|
69
|
-
const x = G(s, o), { contractData: w } = k[t.getCurrentChainId()], E = w?.pendleLPExternalActionInstanceAddress, D = H(e, i), d = await t.getRandomRelay();
|
|
70
|
-
if (!d)
|
|
71
|
-
throw Error(F.RELAYER_NOT_AVAILABLE);
|
|
72
|
-
const L = { ...U }, { zkCallData: p, circomData: l, dimData: f } = await T(
|
|
73
|
-
t.merkleTreeHinkal,
|
|
74
|
-
t.merkleTreeAccessToken,
|
|
75
|
-
i,
|
|
76
|
-
u,
|
|
77
|
-
t.userKeys,
|
|
78
|
-
y,
|
|
79
|
-
m,
|
|
80
|
-
E,
|
|
81
|
-
D,
|
|
82
|
-
d,
|
|
83
|
-
t.getCurrentChainId(),
|
|
84
|
-
x,
|
|
85
|
-
c,
|
|
86
|
-
L
|
|
87
|
-
);
|
|
88
|
-
return console.log("hinkalActionPendle: zkCallData, dimData, circomData:", { zkCallData: p, dimData: f, circomData: l }), g ? await b(t, p, f, l) : await S(t.getCurrentChainId(), p, f, l);
|
|
89
|
-
}, xt = async (t, o, r) => {
|
|
90
|
-
const e = [...await P(t, [o], [-1n * r])];
|
|
91
|
-
return { amount: e[0][0].amount, timestamp: e[0][0].timeStamp };
|
|
92
|
-
};
|
|
93
|
-
export {
|
|
94
|
-
Ct as hinkalActionPendleLP,
|
|
95
|
-
xt as hinkalGetPendleLPClaimableParams
|
|
96
|
-
};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import { ContractType as k } from "../../types/ethereum-network.types.js";
|
|
4
|
-
import { ExternalActionId as h } from "../../types/external-action.types.js";
|
|
5
|
-
import "../../types/transactions.types.js";
|
|
6
|
-
import "../../types/curve.types.js";
|
|
7
|
-
import { HinkalStakeMode as g } from "../../types/hinkal.stake.types.js";
|
|
8
|
-
import { randomBigInt as B } from "../../functions/web3/etherFunctions.js";
|
|
9
|
-
import { Utxo as f } from "../utxo/Utxo.js";
|
|
10
|
-
import "axios";
|
|
11
|
-
import "ethers";
|
|
12
|
-
import { UserKeys as O } from "../crypto-keys/keys.js";
|
|
13
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
14
|
-
import { ownerPublicKey as b, zeroAddress as N } from "../../constants/protocol.constants.js";
|
|
15
|
-
import { addPaddingToUtxos as z } from "../../functions/web3/events/getShieldedBalance.js";
|
|
16
|
-
import { outputUtxoProcessing as $ } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
17
|
-
import { constructZkProof as j } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
18
|
-
import "../../webworker/workerFactory.js";
|
|
19
|
-
import "../../functions/utils/external-action.utils.js";
|
|
20
|
-
import { getERC20Token as Z, getHToken as q } from "../../functions/utils/erc20tokenFunctions.js";
|
|
21
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
22
|
-
import "../../constants/coingecko.constants.js";
|
|
23
|
-
import "../../constants/vite.constants.js";
|
|
24
|
-
import "../../functions/utils/userAgent.js";
|
|
25
|
-
import { transactCallDirect as T } from "../../functions/web3/functionCalls/transactCallDirect.js";
|
|
26
|
-
import "circomlibjs";
|
|
27
|
-
import "../../constants/reorg-depths.constants.js";
|
|
28
|
-
import "../../constants/kyc.constants.js";
|
|
29
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
30
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
31
|
-
import { encryptStake as w, createStakeCommitment as G, encodeHStakeMetadata as J } from "../../functions/staking/index.js";
|
|
32
|
-
import "../../constants/contracts.constants.js";
|
|
33
|
-
import "../../constants/axelar.constants.js";
|
|
34
|
-
import "../../constants/rewards.constants.js";
|
|
35
|
-
const It = async (t, y, e, a, s) => {
|
|
36
|
-
const A = await t.getEthereumAddress(), m = Z(y[0], t.getCurrentChainId());
|
|
37
|
-
if (!m)
|
|
38
|
-
throw Error("Deposit Action: No Token Found");
|
|
39
|
-
const c = a === g.Stake, n = a === g.Unstake, { symbol: U } = m;
|
|
40
|
-
console.log(`${a} token ${U} Start`);
|
|
41
|
-
const { erc20TokenAddress: E } = m, r = [
|
|
42
|
-
...await z(
|
|
43
|
-
t,
|
|
44
|
-
y,
|
|
45
|
-
e,
|
|
46
|
-
2,
|
|
47
|
-
void 0,
|
|
48
|
-
a !== g.Deposit
|
|
49
|
-
)
|
|
50
|
-
];
|
|
51
|
-
if (c || n) {
|
|
52
|
-
r[0][0] = f.createFrom(r[0][0], {
|
|
53
|
-
amount: e[0] * (c ? 1n : -1n),
|
|
54
|
-
isStakeOrUnstakeInput: !0
|
|
55
|
-
});
|
|
56
|
-
for (let o = 0; o < r.length; o += 1)
|
|
57
|
-
for (let i = 0; i < r[o].length; i += 1)
|
|
58
|
-
o === 0 && i === 0 || (r[o][i] = f.createFrom(r[o][i], { amount: 0n }));
|
|
59
|
-
}
|
|
60
|
-
const { outputUtxos: K } = $(t.userKeys, r[0], e[0]), p = [
|
|
61
|
-
K.map(
|
|
62
|
-
(o) => f.createFrom(o, {
|
|
63
|
-
isStake: c,
|
|
64
|
-
isUnstakeOutput: n
|
|
65
|
-
})
|
|
66
|
-
)
|
|
67
|
-
];
|
|
68
|
-
n && (p[0][0] = f.createFrom(p[0][0], {
|
|
69
|
-
amount: 0n,
|
|
70
|
-
isUnstakeOutput: n
|
|
71
|
-
}));
|
|
72
|
-
const H = [!1], d = B(30), I = O.getEncryptionKeyPair(t.userKeys.getShieldedPrivateKey()), P = w(d, s, b), D = w(d, s, I.publicKey), F = n ? 0n : G(
|
|
73
|
-
!0,
|
|
74
|
-
s,
|
|
75
|
-
d,
|
|
76
|
-
E,
|
|
77
|
-
e[0],
|
|
78
|
-
BigInt(p[0][0].timeStamp)
|
|
79
|
-
), W = J(
|
|
80
|
-
c ? 0 : 1,
|
|
81
|
-
F,
|
|
82
|
-
A,
|
|
83
|
-
P,
|
|
84
|
-
D
|
|
85
|
-
), C = t.getContractWithSigner(k.HinkalWrapper2), u = t.getContractWithSigner(k.HinkalStakeExternalAction);
|
|
86
|
-
console.log("external action address", u.address);
|
|
87
|
-
const { zkCallData: S, dimData: x, circomData: l } = await j(
|
|
88
|
-
t.merkleTreeHinkal,
|
|
89
|
-
t.merkleTreeAccessToken,
|
|
90
|
-
r,
|
|
91
|
-
p,
|
|
92
|
-
t.userKeys,
|
|
93
|
-
"swapperME1x2x1",
|
|
94
|
-
h.HinkalStake,
|
|
95
|
-
u.address,
|
|
96
|
-
W,
|
|
97
|
-
N,
|
|
98
|
-
t.getCurrentChainId(),
|
|
99
|
-
H,
|
|
100
|
-
void 0,
|
|
101
|
-
void 0,
|
|
102
|
-
{
|
|
103
|
-
stakedTokenRecipient: s,
|
|
104
|
-
stakeBlinding: d,
|
|
105
|
-
mode: a,
|
|
106
|
-
depositorAddress: A
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
if (console.log(l), n) {
|
|
110
|
-
const o = q(m, t.getCurrentChainId());
|
|
111
|
-
if (!o)
|
|
112
|
-
throw new Error("hToken not found");
|
|
113
|
-
const v = (await t.getContractWithFetcher(k.HToken, o.erc20TokenAddress).previewWithdraw(-e[0])).toBigInt();
|
|
114
|
-
return T(
|
|
115
|
-
t,
|
|
116
|
-
v,
|
|
117
|
-
o,
|
|
118
|
-
S,
|
|
119
|
-
l,
|
|
120
|
-
x,
|
|
121
|
-
u,
|
|
122
|
-
C
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return T(
|
|
126
|
-
t,
|
|
127
|
-
e[0],
|
|
128
|
-
m,
|
|
129
|
-
S,
|
|
130
|
-
l,
|
|
131
|
-
x,
|
|
132
|
-
u,
|
|
133
|
-
C
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
export {
|
|
137
|
-
It as hinkalActionStake
|
|
138
|
-
};
|