@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,112 +0,0 @@
|
|
|
1
|
-
import "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import { ContractType as u } from "../../types/ethereum-network.types.js";
|
|
4
|
-
import { ExternalActionId as W } from "../../types/external-action.types.js";
|
|
5
|
-
import { VolatileAction as a } from "../../types/hinkal.types.js";
|
|
6
|
-
import "../../types/transactions.types.js";
|
|
7
|
-
import "../../types/curve.types.js";
|
|
8
|
-
import "ethers";
|
|
9
|
-
import { transactionErrorCodes as N } from "../../error-handling/error-codes.constants.js";
|
|
10
|
-
import { zeroAddress as y } 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 H } from "../../functions/web3/events/getShieldedBalance.js";
|
|
16
|
-
import { outputUtxoProcessing as L } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
17
|
-
import { constructZkProof as M } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
18
|
-
import { estimateGasRelayer as P } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
19
|
-
import { transactCallRelayer as b } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
20
|
-
import { transactCallDirect as C } from "../../functions/web3/functionCalls/transactCallDirect.js";
|
|
21
|
-
import "../../functions/utils/external-action.utils.js";
|
|
22
|
-
import { getERC20Token as z } 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 { getFlatFees as K } from "../../functions/pre-transaction/getFlatFees.js";
|
|
27
|
-
import "../../functions/utils/userAgent.js";
|
|
28
|
-
import "../../constants/reorg-depths.constants.js";
|
|
29
|
-
import "../../constants/kyc.constants.js";
|
|
30
|
-
import "../../webworker/workerFactory.js";
|
|
31
|
-
import { VolatileHelper as D } from "../volatile-helper/VolatileHelper.js";
|
|
32
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
33
|
-
import "libsodium-wrappers";
|
|
34
|
-
import "../../constants/contracts.constants.js";
|
|
35
|
-
import "../../constants/axelar.constants.js";
|
|
36
|
-
import "../../constants/rewards.constants.js";
|
|
37
|
-
const Rt = async (t, i, o, R, T) => {
|
|
38
|
-
const { action: r, isRelayerOff: n, recipientAddress: V, baseExternalActionId: I, baseExternalActionMetadata: F } = R, f = z(i[0], t.getCurrentChainId());
|
|
39
|
-
if (!f)
|
|
40
|
-
throw Error("Deposit Action: No Token Found");
|
|
41
|
-
const c = [...o], S = [...i];
|
|
42
|
-
let A = [], x = o.map(() => 0n);
|
|
43
|
-
({ erc20Addresses: i, amountChanges: o, onChainCreation: A } = await D.processVolatileData(
|
|
44
|
-
t.getCurrentChainId(),
|
|
45
|
-
r,
|
|
46
|
-
i,
|
|
47
|
-
o
|
|
48
|
-
)), console.log("pre-amounts", o);
|
|
49
|
-
const p = await D.getVolatileExternalData(
|
|
50
|
-
t,
|
|
51
|
-
r,
|
|
52
|
-
c,
|
|
53
|
-
V,
|
|
54
|
-
I,
|
|
55
|
-
F
|
|
56
|
-
);
|
|
57
|
-
if (!p)
|
|
58
|
-
throw Error("No External Action Data");
|
|
59
|
-
(r === a.Withdraw && !n || r === a.Swap) && ({ flatFees: x } = await K(
|
|
60
|
-
t.getCurrentChainId(),
|
|
61
|
-
S,
|
|
62
|
-
W.Volatile,
|
|
63
|
-
c,
|
|
64
|
-
r
|
|
65
|
-
), r === a.Swap && (o[1] = 0n), console.log("hinkalActionVolatile flatFees:", {
|
|
66
|
-
flatFees: x,
|
|
67
|
-
erc20Addresses: i,
|
|
68
|
-
amountChanges: o,
|
|
69
|
-
originalAmountChanges: c,
|
|
70
|
-
externalActionData: p
|
|
71
|
-
}));
|
|
72
|
-
const g = [...await H(t, i, o)], U = `swapperM${o.length.toString()}x${g[0].length}x1`, d = [];
|
|
73
|
-
for (let e = 0; e < i.length; e += 1) {
|
|
74
|
-
const { outputUtxos: w } = L(t.userKeys, g[e], o[e]);
|
|
75
|
-
d.push(w);
|
|
76
|
-
}
|
|
77
|
-
const E = r === a.Deposit || n ? y : await t.getRandomRelay();
|
|
78
|
-
if (!n && !E)
|
|
79
|
-
throw Error(N.RELAYER_NOT_AVAILABLE);
|
|
80
|
-
const { zkCallData: m, circomData: l, dimData: s } = await M(
|
|
81
|
-
t.merkleTreeHinkal,
|
|
82
|
-
t.merkleTreeAccessToken,
|
|
83
|
-
g,
|
|
84
|
-
d,
|
|
85
|
-
t.userKeys,
|
|
86
|
-
U,
|
|
87
|
-
p.externalActionId,
|
|
88
|
-
p.externalAddress,
|
|
89
|
-
p.externalActionMetadata,
|
|
90
|
-
n ? y : E,
|
|
91
|
-
t.getCurrentChainId(),
|
|
92
|
-
A,
|
|
93
|
-
x
|
|
94
|
-
);
|
|
95
|
-
if (console.log("after proof generation"), r === a.Deposit) {
|
|
96
|
-
const e = t.getContractWithSigner(u.VolatileVault), w = t.getContractWithSigner(u.HinkalWrapper);
|
|
97
|
-
return console.log("here", { contractToApprove: e }), await C(
|
|
98
|
-
t,
|
|
99
|
-
c[0],
|
|
100
|
-
f,
|
|
101
|
-
m,
|
|
102
|
-
l,
|
|
103
|
-
s,
|
|
104
|
-
e,
|
|
105
|
-
w
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
return r === a.Withdraw && n ? await C(t, o[0], f, m, l, s) : T ? await P(t, m, s, l) : await b(t.getCurrentChainId(), m, s, l);
|
|
109
|
-
};
|
|
110
|
-
export {
|
|
111
|
-
Rt as hinkalActionVolatile
|
|
112
|
-
};
|
|
@@ -1,95 +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 { transactionErrorCodes as P } from "../../error-handling/error-codes.constants.js";
|
|
7
|
-
import { Utxo as A } from "../utxo/Utxo.js";
|
|
8
|
-
import "axios";
|
|
9
|
-
import "../crypto-keys/keys.js";
|
|
10
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
11
|
-
import { zeroAddress as f } from "../../constants/protocol.constants.js";
|
|
12
|
-
import { addPaddingToUtxos as U } from "../../functions/web3/events/getShieldedBalance.js";
|
|
13
|
-
import { outputUtxoProcessing as z } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
14
|
-
import { constructZkProof as T } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
15
|
-
import "../../webworker/workerFactory.js";
|
|
16
|
-
import "../../functions/utils/external-action.utils.js";
|
|
17
|
-
import { getERC20Token as C } from "../../functions/utils/erc20tokenFunctions.js";
|
|
18
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
19
|
-
import "../../constants/coingecko.constants.js";
|
|
20
|
-
import "../../constants/vite.constants.js";
|
|
21
|
-
import "../../functions/utils/userAgent.js";
|
|
22
|
-
import { transactCallDirect as D } from "../../functions/web3/functionCalls/transactCallDirect.js";
|
|
23
|
-
import "circomlibjs";
|
|
24
|
-
import "../../constants/reorg-depths.constants.js";
|
|
25
|
-
import "../../constants/kyc.constants.js";
|
|
26
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
27
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
28
|
-
import "libsodium-wrappers";
|
|
29
|
-
import "../../constants/contracts.constants.js";
|
|
30
|
-
import "../../constants/axelar.constants.js";
|
|
31
|
-
import "../../constants/rewards.constants.js";
|
|
32
|
-
const mt = async (t, i, r) => {
|
|
33
|
-
const s = C(i[0], t.getCurrentChainId());
|
|
34
|
-
if (!s)
|
|
35
|
-
throw Error("Deposit Action: No Token Found");
|
|
36
|
-
const a = r[0], o = {
|
|
37
|
-
externalActionId: 0n,
|
|
38
|
-
externalAddress: await t.getEthereumAddress(),
|
|
39
|
-
externalActionMetadata: "0x00"
|
|
40
|
-
}, e = [...await U(t, i, r)], p = `swapperM${r.length.toString()}x${e[0].length}x1`, m = [];
|
|
41
|
-
for (let n = 0; n < i.length; n += 1) {
|
|
42
|
-
const { outputUtxos: x } = z(t.userKeys, e[n], r[n]);
|
|
43
|
-
m.push(x);
|
|
44
|
-
}
|
|
45
|
-
const { zkCallData: d, circomData: u, dimData: l } = await T(
|
|
46
|
-
t.merkleTreeHinkal,
|
|
47
|
-
t.merkleTreeAccessToken,
|
|
48
|
-
e,
|
|
49
|
-
m,
|
|
50
|
-
t.userKeys,
|
|
51
|
-
p,
|
|
52
|
-
o.externalActionId,
|
|
53
|
-
o.externalAddress,
|
|
54
|
-
o.externalActionMetadata,
|
|
55
|
-
f,
|
|
56
|
-
t.getCurrentChainId()
|
|
57
|
-
);
|
|
58
|
-
return console.log("after proof generation"), await D(t, a, s, d, u, l);
|
|
59
|
-
}, ct = async (t, i, r, s) => {
|
|
60
|
-
console.log({ recipinetInfo: s });
|
|
61
|
-
const [a, o, e] = s.split(","), p = !a || !o || !e, m = o?.substring(0, 2) !== "0x" || e?.substring(0, 2) !== "0x", d = e?.length !== 66 || o?.length > 66 || o?.length < 64, u = s?.includes('"');
|
|
62
|
-
if (p || m || d || u)
|
|
63
|
-
throw Error(P.RECIPIENT_FORMAT_INCORRECT);
|
|
64
|
-
const l = [BigInt(a)], y = [o], n = i.map((c) => [
|
|
65
|
-
new A({ amount: 0n, erc20TokenAddress: c, shieldedPrivateKey: t.userKeys.getShieldedPrivateKey() }),
|
|
66
|
-
new A({ amount: 0n, erc20TokenAddress: c, shieldedPrivateKey: t.userKeys.getShieldedPrivateKey() })
|
|
67
|
-
]), x = `swapperM${r.length.toString()}x${n[0].length}x1`, E = i.map((c, g) => [
|
|
68
|
-
new A({
|
|
69
|
-
amount: r[g],
|
|
70
|
-
erc20TokenAddress: c,
|
|
71
|
-
randomization: l[g],
|
|
72
|
-
stealthAddress: y[g],
|
|
73
|
-
encryptionKey: e
|
|
74
|
-
})
|
|
75
|
-
]), { zkCallData: K, circomData: h, dimData: I } = await T(
|
|
76
|
-
t.merkleTreeHinkal,
|
|
77
|
-
t.merkleTreeAccessToken,
|
|
78
|
-
n,
|
|
79
|
-
E,
|
|
80
|
-
t.userKeys,
|
|
81
|
-
x,
|
|
82
|
-
0n,
|
|
83
|
-
await t.getEthereumAddress(),
|
|
84
|
-
"0x00",
|
|
85
|
-
f,
|
|
86
|
-
t.getCurrentChainId()
|
|
87
|
-
), w = C(i[0], t.getCurrentChainId());
|
|
88
|
-
if (!w)
|
|
89
|
-
throw Error("Withdraw Action: No Token Found");
|
|
90
|
-
return await D(t, r[0], w, K, h, I);
|
|
91
|
-
};
|
|
92
|
-
export {
|
|
93
|
-
mt as hinkalDeposit,
|
|
94
|
-
ct as hinkalDepositForOther
|
|
95
|
-
};
|
|
@@ -1,47 +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 "../crypto-keys/keys.js";
|
|
8
|
-
import "axios";
|
|
9
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
10
|
-
import "../../functions/web3/events/getShieldedBalance.js";
|
|
11
|
-
import "../../webworker/workerFactory.js";
|
|
12
|
-
import "../../functions/utils/external-action.utils.js";
|
|
13
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
14
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
15
|
-
import "../../functions/utils/userAgent.js";
|
|
16
|
-
import "../../constants/reorg-depths.constants.js";
|
|
17
|
-
import "../../constants/kyc.constants.js";
|
|
18
|
-
import "../../constants/coingecko.constants.js";
|
|
19
|
-
import "../../constants/vite.constants.js";
|
|
20
|
-
import "../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
|
-
import { API as i } from "../../API/API.js";
|
|
26
|
-
const q = (e) => ({
|
|
27
|
-
async getAccessToken() {
|
|
28
|
-
const r = e.getCurrentChainId();
|
|
29
|
-
return i.getZkMeAccessToken(r);
|
|
30
|
-
},
|
|
31
|
-
async getUserAccounts() {
|
|
32
|
-
return [await e.getEthereumAddress()];
|
|
33
|
-
},
|
|
34
|
-
async delegateTransaction(r) {
|
|
35
|
-
const t = await e.getProviderAdapter(), o = {
|
|
36
|
-
...r,
|
|
37
|
-
chainId: Number(r.chainId),
|
|
38
|
-
type: r.type ? r.type : void 0,
|
|
39
|
-
maxPriorityFeePerGas: r.maxPriorityFeePerGas ? r.maxPriorityFeePerGas : void 0,
|
|
40
|
-
maxFeePerGas: r.maxFeePerGas ? r.maxFeePerGas : void 0
|
|
41
|
-
};
|
|
42
|
-
return (await t.sendTransaction(o)).hash;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
export {
|
|
46
|
-
q as getHinkalZkMeProvider
|
|
47
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as A } from "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import { ExternalActionId as g } from "../../types/external-action.types.js";
|
|
4
|
-
import "../../types/transactions.types.js";
|
|
5
|
-
import "../../types/curve.types.js";
|
|
6
|
-
import "ethers";
|
|
7
|
-
import { transactionErrorCodes as w } from "../../error-handling/error-codes.constants.js";
|
|
8
|
-
import "circomlibjs";
|
|
9
|
-
import "../crypto-keys/keys.js";
|
|
10
|
-
import "axios";
|
|
11
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
12
|
-
import { addPaddingToUtxos as R } from "../../functions/web3/events/getShieldedBalance.js";
|
|
13
|
-
import { outputUtxoProcessing as U } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
14
|
-
import "../../webworker/workerFactory.js";
|
|
15
|
-
import "../../functions/utils/external-action.utils.js";
|
|
16
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
17
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
18
|
-
import "../../constants/coingecko.constants.js";
|
|
19
|
-
import "../../constants/vite.constants.js";
|
|
20
|
-
import { processAmountChanges as C } from "../../functions/pre-transaction/processAmountChanges.js";
|
|
21
|
-
import "../../functions/utils/userAgent.js";
|
|
22
|
-
import { estimateGasRelayer as I } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
23
|
-
import { transactCallRelayer as P } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
24
|
-
import "../../constants/reorg-depths.constants.js";
|
|
25
|
-
import "../../constants/kyc.constants.js";
|
|
26
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
27
|
-
import { constructEmporiumProof as T } from "../../functions/snarkjs/constructEmporiumProof.js";
|
|
28
|
-
import "libsodium-wrappers";
|
|
29
|
-
import "../../constants/contracts.constants.js";
|
|
30
|
-
import "../../constants/axelar.constants.js";
|
|
31
|
-
import "../../constants/rewards.constants.js";
|
|
32
|
-
const pt = async (t, i, o, u, d = [], l, E = !1) => {
|
|
33
|
-
const e = i.map((r) => 0n);
|
|
34
|
-
o = C({ erc20Addresses: i, amountChanges: o, flatFees: e, feeUnit: void 0, externalActionId: g.Emporium });
|
|
35
|
-
const m = [...await R(t, i, o)], p = [];
|
|
36
|
-
for (let r = 0; r < i.length; r += 1) {
|
|
37
|
-
const { outputUtxos: y } = U(t.userKeys, m[r], o[r]);
|
|
38
|
-
p.push(y);
|
|
39
|
-
}
|
|
40
|
-
const a = await t.getRandomRelay();
|
|
41
|
-
if (!a)
|
|
42
|
-
throw Error(w.RELAYER_NOT_AVAILABLE);
|
|
43
|
-
const { contractData: x } = A[t.getCurrentChainId()], s = x.emporiumAddress;
|
|
44
|
-
if (!s)
|
|
45
|
-
throw Error("No Emporium Address Provided");
|
|
46
|
-
const { zkCallData: n, circomData: c, dimData: f } = await T(
|
|
47
|
-
t.merkleTreeHinkal,
|
|
48
|
-
t.merkleTreeAccessToken,
|
|
49
|
-
m,
|
|
50
|
-
p,
|
|
51
|
-
t.userKeys,
|
|
52
|
-
o.length,
|
|
53
|
-
m[0].length,
|
|
54
|
-
s,
|
|
55
|
-
d,
|
|
56
|
-
a,
|
|
57
|
-
t.getCurrentChainId(),
|
|
58
|
-
u,
|
|
59
|
-
e,
|
|
60
|
-
l
|
|
61
|
-
);
|
|
62
|
-
return E ? await I(t, n, f, c) : await P(t.getCurrentChainId(), n, f, c);
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
pt as hinkalPrivateWallet
|
|
66
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as R } from "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import { ExternalActionId as n } from "../../types/external-action.types.js";
|
|
4
|
-
import "../../types/transactions.types.js";
|
|
5
|
-
import "../../types/curve.types.js";
|
|
6
|
-
import "ethers";
|
|
7
|
-
import { transactionErrorCodes as I } from "../../error-handling/error-codes.constants.js";
|
|
8
|
-
import "circomlibjs";
|
|
9
|
-
import "../crypto-keys/keys.js";
|
|
10
|
-
import "axios";
|
|
11
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
12
|
-
import { addPaddingToUtxos as U } from "../../functions/web3/events/getShieldedBalance.js";
|
|
13
|
-
import { outputUtxoProcessing as D } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
14
|
-
import { constructZkProof as T } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
15
|
-
import { estimateGasRelayer as b } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
16
|
-
import { transactCallRelayer as F } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
17
|
-
import "../../functions/utils/external-action.utils.js";
|
|
18
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
19
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
20
|
-
import "../../constants/coingecko.constants.js";
|
|
21
|
-
import "../../constants/vite.constants.js";
|
|
22
|
-
import { processAmountChanges as L } from "../../functions/pre-transaction/processAmountChanges.js";
|
|
23
|
-
import { getFlatFees as M } from "../../functions/pre-transaction/getFlatFees.js";
|
|
24
|
-
import "../../functions/utils/userAgent.js";
|
|
25
|
-
import "../../constants/reorg-depths.constants.js";
|
|
26
|
-
import "../../constants/kyc.constants.js";
|
|
27
|
-
import "../../webworker/workerFactory.js";
|
|
28
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
29
|
-
import "libsodium-wrappers";
|
|
30
|
-
import "../../constants/contracts.constants.js";
|
|
31
|
-
import "../../constants/axelar.constants.js";
|
|
32
|
-
import "../../constants/rewards.constants.js";
|
|
33
|
-
const N = (t, o) => {
|
|
34
|
-
const { contractData: r } = R[t.getCurrentChainId()];
|
|
35
|
-
let e;
|
|
36
|
-
switch (o) {
|
|
37
|
-
case n.Uniswap:
|
|
38
|
-
e = r?.uniswapExternalActionAddress;
|
|
39
|
-
break;
|
|
40
|
-
case n.Odos:
|
|
41
|
-
e = r?.odosExternalActionInstanceAddress;
|
|
42
|
-
break;
|
|
43
|
-
case n.OneInch:
|
|
44
|
-
e = r?.oneInchExternalActionInstanceAddress;
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
e = r?.uniswapExternalActionAddress;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
if (!e)
|
|
51
|
-
throw new Error("No external Address set during swap");
|
|
52
|
-
return e;
|
|
53
|
-
}, dt = async (t, o, r, e, u, A = !1, x = !1) => {
|
|
54
|
-
const { flatFees: p, feeUnit: w } = await M(
|
|
55
|
-
t.getCurrentChainId(),
|
|
56
|
-
o,
|
|
57
|
-
e,
|
|
58
|
-
r
|
|
59
|
-
);
|
|
60
|
-
r = L({ erc20Addresses: o, amountChanges: r, flatFees: p, feeUnit: w, externalActionId: e });
|
|
61
|
-
const E = N(t, e), s = {
|
|
62
|
-
externalActionId: e,
|
|
63
|
-
externalAddress: E,
|
|
64
|
-
externalActionMetadata: u
|
|
65
|
-
}, i = [...await U(t, o, r)], g = `swapperM${r.length.toString()}x${i[0].length}x1`, y = [!1, !0], m = [];
|
|
66
|
-
for (let a = 0; a < o.length; a += 1) {
|
|
67
|
-
const { outputUtxos: C } = D(t.userKeys, i[a], r[a]);
|
|
68
|
-
m.push(C);
|
|
69
|
-
}
|
|
70
|
-
const c = await t.getRandomRelay();
|
|
71
|
-
if (!c)
|
|
72
|
-
throw Error(I.RELAYER_NOT_AVAILABLE);
|
|
73
|
-
const { zkCallData: d, circomData: l, dimData: f } = await T(
|
|
74
|
-
t.merkleTreeHinkal,
|
|
75
|
-
t.merkleTreeAccessToken,
|
|
76
|
-
i,
|
|
77
|
-
m,
|
|
78
|
-
t.userKeys,
|
|
79
|
-
g,
|
|
80
|
-
s.externalActionId,
|
|
81
|
-
s.externalAddress,
|
|
82
|
-
s.externalActionMetadata,
|
|
83
|
-
c,
|
|
84
|
-
t.getCurrentChainId(),
|
|
85
|
-
y,
|
|
86
|
-
p
|
|
87
|
-
);
|
|
88
|
-
return A ? await b(t, d, f, l) : await F(
|
|
89
|
-
t.getCurrentChainId(),
|
|
90
|
-
d,
|
|
91
|
-
f,
|
|
92
|
-
l,
|
|
93
|
-
x
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
export {
|
|
97
|
-
dt as hinkalSwap
|
|
98
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import { ExternalActionId as l } from "../../types/external-action.types.js";
|
|
4
|
-
import "../../types/transactions.types.js";
|
|
5
|
-
import "../../types/curve.types.js";
|
|
6
|
-
import "ethers";
|
|
7
|
-
import { transactionErrorCodes as T } from "../../error-handling/error-codes.constants.js";
|
|
8
|
-
import { zeroAddress as I } from "../../constants/protocol.constants.js";
|
|
9
|
-
import "circomlibjs";
|
|
10
|
-
import "../crypto-keys/keys.js";
|
|
11
|
-
import "axios";
|
|
12
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
13
|
-
import { addPaddingToUtxos as y } from "../../functions/web3/events/getShieldedBalance.js";
|
|
14
|
-
import { outputUtxoProcessing as D } from "../../functions/pre-transaction/outputUtxoProcessing.js";
|
|
15
|
-
import { constructZkProof as U } from "../../functions/snarkjs/constructGeneralZkProof.js";
|
|
16
|
-
import { estimateGasRelayer as F } from "../../functions/web3/functionCalls/estimateGasRelayer.js";
|
|
17
|
-
import { transactCallRelayer as N } from "../../functions/web3/functionCalls/transactCallRelayer.js";
|
|
18
|
-
import { transactCallDirect as R } from "../../functions/web3/functionCalls/transactCallDirect.js";
|
|
19
|
-
import "../../functions/utils/external-action.utils.js";
|
|
20
|
-
import { getERC20Token as L } 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 { processAmountChanges as M } from "../../functions/pre-transaction/processAmountChanges.js";
|
|
25
|
-
import { getFlatFees as P } 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 "../custom-token-registry/CustomTokenRegistry.js";
|
|
32
|
-
import "libsodium-wrappers";
|
|
33
|
-
import "../../constants/contracts.constants.js";
|
|
34
|
-
import "../../constants/axelar.constants.js";
|
|
35
|
-
import "../../constants/rewards.constants.js";
|
|
36
|
-
const lt = async (t, i, r, u, e, A = !1) => {
|
|
37
|
-
const { flatFees: x, feeUnit: w } = await P(
|
|
38
|
-
t.getCurrentChainId(),
|
|
39
|
-
i,
|
|
40
|
-
l.Transact,
|
|
41
|
-
r
|
|
42
|
-
);
|
|
43
|
-
e || M({
|
|
44
|
-
erc20Addresses: i,
|
|
45
|
-
amountChanges: r,
|
|
46
|
-
flatFees: x,
|
|
47
|
-
feeUnit: w,
|
|
48
|
-
externalActionId: l.Transact
|
|
49
|
-
});
|
|
50
|
-
const a = L(i[0], t.getCurrentChainId());
|
|
51
|
-
if (!a)
|
|
52
|
-
throw Error("Deposit Action: No Token Found");
|
|
53
|
-
const n = {
|
|
54
|
-
externalActionId: 0n,
|
|
55
|
-
externalAddress: u,
|
|
56
|
-
externalActionMetadata: "0x00"
|
|
57
|
-
}, m = [...await y(t, i, r)], g = `swapperM${r.length.toString()}x${m[0].length}x1`, C = [!1], d = [];
|
|
58
|
-
for (let o = 0; o < i.length; o += 1) {
|
|
59
|
-
const { outputUtxos: E } = D(t.userKeys, m[o], r[o]);
|
|
60
|
-
d.push(E);
|
|
61
|
-
}
|
|
62
|
-
const f = await t.getRandomRelay();
|
|
63
|
-
if (!e && !f)
|
|
64
|
-
throw Error(T.RELAYER_NOT_AVAILABLE);
|
|
65
|
-
const { zkCallData: p, circomData: c, dimData: s } = await U(
|
|
66
|
-
t.merkleTreeHinkal,
|
|
67
|
-
t.merkleTreeAccessToken,
|
|
68
|
-
m,
|
|
69
|
-
d,
|
|
70
|
-
t.userKeys,
|
|
71
|
-
g,
|
|
72
|
-
n.externalActionId,
|
|
73
|
-
n.externalAddress,
|
|
74
|
-
n.externalActionMetadata,
|
|
75
|
-
e ? I : f,
|
|
76
|
-
t.getCurrentChainId(),
|
|
77
|
-
C,
|
|
78
|
-
x
|
|
79
|
-
);
|
|
80
|
-
if (A)
|
|
81
|
-
return await F(t, p, s, c);
|
|
82
|
-
if (e) {
|
|
83
|
-
if (!a)
|
|
84
|
-
throw Error("Withdraw Action: No Token Found");
|
|
85
|
-
return await R(t, r[0], a, p, c, s);
|
|
86
|
-
}
|
|
87
|
-
return await N(t.getCurrentChainId(), p, s, c);
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
lt as hinkalWithdraw
|
|
91
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as i } from "../../constants/chains.constants.js";
|
|
2
|
-
import "../../types/circom-data.types.js";
|
|
3
|
-
import { ContractType as r } from "../../types/ethereum-network.types.js";
|
|
4
|
-
import "../../types/transactions.types.js";
|
|
5
|
-
import "../../types/curve.types.js";
|
|
6
|
-
import "ethers";
|
|
7
|
-
import "circomlibjs";
|
|
8
|
-
import "../crypto-keys/keys.js";
|
|
9
|
-
import "axios";
|
|
10
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
11
|
-
import "../../functions/web3/events/getShieldedBalance.js";
|
|
12
|
-
import "../../webworker/workerFactory.js";
|
|
13
|
-
import "../../functions/utils/external-action.utils.js";
|
|
14
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
15
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
16
|
-
import "../../constants/coingecko.constants.js";
|
|
17
|
-
import "../../constants/vite.constants.js";
|
|
18
|
-
import "../../functions/utils/userAgent.js";
|
|
19
|
-
import { ClientAccessTokenSnapshotService as m } from "../snapshot/ClientAccessTokenSnapshotService.js";
|
|
20
|
-
import { ClientCommitmentsSnapshotService as n } from "../snapshot/ClientCommitmentsSnapshotService.js";
|
|
21
|
-
import { ClientNullifierSnapshotService as c } from "../snapshot/ClientNullifierSnapshotService.js";
|
|
22
|
-
import "../../constants/kyc.constants.js";
|
|
23
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
24
|
-
import "../../constants/reorg-depths.constants.js";
|
|
25
|
-
import { balanceChangedHandler as o } from "../../functions/web3/events/balanceChangedHandler.js";
|
|
26
|
-
import "libsodium-wrappers";
|
|
27
|
-
import "../../constants/contracts.constants.js";
|
|
28
|
-
import "../../constants/axelar.constants.js";
|
|
29
|
-
import "../../constants/rewards.constants.js";
|
|
30
|
-
const j = async (e) => {
|
|
31
|
-
const { maxPageSize: t } = i[e.getCurrentChainId()];
|
|
32
|
-
e.commitmentsSnapshotService?.intervalClear(), e.commitmentsSnapshotService = new n(
|
|
33
|
-
e.getContractWithFetcher(r.HinkalContract),
|
|
34
|
-
t
|
|
35
|
-
), e.nullifierSnapshotService?.intervalClear(), e.nullifierSnapshotService = new c(
|
|
36
|
-
e.getContractWithFetcher(r.HinkalContract),
|
|
37
|
-
t
|
|
38
|
-
), e.accessTokenSnapshotService?.intervalClear(), e.accessTokenSnapshotService = new m(
|
|
39
|
-
e.getContractWithFetcher(r.CrossChainAccessTokenContract),
|
|
40
|
-
t
|
|
41
|
-
), await Promise.all([
|
|
42
|
-
e.commitmentsSnapshotService.init(),
|
|
43
|
-
e.nullifierSnapshotService.init(),
|
|
44
|
-
e.accessTokenSnapshotService.init()
|
|
45
|
-
]), e.merkleTreeHinkal = e.commitmentsSnapshotService.merkleTree, e.merkleTreeAccessToken = e.accessTokenSnapshotService.merkleTree, e.nullifiers = e.nullifierSnapshotService.nullifiers, e.encryptedOutputs = e.commitmentsSnapshotService.encryptedOutputs, e.commitmentsSnapshotService.onNewEvent = o, e.nullifierSnapshotService.onNewEvent = o;
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
j as resetMerkleTrees
|
|
49
|
-
};
|
|
@@ -1,83 +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 { Utxo as p } from "../utxo/Utxo.js";
|
|
7
|
-
import "axios";
|
|
8
|
-
import "../crypto-keys/keys.js";
|
|
9
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
10
|
-
import "../../functions/web3/events/getShieldedBalance.js";
|
|
11
|
-
import { performTaskWithWorker as n } from "../../webworker/performTaskWithWorker.js";
|
|
12
|
-
import { WorkerVariant as c } from "../../webworker/worker.registry.js";
|
|
13
|
-
import "../../functions/utils/external-action.utils.js";
|
|
14
|
-
import "../custom-token-registry/CustomTokenRegistry.js";
|
|
15
|
-
import "../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
16
|
-
import "../../functions/utils/userAgent.js";
|
|
17
|
-
import "circomlibjs";
|
|
18
|
-
import "../../constants/reorg-depths.constants.js";
|
|
19
|
-
import "../../constants/kyc.constants.js";
|
|
20
|
-
import "../../constants/coingecko.constants.js";
|
|
21
|
-
import "../../constants/vite.constants.js";
|
|
22
|
-
import "../volatile-helper/VolatileHelper.js";
|
|
23
|
-
import { UtxoWorkerActionType as m } from "../../webworker/utxoWorker/utxoWorker.types.js";
|
|
24
|
-
import "libsodium-wrappers";
|
|
25
|
-
import "../../constants/contracts.constants.js";
|
|
26
|
-
import "../../constants/axelar.constants.js";
|
|
27
|
-
import "../../constants/rewards.constants.js";
|
|
28
|
-
class l {
|
|
29
|
-
get NUM_WORKERS() {
|
|
30
|
-
return 5;
|
|
31
|
-
}
|
|
32
|
-
async createUtxoPromise(t) {
|
|
33
|
-
return await n({
|
|
34
|
-
type: c.UTXO,
|
|
35
|
-
payload: t
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
async batchFilterUtxosWithNullifier(t, r) {
|
|
39
|
-
const e = this.sliceArrayIntoParts(t, this.NUM_WORKERS).map(
|
|
40
|
-
(s) => this.createUtxoPromise(
|
|
41
|
-
{
|
|
42
|
-
type: m.BATCH_FILTER_UTXOS_WITH_NULLIFIER,
|
|
43
|
-
data: {
|
|
44
|
-
utxos: s.map((i) => i.getConstructableParams()),
|
|
45
|
-
nullifiers: r
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
return (await Promise.all(e)).flat().map((s) => new p(s));
|
|
51
|
-
}
|
|
52
|
-
async buildBatchProcess(t, r) {
|
|
53
|
-
const e = this.sliceArrayIntoParts(t, this.NUM_WORKERS).map(
|
|
54
|
-
(i) => this.createUtxoPromise(
|
|
55
|
-
{ type: m.BUILD_UTXOS, data: { signature: r.getSignature(), encryptedOutputs: i } }
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
return (await Promise.all(e)).flat().map((i) => new p(i));
|
|
59
|
-
}
|
|
60
|
-
sliceArrayIntoParts(t, r) {
|
|
61
|
-
const o = Math.ceil(t.length / r);
|
|
62
|
-
return Array.from(
|
|
63
|
-
{ length: r },
|
|
64
|
-
(a, s) => t.slice(o * s, o * (s + 1))
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
async batchProcess(t, r, o) {
|
|
68
|
-
const e = {
|
|
69
|
-
type: m.DECIPHER_OUTPUTS,
|
|
70
|
-
data: {
|
|
71
|
-
encryptedOutputs: t,
|
|
72
|
-
lastOutput: r,
|
|
73
|
-
signature: o.getSignature()
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return await this.createUtxoPromise(e);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const K = new l();
|
|
80
|
-
export {
|
|
81
|
-
l as MultiThreadedUtxoUtils,
|
|
82
|
-
K as multiThreadedUtxoUtils
|
|
83
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
class e {
|
|
2
|
-
constructor(t) {
|
|
3
|
-
this.timeoutInMs = t, this.setTimer();
|
|
4
|
-
}
|
|
5
|
-
timeoutInMs;
|
|
6
|
-
values = {};
|
|
7
|
-
setTimer() {
|
|
8
|
-
if (this.timeoutInMs > 0) {
|
|
9
|
-
const t = this;
|
|
10
|
-
setInterval(() => {
|
|
11
|
-
t.onTimeout();
|
|
12
|
-
}, this.timeoutInMs);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
// clear cache when times-up
|
|
16
|
-
onTimeout() {
|
|
17
|
-
this.clear();
|
|
18
|
-
}
|
|
19
|
-
clear() {
|
|
20
|
-
this.values = {};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
e as ValueCache
|
|
25
|
-
};
|