@hinkal/common 0.0.110 → 0.0.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index-DXElTGy9.mjs +254449 -0
- package/index.js +455 -642
- package/package.json +1 -1
- package/{webworker/snarkjsWorker/snarkjsWorkerLogic.js → snarkjsWorkerLogic-CVna_BW9.mjs} +1 -1
- package/utxoWorkerLogic-B1Hh-bq4.mjs +64 -0
- package/{webworker/workerProxy.js → workerProxy-BDj498Ht.mjs} +1 -1
- package/zkProofWorkerLogic-D9rxuuiK.mjs +60 -0
- package/API/API.js +0 -58
- package/API/HinkalPointsCalls.js +0 -38
- package/API/callBeefyGraphAPI.js +0 -37
- package/API/callCurveAPI.js +0 -156
- package/API/callMonitor.js +0 -30
- package/API/callOdosAPI.js +0 -44
- package/API/callOneInchAPI.js +0 -37
- package/API/callRelayer.js +0 -32
- package/API/checkRisk.js +0 -30
- package/API/dataServerCalls.js +0 -32
- package/API/fetchCommitmentsCache.js +0 -31
- package/API/fetchNullifiers.js +0 -30
- package/API/getAxelarGasEstimate.js +0 -37
- package/API/getCoingeckoPrice.js +0 -27
- package/API/getConnextReceiveFee.js +0 -30
- package/API/getGasEstimates.js +0 -38
- package/API/getRelayerURL.js +0 -32
- package/API/getServerURL.js +0 -67
- package/API/getTokenPrice.js +0 -41
- package/API/kycCalls.js +0 -32
- package/API/passwordCalls.js +0 -36
- package/API/referralProgramCalls.js +0 -58
- package/API/relayCalls.js +0 -30
- package/API/restoreSnapshots.js +0 -32
- package/API/rewardsPointsCalls.js +0 -40
- package/API/userVerifyTransactions.js +0 -45
- package/constants/assets.constants.js +0 -16
- package/constants/axelar.constants.js +0 -55
- package/constants/backend.constants.js +0 -18
- package/constants/beefy.registry.js +0 -24
- package/constants/chains.constants.js +0 -204
- package/constants/coingecko.constants.js +0 -53
- package/constants/contracts.constants.js +0 -276
- package/constants/crvCvx.registry.js +0 -636
- package/constants/crvDynamic.registry.js +0 -24
- package/constants/deploy-data/deploy-data-arbMainnet.json.js +0 -7415
- package/constants/deploy-data/deploy-data-avalanche.json.js +0 -7411
- package/constants/deploy-data/deploy-data-axelar1.json.js +0 -4329
- package/constants/deploy-data/deploy-data-axelar2.json.js +0 -4329
- package/constants/deploy-data/deploy-data-base.json.js +0 -8425
- package/constants/deploy-data/deploy-data-blast.json.js +0 -9600
- package/constants/deploy-data/deploy-data-bnbMainnet.json.js +0 -6877
- package/constants/deploy-data/deploy-data-ethMainnet.json.js +0 -11427
- package/constants/deploy-data/deploy-data-localhost.json.js +0 -13283
- package/constants/deploy-data/deploy-data-optimism.json.js +0 -7417
- package/constants/deploy-data/deploy-data-polygon.json.js +0 -7439
- package/constants/fees.constants.js +0 -57
- package/constants/kyc.constants.js +0 -118
- package/constants/lido.constants.js +0 -13
- package/constants/pendle.registry.js +0 -253
- package/constants/protocol.constants.js +0 -26
- package/constants/reorg-depths.constants.js +0 -15
- package/constants/rewards.constants.js +0 -27
- package/constants/server.constants.js +0 -157
- package/constants/token-data/ERC20Registry.js +0 -85
- package/constants/token-data/arbMainnetRegistry.json.js +0 -946
- package/constants/token-data/arbMainnetRegistryFixed.json.js +0 -856
- package/constants/token-data/avalancheRegistry.json.js +0 -591
- package/constants/token-data/avalancheRegistryFixed.json.js +0 -591
- package/constants/token-data/baseRegistry.json.js +0 -490
- package/constants/token-data/baseRegistryFixed.json.js +0 -463
- package/constants/token-data/blastRegistry.json.js +0 -137
- package/constants/token-data/blastRegistryFixed.json.js +0 -137
- package/constants/token-data/bnbMainnetRegistry.json.js +0 -973
- package/constants/token-data/bnbMainnetRegistryFixed.json.js +0 -973
- package/constants/token-data/coingeckoRegistry.json.js +0 -115623
- package/constants/token-data/ethMainnetRegistry.json.js +0 -2700
- package/constants/token-data/ethMainnetRegistryFixed.json.js +0 -2251
- package/constants/token-data/index.js +0 -6
- package/constants/token-data/localhostRegistry.json.js +0 -2768
- package/constants/token-data/optimismRegistry.json.js +0 -1455
- package/constants/token-data/optimismRegistryFixed.json.js +0 -1392
- package/constants/token-data/polygonRegistry.json.js +0 -1327
- package/constants/token-data/polygonRegistryFixed.json.js +0 -1255
- package/constants/token-data/popularTokens.constants.js +0 -14
- package/constants/token-data/tokenPricing.consts.js +0 -8
- package/constants/vite.constants.js +0 -29
- package/crypto/babyJub.js +0 -15
- package/crypto/poseidon.js +0 -26
- package/crypto/preProcessing.js +0 -9
- package/data-structures/Hinkal/Hinkal.js +0 -299
- package/data-structures/Hinkal/hinkalActionBeefy.js +0 -101
- package/data-structures/Hinkal/hinkalActionConvex.js +0 -83
- package/data-structures/Hinkal/hinkalActionCurve.js +0 -112
- package/data-structures/Hinkal/hinkalActionLidoEth.js +0 -91
- package/data-structures/Hinkal/hinkalActionPendle.js +0 -140
- package/data-structures/Hinkal/hinkalActionPendleLP.js +0 -96
- package/data-structures/Hinkal/hinkalActionStake.js +0 -138
- package/data-structures/Hinkal/hinkalActionVolatile.js +0 -112
- package/data-structures/Hinkal/hinkalDeposit.js +0 -95
- package/data-structures/Hinkal/hinkalGetZkMeProvider.js +0 -47
- package/data-structures/Hinkal/hinkalPrivateWallet.js +0 -66
- package/data-structures/Hinkal/hinkalSwap.js +0 -98
- package/data-structures/Hinkal/hinkalTransfer.js +0 -5
- package/data-structures/Hinkal/hinkalWithdraw.js +0 -91
- package/data-structures/Hinkal/resetMerkleTrees.js +0 -49
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.js +0 -83
- package/data-structures/ValueCache/ValueCache.js +0 -25
- package/data-structures/crypto-keys/decodeUTXO.js +0 -40
- package/data-structures/crypto-keys/encryptDecryptUtxo.js +0 -41
- package/data-structures/crypto-keys/keyUtils.js +0 -10
- package/data-structures/crypto-keys/keys.js +0 -90
- package/data-structures/custom-token-registry/CustomTokenRegistry.js +0 -33
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.js +0 -131
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.js +0 -132
- package/data-structures/event-service/AbstractEventService.js +0 -118
- package/data-structures/event-service/AbstractNullifierSnapshotService.js +0 -59
- package/data-structures/event-service/AbstractSnapshotService.js +0 -35
- package/data-structures/merkle-tree/MerkleTree.js +0 -177
- package/data-structures/merkle-tree/MerkleTreeIncompleteError.js +0 -8
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.js +0 -48
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.js +0 -47
- package/data-structures/snapshot/ClientNullifierSnapshotService.js +0 -44
- package/data-structures/token-price-fetcher/TokenChecker.js +0 -29
- package/data-structures/token-price-fetcher/TokenPriceFetcher.js +0 -218
- package/data-structures/transactions-manager/TransactionsManager.js +0 -194
- package/data-structures/transactions-manager/history/getBeefyData.js +0 -68
- package/data-structures/transactions-manager/history/getConvexData.js +0 -57
- package/data-structures/transactions-manager/history/getCurveData.js +0 -97
- package/data-structures/transactions-manager/history/getDepositData.js +0 -36
- package/data-structures/transactions-manager/history/getLidoData.js +0 -44
- package/data-structures/transactions-manager/history/getPendleData.js +0 -59
- package/data-structures/transactions-manager/history/getSwapData.js +0 -43
- package/data-structures/transactions-manager/history/getTxDetails.js +0 -74
- package/data-structures/transactions-manager/history/getVolatileData.js +0 -75
- package/data-structures/transactions-manager/history/history.types.js +0 -62
- package/data-structures/transactions-manager/history/history.utils.js +0 -8
- package/data-structures/utxo/Utxo.js +0 -134
- package/data-structures/volatile-helper/VolatileHelper.js +0 -181
- package/error-handling/customErrors/ErrorWithAmount.js +0 -9
- package/error-handling/customErrors/FeeOverTransactionValueError.js +0 -9
- package/error-handling/customErrors/customErrors.helpers.js +0 -21
- package/error-handling/error-codes.constants.js +0 -184
- package/error-handling/get-error.message.js +0 -53
- package/error-handling/handleErrorRestore.js +0 -35
- package/error-handling/logError.js +0 -7
- package/error-handling/types.js +0 -4
- package/externalABIs/BUSD.js +0 -519
- package/externalABIs/BabPassport.json.js +0 -24
- package/externalABIs/BeefyRouterAbi.json.js +0 -1022
- package/externalABIs/BeefyStrategyAbi.json.js +0 -1423
- package/externalABIs/BeefyVaultAbi.json.js +0 -570
- package/externalABIs/BeefyZapAbi.json.js +0 -208
- package/externalABIs/BeefyZapOneInchAbi.json.js +0 -340
- package/externalABIs/ConvexBoosterAbi.json.js +0 -674
- package/externalABIs/ConvexBoosterAbiMainnet.json.js +0 -1002
- package/externalABIs/ConvexRewardPoolAbi.json.js +0 -883
- package/externalABIs/CurveReadingWrapperAbi.json.js +0 -1422
- package/externalABIs/CurveWrappedMainPool.json.js +0 -1136
- package/externalABIs/CurveZap.json.js +0 -262
- package/externalABIs/CvxCrvUtilities.json.js +0 -264
- package/externalABIs/DAI.js +0 -334
- package/externalABIs/ERC20.json.js +0 -291
- package/externalABIs/GalxePassport.json.js +0 -41
- package/externalABIs/IQuoterV2.json.js +0 -205
- package/externalABIs/ISwapRouter.json.js +0 -568
- package/externalABIs/IUniswapV3Factory.json.js +0 -201
- package/externalABIs/IUniswapV3Pool.json.js +0 -999
- package/externalABIs/LidoStEthAbi.json.js +0 -1603
- package/externalABIs/LidoStMaticAbi.json.js +0 -1764
- package/externalABIs/LidoStakeManagerAbi.json.js +0 -2082
- package/externalABIs/LidoWithdrawalQueueERC721Abi.json.js +0 -2030
- package/externalABIs/LidoWstEthAbi.json.js +0 -480
- package/externalABIs/OptimismGasPriceOracle.json.js +0 -206
- package/externalABIs/PendleRouterAbi.json.js +0 -173
- package/externalABIs/PoLidoNftAbi.json.js +0 -701
- package/externalABIs/SanctionsList.js +0 -89
- package/externalABIs/USDC.js +0 -721
- package/externalABIs/USDR.js +0 -346
- package/externalABIs/USDR3CRV.js +0 -542
- package/externalABIs/USDT.js +0 -393
- package/externalABIs/UniswapV2PoolAbi.json.js +0 -80
- package/externalABIs/WETH.js +0 -156
- package/externalABIs/amToken.js +0 -350
- package/externalABIs/transactionsProver.json.js +0 -39
- package/functions/kyc/authentoHelper.js +0 -42
- package/functions/kyc/passportHelper.js +0 -39
- package/functions/kyc/zkMeHelper.js +0 -56
- package/functions/pre-transaction/getFlatFees.js +0 -203
- package/functions/pre-transaction/interaction-to-action.js +0 -57
- package/functions/pre-transaction/outputUtxoProcessing.js +0 -45
- package/functions/pre-transaction/process-gas-estimates.js +0 -57
- package/functions/pre-transaction/processAmountChanges.js +0 -229
- package/functions/private-wallet/emporium.helpers.js +0 -19
- package/functions/private-wallet/opProducer.js +0 -24
- package/functions/protocols/convex.protocols.js +0 -41
- package/functions/protocols/curve.protocols.js +0 -45
- package/functions/protocols/pendle.helpers.js +0 -108
- package/functions/snarkjs/common.snarkjs.js +0 -96
- package/functions/snarkjs/constant.js +0 -211
- package/functions/snarkjs/constructEmporiumProof.js +0 -105
- package/functions/snarkjs/constructGeneralZkProof.js +0 -129
- package/functions/snarkjs/generateCircomData.js +0 -60
- package/functions/snarkjs/generateZkProof.js +0 -18
- package/functions/snarkjs/getZKFiles.js +0 -30
- package/functions/staking/index.js +0 -40
- package/functions/utils/amounts.utils.js +0 -70
- package/functions/utils/axelar.utils.js +0 -38
- package/functions/utils/cacheFunctions.js +0 -67
- package/functions/utils/caseInsensitive.utils.js +0 -6
- package/functions/utils/convertIntegrationProviderToExternalActionId.js +0 -16
- package/functions/utils/create-provider.js +0 -5
- package/functions/utils/enum.utils.js +0 -14
- package/functions/utils/erc20tokenFunctions.js +0 -20
- package/functions/utils/evmNetworkFunctions.js +0 -29
- package/functions/utils/external-action.utils.js +0 -61
- package/functions/utils/getDataFromTransaction.js +0 -105
- package/functions/utils/memoize.utils.js +0 -14
- package/functions/utils/nickname.utils.js +0 -7
- package/functions/utils/process.utils.js +0 -4
- package/functions/utils/reloadPage.js +0 -4
- package/functions/utils/requireEnv.js +0 -7
- package/functions/utils/resolve-sync.utils.js +0 -22
- package/functions/utils/serialize.utils.js +0 -4
- package/functions/utils/string.utils.js +0 -14
- package/functions/utils/time.utils.js +0 -8
- package/functions/utils/userAgent.js +0 -15
- package/functions/utils/volatile-patcher.utils.js +0 -40
- package/functions/web3/etherFunctions.js +0 -41
- package/functions/web3/events/balanceChangedHandler.js +0 -10
- package/functions/web3/events/getInputUtxoAndBalance.js +0 -72
- package/functions/web3/events/getShieldedBalance.js +0 -107
- package/functions/web3/events/web3RetrieveEvents.js +0 -9
- package/functions/web3/functionCalls/accessTokenCalls.js +0 -48
- package/functions/web3/functionCalls/approveToken.js +0 -153
- package/functions/web3/functionCalls/estimateGasRelayer.js +0 -18
- package/functions/web3/functionCalls/transactCallDirect.js +0 -60
- package/functions/web3/functionCalls/transactCallRelayer.js +0 -42
- package/functions/web3/odosAPI.js +0 -65
- package/functions/web3/oneInchAPI.js +0 -61
- package/functions/web3/runContractFunction.js +0 -95
- package/functions/web3/uniswapAPI.js +0 -97
- package/types/beefy.types.js +0 -21
- package/types/circom-data.types.js +0 -22
- package/types/curve.types.js +0 -25
- package/types/ethereum-network.types.js +0 -4
- package/types/external-action.types.js +0 -4
- package/types/hinkal.stake.types.js +0 -4
- package/types/hinkal.types.js +0 -15
- package/types/kyc.types.js +0 -13
- package/types/pendle.types.js +0 -15
- package/types/rewards.types.js +0 -27
- package/types/slippage.types.js +0 -15
- package/types/time.types.js +0 -58
- package/types/token.types.js +0 -4
- package/types/transactions.types.js +0 -36
- package/webworker/performTaskWithWorker.js +0 -62
- package/webworker/snarkjsWorker/snarkjsWorker.types.js +0 -4
- package/webworker/utxoWorker/utxoWorker.types.js +0 -4
- package/webworker/utxoWorker/utxoWorkerLogic.js +0 -70
- package/webworker/worker.registry.js +0 -4
- package/webworker/workerFactory.js +0 -42
- package/webworker/zkProofWorker/zkProofWorker.types.js +0 -4
- package/webworker/zkProofWorker/zkProofWorkerLogic.js +0 -66
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import "../../../types/circom-data.types.js";
|
|
2
|
-
import { ExternalActionId as t } from "../../../types/external-action.types.js";
|
|
3
|
-
import "../../../types/transactions.types.js";
|
|
4
|
-
import "../../../types/curve.types.js";
|
|
5
|
-
import { getNonLocalhostChainId as n } from "../../../constants/chains.constants.js";
|
|
6
|
-
import "../../../constants/vite.constants.js";
|
|
7
|
-
import "../../../constants/contracts.constants.js";
|
|
8
|
-
import "../../../constants/kyc.constants.js";
|
|
9
|
-
import "../../../constants/coingecko.constants.js";
|
|
10
|
-
import "../../../constants/axelar.constants.js";
|
|
11
|
-
import "../../../constants/rewards.constants.js";
|
|
12
|
-
import "../../../constants/reorg-depths.constants.js";
|
|
13
|
-
import "ethers";
|
|
14
|
-
import "circomlibjs";
|
|
15
|
-
import "../../crypto-keys/keys.js";
|
|
16
|
-
import "axios";
|
|
17
|
-
import "../../crypto-keys/encryptDecryptUtxo.js";
|
|
18
|
-
import "../../../functions/web3/events/getShieldedBalance.js";
|
|
19
|
-
import "../../../webworker/workerFactory.js";
|
|
20
|
-
import { getExternalActionIdHash as r } from "../../../functions/utils/external-action.utils.js";
|
|
21
|
-
import "../../custom-token-registry/CustomTokenRegistry.js";
|
|
22
|
-
import "../../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
23
|
-
import { logError as c } from "../../../error-handling/logError.js";
|
|
24
|
-
import "../../../functions/utils/userAgent.js";
|
|
25
|
-
import { getBeefyData as p } from "./getBeefyData.js";
|
|
26
|
-
import { getConvexData as s } from "./getConvexData.js";
|
|
27
|
-
import { getCurveData as l } from "./getCurveData.js";
|
|
28
|
-
import { getDepositData as d } from "./getDepositData.js";
|
|
29
|
-
import { getSwapData as f } from "./getSwapData.js";
|
|
30
|
-
import { TransactionType as T, externalActionToTransactionType as g } from "./history.types.js";
|
|
31
|
-
import { getLidoData as C } from "./getLidoData.js";
|
|
32
|
-
import { getPendleData as D } from "./getPendleData.js";
|
|
33
|
-
import { getVolatileData as I } from "./getVolatileData.js";
|
|
34
|
-
import "../../volatile-helper/VolatileHelper.js";
|
|
35
|
-
import "libsodium-wrappers";
|
|
36
|
-
const tt = async (i, e, a = []) => {
|
|
37
|
-
try {
|
|
38
|
-
const o = n(i);
|
|
39
|
-
switch (e.externalActionId.toBigInt()) {
|
|
40
|
-
case r(t.Transact):
|
|
41
|
-
case 0n:
|
|
42
|
-
return d(e, o);
|
|
43
|
-
case r(t.Uniswap):
|
|
44
|
-
case r(t.Odos):
|
|
45
|
-
case r(t.OneInch):
|
|
46
|
-
return f(e, a, o);
|
|
47
|
-
case r(t.Beefy):
|
|
48
|
-
return p(e, a, o);
|
|
49
|
-
case r(t.Curve):
|
|
50
|
-
case r(t.CurveCRV):
|
|
51
|
-
case r(t.CurveDynamic):
|
|
52
|
-
case r(t.CurveCRVRewards):
|
|
53
|
-
return l(e, a, o);
|
|
54
|
-
case r(t.Convex):
|
|
55
|
-
return s(e, a, o);
|
|
56
|
-
case r(t.LidoETH):
|
|
57
|
-
case r(t.LidoETHNFT):
|
|
58
|
-
case r(t.LidoMATIC):
|
|
59
|
-
case r(t.LidoMATICNFT):
|
|
60
|
-
return C(e, a, o);
|
|
61
|
-
case r(t.Pendle):
|
|
62
|
-
return D(e, a, o);
|
|
63
|
-
case r(t.Volatile):
|
|
64
|
-
return await I(e, a, o);
|
|
65
|
-
default:
|
|
66
|
-
return { type: T.UNKNOWN };
|
|
67
|
-
}
|
|
68
|
-
} catch (o) {
|
|
69
|
-
return c(o), { type: g(e) };
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
export {
|
|
73
|
-
tt as getTxDetails
|
|
74
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { TransactionType as d } from "./history.types.js";
|
|
2
|
-
import "../../../types/circom-data.types.js";
|
|
3
|
-
import { VolatileAction as A } from "../../../types/hinkal.types.js";
|
|
4
|
-
import "../../../types/transactions.types.js";
|
|
5
|
-
import "../../../types/curve.types.js";
|
|
6
|
-
import { getERC20Registry as W } from "../../../constants/token-data/ERC20Registry.js";
|
|
7
|
-
import "../../../constants/chains.constants.js";
|
|
8
|
-
import "../../../constants/vite.constants.js";
|
|
9
|
-
import "../../../constants/contracts.constants.js";
|
|
10
|
-
import "../../../constants/kyc.constants.js";
|
|
11
|
-
import "../../../constants/coingecko.constants.js";
|
|
12
|
-
import "../../../constants/axelar.constants.js";
|
|
13
|
-
import "../../../constants/rewards.constants.js";
|
|
14
|
-
import "../../../constants/reorg-depths.constants.js";
|
|
15
|
-
import { caseInsensitiveEqual as a } from "../../../functions/utils/caseInsensitive.utils.js";
|
|
16
|
-
import "ethers";
|
|
17
|
-
import "circomlibjs";
|
|
18
|
-
import "../../crypto-keys/keys.js";
|
|
19
|
-
import "axios";
|
|
20
|
-
import "../../crypto-keys/encryptDecryptUtxo.js";
|
|
21
|
-
import "../../../functions/web3/events/getShieldedBalance.js";
|
|
22
|
-
import "../../../webworker/workerFactory.js";
|
|
23
|
-
import "../../../functions/utils/external-action.utils.js";
|
|
24
|
-
import { getERC20Token as l } from "../../../functions/utils/erc20tokenFunctions.js";
|
|
25
|
-
import "../../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
26
|
-
import "../../../functions/utils/userAgent.js";
|
|
27
|
-
import { VolatileHelper as g } from "../../volatile-helper/VolatileHelper.js";
|
|
28
|
-
import "../../custom-token-registry/CustomTokenRegistry.js";
|
|
29
|
-
import "libsodium-wrappers";
|
|
30
|
-
const _ = async (r, u, n) => {
|
|
31
|
-
const c = W(n), { externalActionMetadata: B } = r, { volatileAmounts: m, redirectActionId: E, volatileAction: p } = g.decodeVolatileMetadata(B);
|
|
32
|
-
if (p === A.Deposit) {
|
|
33
|
-
const s = r.erc20TokenAddresses[0], t = c.find((e) => a(e.sharedAddress, s));
|
|
34
|
-
if (!t)
|
|
35
|
-
throw Error("Volatile not found in statistics");
|
|
36
|
-
return {
|
|
37
|
-
tokenWithBalance: {
|
|
38
|
-
token: l(t.erc20TokenAddress, n) ?? { erc20TokenAddress: t.erc20TokenAddress },
|
|
39
|
-
balance: m[0].toBigInt()
|
|
40
|
-
},
|
|
41
|
-
type: d.DEPOSIT
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
if (p === A.Withdraw) {
|
|
45
|
-
const s = r.erc20TokenAddresses[0], t = c.find((e) => a(e.sharedAddress, s));
|
|
46
|
-
if (!t)
|
|
47
|
-
throw Error("Volatile not found in statistics");
|
|
48
|
-
return {
|
|
49
|
-
tokenWithBalance: {
|
|
50
|
-
token: l(t.erc20TokenAddress, n) ?? { erc20TokenAddress: t.erc20TokenAddress },
|
|
51
|
-
balance: m[0].toBigInt()
|
|
52
|
-
},
|
|
53
|
-
type: d.WITHDRAW
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (p === A.Swap) {
|
|
57
|
-
const s = r.erc20TokenAddresses[0], t = r.erc20TokenAddresses[1], k = r.amountChanges[0].toBigInt(), i = c.find((o) => a(o.sharedAddress, s)), e = c.find((o) => a(o.sharedAddress, t));
|
|
58
|
-
if (!i && !e)
|
|
59
|
-
throw Error("Volatile not found in swap statistics");
|
|
60
|
-
const V = {
|
|
61
|
-
token: l(i ? i.erc20TokenAddress : s, n),
|
|
62
|
-
balance: i ? m[0].toBigInt() : k
|
|
63
|
-
}, T = u.find((o) => a(o.erc20TokenAddress, t));
|
|
64
|
-
let f = { token: l(t, n), balance: T?.amount };
|
|
65
|
-
if (e) {
|
|
66
|
-
const o = await g.getVolatileTokenBalance(n, t, T?.amount ?? 0n);
|
|
67
|
-
console.log("VOLATILE OUTPUT BALANCE: ", { balance: o }), f = { token: e, balance: o };
|
|
68
|
-
}
|
|
69
|
-
return { tokenIn: V, tokenOut: f, type: d.SWAP, protocol: E.toBigInt() };
|
|
70
|
-
}
|
|
71
|
-
return { type: d.UNKNOWN };
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
_ as getVolatileData
|
|
75
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import "../../../constants/chains.constants.js";
|
|
2
|
-
import "../../../types/circom-data.types.js";
|
|
3
|
-
import { ExternalActionId as t } from "../../../types/external-action.types.js";
|
|
4
|
-
import "../../../types/transactions.types.js";
|
|
5
|
-
import "../../../types/curve.types.js";
|
|
6
|
-
import "../../../constants/vite.constants.js";
|
|
7
|
-
import "../../../constants/contracts.constants.js";
|
|
8
|
-
import "../../../constants/kyc.constants.js";
|
|
9
|
-
import "../../../constants/coingecko.constants.js";
|
|
10
|
-
import "../../../constants/axelar.constants.js";
|
|
11
|
-
import "../../../constants/rewards.constants.js";
|
|
12
|
-
import "../../../constants/reorg-depths.constants.js";
|
|
13
|
-
import "ethers";
|
|
14
|
-
import "circomlibjs";
|
|
15
|
-
import "../../crypto-keys/keys.js";
|
|
16
|
-
import "axios";
|
|
17
|
-
import "../../crypto-keys/encryptDecryptUtxo.js";
|
|
18
|
-
import "../../../functions/web3/events/getShieldedBalance.js";
|
|
19
|
-
import "../../../webworker/workerFactory.js";
|
|
20
|
-
import { getExternalActionIdFromNumber as o } from "../../../functions/utils/external-action.utils.js";
|
|
21
|
-
import "../../custom-token-registry/CustomTokenRegistry.js";
|
|
22
|
-
import "../../../functions/utils/convertIntegrationProviderToExternalActionId.js";
|
|
23
|
-
import "../../../functions/utils/userAgent.js";
|
|
24
|
-
import "../../volatile-helper/VolatileHelper.js";
|
|
25
|
-
import "libsodium-wrappers";
|
|
26
|
-
var m = /* @__PURE__ */ ((r) => (r[r.DEPOSIT = 0] = "DEPOSIT", r[r.WITHDRAW = 1] = "WITHDRAW", r[r.SWAP = 2] = "SWAP", r[r.BEEFY = 3] = "BEEFY", r[r.CURVE = 4] = "CURVE", r[r.CONVEX = 5] = "CONVEX", r[r.LIDO = 6] = "LIDO", r[r.PENDLE = 7] = "PENDLE", r[r.VOLATILE = 8] = "VOLATILE", r[r.UNKNOWN = 9] = "UNKNOWN", r))(m || {});
|
|
27
|
-
const p = (r) => {
|
|
28
|
-
const e = r.externalActionId.toBigInt();
|
|
29
|
-
switch (o(e)) {
|
|
30
|
-
case t.Transact:
|
|
31
|
-
return r.amountChanges[0].toBigInt() >= 0n ? 0 : 1;
|
|
32
|
-
case t.Uniswap:
|
|
33
|
-
case t.Odos:
|
|
34
|
-
case t.OneInch:
|
|
35
|
-
return 2;
|
|
36
|
-
case t.Beefy:
|
|
37
|
-
case t.BeefyStake:
|
|
38
|
-
return 3;
|
|
39
|
-
case t.Curve:
|
|
40
|
-
case t.CurveDynamic:
|
|
41
|
-
case t.CurveCRV:
|
|
42
|
-
case t.CurveCRVRewards:
|
|
43
|
-
return 4;
|
|
44
|
-
case t.Convex:
|
|
45
|
-
return 5;
|
|
46
|
-
case t.LidoETH:
|
|
47
|
-
case t.LidoMATIC:
|
|
48
|
-
case t.LidoETHNFT:
|
|
49
|
-
case t.LidoMATICNFT:
|
|
50
|
-
return 6;
|
|
51
|
-
case t.Pendle:
|
|
52
|
-
return 7;
|
|
53
|
-
case t.Volatile:
|
|
54
|
-
return r.amountChanges.length === 1 ? r.amountChanges[0].toBigInt() < 0n ? 1 : 0 : r.amountChanges.length === 2 ? 2 : 9;
|
|
55
|
-
default:
|
|
56
|
-
return 9;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
export {
|
|
60
|
-
m as TransactionType,
|
|
61
|
-
p as externalActionToTransactionType
|
|
62
|
-
};
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { ethers as y } from "ethers";
|
|
2
|
-
import { CIRCOM_P as o } from "../../constants/protocol.constants.js";
|
|
3
|
-
import { poseidonHash as a } from "../../crypto/poseidon.js";
|
|
4
|
-
import { randomBigInt as S } from "../../functions/web3/etherFunctions.js";
|
|
5
|
-
import { UserKeys as d } from "../crypto-keys/keys.js";
|
|
6
|
-
class h {
|
|
7
|
-
amount;
|
|
8
|
-
erc20TokenAddress;
|
|
9
|
-
timeStamp;
|
|
10
|
-
tokenId;
|
|
11
|
-
shieldedPrivateKey;
|
|
12
|
-
// 1) if it's own UTXO one provides private key and randomization -> computes stealth address and and eKey
|
|
13
|
-
randomization;
|
|
14
|
-
stealthAddress;
|
|
15
|
-
// 2) if it's other's utxo, stealth address and encryption key should be provided
|
|
16
|
-
encryptionKey;
|
|
17
|
-
commitment;
|
|
18
|
-
// computed
|
|
19
|
-
nullifier;
|
|
20
|
-
// computed
|
|
21
|
-
isStake;
|
|
22
|
-
isStakeOrUnstakeInput;
|
|
23
|
-
isUnstakeOutput;
|
|
24
|
-
/**
|
|
25
|
-
* creates new UTXO instance
|
|
26
|
-
* @param amount UTXO amount
|
|
27
|
-
* @param erc20TokenAddress contract address of ERC-20/ERC-721 token
|
|
28
|
-
* @param timeStamp timestamp
|
|
29
|
-
* @param tokenId tokenId
|
|
30
|
-
* @param randomization randomization parameter
|
|
31
|
-
* @param stealthAddress stealth address as a parameter(e.g. in case of transfers we will not know private key and randomization of payee
|
|
32
|
-
* @param encryptionKey encryption public key
|
|
33
|
-
* @param shieldedPrivateKey private key for nullification
|
|
34
|
-
* @param commitment [optional] commitment value if already computed
|
|
35
|
-
* @param nullifier [optional] nullifier value if already computed
|
|
36
|
-
*/
|
|
37
|
-
constructor({
|
|
38
|
-
amount: t,
|
|
39
|
-
erc20TokenAddress: e,
|
|
40
|
-
timeStamp: s,
|
|
41
|
-
tokenId: i,
|
|
42
|
-
shieldedPrivateKey: r,
|
|
43
|
-
randomization: n,
|
|
44
|
-
stealthAddress: m,
|
|
45
|
-
encryptionKey: l,
|
|
46
|
-
commitment: u = void 0,
|
|
47
|
-
nullifier: c = void 0,
|
|
48
|
-
isStake: p = !1,
|
|
49
|
-
isStakeOrUnstakeInput: k = !1,
|
|
50
|
-
isUnstakeOutput: f = !1
|
|
51
|
-
}) {
|
|
52
|
-
this.amount = t, this.erc20TokenAddress = e, this.timeStamp = s ?? Math.floor(Date.now() / 1e3).toString(), this.tokenId = i ?? 0, this.shieldedPrivateKey = r, this.randomization = n ?? h.findCorrectRandomization(S(31), r), this.stealthAddress = m, this.encryptionKey = l, this.commitment = u, this.nullifier = c, this.isStake = p, this.isStakeOrUnstakeInput = k, this.isUnstakeOutput = f;
|
|
53
|
-
}
|
|
54
|
-
static createFrom(t, e) {
|
|
55
|
-
return new h({
|
|
56
|
-
...t.getConstructableParams(),
|
|
57
|
-
nullifier: void 0,
|
|
58
|
-
commitment: void 0,
|
|
59
|
-
...e
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
getConstructableParams() {
|
|
63
|
-
return {
|
|
64
|
-
amount: this.amount,
|
|
65
|
-
erc20TokenAddress: this.erc20TokenAddress,
|
|
66
|
-
timeStamp: this.timeStamp,
|
|
67
|
-
shieldedPrivateKey: this.shieldedPrivateKey,
|
|
68
|
-
randomization: this.randomization,
|
|
69
|
-
stealthAddress: this.stealthAddress,
|
|
70
|
-
encryptionKey: this.encryptionKey,
|
|
71
|
-
tokenId: this.tokenId,
|
|
72
|
-
commitment: this.commitment,
|
|
73
|
-
nullifier: this.nullifier,
|
|
74
|
-
isStake: this.isStake,
|
|
75
|
-
isStakeOrUnstakeInput: this.isStakeOrUnstakeInput,
|
|
76
|
-
isUnstakeOutput: this.isUnstakeOutput
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @returns commitment hash of the UTXO instance
|
|
81
|
-
*/
|
|
82
|
-
getCommitment() {
|
|
83
|
-
if (!this.commitment) {
|
|
84
|
-
const t = [this.amount, this.erc20TokenAddress, BigInt(this.getStealthAddress()), this.timeStamp];
|
|
85
|
-
this.tokenId > 0 && t.push(this.tokenId.toString()), (this.isStake || this.isUnstakeOutput) && t.push(0n, 1n), this.commitment = a(...t);
|
|
86
|
-
}
|
|
87
|
-
return this.commitment;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* @returns nullifier hash of the UTXO instance
|
|
91
|
-
*/
|
|
92
|
-
getNullifier() {
|
|
93
|
-
if (!this.nullifier) {
|
|
94
|
-
if (!this.shieldedPrivateKey)
|
|
95
|
-
throw new Error("No Nullifiers if private key is not provided");
|
|
96
|
-
const t = a(this.shieldedPrivateKey, this.getCommitment()), e = BigInt(a(this.commitment, t)), s = BigInt(this.isStakeOrUnstakeInput);
|
|
97
|
-
this.nullifier = y.BigNumber.from(e + s).toHexString();
|
|
98
|
-
}
|
|
99
|
-
return this.nullifier;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* @returns stealth address from randomization and private shieldedPrivateKey
|
|
103
|
-
*/
|
|
104
|
-
getStealthAddress() {
|
|
105
|
-
if (!this.stealthAddress) {
|
|
106
|
-
if (!this.shieldedPrivateKey)
|
|
107
|
-
throw Error("No stealth address in UTXO if private key is not provided");
|
|
108
|
-
const t = d.getStealthAddress(this.randomization, this.shieldedPrivateKey);
|
|
109
|
-
this.stealthAddress = t;
|
|
110
|
-
}
|
|
111
|
-
return this.stealthAddress;
|
|
112
|
-
}
|
|
113
|
-
getEncryptionKey() {
|
|
114
|
-
if (!this.shieldedPrivateKey) {
|
|
115
|
-
if (!this.encryptionKey)
|
|
116
|
-
throw Error("No encryption key provided in UTXO");
|
|
117
|
-
return this.encryptionKey;
|
|
118
|
-
}
|
|
119
|
-
return d.getEncryptionKeyPair(this.shieldedPrivateKey).publicKey;
|
|
120
|
-
}
|
|
121
|
-
static findCorrectRandomization(t, e) {
|
|
122
|
-
if (!e)
|
|
123
|
-
throw Error("No Private Shielded Key Provided");
|
|
124
|
-
const s = BigInt(e) % o;
|
|
125
|
-
let i, r, n = 0n;
|
|
126
|
-
do
|
|
127
|
-
i = t * 10n ** n % o, r = i * s % o, n += 1n;
|
|
128
|
-
while (r >= 2n ** 253n || i >= 2n ** 253n);
|
|
129
|
-
return i;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
export {
|
|
133
|
-
h as Utxo
|
|
134
|
-
};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { ethers as T } from "ethers";
|
|
2
|
-
import { networkRegistry as h } from "../../constants/chains.constants.js";
|
|
3
|
-
import "../../types/circom-data.types.js";
|
|
4
|
-
import { ContractType as w } from "../../types/ethereum-network.types.js";
|
|
5
|
-
import { ExternalActionId as f } from "../../types/external-action.types.js";
|
|
6
|
-
import { VolatileAction as l } from "../../types/hinkal.types.js";
|
|
7
|
-
import "../../types/transactions.types.js";
|
|
8
|
-
import "../../types/curve.types.js";
|
|
9
|
-
import { zeroAddress as d, ethVolatileAddress as u } from "../../constants/protocol.constants.js";
|
|
10
|
-
import "circomlibjs";
|
|
11
|
-
import "../crypto-keys/keys.js";
|
|
12
|
-
import "axios";
|
|
13
|
-
import "../crypto-keys/encryptDecryptUtxo.js";
|
|
14
|
-
import "../../functions/web3/events/getShieldedBalance.js";
|
|
15
|
-
import "../../webworker/workerFactory.js";
|
|
16
|
-
import { decodeMetadata as v, getExternalActionIdHash as g } from "../../functions/utils/external-action.utils.js";
|
|
17
|
-
import { getERC20Token as m } 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 "../../constants/reorg-depths.constants.js";
|
|
23
|
-
import "../../constants/kyc.constants.js";
|
|
24
|
-
import { toEnumValue as A } from "../../functions/utils/enum.utils.js";
|
|
25
|
-
import "../custom-token-registry/CustomTokenRegistry.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 p = new T.utils.Interface([
|
|
31
|
-
"function volatileTokenToShareToken(address volatileToken) external view returns (address)",
|
|
32
|
-
"function shareTokenToVolatileToken(address volatileToken) external view returns (address)",
|
|
33
|
-
"function shareToVolatile(address shareToken, uint shareValue) external view returns (uint)",
|
|
34
|
-
"function volatileToShare(address volatileToken, uint volatileTokenValue, uint volatileTokenBalanceOverride) external view returns (uint)"
|
|
35
|
-
]);
|
|
36
|
-
class a {
|
|
37
|
-
static getVolatileTokenAction(r) {
|
|
38
|
-
const o = h[r], { fetchRpcUrl: t } = o, { volatileTokenActionInstanceAddress: e } = o.contractData;
|
|
39
|
-
if (!e)
|
|
40
|
-
throw Error("Volatile Token Address not found");
|
|
41
|
-
const n = new T.providers.JsonRpcProvider(t);
|
|
42
|
-
return new T.Contract(e, p, n);
|
|
43
|
-
}
|
|
44
|
-
static getVolatileTokenAddress = async (r, o) => {
|
|
45
|
-
try {
|
|
46
|
-
const e = await a.getVolatileTokenAction(r).shareTokenToVolatileToken(o);
|
|
47
|
-
if (e === d)
|
|
48
|
-
throw new Error("Can't get share token address");
|
|
49
|
-
return e;
|
|
50
|
-
} catch (t) {
|
|
51
|
-
console.log("getShareTokenAddress error ", t.message);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
static getShareTokenAddress = async (r, o) => {
|
|
56
|
-
if (o === d)
|
|
57
|
-
return a.getShareTokenAddress(r, u);
|
|
58
|
-
try {
|
|
59
|
-
const e = await a.getVolatileTokenAction(r).volatileTokenToShareToken(o);
|
|
60
|
-
if (e === d)
|
|
61
|
-
throw new Error("Can't get share token address");
|
|
62
|
-
return e;
|
|
63
|
-
} catch (t) {
|
|
64
|
-
console.log("getShareTokenAddress error ", t.message);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
static getVolatileTokenBalance = async (r, o, t, e) => {
|
|
69
|
-
try {
|
|
70
|
-
if (t === 0n)
|
|
71
|
-
return 0n;
|
|
72
|
-
const n = a.getVolatileTokenAction(r), c = t < 0n ? -1n : 1n, s = e ? { blockTag: e } : {};
|
|
73
|
-
return c * (await n.shareToVolatile(
|
|
74
|
-
o,
|
|
75
|
-
c * t,
|
|
76
|
-
s
|
|
77
|
-
)).toBigInt();
|
|
78
|
-
} catch (n) {
|
|
79
|
-
return console.log("getVolatileTokenBalance convertToShare error", n), 0n;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
static getShareTokenBalance = async (r, o, t) => {
|
|
83
|
-
if (o === d)
|
|
84
|
-
return this.getShareTokenBalance(r, u, t);
|
|
85
|
-
try {
|
|
86
|
-
if (t === 0n)
|
|
87
|
-
return 0n;
|
|
88
|
-
const e = a.getVolatileTokenAction(r), n = t < 0n ? -1n : 1n;
|
|
89
|
-
return n * (await e.volatileToShare(
|
|
90
|
-
o,
|
|
91
|
-
n * t,
|
|
92
|
-
0n
|
|
93
|
-
)).toBigInt();
|
|
94
|
-
} catch (e) {
|
|
95
|
-
return console.log("getShareTokenBalance convertToShare error", e), 0n;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
static processVolatileData = async (r, o, t, e) => {
|
|
99
|
-
let n = [];
|
|
100
|
-
if (o === l.Deposit)
|
|
101
|
-
e[0] = 0n, t[0] = await a.getShareTokenAddress(r, t[0]), n = [!0];
|
|
102
|
-
else if (o === l.Withdraw)
|
|
103
|
-
e[0] = -1n * await a.getShareTokenBalance(r, t[0], -e[0]), t[0] = await a.getShareTokenAddress(r, t[0]), n = [!1];
|
|
104
|
-
else if (o === l.Swap) {
|
|
105
|
-
const c = t.map((s) => m(s, r));
|
|
106
|
-
await Promise.all(
|
|
107
|
-
c.map(async (s, i) => {
|
|
108
|
-
s?.isVolatile && (console.log("is volotile", s.erc20TokenAddress), e[i] < 0n ? e[i] = -1n * await a.getShareTokenBalance(r, t[i], -e[i]) : e[i] >= 0n && (e[i] = 0n), t[i] = await a.getShareTokenAddress(r, s.erc20TokenAddress), console.log("change address ", t[i]));
|
|
109
|
-
})
|
|
110
|
-
), n = [!1, !0];
|
|
111
|
-
}
|
|
112
|
-
return { erc20Addresses: t, amountChanges: e, onChainCreation: n };
|
|
113
|
-
};
|
|
114
|
-
static decodeVolatileMetadata = (r) => {
|
|
115
|
-
const o = v(f.Volatile, r), t = o[0], e = o[2], n = o[4], c = A(l, n);
|
|
116
|
-
return { volatileAmounts: t, redirectActionId: e, volatileAction: c };
|
|
117
|
-
};
|
|
118
|
-
// TODO: Type descriminate these base on actionType
|
|
119
|
-
static encodeVolatileActionMetadata = ({
|
|
120
|
-
actionType: r = l.Deposit,
|
|
121
|
-
volatileAmounts: o = [],
|
|
122
|
-
withdrawRecipient: t = d,
|
|
123
|
-
redirectActionId: e = 0,
|
|
124
|
-
redirectMetadata: n = "0x00"
|
|
125
|
-
}) => (console.log({ volatileAmounts: o }), T.utils.defaultAbiCoder.encode(
|
|
126
|
-
["uint256[]", "address", "uint256", "bytes", "uint8"],
|
|
127
|
-
[o, t, e, n, r]
|
|
128
|
-
));
|
|
129
|
-
static getVolotileMetadata = (r, o, t, e, n) => {
|
|
130
|
-
if (r === l.Deposit)
|
|
131
|
-
return {
|
|
132
|
-
actionType: r,
|
|
133
|
-
volatileAmounts: o
|
|
134
|
-
};
|
|
135
|
-
if (r === l.Withdraw) {
|
|
136
|
-
if (!t)
|
|
137
|
-
throw Error("No withdrawal recipient");
|
|
138
|
-
return {
|
|
139
|
-
actionType: r,
|
|
140
|
-
volatileAmounts: o,
|
|
141
|
-
withdrawRecipient: t
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
if (r === l.Swap) {
|
|
145
|
-
if (e === void 0 || !n)
|
|
146
|
-
throw Error("No redirect action Id");
|
|
147
|
-
return {
|
|
148
|
-
actionType: r,
|
|
149
|
-
volatileAmounts: o,
|
|
150
|
-
redirectActionId: g(e),
|
|
151
|
-
redirectMetadata: n
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
throw new Error("Invalid Request");
|
|
155
|
-
};
|
|
156
|
-
static getVolatileExternalData = async (r, o, t, e, n, c) => {
|
|
157
|
-
const i = r.getContractWithFetcher(w.VolatileTokenAction).address;
|
|
158
|
-
let k = [];
|
|
159
|
-
return o === l.Deposit && (k = t), o === l.Withdraw && (k = [-t[0]]), o === l.Swap && (k = [-t[0], 0n]), {
|
|
160
|
-
externalActionId: f.Volatile,
|
|
161
|
-
externalAddress: i,
|
|
162
|
-
externalActionMetadata: this.encodeVolatileActionMetadata(
|
|
163
|
-
this.getVolotileMetadata(
|
|
164
|
-
o,
|
|
165
|
-
k,
|
|
166
|
-
e,
|
|
167
|
-
n,
|
|
168
|
-
c
|
|
169
|
-
)
|
|
170
|
-
)
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
static decodeExternalActionId = (r) => {
|
|
174
|
-
let o = !1, t;
|
|
175
|
-
const { externalActionId: e } = r.decodedInput;
|
|
176
|
-
return (typeof e == "string" ? e : e.toBigInt()) === g(f.Volatile) && ({ redirectActionId: t } = a.decodeVolatileMetadata(r.decodedInput.externalActionMetadata), o = !0), { isVolatile: o, redirectActionId: t };
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
export {
|
|
180
|
-
a as VolatileHelper
|
|
181
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { transactionErrorCodes as t } from "../error-codes.constants.js";
|
|
2
|
-
class e extends Error {
|
|
3
|
-
constructor(r) {
|
|
4
|
-
super(t.FEES_OVER_TRANSACTION_VALUE), this.data = r, this.name = this.constructor.name;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
e as FeeOverTransactionValueError
|
|
9
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { fixDecimalsAmount as i } from "../../functions/utils/amounts.utils.js";
|
|
2
|
-
import { getAmountInToken as m } from "../../functions/web3/etherFunctions.js";
|
|
3
|
-
import { transactionErrorCodes as f } from "../error-codes.constants.js";
|
|
4
|
-
import { ErrorCategory as c } from "../types.js";
|
|
5
|
-
import { FeeOverTransactionValueError as l } from "./FeeOverTransactionValueError.js";
|
|
6
|
-
const v = (e, r) => {
|
|
7
|
-
const { totalFeeWEI: n, feeUnit: t } = e.data;
|
|
8
|
-
if (!t)
|
|
9
|
-
return e.message;
|
|
10
|
-
const s = m(t, n);
|
|
11
|
-
let o = "transact", a = "an equivalent of ";
|
|
12
|
-
return r === c.WITHDRAW && (o = "withdraw", a = ""), `Fees are over transaction value. Please ${o} at least ${a} ${i(
|
|
13
|
-
Number(s)
|
|
14
|
-
)} of ${t?.symbol} (subject to real-time price)`;
|
|
15
|
-
}, F = (e, r) => {
|
|
16
|
-
throw e instanceof l || e?.message === f.INSUFFICIENT_FUNDS_TO_TRANSACT ? e : Error(r);
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
v as getGenericFeeOverTransactionValueErrorMessage,
|
|
20
|
-
F as rethrowKnownGasErrorIfPossible
|
|
21
|
-
};
|