@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,45 +0,0 @@
|
|
|
1
|
-
import { getNonLocalhostChainId as o, chainIds as t } 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 "../../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 v = (r) => {
|
|
26
|
-
switch (o(r)) {
|
|
27
|
-
case t.polygon:
|
|
28
|
-
return "0x172370d5Cd63279eFa6d502DAB29171933a610AF";
|
|
29
|
-
case t.arbMainnet:
|
|
30
|
-
return "0x11cdb42b0eb46d95f990bedd4695a6e3fa034978";
|
|
31
|
-
case t.ethMainnet:
|
|
32
|
-
return "0xD533a949740bb3306d119CC777fa900bA034cd52";
|
|
33
|
-
case t.avalanche:
|
|
34
|
-
return "0x47536F17F4fF30e64A96a7555826b8f9e66ec468";
|
|
35
|
-
case t.optimism:
|
|
36
|
-
return "0x0994206dfe8de6ec6920ff4d779b0d950605fb53";
|
|
37
|
-
case t.base:
|
|
38
|
-
return "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415";
|
|
39
|
-
default:
|
|
40
|
-
return "0xD533a949740bb3306d119CC777fa900bA034cd52";
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
export {
|
|
44
|
-
v as getCRV
|
|
45
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import { PendleAction as n } from "../../types/hinkal.types.js";
|
|
4
|
-
import "../../types/transactions.types.js";
|
|
5
|
-
import { PendleAssetType as i, PendleSwapType as t } from "../../types/pendle.types.js";
|
|
6
|
-
import "../../types/curve.types.js";
|
|
7
|
-
import "ethers";
|
|
8
|
-
import "circomlibjs";
|
|
9
|
-
import "../../data-structures/crypto-keys/keys.js";
|
|
10
|
-
import "axios";
|
|
11
|
-
import "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
12
|
-
import "../web3/events/getShieldedBalance.js";
|
|
13
|
-
import "../../webworker/workerFactory.js";
|
|
14
|
-
import "../utils/external-action.utils.js";
|
|
15
|
-
import { getERC20Token as T } from "../utils/erc20tokenFunctions.js";
|
|
16
|
-
import "../utils/convertIntegrationProviderToExternalActionId.js";
|
|
17
|
-
import "../../constants/coingecko.constants.js";
|
|
18
|
-
import { API_CONFIG as p } from "../../constants/server.constants.js";
|
|
19
|
-
import "../../constants/vite.constants.js";
|
|
20
|
-
import { caseInsensitiveEqual as d } from "../utils/caseInsensitive.utils.js";
|
|
21
|
-
import "../utils/userAgent.js";
|
|
22
|
-
import "../../constants/reorg-depths.constants.js";
|
|
23
|
-
import "../../constants/kyc.constants.js";
|
|
24
|
-
import { isInEnum as w } from "../utils/enum.utils.js";
|
|
25
|
-
import "../../data-structures/volatile-helper/VolatileHelper.js";
|
|
26
|
-
import "../../data-structures/custom-token-registry/CustomTokenRegistry.js";
|
|
27
|
-
import "libsodium-wrappers";
|
|
28
|
-
import "../../constants/contracts.constants.js";
|
|
29
|
-
import "../../constants/axelar.constants.js";
|
|
30
|
-
import "../../constants/rewards.constants.js";
|
|
31
|
-
function H(e) {
|
|
32
|
-
if (!e)
|
|
33
|
-
return;
|
|
34
|
-
const r = T(e.address, e.chainId);
|
|
35
|
-
if (!r?.isVolatile)
|
|
36
|
-
return r?.symbol.toLowerCase() === "weth" && console.log("token:", r), r;
|
|
37
|
-
}
|
|
38
|
-
function J(e, r) {
|
|
39
|
-
if (!e || !r)
|
|
40
|
-
return;
|
|
41
|
-
let o;
|
|
42
|
-
switch (r) {
|
|
43
|
-
case i.YT:
|
|
44
|
-
o = e?.yt;
|
|
45
|
-
break;
|
|
46
|
-
case i.PT:
|
|
47
|
-
o = e?.pt;
|
|
48
|
-
break;
|
|
49
|
-
case i.PENDLE_LP:
|
|
50
|
-
o = e?.lp;
|
|
51
|
-
break;
|
|
52
|
-
case i.SY:
|
|
53
|
-
o = e?.sy;
|
|
54
|
-
break;
|
|
55
|
-
default:
|
|
56
|
-
o = void 0;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
return o;
|
|
60
|
-
}
|
|
61
|
-
const K = (e, r, o) => {
|
|
62
|
-
if (d(e.yt.address, o.erc20TokenAddress))
|
|
63
|
-
return t.SwapExactTokenForYt;
|
|
64
|
-
if (d(e.pt.address, o.erc20TokenAddress))
|
|
65
|
-
return t.SwapExactTokenForPt;
|
|
66
|
-
if (d(e.yt.address, r.erc20TokenAddress))
|
|
67
|
-
return t.SwapExactYtForToken;
|
|
68
|
-
if (d(e.pt.address, r.erc20TokenAddress))
|
|
69
|
-
return t.SwapExactPtForToken;
|
|
70
|
-
}, Q = (e) => {
|
|
71
|
-
let r;
|
|
72
|
-
switch (e) {
|
|
73
|
-
case t.SwapExactTokenForYt:
|
|
74
|
-
r = p.ROUTES.pendleSwapExactTokenForYT;
|
|
75
|
-
break;
|
|
76
|
-
case t.SwapExactTokenForPt:
|
|
77
|
-
r = p.ROUTES.pendleSwapExactTokenForPt;
|
|
78
|
-
break;
|
|
79
|
-
case t.SwapExactYtForToken:
|
|
80
|
-
r = p.ROUTES.pendleSwapExactYtForToken;
|
|
81
|
-
break;
|
|
82
|
-
case t.SwapExactPtForToken:
|
|
83
|
-
r = p.ROUTES.pendleSwapExactPtForToken;
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
throw new Error("Cant determine Pendle Swap Type Api Route");
|
|
87
|
-
}
|
|
88
|
-
return r;
|
|
89
|
-
}, W = (e, r, o, s) => {
|
|
90
|
-
if (!w(n, e))
|
|
91
|
-
throw new Error("getTokenIndexForPendleFlatFee: Invalid Pendle Action");
|
|
92
|
-
if (s)
|
|
93
|
-
return o.findIndex(
|
|
94
|
-
(a) => a.toLowerCase() === s?.toLowerCase()
|
|
95
|
-
);
|
|
96
|
-
const l = r.findIndex((a) => a > 0n), c = r.length - 1;
|
|
97
|
-
if (r[c] <= 0n)
|
|
98
|
-
throw new Error("getTokenIndexForPendleFlatFee: Last token in amountChange is not > 0");
|
|
99
|
-
let m = l;
|
|
100
|
-
return (e === n.Mint || e === n.Redeem || e === n.PoolRemove) && (m = l), m;
|
|
101
|
-
};
|
|
102
|
-
export {
|
|
103
|
-
K as determinePendleSwapType,
|
|
104
|
-
Q as determinePendleSwapTypeApiRoute,
|
|
105
|
-
H as erc20TokenFromPendleAsset,
|
|
106
|
-
J as getAssetTypeFromPendleMarket,
|
|
107
|
-
W as getTokenIndexForPendleFlatFee
|
|
108
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { ethers as i } from "ethers";
|
|
2
|
-
import { CIRCOM_P as u } from "../../constants/protocol.constants.js";
|
|
3
|
-
import { UserKeys as g } from "../../data-structures/crypto-keys/keys.js";
|
|
4
|
-
import { encryptUtxo as h } from "../../data-structures/crypto-keys/encryptDecryptUtxo.js";
|
|
5
|
-
import { defaultHookData as S } from "../../types/circom-data.types.js";
|
|
6
|
-
import { getExternalActionIdHash as m } from "../utils/external-action.utils.js";
|
|
7
|
-
const k = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getNullifier())), B = (t, e) => t.map((r, n) => r.map((s) => e[n] ? "0" : s.getCommitment())), y = (t, e, r = !1) => {
|
|
8
|
-
const n = [];
|
|
9
|
-
for (let s = 0; s < t.length; s += 1) {
|
|
10
|
-
let o = 0n, l = 0n;
|
|
11
|
-
for (let a = 0; a < t[s].length; a += 1)
|
|
12
|
-
o += t[s][a].amount;
|
|
13
|
-
for (let a = 0; a < e[s].length; a += 1)
|
|
14
|
-
l += e[s][a].amount;
|
|
15
|
-
l - o < 0 ? r ? n.push(l - o) : n.push(u + (l - o)) : n.push(l - o);
|
|
16
|
-
}
|
|
17
|
-
return n;
|
|
18
|
-
}, O = (t, e) => {
|
|
19
|
-
const r = [[""]];
|
|
20
|
-
for (let n = 0; n < t.length; n += 1)
|
|
21
|
-
n > 0 && r.push([""]), t[n].forEach((s, o) => {
|
|
22
|
-
r[n][o] = `0x${Buffer.from(h(s, e)).toString("hex")}`;
|
|
23
|
-
});
|
|
24
|
-
return r;
|
|
25
|
-
}, T = (t, e) => {
|
|
26
|
-
const r = [];
|
|
27
|
-
for (let s = 0; s < t.length; s += 1) {
|
|
28
|
-
r.push([]);
|
|
29
|
-
for (let o = 0; o < t[s].length; o += 1)
|
|
30
|
-
r[s][o] = e.getSiblingHashesForVerification(BigInt(t[s][o].getCommitment())).map((l) => l.toString());
|
|
31
|
-
}
|
|
32
|
-
const n = [];
|
|
33
|
-
for (let s = 0; s < t.length; s += 1) {
|
|
34
|
-
n.push([]);
|
|
35
|
-
for (let o = 0; o < t[s].length; o += 1)
|
|
36
|
-
n[s][o] = e.getSiblingSides(BigInt(t[s][o].getCommitment())).map((l) => l.toString());
|
|
37
|
-
}
|
|
38
|
-
return { inCommitmentSiblings: r, inCommitmentSiblingSides: n };
|
|
39
|
-
}, j = (t, e) => {
|
|
40
|
-
const r = e.getSiblingHashesForVerification(BigInt(t.getAccessKey())).map((s) => s.toString()), n = e.getSiblingSides(BigInt(t.getAccessKey())).map((s) => s.toString());
|
|
41
|
-
return { accessTokenSiblings: r, accessTokenSiblingSides: n };
|
|
42
|
-
}, E = (t) => {
|
|
43
|
-
const e = { ...t };
|
|
44
|
-
return e.amountChanges = t.amountChanges.map((r) => r.toString()), e.calldataHash = t.calldataHash.toString(), e.rootHashAccessToken = t.rootHashAccessToken?.toString(), e.stealthAddressStructure.extraRandomization = t.stealthAddressStructure.extraRandomization.toString(), e.stealthAddressStructure.stealthAddress = t.stealthAddressStructure.stealthAddress.toString(), e.stealthAddressStructure.H0 = t.stealthAddressStructure.H0.toString(), e.stealthAddressStructure.H1 = t.stealthAddressStructure.H1.toString(), e.rootHashHinkal = t.rootHashHinkal?.toString(), e.externalActionId = t.externalActionId?.toString(), e.flatFees = t.flatFees.map((r) => r.toString()), e;
|
|
45
|
-
}, F = (t) => {
|
|
46
|
-
const e = { ...t };
|
|
47
|
-
return e.amountChanges = t.amountChanges.map((r) => BigInt(r)), e.calldataHash = BigInt(t.calldataHash), e.rootHashAccessToken = BigInt(t.rootHashAccessToken), e.rootHashHinkal = BigInt(t.rootHashHinkal), e.externalActionId = BigInt(t.externalActionId), e;
|
|
48
|
-
}, M = (t, e, r, n, s, o, l, a) => {
|
|
49
|
-
const d = Object.values(a || S), c = i.utils.defaultAbiCoder.encode(
|
|
50
|
-
[
|
|
51
|
-
"uint16",
|
|
52
|
-
"address",
|
|
53
|
-
"address",
|
|
54
|
-
"uint256",
|
|
55
|
-
"bytes",
|
|
56
|
-
"tuple(address, address, bytes, bytes)",
|
|
57
|
-
"bytes[][]",
|
|
58
|
-
"uint256[]"
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
t,
|
|
62
|
-
e,
|
|
63
|
-
r,
|
|
64
|
-
typeof n == "bigint" ? n : m(n),
|
|
65
|
-
s,
|
|
66
|
-
d,
|
|
67
|
-
o,
|
|
68
|
-
l
|
|
69
|
-
]
|
|
70
|
-
);
|
|
71
|
-
return BigInt(i.utils.keccak256(c)) % u;
|
|
72
|
-
}, f = (t) => t.startsWith("swapperMO") || t.startsWith("swapperME") ? 2 : t.startsWith("swapperMW") ? 1 : 0, W = (t, e, r, n, s, o) => {
|
|
73
|
-
const l = f(t);
|
|
74
|
-
return 9 + e.length + r.length + n.flat().length + s.length + l + o;
|
|
75
|
-
}, w = (t, e) => {
|
|
76
|
-
const { h0: r, h1: n } = g.getStealthAddressCompressedPoints(t, e), s = BigInt(g.getStealthAddress(t, e));
|
|
77
|
-
return {
|
|
78
|
-
extraRandomization: t,
|
|
79
|
-
H0: r,
|
|
80
|
-
H1: n,
|
|
81
|
-
stealthAddress: s
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
export {
|
|
85
|
-
k as buildInNullifiers,
|
|
86
|
-
B as buildOutCommitments,
|
|
87
|
-
j as calcAccessTokenSiblingsAndSides,
|
|
88
|
-
y as calcAmountChanges,
|
|
89
|
-
T as calcCommitmentsSiblingAndSides,
|
|
90
|
-
O as calcEncryptedOutputs,
|
|
91
|
-
W as calcPublicSignalCount,
|
|
92
|
-
w as calcStealthAddressStructure,
|
|
93
|
-
M as createCallDataHash,
|
|
94
|
-
F as deserializeCircomData,
|
|
95
|
-
E as serializeCircomData
|
|
96
|
-
};
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { chainIds as e } 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 { logError as x } from "../../error-handling/logError.js";
|
|
17
|
-
import "../utils/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/vite.constants.js";
|
|
23
|
-
import "../../constants/contracts.constants.js";
|
|
24
|
-
import "../../constants/axelar.constants.js";
|
|
25
|
-
import "../../constants/rewards.constants.js";
|
|
26
|
-
const p = {
|
|
27
|
-
ethMainnet: "https://hinkal-zk-verifiers-may-2024.s3.us-west-1.amazonaws.com/",
|
|
28
|
-
polygon: "https://hinkal-zk-new-verifiers.s3.us-west-1.amazonaws.com/",
|
|
29
|
-
bnb: "https://hinkal-zk-verifiers-may-2024.s3.us-west-1.amazonaws.com/",
|
|
30
|
-
arbitrum: "https://hinkal-zk-verifiers-may-2024.s3.us-west-1.amazonaws.com/",
|
|
31
|
-
optimism: "https://hinkal-zk-new-verifiers.s3.us-west-1.amazonaws.com/",
|
|
32
|
-
avalanche: "https://hinkal-zk-new-verifiers.s3.us-west-1.amazonaws.com/",
|
|
33
|
-
base: "https://hinkal-zk-verifiers-may-2024.s3.us-west-1.amazonaws.com/",
|
|
34
|
-
blast: "https://hinkal-zk-verifiers-may-2024.s3.us-west-1.amazonaws.com/"
|
|
35
|
-
}, r = (s) => {
|
|
36
|
-
switch (s) {
|
|
37
|
-
case e.ethMainnet:
|
|
38
|
-
return p.ethMainnet;
|
|
39
|
-
case e.polygon:
|
|
40
|
-
return p.polygon;
|
|
41
|
-
case e.bnbMainnet:
|
|
42
|
-
return p.bnb;
|
|
43
|
-
case e.arbMainnet:
|
|
44
|
-
return p.arbitrum;
|
|
45
|
-
case e.optimism:
|
|
46
|
-
return p.optimism;
|
|
47
|
-
case e.avalanche:
|
|
48
|
-
return p.avalanche;
|
|
49
|
-
case e.base:
|
|
50
|
-
return p.base;
|
|
51
|
-
case e.blast:
|
|
52
|
-
return p.blast;
|
|
53
|
-
default:
|
|
54
|
-
return x("Warning: no S3 bucket specified for selected chainid: ", s), p.polygon;
|
|
55
|
-
}
|
|
56
|
-
}, E = (s) => {
|
|
57
|
-
const a = r(s);
|
|
58
|
-
return {
|
|
59
|
-
swapperM1x2x1Zkey: `${a}swapperM1x2x1_final-31337.zkey`,
|
|
60
|
-
swapperM1x2x1Wasm: `${a}swapperM1x2x1-31337.wasm`,
|
|
61
|
-
swapperM1x6x1Zkey: `${a}swapperM1x6x1_final-31337.zkey`,
|
|
62
|
-
swapperM1x6x1Wasm: `${a}swapperM1x6x1-31337.wasm`,
|
|
63
|
-
swapperME1x2x1Zkey: `${a}swapperME1x2x1_final-31337.zkey`,
|
|
64
|
-
swapperME1x2x1Wasm: `${a}swapperME1x2x1-31337.wasm`,
|
|
65
|
-
swapperM2x2x1Zkey: `${a}swapperM2x2x1_final-31337.zkey`,
|
|
66
|
-
swapperM2x2x1Wasm: `${a}swapperM2x2x1-31337.wasm`,
|
|
67
|
-
swapperM2x6x1Zkey: `${a}swapperM2x6x1_final-31337.zkey`,
|
|
68
|
-
swapperM2x6x1Wasm: `${a}swapperM2x6x1-31337.wasm`,
|
|
69
|
-
swapperMO2x2x1Zkey: `${a}swapperMO2x2x1_final-31337.zkey`,
|
|
70
|
-
swapperMO2x2x1Wasm: `${a}swapperMO2x2x1-31337.wasm`,
|
|
71
|
-
swapperMO2x6x1Zkey: `${a}swapperMO2x6x1_final-31337.zkey`,
|
|
72
|
-
swapperMO2x6x1Wasm: `${a}swapperMO2x6x1-31337.wasm`,
|
|
73
|
-
swapperToken2x2x1Zkey: `${a}swapperToken2x2x1_final-31337.zkey`,
|
|
74
|
-
swapperToken2x2x1Wasm: `${a}swapperToken2x2x1-31337.wasm`,
|
|
75
|
-
swapperToken2x6x1Zkey: `${a}swapperToken2x6x1_final-31337.zkey`,
|
|
76
|
-
swapperToken2x6x1Wasm: `${a}swapperToken2x6x1-31337.wasm`,
|
|
77
|
-
swapperM3x2x1Zkey: `${a}swapperM3x2x1_final-31337.zkey`,
|
|
78
|
-
swapperM3x2x1Wasm: `${a}swapperM3x2x1-31337.wasm`,
|
|
79
|
-
swapperM3x6x1Zkey: `${a}swapperM3x6x1_final-31337.zkey`,
|
|
80
|
-
swapperM3x6x1Wasm: `${a}swapperM3x6x1-31337.wasm`,
|
|
81
|
-
swapperMO3x2x1Zkey: `${a}swapperMO3x2x1_final-31337.zkey`,
|
|
82
|
-
swapperMO3x2x1Wasm: `${a}swapperMO3x2x1-31337.wasm`,
|
|
83
|
-
swapperMO3x6x1Zkey: `${a}swapperMO3x6x1_final-31337.zkey`,
|
|
84
|
-
swapperMO3x6x1Wasm: `${a}swapperMO3x6x1-31337.wasm`,
|
|
85
|
-
swapperM4x2x1Zkey: `${a}swapperM4x2x1_final-31337.zkey`,
|
|
86
|
-
swapperM4x2x1Wasm: `${a}swapperM4x2x1-31337.wasm`,
|
|
87
|
-
swapperM4x6x1Zkey: `${a}swapperM4x6x1_final-31337.zkey`,
|
|
88
|
-
swapperM4x6x1Wasm: `${a}swapperM4x6x1-31337.wasm`,
|
|
89
|
-
swapperMO4x2x1Zkey: `${a}swapperMO4x2x1_final-31337.zkey`,
|
|
90
|
-
swapperMO4x2x1Wasm: `${a}swapperMO4x2x1-31337.wasm`,
|
|
91
|
-
swapperMO4x6x1Zkey: `${a}swapperMO4x6x1_final-31337.zkey`,
|
|
92
|
-
swapperMO4x6x1Wasm: `${a}swapperMO4x6x1-31337.wasm`,
|
|
93
|
-
swapperM5x2x1Zkey: `${a}swapperM5x2x1_final-31337.zkey`,
|
|
94
|
-
swapperM5x2x1Wasm: `${a}swapperM5x2x1-31337.wasm`,
|
|
95
|
-
swapperM5x6x1Zkey: `${a}swapperM5x6x1_final-31337.zkey`,
|
|
96
|
-
swapperM5x6x1Wasm: `${a}swapperM5x6x1-31337.wasm`,
|
|
97
|
-
swapperMO5x2x1Zkey: `${a}swapperMO5x2x1_final-31337.zkey`,
|
|
98
|
-
swapperMO5x2x1Wasm: `${a}swapperMO5x2x1-31337.wasm`,
|
|
99
|
-
swapperMO5x6x1Zkey: `${a}swapperMO5x6x1_final-31337.zkey`,
|
|
100
|
-
swapperMO5x6x1Wasm: `${a}swapperMO5x6x1-31337.wasm`,
|
|
101
|
-
swapperMTS2x2x1Zkey: "swapperMTS2x2x1_final-31337.zkey",
|
|
102
|
-
swapperMTS2x2x1Wasm: "swapperMTS2x2x1-31337.wasm",
|
|
103
|
-
transactionsProverZkey: `${a}transactionsProver.zkey`,
|
|
104
|
-
transactionsProverWasm: `${a}transactionsProver.wasm`,
|
|
105
|
-
stakeProverZkey: `${a}StakeProver_final-31337.zkey`,
|
|
106
|
-
stakeProverWasm: `${a}StakeProver-31337.wasm`,
|
|
107
|
-
stakeProverPermissionlessZkey: `${a}StakeProverPermissionless_final-31337.zkey`,
|
|
108
|
-
stakeProverPermissionlessWasm: `${a}StakeProverPermissionless-31337.wasm`,
|
|
109
|
-
swapperMW1x2Wasm: `${a}swapperMW1x2-31337.wasm`,
|
|
110
|
-
swapperMW1x2Zkey: `${a}swapperMW1x2_final-31337.zkey`,
|
|
111
|
-
swapperMW1x6Wasm: `${a}swapperMW1x6-31337.wasm`,
|
|
112
|
-
swapperMW1x6Zkey: `${a}swapperMW1x6_final-31337.zkey`,
|
|
113
|
-
swapperMW2x2Wasm: `${a}swapperMW2x2-31337.wasm`,
|
|
114
|
-
swapperMW2x2Zkey: `${a}swapperMW2x2_final-31337.zkey`,
|
|
115
|
-
swapperMW2x6Wasm: `${a}swapperMW2x6-31337.wasm`,
|
|
116
|
-
swapperMW2x6Zkey: `${a}swapperMW2x6_final-31337.zkey`,
|
|
117
|
-
swapperMW3x2Wasm: `${a}swapperMW3x2-31337.wasm`,
|
|
118
|
-
swapperMW3x2Zkey: `${a}swapperMW3x2_final-31337.zkey`,
|
|
119
|
-
swapperMW3x6Wasm: `${a}swapperMW3x6-31337.wasm`,
|
|
120
|
-
swapperMW3x6Zkey: `${a}swapperMW3x6_final-31337.zkey`,
|
|
121
|
-
swapperMW4x2Wasm: `${a}swapperMW4x2-31337.wasm`,
|
|
122
|
-
swapperMW4x2Zkey: `${a}swapperMW4x2_final-31337.zkey`,
|
|
123
|
-
swapperMW4x6Wasm: `${a}swapperMW4x6-31337.wasm`,
|
|
124
|
-
swapperMW4x6Zkey: `${a}swapperMW4x6_final-31337.zkey`,
|
|
125
|
-
swapperMW5x2Wasm: `${a}swapperMW5x2-31337.wasm`,
|
|
126
|
-
swapperMW5x2Zkey: `${a}swapperMW5x2_final-31337.zkey`,
|
|
127
|
-
swapperMW5x6Wasm: `${a}swapperMW5x6-31337.wasm`,
|
|
128
|
-
swapperMW5x6Zkey: `${a}swapperMW5x6_final-31337.zkey`
|
|
129
|
-
};
|
|
130
|
-
}, g = {
|
|
131
|
-
swapperM1x2x1Zkey: "swapperM1x2x1_final-31337.zkey",
|
|
132
|
-
swapperM1x2x1Wasm: "swapperM1x2x1-31337.wasm",
|
|
133
|
-
swapperM1x6x1Zkey: "swapperM1x6x1_final-31337.zkey",
|
|
134
|
-
swapperM1x6x1Wasm: "swapperM1x6x1-31337.wasm",
|
|
135
|
-
swapperMO1x2x1Zkey: "swapperMO1x2x1_final-31337.zkey",
|
|
136
|
-
swapperMO1x2x1Wasm: "swapperMO1x2x1-31337.wasm",
|
|
137
|
-
swapperMO1x6x1Zkey: "swapperMO1x6x1_final-31337.zkey",
|
|
138
|
-
swapperMO1x6x1Wasm: "swapperMO1x6x1-31337.wasm",
|
|
139
|
-
swapperME1x2x1Zkey: "swapperME1x2x1_final-31337.zkey",
|
|
140
|
-
swapperME1x2x1Wasm: "swapperME1x2x1-31337.wasm",
|
|
141
|
-
swapperM2x2x1Zkey: "swapperM2x2x1_final-31337.zkey",
|
|
142
|
-
swapperM2x2x1Wasm: "swapperM2x2x1-31337.wasm",
|
|
143
|
-
swapperM2x6x1Zkey: "swapperM2x6x1_final-31337.zkey",
|
|
144
|
-
swapperM2x6x1Wasm: "swapperM2x6x1-31337.wasm",
|
|
145
|
-
swapperMO2x2x1Zkey: "swapperMO2x2x1_final-31337.zkey",
|
|
146
|
-
swapperMO2x2x1Wasm: "swapperMO2x2x1-31337.wasm",
|
|
147
|
-
swapperMO2x6x1Zkey: "swapperMO2x6x1_final-31337.zkey",
|
|
148
|
-
swapperMO2x6x1Wasm: "swapperMO2x6x1-31337.wasm",
|
|
149
|
-
swapperToken2x2x1Zkey: "swapperToken2x2x1_final-31337.zkey",
|
|
150
|
-
swapperToken2x2x1Wasm: "swapperToken2x2x1-31337.wasm",
|
|
151
|
-
swapperToken2x6x1Zkey: "swapperToken2x6x1_final-31337.zkey",
|
|
152
|
-
swapperToken2x6x1Wasm: "swapperToken2x6x1-31337.wasm",
|
|
153
|
-
swapperM3x2x1Zkey: "swapperM3x2x1_final-31337.zkey",
|
|
154
|
-
swapperM3x2x1Wasm: "swapperM3x2x1-31337.wasm",
|
|
155
|
-
swapperM3x6x1Zkey: "swapperM3x6x1_final-31337.zkey",
|
|
156
|
-
swapperM3x6x1Wasm: "swapperM3x6x1-31337.wasm",
|
|
157
|
-
swapperMO3x2x1Zkey: "swapperMO3x2x1_final-31337.zkey",
|
|
158
|
-
swapperMO3x2x1Wasm: "swapperMO3x2x1-31337.wasm",
|
|
159
|
-
swapperMO3x6x1Zkey: "swapperMO3x6x1_final-31337.zkey",
|
|
160
|
-
swapperMO3x6x1Wasm: "swapperMO3x6x1-31337.wasm",
|
|
161
|
-
swapperM4x2x1Zkey: "swapperM4x2x1_final-31337.zkey",
|
|
162
|
-
swapperM4x2x1Wasm: "swapperM4x2x1-31337.wasm",
|
|
163
|
-
swapperM4x6x1Zkey: "swapperM4x6x1_final-31337.zkey",
|
|
164
|
-
swapperM4x6x1Wasm: "swapperM4x6x1-31337.wasm",
|
|
165
|
-
swapperMO4x2x1Zkey: "swapperMO4x2x1_final-31337.zkey",
|
|
166
|
-
swapperMO4x2x1Wasm: "swapperMO4x2x1-31337.wasm",
|
|
167
|
-
swapperMO4x6x1Zkey: "swapperMO4x6x1_final-31337.zkey",
|
|
168
|
-
swapperMO4x6x1Wasm: "swapperMO4x6x1-31337.wasm",
|
|
169
|
-
swapperM5x2x1Zkey: "swapperM5x2x1_final-31337.zkey",
|
|
170
|
-
swapperM5x2x1Wasm: "swapperM5x2x1-31337.wasm",
|
|
171
|
-
swapperM5x6x1Zkey: "swapperM5x6x1_final-31337.zkey",
|
|
172
|
-
swapperM5x6x1Wasm: "swapperM5x6x1-31337.wasm",
|
|
173
|
-
swapperMO5x2x1Zkey: "swapperMO5x2x1_final-31337.zkey",
|
|
174
|
-
swapperMO5x2x1Wasm: "swapperMO5x2x1-31337.wasm",
|
|
175
|
-
swapperMO5x6x1Zkey: "swapperMO5x6x1_final-31337.zkey",
|
|
176
|
-
swapperMO5x6x1Wasm: "swapperMO5x6x1-31337.wasm",
|
|
177
|
-
swapperMTS2x2x1Zkey: "swapperMTS2x2x1_final-31337.zkey",
|
|
178
|
-
swapperMTS2x2x1Wasm: "swapperMTS2x2x1-31337.wasm",
|
|
179
|
-
transactionsProverZkey: "transactionsProver.zkey",
|
|
180
|
-
transactionsProverWasm: "transactionsProver.wasm",
|
|
181
|
-
stakeProverZkey: "StakeProver_final-31337.zkey",
|
|
182
|
-
stakeProverWasm: "StakeProver-31337.wasm",
|
|
183
|
-
stakeProverPermissionlessZkey: "StakeProverPermissionless_final-31337.zkey",
|
|
184
|
-
stakeProverPermissionlessWasm: "StakeProverPermissionless-31337.wasm",
|
|
185
|
-
receiverZkey: "receiver_final-31337.zkey",
|
|
186
|
-
receiverWasm: "receiver-31337.wasm",
|
|
187
|
-
swapperMW1x2Wasm: "swapperMW1x2-31337.wasm",
|
|
188
|
-
swapperMW1x2Zkey: "swapperMW1x2_final-31337.zkey",
|
|
189
|
-
swapperMW1x6Wasm: "swapperMW1x6-31337.wasm",
|
|
190
|
-
swapperMW1x6Zkey: "swapperMW1x6_final-31337.zkey",
|
|
191
|
-
swapperMW2x2Wasm: "swapperMW2x2-31337.wasm",
|
|
192
|
-
swapperMW2x2Zkey: "swapperMW2x2_final-31337.zkey",
|
|
193
|
-
swapperMW2x6Wasm: "swapperMW2x6-31337.wasm",
|
|
194
|
-
swapperMW2x6Zkey: "swapperMW2x6_final-31337.zkey",
|
|
195
|
-
swapperMW3x2Wasm: "swapperMW3x2-31337.wasm",
|
|
196
|
-
swapperMW3x2Zkey: "swapperMW3x2_final-31337.zkey",
|
|
197
|
-
swapperMW3x6Wasm: "swapperMW3x6-31337.wasm",
|
|
198
|
-
swapperMW3x6Zkey: "swapperMW3x6_final-31337.zkey",
|
|
199
|
-
swapperMW4x2Wasm: "swapperMW4x2-31337.wasm",
|
|
200
|
-
swapperMW4x2Zkey: "swapperMW4x2_final-31337.zkey",
|
|
201
|
-
swapperMW4x6Wasm: "swapperMW4x6-31337.wasm",
|
|
202
|
-
swapperMW4x6Zkey: "swapperMW4x6_final-31337.zkey",
|
|
203
|
-
swapperMW5x2Wasm: "swapperMW5x2-31337.wasm",
|
|
204
|
-
swapperMW5x2Zkey: "swapperMW5x2_final-31337.zkey",
|
|
205
|
-
swapperMW5x6Wasm: "swapperMW5x6-31337.wasm",
|
|
206
|
-
swapperMW5x6Zkey: "swapperMW5x6_final-31337.zkey"
|
|
207
|
-
};
|
|
208
|
-
export {
|
|
209
|
-
g as localVerifiers,
|
|
210
|
-
E as prodVerifiers
|
|
211
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Utxo as $ } from "../../data-structures/utxo/Utxo.js";
|
|
2
|
-
import { zeroAddress as V } from "../../constants/protocol.constants.js";
|
|
3
|
-
import { chainIds as j } from "../../constants/chains.constants.js";
|
|
4
|
-
import { ZKProofWorkerActionType as d } from "../../webworker/zkProofWorker/zkProofWorker.types.js";
|
|
5
|
-
import { performTaskWithWorker as p } from "../../webworker/performTaskWithWorker.js";
|
|
6
|
-
import { WorkerVariant as S } from "../../webworker/worker.registry.js";
|
|
7
|
-
import { calcAmountChanges as q, calcEncryptedOutputs as F, buildOutCommitments as Q, calcPublicSignalCount as X, createCallDataHash as Y, calcStealthAddressStructure as x } from "./common.snarkjs.js";
|
|
8
|
-
import { randomBigInt as U } from "../web3/etherFunctions.js";
|
|
9
|
-
import { encodeEmporiumMetadata as tt } from "../private-wallet/emporium.helpers.js";
|
|
10
|
-
import { ExternalActionId as at } from "../../types/external-action.types.js";
|
|
11
|
-
import { defaultHookData as et } from "../../types/circom-data.types.js";
|
|
12
|
-
import { generateCircomData as ot } from "./generateCircomData.js";
|
|
13
|
-
import { generateZkProof as rt } from "./generateZkProof.js";
|
|
14
|
-
const It = async (f, g, a, e, n, _, b, H, z, A = V, v = j.localhost, m = a.map(() => !1), h = a.map(() => 0n), i, mt, nt) => {
|
|
15
|
-
const u = f.getRootHash(), k = g.getRootHash(), I = a.map((t) => t.map((r) => r.getConstructableParams())), C = n.getSignature(), { accessTokenSiblings: L, accessTokenSiblingSides: O } = await p({
|
|
16
|
-
type: S.ZKProof,
|
|
17
|
-
payload: {
|
|
18
|
-
type: d.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES,
|
|
19
|
-
data: {
|
|
20
|
-
userSignature: C,
|
|
21
|
-
merkleTreeAccessTokenSerialized: g.toJSON()
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}), { inCommitmentSiblings: W, inCommitmentSiblingSides: K } = await p({
|
|
25
|
-
type: S.ZKProof,
|
|
26
|
-
payload: {
|
|
27
|
-
type: d.CALC_COMMITMENTS_SIBLING_AND_SIDES,
|
|
28
|
-
data: { inputUtxosSerialized: I, userSignature: C, merkleTreeSerialized: f.toJSON() }
|
|
29
|
-
}
|
|
30
|
-
}), M = q(a, e), l = F(e, !1), s = n.getShieldedPrivateKey(), y = $.findCorrectRandomization(U(31), s), R = await p({
|
|
31
|
-
type: S.ZKProof,
|
|
32
|
-
payload: {
|
|
33
|
-
type: d.BUILD_IN_NULLIFIERS,
|
|
34
|
-
data: { inputUtxosSerialized: I, onChainCreation: m }
|
|
35
|
-
}
|
|
36
|
-
}), c = a.map((t) => t[0].tokenId ?? 0), o = {
|
|
37
|
-
rootHashHinkal: u,
|
|
38
|
-
erc20TokenAddresses: a.map((t) => t[0].erc20TokenAddress),
|
|
39
|
-
tokenIds: c,
|
|
40
|
-
inNullifiers: R,
|
|
41
|
-
outTimeStamp: BigInt(e[0][0].timeStamp),
|
|
42
|
-
extraRandomization: y,
|
|
43
|
-
amountChanges: M,
|
|
44
|
-
outCommitments: Q(e, m).map((t) => t[0]),
|
|
45
|
-
rootHashAccessToken: k,
|
|
46
|
-
calldataHash: 0n,
|
|
47
|
-
shieldedPrivateKey: s,
|
|
48
|
-
hinkalWalletNonce: i ?? 0n,
|
|
49
|
-
accessTokenSiblings: L,
|
|
50
|
-
accessTokenSiblingSides: O,
|
|
51
|
-
onChainCreation: m,
|
|
52
|
-
outAmounts: e.map((t) => t[0].amount),
|
|
53
|
-
outPublicKeys: e.map((t) => t[0].getStealthAddress()),
|
|
54
|
-
inAmounts: a.map((t) => t.map((r) => r.amount.toString())),
|
|
55
|
-
inTimeStamps: a.map((t) => t.map((r) => r.timeStamp)),
|
|
56
|
-
inRandomizations: a.map((t) => t.map((r) => r.randomization)),
|
|
57
|
-
inCommitmentSiblings: W,
|
|
58
|
-
inCommitmentSiblingSides: K
|
|
59
|
-
}, w = i ? n.getWalletSalt(i) : void 0;
|
|
60
|
-
let N = H, T = at.Emporium, D = tt(z, w);
|
|
61
|
-
const E = `swapperMW${_}x${b}`, P = X(
|
|
62
|
-
E,
|
|
63
|
-
o.erc20TokenAddresses,
|
|
64
|
-
o.amountChanges,
|
|
65
|
-
o.inNullifiers,
|
|
66
|
-
o.outCommitments,
|
|
67
|
-
c.length
|
|
68
|
-
);
|
|
69
|
-
o.calldataHash = Y(
|
|
70
|
-
P,
|
|
71
|
-
A,
|
|
72
|
-
N,
|
|
73
|
-
T,
|
|
74
|
-
D,
|
|
75
|
-
l,
|
|
76
|
-
h,
|
|
77
|
-
void 0
|
|
78
|
-
);
|
|
79
|
-
const { zkCallData: B } = await rt(v, E, o), Z = x(y, s), G = await ot(
|
|
80
|
-
u,
|
|
81
|
-
k,
|
|
82
|
-
a,
|
|
83
|
-
e,
|
|
84
|
-
l,
|
|
85
|
-
h,
|
|
86
|
-
P,
|
|
87
|
-
T,
|
|
88
|
-
N,
|
|
89
|
-
D,
|
|
90
|
-
A,
|
|
91
|
-
o.calldataHash,
|
|
92
|
-
c,
|
|
93
|
-
Z,
|
|
94
|
-
m,
|
|
95
|
-
et
|
|
96
|
-
), J = {
|
|
97
|
-
tokenNumber: a.length,
|
|
98
|
-
nullifierAmount: a[0].length,
|
|
99
|
-
outputAmount: e[0].length
|
|
100
|
-
};
|
|
101
|
-
return { zkCallData: B, circomData: G, dimData: J, encryptedOutputs: l };
|
|
102
|
-
};
|
|
103
|
-
export {
|
|
104
|
-
It as constructEmporiumProof
|
|
105
|
-
};
|