@hinkal/common 0.0.111 → 0.0.113
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,129 +0,0 @@
|
|
|
1
|
-
import { chainIds as J } from "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import "../../types/transactions.types.js";
|
|
4
|
-
import "../../types/curve.types.js";
|
|
5
|
-
import { HinkalStakeMode as c } from "../../types/hinkal.stake.types.js";
|
|
6
|
-
import { randomBigInt as V } from "../web3/etherFunctions.js";
|
|
7
|
-
import { Utxo as j } from "../../data-structures/utxo/Utxo.js";
|
|
8
|
-
import "axios";
|
|
9
|
-
import "ethers";
|
|
10
|
-
import "../../data-structures/crypto-keys/keys.js";
|
|
11
|
-
import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
12
|
-
import { zeroAddress as q } from "../../constants/protocol.constants.js";
|
|
13
|
-
import "../web3/events/getShieldedBalance.js";
|
|
14
|
-
import { performTaskWithWorker as s } from "../../webworker/performTaskWithWorker.js";
|
|
15
|
-
import { WorkerVariant as l } from "../../webworker/worker.registry.js";
|
|
16
|
-
import { ZKProofWorkerActionType as S } from "../../webworker/zkProofWorker/zkProofWorker.types.js";
|
|
17
|
-
import { calcAmountChanges as F, calcEncryptedOutputs as Q, buildOutCommitments as X, calcPublicSignalCount as Y, createCallDataHash as $, calcStealthAddressStructure as U } from "./common.snarkjs.js";
|
|
18
|
-
import { generateCircomData as x } from "./generateCircomData.js";
|
|
19
|
-
import { generateZkProof as oo } from "./generateZkProof.js";
|
|
20
|
-
import "circomlibjs";
|
|
21
|
-
import "../utils/external-action.utils.js";
|
|
22
|
-
import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
23
|
-
import "../utils/convertIntegrationProviderToExternalActionId.js";
|
|
24
|
-
import "../../constants/coingecko.constants.js";
|
|
25
|
-
import "../../constants/vite.constants.js";
|
|
26
|
-
import "../utils/userAgent.js";
|
|
27
|
-
import "../../constants/reorg-depths.constants.js";
|
|
28
|
-
import "../../constants/kyc.constants.js";
|
|
29
|
-
import "../../data-structures/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 Lo = async (f, g, e, a, h, u, k, C, I, T = q, R = J.localhost, r = e.map(() => !1), y = e.map(() => 0n), b = void 0, m) => {
|
|
35
|
-
const N = f.getRootHash(), P = g.getRootHash(), D = e.map((o) => o.map((i) => i.getConstructableParams())), _ = h.getSignature(), { accessTokenSiblings: B, accessTokenSiblingSides: E } = await s({
|
|
36
|
-
type: l.ZKProof,
|
|
37
|
-
payload: {
|
|
38
|
-
type: S.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES,
|
|
39
|
-
data: {
|
|
40
|
-
userSignature: _,
|
|
41
|
-
merkleTreeAccessTokenSerialized: g.toJSON()
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}), { inCommitmentSiblings: K, inCommitmentSiblingSides: L } = await s({
|
|
45
|
-
type: l.ZKProof,
|
|
46
|
-
payload: {
|
|
47
|
-
type: S.CALC_COMMITMENTS_SIBLING_AND_SIDES,
|
|
48
|
-
data: { inputUtxosSerialized: D, userSignature: _, merkleTreeSerialized: f.toJSON() }
|
|
49
|
-
}
|
|
50
|
-
}), O = F(e, a), d = Q(
|
|
51
|
-
a,
|
|
52
|
-
(m && m.mode !== c.Deposit) ?? !1
|
|
53
|
-
), p = h.getShieldedPrivateKey(), H = j.findCorrectRandomization(V(31), p), Z = await s({
|
|
54
|
-
type: l.ZKProof,
|
|
55
|
-
payload: {
|
|
56
|
-
type: S.BUILD_IN_NULLIFIERS,
|
|
57
|
-
data: { inputUtxosSerialized: D, onChainCreation: r }
|
|
58
|
-
}
|
|
59
|
-
}), t = {
|
|
60
|
-
rootHashHinkal: N,
|
|
61
|
-
shieldedPrivateKey: p,
|
|
62
|
-
erc20TokenAddresses: e.map((o) => o[0].erc20TokenAddress),
|
|
63
|
-
inAmounts: e.map((o) => o.map((i) => i.amount.toString())),
|
|
64
|
-
inTimeStamps: e.map((o) => o.map((i) => i.timeStamp)),
|
|
65
|
-
inRandomizations: e.map((o) => o.map((i) => i.randomization)),
|
|
66
|
-
inNullifiers: Z,
|
|
67
|
-
inCommitmentSiblings: K,
|
|
68
|
-
inCommitmentSiblingSides: L,
|
|
69
|
-
outAmounts: a.map((o) => o.map((i) => i.amount.toString())),
|
|
70
|
-
outTimeStamp: BigInt(a[0][0].timeStamp),
|
|
71
|
-
outPublicKeys: a.map((o) => o.map((i) => i.getStealthAddress())),
|
|
72
|
-
extraRandomization: H,
|
|
73
|
-
amountChanges: O,
|
|
74
|
-
outCommitments: X(a, r),
|
|
75
|
-
rootHashAccessToken: P,
|
|
76
|
-
accessTokenSiblings: B,
|
|
77
|
-
accessTokenSiblingSides: E,
|
|
78
|
-
calldataHash: 0n
|
|
79
|
-
};
|
|
80
|
-
m || (t.onChainCreation = r);
|
|
81
|
-
const n = e.map((o) => o[0].tokenId ?? 0), z = n.reduce((o, i) => o + i, 0) > 0 ? n.length : 0;
|
|
82
|
-
z > 0 && (t.tokenIds = n);
|
|
83
|
-
const A = Y(
|
|
84
|
-
u,
|
|
85
|
-
t.erc20TokenAddresses,
|
|
86
|
-
t.amountChanges,
|
|
87
|
-
t.inNullifiers,
|
|
88
|
-
t.outCommitments,
|
|
89
|
-
z
|
|
90
|
-
);
|
|
91
|
-
t.calldataHash = $(
|
|
92
|
-
A,
|
|
93
|
-
T,
|
|
94
|
-
C,
|
|
95
|
-
k,
|
|
96
|
-
I,
|
|
97
|
-
d,
|
|
98
|
-
y,
|
|
99
|
-
b
|
|
100
|
-
), m && (m.mode === c.Deposit && (t.mode = 0), m.mode === c.Stake && (t.mode = 1), m.mode === c.Unstake && (t.mode = 2), t.stakedTokenRecipient = m.stakedTokenRecipient, t.stakeBlinding = m.stakeBlinding, t.depositorAddress = m.depositorAddress);
|
|
101
|
-
const { zkCallData: w, publicSignals: W } = await oo(R, u, t);
|
|
102
|
-
console.log("publicSignals", W);
|
|
103
|
-
const v = U(H, p), M = await x(
|
|
104
|
-
N,
|
|
105
|
-
P,
|
|
106
|
-
e,
|
|
107
|
-
a,
|
|
108
|
-
d,
|
|
109
|
-
y,
|
|
110
|
-
A,
|
|
111
|
-
k,
|
|
112
|
-
C,
|
|
113
|
-
I,
|
|
114
|
-
T,
|
|
115
|
-
t.calldataHash,
|
|
116
|
-
n,
|
|
117
|
-
v,
|
|
118
|
-
r,
|
|
119
|
-
b
|
|
120
|
-
), G = {
|
|
121
|
-
tokenNumber: e.length,
|
|
122
|
-
nullifierAmount: e[0].length,
|
|
123
|
-
outputAmount: a[0].length
|
|
124
|
-
};
|
|
125
|
-
return { zkCallData: w, circomData: M, dimData: G, encryptedOutputs: d };
|
|
126
|
-
};
|
|
127
|
-
export {
|
|
128
|
-
Lo as constructZkProof
|
|
129
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import "../../constants/chains.constants.js";
|
|
2
|
-
import { defaultHookData as S } from "../../types/circom-data.types.js";
|
|
3
|
-
import "../../types/transactions.types.js";
|
|
4
|
-
import "../../types/curve.types.js";
|
|
5
|
-
import "ethers";
|
|
6
|
-
import { zeroAddress as h } from "../../constants/protocol.constants.js";
|
|
7
|
-
import "circomlibjs";
|
|
8
|
-
import "../../data-structures/crypto-keys/keys.js";
|
|
9
|
-
import "axios";
|
|
10
|
-
import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
11
|
-
import "../web3/events/getShieldedBalance.js";
|
|
12
|
-
import { performTaskWithWorker as C } from "../../webworker/performTaskWithWorker.js";
|
|
13
|
-
import { WorkerVariant as T } from "../../webworker/worker.registry.js";
|
|
14
|
-
import { ZKProofWorkerActionType as W } from "../../webworker/zkProofWorker/zkProofWorker.types.js";
|
|
15
|
-
import { calcAmountChanges as b, buildOutCommitments as L } from "./common.snarkjs.js";
|
|
16
|
-
import { getExternalActionIdHash as N } from "../utils/external-action.utils.js";
|
|
17
|
-
import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
18
|
-
import "../utils/convertIntegrationProviderToExternalActionId.js";
|
|
19
|
-
import "../../constants/coingecko.constants.js";
|
|
20
|
-
import "../../constants/vite.constants.js";
|
|
21
|
-
import "../utils/userAgent.js";
|
|
22
|
-
import "../../constants/reorg-depths.constants.js";
|
|
23
|
-
import "../../constants/kyc.constants.js";
|
|
24
|
-
import "../../data-structures/volatile-helper/VolatileHelper.js";
|
|
25
|
-
import "libsodium-wrappers";
|
|
26
|
-
import "../../constants/contracts.constants.js";
|
|
27
|
-
import "../../constants/axelar.constants.js";
|
|
28
|
-
import "../../constants/rewards.constants.js";
|
|
29
|
-
const ir = async (e, a, o, t, n, s, c, m, i, d, f, k, l, g, p, u) => {
|
|
30
|
-
const y = b(o, t, !0), A = o.map((r) => r.map((I) => I.getConstructableParams())), D = await C({
|
|
31
|
-
type: T.ZKProof,
|
|
32
|
-
payload: {
|
|
33
|
-
type: W.BUILD_IN_NULLIFIERS,
|
|
34
|
-
data: { inputUtxosSerialized: A, onChainCreation: p }
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
rootHashHinkal: e,
|
|
39
|
-
erc20TokenAddresses: o.map((r) => r[0].erc20TokenAddress),
|
|
40
|
-
tokenIds: l.map((r) => String(r)),
|
|
41
|
-
amountChanges: y,
|
|
42
|
-
inputNullifiers: D,
|
|
43
|
-
outCommitments: L(t, p),
|
|
44
|
-
encryptedOutputs: n,
|
|
45
|
-
flatFees: s,
|
|
46
|
-
timeStamp: t[0][0].timeStamp,
|
|
47
|
-
stealthAddressStructure: g,
|
|
48
|
-
rootHashAccessToken: a,
|
|
49
|
-
relay: f,
|
|
50
|
-
externalAddress: i === void 0 ? h : i,
|
|
51
|
-
externalActionMetadata: d,
|
|
52
|
-
externalActionId: typeof m == "bigint" ? 0n : N(m),
|
|
53
|
-
hookData: u || S,
|
|
54
|
-
publicSignalCount: c,
|
|
55
|
-
calldataHash: k
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export {
|
|
59
|
-
ir as generateCircomData
|
|
60
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { performTaskWithWorker as p } from "../../webworker/performTaskWithWorker.js";
|
|
2
|
-
import { SnarkJSWorkerActionType as i } from "../../webworker/snarkjsWorker/snarkjsWorker.types.js";
|
|
3
|
-
import { WorkerVariant as c } from "../../webworker/worker.registry.js";
|
|
4
|
-
import { getZKeyFile as r, getWASMFile as g } from "./getZKFiles.js";
|
|
5
|
-
const S = async (o, t, e) => {
|
|
6
|
-
console.log("Zero Knowledge proof construction started, please wait...", r(t, o));
|
|
7
|
-
const a = g(t, o), n = r(t, o), { publicSignals: l, zkCallData: s } = await p({
|
|
8
|
-
type: c.SnarkJS,
|
|
9
|
-
payload: {
|
|
10
|
-
type: i.FULL_PROVE,
|
|
11
|
-
data: { input: e, chainId: o, wasmFilePath: a, zKeyFilePath: n }
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return console.log("Zero Knowledge proof construction finished "), { zkCallData: s, publicSignals: l };
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
S as generateZkProof
|
|
18
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { chainIds as o } from "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import "../../types/transactions.types.js";
|
|
4
|
-
import "../../types/curve.types.js";
|
|
5
|
-
import "ethers";
|
|
6
|
-
import "circomlibjs";
|
|
7
|
-
import "../../data-structures/crypto-keys/keys.js";
|
|
8
|
-
import "axios";
|
|
9
|
-
import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
10
|
-
import "../web3/events/getShieldedBalance.js";
|
|
11
|
-
import "../../webworker/workerFactory.js";
|
|
12
|
-
import "../utils/external-action.utils.js";
|
|
13
|
-
import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
14
|
-
import "../utils/convertIntegrationProviderToExternalActionId.js";
|
|
15
|
-
import "../../constants/coingecko.constants.js";
|
|
16
|
-
import "../../constants/vite.constants.js";
|
|
17
|
-
import "../utils/userAgent.js";
|
|
18
|
-
import { prodVerifiers as t, localVerifiers as m } from "./constant.js";
|
|
19
|
-
import "../../constants/reorg-depths.constants.js";
|
|
20
|
-
import "../../constants/kyc.constants.js";
|
|
21
|
-
import "../../data-structures/volatile-helper/VolatileHelper.js";
|
|
22
|
-
import "libsodium-wrappers";
|
|
23
|
-
import "../../constants/contracts.constants.js";
|
|
24
|
-
import "../../constants/axelar.constants.js";
|
|
25
|
-
import "../../constants/rewards.constants.js";
|
|
26
|
-
const j = (r, i) => i === o.localhost ? m[`${r}Wasm`] : t(i)[`${r}Wasm`], q = (r, i) => i === o.localhost ? m[`${r}Zkey`] : t(i)[`${r}Zkey`];
|
|
27
|
-
export {
|
|
28
|
-
j as getWASMFile,
|
|
29
|
-
q as getZKeyFile
|
|
30
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ethers as i } from "ethers";
|
|
2
|
-
import { UserKeys as f } from "../../data-structures/crypto-keys/keys.js";
|
|
3
|
-
import s from "libsodium-wrappers";
|
|
4
|
-
import { poseidonHash as c } from "../../crypto/poseidon.js";
|
|
5
|
-
import "circomlibjs";
|
|
6
|
-
const S = (t, e, r) => {
|
|
7
|
-
const o = i.utils.defaultAbiCoder.encode(
|
|
8
|
-
["uint256", "address"],
|
|
9
|
-
[t, e]
|
|
10
|
-
), n = s.crypto_box_seal(o, i.utils.arrayify(r));
|
|
11
|
-
return `0x${Buffer.from(n).toString("hex")}`;
|
|
12
|
-
}, k = (t, e) => {
|
|
13
|
-
const r = Buffer.from(t.slice(2), "hex"), { publicKey: o, privateKey: n } = f.getEncryptionKeyPair(e.getShieldedPrivateKey());
|
|
14
|
-
try {
|
|
15
|
-
const a = s.crypto_box_seal_open(
|
|
16
|
-
r,
|
|
17
|
-
i.utils.arrayify(o),
|
|
18
|
-
i.utils.arrayify(n)
|
|
19
|
-
), d = Buffer.from(a).toString("utf-8"), [u, y] = i.utils.defaultAbiCoder.decode(
|
|
20
|
-
["uint256", "address"],
|
|
21
|
-
d
|
|
22
|
-
);
|
|
23
|
-
return { stakeBlinding: u.toBigInt(), stakedTokenRecipient: y };
|
|
24
|
-
} catch {
|
|
25
|
-
console.log("failed to decrypt");
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
}, B = (t, e, r, o, n, a) => BigInt(
|
|
29
|
-
c(...[t, e, r, o, n, a].map(BigInt))
|
|
30
|
-
), h = (t, e) => c(t, e), x = (t, e, r, o, n) => i.utils.defaultAbiCoder.encode(
|
|
31
|
-
["uint8", "uint256", "address", "bytes", "bytes"],
|
|
32
|
-
[t, e, r, o, n]
|
|
33
|
-
);
|
|
34
|
-
export {
|
|
35
|
-
h as calculateStakeNullifier,
|
|
36
|
-
B as createStakeCommitment,
|
|
37
|
-
k as decryptStake,
|
|
38
|
-
x as encodeHStakeMetadata,
|
|
39
|
-
S as encryptStake
|
|
40
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const s = (t) => t.reduce((n, e) => n + e, 0), u = (t) => t / 100, a = (t, n) => n * t / 10000n;
|
|
2
|
-
function d(t) {
|
|
3
|
-
return typeof t == "object" && "toBigInt" in t ? t.toBigInt() : BigInt(t);
|
|
4
|
-
}
|
|
5
|
-
const g = (t) => {
|
|
6
|
-
try {
|
|
7
|
-
return BigInt(t);
|
|
8
|
-
} catch {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
}, f = (t) => {
|
|
12
|
-
const n = Number(t);
|
|
13
|
-
return Number.isNaN(n) ? void 0 : n;
|
|
14
|
-
}, m = (t, n) => t ? parseInt(t, 10) : n;
|
|
15
|
-
function l() {
|
|
16
|
-
BigInt.prototype.toJSON = function() {
|
|
17
|
-
return this.toString();
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function p(...t) {
|
|
21
|
-
return t.reduce((n, e) => e > n ? e : n);
|
|
22
|
-
}
|
|
23
|
-
function I(t) {
|
|
24
|
-
return t === 0 ? 0 : t < 99999e-11 ? "< 0.000001" : +Number(t).toFixed(6);
|
|
25
|
-
}
|
|
26
|
-
const B = (t, n) => {
|
|
27
|
-
const e = t.toFixed(20), r = e.indexOf(".");
|
|
28
|
-
if (r === -1)
|
|
29
|
-
return e;
|
|
30
|
-
const o = r + n + 1;
|
|
31
|
-
return e.substring(0, o);
|
|
32
|
-
}, i = (t) => {
|
|
33
|
-
if (/^0+$/.test(t))
|
|
34
|
-
return "0";
|
|
35
|
-
if (/^0\.\d+$/.test(t))
|
|
36
|
-
return t;
|
|
37
|
-
const n = t.replace(/^0+/, "");
|
|
38
|
-
return n.startsWith(".") ? `0${n}` : n;
|
|
39
|
-
}, N = (t) => {
|
|
40
|
-
const n = t.split("."), e = n[0], r = n.length > 1 ? `.${n[1]}` : "";
|
|
41
|
-
return `${i(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}${r}`;
|
|
42
|
-
}, P = (t) => {
|
|
43
|
-
const n = t.match(/^(\d+)(\.\d{1,18})?\d*$/);
|
|
44
|
-
if (n) {
|
|
45
|
-
const e = n[1], r = n[2] || "";
|
|
46
|
-
return `${e}${r}`;
|
|
47
|
-
}
|
|
48
|
-
return t;
|
|
49
|
-
}, $ = (t) => t < 0n ? -t : t, b = (t, n, e) => {
|
|
50
|
-
const r = t < n ? t : n;
|
|
51
|
-
return e ? r < e ? r : e : r;
|
|
52
|
-
};
|
|
53
|
-
export {
|
|
54
|
-
$ as absBigInt,
|
|
55
|
-
u as beepsToPercentage,
|
|
56
|
-
l as bigintApplySugar,
|
|
57
|
-
p as bigintMax,
|
|
58
|
-
a as calculateAmountUsingBeeps,
|
|
59
|
-
s as calculateSum,
|
|
60
|
-
I as fixDecimalsAmount,
|
|
61
|
-
B as getValueFirstNDigit,
|
|
62
|
-
b as minBigInt,
|
|
63
|
-
d as toBigInt,
|
|
64
|
-
g as toBigIntOrUndefined,
|
|
65
|
-
N as toCommaSeparatedNumberString,
|
|
66
|
-
m as toInt,
|
|
67
|
-
f as toNumberOrUndefined,
|
|
68
|
-
i as trimLeadingZeros,
|
|
69
|
-
P as truncateTo18DecimalPlaces
|
|
70
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import "../../types/transactions.types.js";
|
|
4
|
-
import "../../types/curve.types.js";
|
|
5
|
-
import "ethers";
|
|
6
|
-
import "circomlibjs";
|
|
7
|
-
import "../../data-structures/crypto-keys/keys.js";
|
|
8
|
-
import "axios";
|
|
9
|
-
import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
10
|
-
import "../web3/events/getShieldedBalance.js";
|
|
11
|
-
import "../../webworker/workerFactory.js";
|
|
12
|
-
import "./external-action.utils.js";
|
|
13
|
-
import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
14
|
-
import "./convertIntegrationProviderToExternalActionId.js";
|
|
15
|
-
import "../../constants/coingecko.constants.js";
|
|
16
|
-
import "../../constants/vite.constants.js";
|
|
17
|
-
import "./userAgent.js";
|
|
18
|
-
import "../../constants/reorg-depths.constants.js";
|
|
19
|
-
import "../../constants/kyc.constants.js";
|
|
20
|
-
import "../../data-structures/volatile-helper/VolatileHelper.js";
|
|
21
|
-
import "libsodium-wrappers";
|
|
22
|
-
import "../../constants/contracts.constants.js";
|
|
23
|
-
import { AxelarRegistry as p } from "../../constants/axelar.constants.js";
|
|
24
|
-
import "../../constants/rewards.constants.js";
|
|
25
|
-
const z = (i) => {
|
|
26
|
-
const r = p.find((m) => m.chainId === i.chainId);
|
|
27
|
-
if (!r)
|
|
28
|
-
return;
|
|
29
|
-
const { sourceChain: t, sourceAddress: o } = r;
|
|
30
|
-
return {
|
|
31
|
-
destinationChain: t,
|
|
32
|
-
destinationAddress: o,
|
|
33
|
-
messageFee: i.gasFeeInWei ?? 0n
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
z as getAxelarMigrationInfo
|
|
38
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import "ethers";
|
|
2
|
-
import "axios";
|
|
3
|
-
import "../../constants/chains.constants.js";
|
|
4
|
-
import "../../types/circom-data.types.js";
|
|
5
|
-
import "../../types/transactions.types.js";
|
|
6
|
-
import "../../types/curve.types.js";
|
|
7
|
-
import "circomlibjs";
|
|
8
|
-
import "../../data-structures/crypto-keys/keys.js";
|
|
9
|
-
import { serializeDecodedTxs as g, deserializeDecodedTxs as C } from "./getDataFromTransaction.js";
|
|
10
|
-
import "../web3/events/getShieldedBalance.js";
|
|
11
|
-
import "./external-action.utils.js";
|
|
12
|
-
import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
13
|
-
import "./convertIntegrationProviderToExternalActionId.js";
|
|
14
|
-
import "../../constants/coingecko.constants.js";
|
|
15
|
-
import { logError as p } from "../../error-handling/logError.js";
|
|
16
|
-
import "./userAgent.js";
|
|
17
|
-
import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
18
|
-
import "../../webworker/workerFactory.js";
|
|
19
|
-
import "../../constants/reorg-depths.constants.js";
|
|
20
|
-
import "../../constants/kyc.constants.js";
|
|
21
|
-
import "../../data-structures/volatile-helper/VolatileHelper.js";
|
|
22
|
-
import "libsodium-wrappers";
|
|
23
|
-
import "../../constants/vite.constants.js";
|
|
24
|
-
import "../../constants/contracts.constants.js";
|
|
25
|
-
import "../../constants/axelar.constants.js";
|
|
26
|
-
import "../../constants/rewards.constants.js";
|
|
27
|
-
const l = {
|
|
28
|
-
encryptedOutputs: [],
|
|
29
|
-
lastOutput: ""
|
|
30
|
-
}, c = (o, t) => {
|
|
31
|
-
const r = o.substring(0, 25), s = t.substring(0, 25);
|
|
32
|
-
return { shortPublicKey: r, shortHinkalAddress: s };
|
|
33
|
-
}, L = (o, t, r) => {
|
|
34
|
-
if (!o || !t || !r)
|
|
35
|
-
throw Error("GetHinkalCache: incorrect arguments");
|
|
36
|
-
const { shortPublicKey: s, shortHinkalAddress: e } = c(t, r);
|
|
37
|
-
return JSON.parse(
|
|
38
|
-
localStorage.getItem(`hinkalCache-${o}-${s}-${e}`) ?? JSON.stringify(l)
|
|
39
|
-
);
|
|
40
|
-
}, u = (o, t, r, s) => {
|
|
41
|
-
if (!t || !r || !s)
|
|
42
|
-
throw Error("SetHinkalCache: incorrect arguments");
|
|
43
|
-
const { shortPublicKey: e, shortHinkalAddress: a } = c(r, s);
|
|
44
|
-
localStorage.setItem(`hinkalCache-${t}-${e}-${a}`, JSON.stringify(o));
|
|
45
|
-
}, M = (o, t, r) => {
|
|
46
|
-
u(l, o, t, r);
|
|
47
|
-
}, Q = (o, t, r, s, e) => {
|
|
48
|
-
if (!t || !r || !s)
|
|
49
|
-
throw Error("saveTxsCache: incorrect arguments");
|
|
50
|
-
const { shortPublicKey: a, shortHinkalAddress: n } = c(r, s), i = g(o);
|
|
51
|
-
p("saveTxsCache before saving", { serializedTxs: i }), localStorage.setItem(
|
|
52
|
-
`txsCache-${t}-${a}-${n}`,
|
|
53
|
-
JSON.stringify({ serializedTxs: i, lastHash: e })
|
|
54
|
-
);
|
|
55
|
-
}, x = { serializedTxs: [], lastHash: "" }, R = (o, t, r) => {
|
|
56
|
-
if (!o || !t || !r)
|
|
57
|
-
throw Error("loadTxsCache: incorrect arguments");
|
|
58
|
-
const { shortPublicKey: s, shortHinkalAddress: e } = c(t, r), a = localStorage.getItem(`txsCache-${o}-${s}-${e}`), { serializedTxs: n, lastHash: i } = JSON.parse(a ?? JSON.stringify(x)), m = n.map((h) => C(h));
|
|
59
|
-
return p("loadTxsCache ", { decodedTxs: m, lastHash: i }), { decodedTxs: m, lastHash: i === "" ? void 0 : i };
|
|
60
|
-
};
|
|
61
|
-
export {
|
|
62
|
-
L as getHinkalCache,
|
|
63
|
-
R as loadTxsCache,
|
|
64
|
-
M as resetCache,
|
|
65
|
-
Q as saveTxsCache,
|
|
66
|
-
u as setHinkalCache
|
|
67
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const o = (e, s) => !e || !s ? !1 : e.toLowerCase() === s.toLowerCase(), r = (e, s) => e.some((t) => o(t, s)), a = (e, s) => e.some((t) => t.toLowerCase().startsWith(s.toLowerCase()));
|
|
2
|
-
export {
|
|
3
|
-
o as caseInsensitiveEqual,
|
|
4
|
-
r as lowerCaseIncludes,
|
|
5
|
-
a as lowerCaseStartsWith
|
|
6
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "../../types/circom-data.types.js";
|
|
2
|
-
import { ExternalActionId as r } from "../../types/external-action.types.js";
|
|
3
|
-
import { IntegrationProvider as o } from "../../types/hinkal.types.js";
|
|
4
|
-
import "../../types/transactions.types.js";
|
|
5
|
-
import "../../types/curve.types.js";
|
|
6
|
-
const t = {
|
|
7
|
-
[o.UNISWAP]: r.Uniswap,
|
|
8
|
-
[o.ODOS]: r.Odos,
|
|
9
|
-
[o.ONEINCH]: r.OneInch,
|
|
10
|
-
[o.PENDLE]: r.Pendle,
|
|
11
|
-
[o.ALL]: void 0,
|
|
12
|
-
[o.NONE]: void 0
|
|
13
|
-
}, p = (n) => t[n];
|
|
14
|
-
export {
|
|
15
|
-
p as convertIntegrationProviderToExternalActionId
|
|
16
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function e(r, n) {
|
|
2
|
-
return Object.values(r).includes(n);
|
|
3
|
-
}
|
|
4
|
-
function o(r, n, i = !1) {
|
|
5
|
-
if (e(r, n))
|
|
6
|
-
return n;
|
|
7
|
-
const t = `Value ${JSON.stringify(n)} is not a valid member of enum ${JSON.stringify(r)}.`;
|
|
8
|
-
if (i)
|
|
9
|
-
throw new Error(t);
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
e as isInEnum,
|
|
13
|
-
o as toEnumValue
|
|
14
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { getERC20Registry as n } from "../../constants/token-data/ERC20Registry.js";
|
|
2
|
-
import { customTokenRegistry as i } from "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
3
|
-
const T = (e, o) => {
|
|
4
|
-
const r = n(o), t = i.getCustomTokens(o);
|
|
5
|
-
return [...r, ...t].find((s) => e === void 0 ? !1 : s.erc20TokenAddress.toLowerCase() === e.toLowerCase());
|
|
6
|
-
}, g = (e, o) => {
|
|
7
|
-
const r = n(o), t = i.getCustomTokens(o);
|
|
8
|
-
return [...r, ...t].find((s) => e === void 0 ? !1 : s.symbol.toLowerCase() === e.toLowerCase());
|
|
9
|
-
}, c = (e, o) => {
|
|
10
|
-
const r = n(o);
|
|
11
|
-
if (e.hasHToken)
|
|
12
|
-
return r.find(
|
|
13
|
-
(t) => t.underlyingErc20TokenAddress?.toLowerCase() === e.erc20TokenAddress.toLowerCase() && t.isHToken
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
T as getERC20Token,
|
|
18
|
-
g as getERC20TokenBySymbol,
|
|
19
|
-
c as getHToken
|
|
20
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as i, chainIdsByType as o } from "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import "../../types/transactions.types.js";
|
|
4
|
-
import "../../types/curve.types.js";
|
|
5
|
-
import "ethers";
|
|
6
|
-
import "circomlibjs";
|
|
7
|
-
import "../../data-structures/crypto-keys/keys.js";
|
|
8
|
-
import "axios";
|
|
9
|
-
import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
10
|
-
import "../web3/events/getShieldedBalance.js";
|
|
11
|
-
import "../../webworker/workerFactory.js";
|
|
12
|
-
import "./external-action.utils.js";
|
|
13
|
-
import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
14
|
-
import "./convertIntegrationProviderToExternalActionId.js";
|
|
15
|
-
import "../../constants/coingecko.constants.js";
|
|
16
|
-
import "../../constants/vite.constants.js";
|
|
17
|
-
import "./userAgent.js";
|
|
18
|
-
import "../../constants/reorg-depths.constants.js";
|
|
19
|
-
import "../../constants/kyc.constants.js";
|
|
20
|
-
import "../../data-structures/volatile-helper/VolatileHelper.js";
|
|
21
|
-
import "libsodium-wrappers";
|
|
22
|
-
import "../../constants/contracts.constants.js";
|
|
23
|
-
import "../../constants/axelar.constants.js";
|
|
24
|
-
import "../../constants/rewards.constants.js";
|
|
25
|
-
const B = (t) => i[t], R = (t) => Object.keys(o)[Object.values(o).findIndex((r) => r.includes(t.chainId))];
|
|
26
|
-
export {
|
|
27
|
-
B as getNetworkObject,
|
|
28
|
-
R as getNetworkType
|
|
29
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ethers as u } from "ethers";
|
|
2
|
-
import { CIRCOM_P as r } from "../../constants/protocol.constants.js";
|
|
3
|
-
import "../../types/circom-data.types.js";
|
|
4
|
-
import { ExternalActionId as t } from "../../types/external-action.types.js";
|
|
5
|
-
import "../../types/transactions.types.js";
|
|
6
|
-
import "../../types/curve.types.js";
|
|
7
|
-
import { toNumberOrUndefined as a } from "./amounts.utils.js";
|
|
8
|
-
const s = (n) => n === 0n ? 0n : BigInt(u.utils.id(n)) % r, g = (n) => BigInt(n) === 0n ? t.Transact : Object.values(t).find(
|
|
9
|
-
(e) => BigInt(n) === s(e)
|
|
10
|
-
), i = {
|
|
11
|
-
[t.Curve]: ["uint8", "address", "uint256", "uint256"],
|
|
12
|
-
[t.CurveDynamic]: ["uint8", "address", "uint256", "uint256"],
|
|
13
|
-
[t.CurveCRV]: ["uint8", "address", "uint256", "uint256"],
|
|
14
|
-
[t.CurveCRVRewards]: ["uint8", "address", "uint256", "uint256"],
|
|
15
|
-
[t.Convex]: ["uint8", "uint256", "uint256", "uint256"],
|
|
16
|
-
[t.Beefy]: ["uint8", "bytes", "bytes", "address"],
|
|
17
|
-
[t.BeefyStake]: ["uint8", "address", "uint256", "uint256"],
|
|
18
|
-
[t.Volatile]: ["uint256[]", "address", "uint256", "bytes", "uint8"],
|
|
19
|
-
[t.LidoETH]: ["uint8"],
|
|
20
|
-
[t.LidoMATIC]: ["uint8"],
|
|
21
|
-
[t.LidoETHNFT]: ["uint8"],
|
|
22
|
-
[t.LidoMATICNFT]: ["uint8"],
|
|
23
|
-
[t.Pendle]: ["uint8", "address", "uint256", "uint256", "address", "bool", "bytes"],
|
|
24
|
-
[t.PendleLP]: ["uint8", "address", "uint256", "uint256", "bytes"],
|
|
25
|
-
[t.Connext]: [
|
|
26
|
-
"bool",
|
|
27
|
-
"bool",
|
|
28
|
-
"uint32",
|
|
29
|
-
"uint256",
|
|
30
|
-
"uint256",
|
|
31
|
-
"uint256",
|
|
32
|
-
"uint256[2]",
|
|
33
|
-
"uint256[2][2]",
|
|
34
|
-
"uint256[2]"
|
|
35
|
-
]
|
|
36
|
-
}, c = {
|
|
37
|
-
[t.Pendle]: !0
|
|
38
|
-
}, d = {
|
|
39
|
-
[t.Volatile]: 4
|
|
40
|
-
}, y = (n, e) => {
|
|
41
|
-
if (c[n])
|
|
42
|
-
return a(e?.hookData?.preHookMetadata);
|
|
43
|
-
if (!i[n] || !e?.externalActionMetadata)
|
|
44
|
-
return;
|
|
45
|
-
let o = 0;
|
|
46
|
-
return d[n] && (o = d[n]), u.utils.defaultAbiCoder.decode(
|
|
47
|
-
i[n],
|
|
48
|
-
e.externalActionMetadata
|
|
49
|
-
)[o];
|
|
50
|
-
}, v = (n, e) => {
|
|
51
|
-
if (!e || !i[n])
|
|
52
|
-
throw Error("No externalActionMetadata");
|
|
53
|
-
return u.utils.defaultAbiCoder.decode(i[n], e);
|
|
54
|
-
}, E = (n) => BigInt(u.utils.keccak256(n)) % r;
|
|
55
|
-
export {
|
|
56
|
-
v as decodeMetadata,
|
|
57
|
-
y as getActionFromMetadata,
|
|
58
|
-
g as getExternalActionIdFromNumber,
|
|
59
|
-
s as getExternalActionIdHash,
|
|
60
|
-
E as getExternalMetadataHash
|
|
61
|
-
};
|