@hinkal/common 0.2.13 → 0.2.14
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/API/API.cjs +1 -1
- package/API/API.d.ts +10 -3
- package/API/API.mjs +42 -31
- package/API/ai-calls.cjs +1 -0
- package/API/ai-calls.d.ts +9 -0
- package/API/ai-calls.mjs +13 -0
- package/API/callCurveAPI.cjs +1 -1
- package/API/callCurveAPI.mjs +28 -22
- package/API/callRelayer.d.ts +3 -2
- package/API/dataServerCalls.cjs +1 -1
- package/API/dataServerCalls.d.ts +4 -0
- package/API/dataServerCalls.mjs +11 -7
- package/API/duneAPI.cjs +1 -1
- package/API/duneAPI.mjs +7 -4
- package/API/fetchCommitmentsCache.cjs +1 -1
- package/API/fetchCommitmentsCache.d.ts +9 -1
- package/API/fetchCommitmentsCache.mjs +6 -5
- package/API/getGasEstimates.cjs +1 -1
- package/API/getGasEstimates.d.ts +2 -1
- package/API/getGasEstimates.mjs +10 -9
- package/API/getServerURL.d.ts +1 -1
- package/API/index.d.ts +2 -0
- package/API/is-tx-stateless.cjs +1 -0
- package/API/is-tx-stateless.d.ts +3 -0
- package/API/is-tx-stateless.mjs +9 -0
- package/API/rewardsPointsCalls.cjs +1 -1
- package/API/rewardsPointsCalls.d.ts +3 -3
- package/API/rewardsPointsCalls.mjs +1 -3
- package/API/tenderly.api.cjs +1 -0
- package/API/tenderly.api.d.ts +12 -0
- package/API/tenderly.api.mjs +47 -0
- package/API/token-calls.cjs +1 -0
- package/API/token-calls.d.ts +2 -0
- package/API/token-calls.mjs +9 -0
- package/API/userVerifyTransactions.cjs +1 -1
- package/API/userVerifyTransactions.d.ts +6 -7
- package/API/userVerifyTransactions.mjs +13 -14
- package/constants/addresses.constants.cjs +1 -0
- package/constants/addresses.constants.d.ts +16 -0
- package/constants/addresses.constants.mjs +50 -0
- package/constants/assets.constants.cjs +1 -1
- package/constants/assets.constants.mjs +13 -13
- package/constants/axelar.constants.cjs +1 -1
- package/constants/axelar.constants.mjs +5 -5
- package/constants/balance.constants.cjs +1 -0
- package/constants/balance.constants.d.ts +1 -0
- package/constants/balance.constants.mjs +4 -0
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +0 -2
- package/constants/chains.constants.mjs +28 -40
- package/constants/contracts.constants.cjs +1 -1
- package/constants/contracts.constants.mjs +144 -140
- package/constants/conversion.constants.cjs +1 -0
- package/constants/conversion.constants.d.ts +1 -0
- package/constants/conversion.constants.mjs +4 -0
- package/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-arbMainnet.json.mjs +846 -11
- package/constants/deploy-data/deploy-data-avalanche.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-avalanche.json.mjs +848 -13
- package/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-base.json.mjs +852 -17
- package/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +855 -20
- package/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-ethMainnet.json.mjs +850 -15
- package/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-localhost.json.mjs +3208 -1550
- package/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-optimism.json.mjs +10010 -3429
- package/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/constants/deploy-data/deploy-data-polygon.json.mjs +844 -9
- package/constants/fees.constants.cjs +1 -1
- package/constants/fees.constants.d.ts +5 -3
- package/constants/fees.constants.mjs +22 -19
- package/constants/index.d.ts +6 -0
- package/constants/kyc.constants.cjs +1 -1
- package/constants/kyc.constants.mjs +30 -18
- package/constants/mediaUrls.constants.cjs +1 -0
- package/constants/mediaUrls.constants.d.ts +23 -0
- package/constants/mediaUrls.constants.mjs +26 -0
- package/constants/permit2.constants.cjs +1 -0
- package/constants/permit2.constants.d.ts +2 -0
- package/constants/permit2.constants.mjs +5 -0
- package/constants/protocol.constants.cjs +1 -1
- package/constants/protocol.constants.d.ts +6 -0
- package/constants/protocol.constants.mjs +27 -15
- package/constants/rewards.constants.cjs +1 -1
- package/constants/rewards.constants.mjs +14 -12
- package/constants/server.constants.cjs +1 -1
- package/constants/server.constants.d.ts +14 -6
- package/constants/server.constants.mjs +24 -16
- package/constants/token-data/ERC20Registry.cjs +1 -1
- package/constants/token-data/ERC20Registry.mjs +49 -48
- package/constants/token-data/arbMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistry.json.mjs +89 -86
- package/constants/token-data/arbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/arbMainnetRegistryFixed.json.mjs +79 -76
- package/constants/token-data/avalancheRegistry.json.cjs +1 -1
- package/constants/token-data/avalancheRegistry.json.mjs +51 -48
- package/constants/token-data/avalancheRegistryFixed.json.cjs +1 -1
- package/constants/token-data/avalancheRegistryFixed.json.mjs +51 -48
- package/constants/token-data/baseRegistry.json.cjs +1 -1
- package/constants/token-data/baseRegistry.json.mjs +34 -31
- package/constants/token-data/baseRegistryFixed.json.cjs +1 -1
- package/constants/token-data/baseRegistryFixed.json.mjs +31 -28
- package/constants/token-data/bnbMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/bnbMainnetRegistry.json.mjs +67 -64
- package/constants/token-data/bnbMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/bnbMainnetRegistryFixed.json.mjs +67 -64
- package/constants/token-data/ethMainnetRegistry.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistry.json.mjs +229 -226
- package/constants/token-data/ethMainnetRegistryFixed.json.cjs +1 -1
- package/constants/token-data/ethMainnetRegistryFixed.json.mjs +193 -190
- package/constants/token-data/index.cjs +1 -0
- package/constants/token-data/index.d.ts +1063 -15
- package/constants/token-data/index.mjs +34 -0
- package/constants/token-data/localhostRegistry.json.cjs +1 -1
- package/constants/token-data/localhostRegistry.json.mjs +296 -276
- package/constants/token-data/optimismRegistry.json.cjs +1 -1
- package/constants/token-data/optimismRegistry.json.mjs +703 -180
- package/constants/token-data/optimismRegistryFixed.json.cjs +1 -1
- package/constants/token-data/optimismRegistryFixed.json.mjs +679 -173
- package/constants/token-data/polygonRegistry.json.cjs +1 -1
- package/constants/token-data/polygonRegistry.json.mjs +110 -107
- package/constants/token-data/polygonRegistryFixed.json.cjs +1 -1
- package/constants/token-data/polygonRegistryFixed.json.mjs +102 -99
- package/constants/token.limits.constants.cjs +1 -0
- package/constants/token.limits.constants.d.ts +5 -0
- package/constants/token.limits.constants.mjs +30 -0
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.d.ts +5 -0
- package/constants/vite.constants.mjs +26 -22
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +48 -20
- package/data-structures/Hinkal/Hinkal.mjs +263 -85
- package/data-structures/Hinkal/IHinkal.d.ts +37 -10
- package/data-structures/Hinkal/hinkalActionBeefy.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionBeefy.mjs +25 -23
- package/data-structures/Hinkal/hinkalActionConvex.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionConvex.mjs +11 -9
- package/data-structures/Hinkal/hinkalActionCurve.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionCurve.mjs +18 -16
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.d.ts +3 -0
- package/data-structures/Hinkal/hinkalActionFundApproveAndTransact.mjs +61 -0
- package/data-structures/Hinkal/hinkalActionLidoEth.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionLidoEth.mjs +24 -22
- package/data-structures/Hinkal/hinkalActionPendle.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendle.d.ts +1 -1
- package/data-structures/Hinkal/hinkalActionPendle.mjs +17 -15
- package/data-structures/Hinkal/hinkalActionPendleLP.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendleLP.mjs +29 -26
- package/data-structures/Hinkal/hinkalActionReceive.cjs +1 -0
- package/data-structures/Hinkal/hinkalActionReceive.d.ts +4 -0
- package/data-structures/Hinkal/hinkalActionReceive.mjs +39 -0
- package/data-structures/Hinkal/hinkalActionStake.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionStake.d.ts +1 -1
- package/data-structures/Hinkal/hinkalActionStake.mjs +15 -11
- package/data-structures/Hinkal/hinkalActionVolatile.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionVolatile.d.ts +1 -1
- package/data-structures/Hinkal/hinkalActionVolatile.mjs +31 -26
- package/data-structures/Hinkal/hinkalApprove.cjs +1 -0
- package/data-structures/Hinkal/hinkalApprove.d.ts +2 -0
- package/data-structures/Hinkal/hinkalApprove.mjs +120 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.cjs +1 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.d.ts +3 -0
- package/data-structures/Hinkal/hinkalCheckTokenRegistry.mjs +12 -0
- package/data-structures/Hinkal/hinkalDeploySubAccount.cjs +1 -0
- package/data-structures/Hinkal/hinkalDeploySubAccount.d.ts +3 -0
- package/data-structures/Hinkal/hinkalDeploySubAccount.mjs +15 -0
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.d.ts +3 -2
- package/data-structures/Hinkal/hinkalDeposit.mjs +116 -52
- package/data-structures/Hinkal/hinkalGetRecipientInfo.cjs +1 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.d.ts +2 -0
- package/data-structures/Hinkal/hinkalGetRecipientInfo.mjs +10 -0
- package/data-structures/Hinkal/hinkalGetZkMeProvider.cjs +1 -1
- package/data-structures/Hinkal/hinkalGetZkMeProvider.mjs +6 -17
- package/data-structures/Hinkal/hinkalInsideTransact.cjs +1 -0
- package/data-structures/Hinkal/hinkalInsideTransact.d.ts +2 -0
- package/data-structures/Hinkal/hinkalInsideTransact.mjs +111 -0
- package/data-structures/Hinkal/hinkalMultiSend.cjs +1 -0
- package/data-structures/Hinkal/hinkalMultiSend.d.ts +3 -0
- package/data-structures/Hinkal/hinkalMultiSend.mjs +13 -0
- package/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.d.ts +2 -1
- package/data-structures/Hinkal/hinkalPrivateWallet.mjs +83 -37
- package/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -0
- package/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +4 -0
- package/data-structures/Hinkal/hinkalProoflessDeposit.mjs +46 -0
- package/data-structures/Hinkal/hinkalProxySwap.cjs +1 -0
- package/data-structures/Hinkal/hinkalProxySwap.d.ts +5 -0
- package/data-structures/Hinkal/hinkalProxySwap.mjs +36 -0
- package/data-structures/Hinkal/hinkalSignSubAccount.cjs +1 -0
- package/data-structures/Hinkal/hinkalSignSubAccount.d.ts +3 -0
- package/data-structures/Hinkal/hinkalSignSubAccount.mjs +20 -0
- package/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/data-structures/Hinkal/hinkalSwap.d.ts +2 -1
- package/data-structures/Hinkal/hinkalSwap.mjs +69 -60
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.d.ts +3 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +77 -50
- package/data-structures/Hinkal/index.d.ts +1 -0
- package/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/data-structures/Hinkal/resetMerkleTrees.mjs +18 -11
- package/data-structures/IndexedDB/activity-db.cjs +1 -0
- package/data-structures/IndexedDB/activity-db.d.ts +16 -0
- package/data-structures/IndexedDB/activity-db.mjs +124 -0
- package/data-structures/IndexedDB/balances-db.cjs +1 -0
- package/data-structures/IndexedDB/balances-db.d.ts +13 -0
- package/data-structures/IndexedDB/balances-db.mjs +75 -0
- package/data-structures/IndexedDB/contact-db.cjs +1 -0
- package/data-structures/IndexedDB/contact-db.d.ts +11 -0
- package/data-structures/IndexedDB/contact-db.mjs +44 -0
- package/data-structures/IndexedDB/index.d.ts +5 -0
- package/data-structures/IndexedDB/prices-db.cjs +1 -0
- package/data-structures/IndexedDB/prices-db.d.ts +9 -0
- package/data-structures/IndexedDB/prices-db.mjs +62 -0
- package/data-structures/IndexedDB/private-balances-db.cjs +1 -0
- package/data-structures/IndexedDB/private-balances-db.d.ts +9 -0
- package/data-structures/IndexedDB/private-balances-db.mjs +28 -0
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +47 -44
- package/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -0
- package/data-structures/TokenDBs/PrivateTokensDB.d.ts +11 -0
- package/data-structures/TokenDBs/PrivateTokensDB.mjs +53 -0
- package/data-structures/TokenDBs/PublicTokensDB.cjs +1 -0
- package/data-structures/TokenDBs/PublicTokensDB.d.ts +13 -0
- package/data-structures/TokenDBs/PublicTokensDB.mjs +81 -0
- package/data-structures/TokenDBs/index.d.ts +2 -0
- package/data-structures/cacheDevices/AttachableMemoryCacheDevice.cjs +1 -0
- package/data-structures/cacheDevices/AttachableMemoryCacheDevice.d.ts +8 -0
- package/data-structures/cacheDevices/AttachableMemoryCacheDevice.mjs +28 -0
- package/data-structures/cacheDevices/BaseCacheDevice.cjs +1 -1
- package/data-structures/cacheDevices/BaseCacheDevice.d.ts +9 -6
- package/data-structures/cacheDevices/BaseCacheDevice.mjs +13 -4
- package/data-structures/cacheDevices/FileCacheDevice.cjs +1 -1
- package/data-structures/cacheDevices/FileCacheDevice.d.ts +1 -0
- package/data-structures/cacheDevices/FileCacheDevice.mjs +7 -3
- package/data-structures/cacheDevices/LocalStorageCacheDevice.cjs +1 -1
- package/data-structures/cacheDevices/LocalStorageCacheDevice.d.ts +2 -1
- package/data-structures/cacheDevices/LocalStorageCacheDevice.mjs +10 -5
- package/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/data-structures/crypto-keys/decodeUTXO.mjs +13 -12
- package/data-structures/crypto-keys/keys.cjs +1 -1
- package/data-structures/crypto-keys/keys.d.ts +13 -3
- package/data-structures/crypto-keys/keys.mjs +45 -34
- package/data-structures/custom-token-registry/CustomTokenRegistry.cjs +1 -1
- package/data-structures/custom-token-registry/CustomTokenRegistry.d.ts +2 -3
- package/data-structures/custom-token-registry/CustomTokenRegistry.mjs +17 -21
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/event-service/AbstractAccessTokenSnapshotService.mjs +15 -29
- package/data-structures/event-service/AbstractApprovalsSnapshotService.cjs +1 -0
- package/data-structures/event-service/AbstractApprovalsSnapshotService.d.ts +30 -0
- package/data-structures/event-service/AbstractApprovalsSnapshotService.mjs +104 -0
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.mjs +24 -37
- package/data-structures/event-service/AbstractEventService.cjs +1 -1
- package/data-structures/event-service/AbstractEventService.d.ts +1 -1
- package/data-structures/event-service/AbstractEventService.mjs +15 -15
- package/data-structures/event-service/index.d.ts +1 -0
- package/data-structures/index.d.ts +2 -0
- package/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/data-structures/merkle-tree/MerkleTree.d.ts +6 -1
- package/data-structures/merkle-tree/MerkleTree.mjs +79 -65
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs +1 -0
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.d.ts +3 -0
- package/data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs +13 -0
- package/data-structures/merkle-tree/index.d.ts +1 -0
- package/data-structures/provider-adapter/IProviderAdapter.d.ts +2 -0
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientAccessTokenSnapshotService.mjs +3 -2
- package/data-structures/snapshot/ClientApprovalsSnapshotService.cjs +1 -0
- package/data-structures/snapshot/ClientApprovalsSnapshotService.d.ts +8 -0
- package/data-structures/snapshot/ClientApprovalsSnapshotService.mjs +23 -0
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientCommitmentsSnapshotService.mjs +3 -2
- package/data-structures/snapshot/ClientNullifierSnapshotService.cjs +1 -1
- package/data-structures/snapshot/ClientNullifierSnapshotService.mjs +6 -5
- package/data-structures/token-price-fetcher/TokenChecker.cjs +1 -1
- package/data-structures/token-price-fetcher/TokenChecker.d.ts +1 -0
- package/data-structures/token-price-fetcher/TokenChecker.mjs +4 -2
- package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
- package/data-structures/transactions-manager/TransactionsManager.d.ts +8 -6
- package/data-structures/transactions-manager/TransactionsManager.mjs +124 -122
- package/data-structures/transactions-manager/history/getBeefyData.cjs +1 -1
- package/data-structures/transactions-manager/history/getBeefyData.mjs +3 -2
- package/data-structures/transactions-manager/history/getConvexData.cjs +1 -1
- package/data-structures/transactions-manager/history/getConvexData.mjs +3 -2
- package/data-structures/transactions-manager/history/getCurveData.cjs +1 -1
- package/data-structures/transactions-manager/history/getCurveData.mjs +3 -2
- package/data-structures/transactions-manager/history/getLidoData.cjs +1 -1
- package/data-structures/transactions-manager/history/getLidoData.mjs +3 -2
- package/data-structures/transactions-manager/history/getPendleData.cjs +1 -1
- package/data-structures/transactions-manager/history/getPendleData.mjs +13 -12
- package/data-structures/transactions-manager/history/getTxDetails.cjs +1 -1
- package/data-structures/transactions-manager/history/getTxDetails.mjs +22 -20
- package/data-structures/transactions-manager/history/getVolatileData.cjs +1 -1
- package/data-structures/transactions-manager/history/getVolatileData.mjs +11 -10
- package/data-structures/transactions-manager/history/history.types.cjs +1 -1
- package/data-structures/transactions-manager/history/history.types.mjs +4 -2
- package/data-structures/utxo/Utxo.cjs +1 -1
- package/data-structures/utxo/Utxo.d.ts +3 -3
- package/data-structures/utxo/Utxo.mjs +8 -7
- package/error-handling/error-codes.constants.cjs +2 -2
- package/error-handling/error-codes.constants.d.ts +22 -1
- package/error-handling/error-codes.constants.mjs +129 -112
- package/error-handling/get-error.message.cjs +1 -1
- package/error-handling/get-error.message.mjs +29 -25
- package/error-handling/index.d.ts +1 -0
- package/error-handling/logger.cjs +1 -0
- package/error-handling/logger.d.ts +5 -0
- package/error-handling/logger.mjs +16 -0
- package/error-handling/types.cjs +1 -1
- package/error-handling/types.d.ts +3 -1
- package/error-handling/types.mjs +2 -2
- package/externalABIs/BabPassport.json.cjs +1 -1
- package/externalABIs/BabPassport.json.mjs +8 -3
- package/externalABIs/BeefyRouterAbi.json.cjs +1 -1
- package/externalABIs/BeefyRouterAbi.json.mjs +5 -2
- package/externalABIs/BeefyStrategyAbi.json.cjs +1 -1
- package/externalABIs/BeefyStrategyAbi.json.mjs +5 -2
- package/externalABIs/BeefyVaultAbi.json.cjs +1 -1
- package/externalABIs/BeefyVaultAbi.json.mjs +5 -2
- package/externalABIs/BeefyZapAbi.json.cjs +1 -1
- package/externalABIs/BeefyZapAbi.json.mjs +5 -2
- package/externalABIs/BeefyZapOneInchAbi.json.cjs +1 -1
- package/externalABIs/BeefyZapOneInchAbi.json.mjs +5 -2
- package/externalABIs/ConvexBoosterAbi.json.cjs +1 -1
- package/externalABIs/ConvexBoosterAbi.json.mjs +5 -2
- package/externalABIs/ConvexBoosterAbiMainnet.json.cjs +1 -1
- package/externalABIs/ConvexBoosterAbiMainnet.json.mjs +5 -2
- package/externalABIs/ConvexRewardPoolAbi.json.cjs +1 -1
- package/externalABIs/ConvexRewardPoolAbi.json.mjs +5 -2
- package/externalABIs/CurveReadingWrapperAbi.json.cjs +1 -1
- package/externalABIs/CurveReadingWrapperAbi.json.mjs +5 -2
- package/externalABIs/CurveWrappedMainPool.json.cjs +1 -1
- package/externalABIs/CurveWrappedMainPool.json.mjs +5 -2
- package/externalABIs/CurveZap.json.cjs +1 -1
- package/externalABIs/CurveZap.json.mjs +5 -2
- package/externalABIs/CvxCrvUtilities.json.cjs +1 -1
- package/externalABIs/CvxCrvUtilities.json.mjs +5 -2
- package/externalABIs/ERC20.json.cjs +1 -1
- package/externalABIs/ERC20.json.mjs +20 -3
- package/externalABIs/GalxePassport.json.cjs +1 -1
- package/externalABIs/GalxePassport.json.mjs +8 -3
- package/externalABIs/IQuoterV2.json.cjs +1 -1
- package/externalABIs/IQuoterV2.json.mjs +20 -3
- package/externalABIs/ISwapRouter.json.cjs +1 -1
- package/externalABIs/ISwapRouter.json.mjs +5 -2
- package/externalABIs/IUniswapV3Factory.json.cjs +1 -1
- package/externalABIs/IUniswapV3Factory.json.mjs +20 -3
- package/externalABIs/IUniswapV3Pool.json.cjs +1 -1
- package/externalABIs/IUniswapV3Pool.json.mjs +20 -3
- package/externalABIs/PendleRouterAbi.json.cjs +1 -1
- package/externalABIs/PendleRouterAbi.json.mjs +5 -2
- package/externalABIs/UniswapV2PoolAbi.json.cjs +1 -1
- package/externalABIs/UniswapV2PoolAbi.json.mjs +16 -3
- package/externalABIs/index.cjs +1 -0
- package/externalABIs/index.d.ts +307 -11
- package/externalABIs/index.mjs +23 -0
- package/externalABIs/transactionsProver.json.cjs +1 -1
- package/externalABIs/transactionsProver.json.mjs +20 -3
- package/functions/kyc/zkMeHelper.cjs +1 -1
- package/functions/kyc/zkMeHelper.d.ts +0 -1
- package/functions/kyc/zkMeHelper.mjs +8 -11
- package/functions/pre-transaction/getExternalSwapAddress.cjs +1 -0
- package/functions/pre-transaction/getExternalSwapAddress.d.ts +3 -0
- package/functions/pre-transaction/getExternalSwapAddress.mjs +26 -0
- package/functions/pre-transaction/getFeeStructure.cjs +1 -0
- package/functions/pre-transaction/getFeeStructure.d.ts +4 -0
- package/functions/pre-transaction/getFeeStructure.mjs +30 -0
- package/functions/pre-transaction/getFlatFees.cjs +1 -1
- package/functions/pre-transaction/getFlatFees.d.ts +3 -7
- package/functions/pre-transaction/getFlatFees.mjs +52 -46
- package/functions/pre-transaction/getSignatureDataForTransact.cjs +1 -0
- package/functions/pre-transaction/getSignatureDataForTransact.d.ts +3 -0
- package/functions/pre-transaction/getSignatureDataForTransact.mjs +6 -0
- package/functions/pre-transaction/index.d.ts +1 -0
- package/functions/pre-transaction/interaction-to-action.cjs +1 -1
- package/functions/pre-transaction/interaction-to-action.mjs +3 -2
- package/functions/pre-transaction/merge-with-fee-structure.cjs +1 -0
- package/functions/pre-transaction/merge-with-fee-structure.d.ts +2 -0
- package/functions/pre-transaction/merge-with-fee-structure.mjs +25 -0
- package/functions/pre-transaction/outputApprovalDataProcessing.cjs +1 -0
- package/functions/pre-transaction/outputApprovalDataProcessing.d.ts +16 -0
- package/functions/pre-transaction/outputApprovalDataProcessing.mjs +42 -0
- package/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
- package/functions/pre-transaction/outputUtxoProcessing.mjs +19 -30
- package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
- package/functions/pre-transaction/process-gas-estimates.d.ts +2 -2
- package/functions/pre-transaction/process-gas-estimates.mjs +17 -27
- package/functions/pre-transaction/processAmountChanges.cjs +1 -1
- package/functions/pre-transaction/processAmountChanges.mjs +34 -23
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.cjs +1 -0
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.d.ts +6 -0
- package/functions/pre-transaction/shouldPatchAccessTokenMerkleTree.mjs +7 -0
- package/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/functions/private-wallet/emporium.helpers.d.ts +9 -1
- package/functions/private-wallet/emporium.helpers.mjs +117 -22
- package/functions/private-wallet/emporium.swap.helpers.cjs +1 -0
- package/functions/private-wallet/emporium.swap.helpers.d.ts +5 -0
- package/functions/private-wallet/emporium.swap.helpers.mjs +92 -0
- package/functions/private-wallet/index.d.ts +1 -0
- package/functions/private-wallet/opProducer.cjs +1 -1
- package/functions/private-wallet/opProducer.mjs +9 -10
- package/functions/private-wallet/smartContractWalletCalculator.cjs +1 -1
- package/functions/private-wallet/smartContractWalletCalculator.d.ts +5 -1
- package/functions/private-wallet/smartContractWalletCalculator.mjs +22 -17
- package/functions/protocols/convex.protocols.cjs +1 -1
- package/functions/protocols/convex.protocols.mjs +11 -8
- package/functions/protocols/pendle.helpers.cjs +1 -1
- package/functions/protocols/pendle.helpers.mjs +20 -15
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.d.ts +8 -5
- package/functions/snarkjs/common.snarkjs.mjs +177 -87
- package/functions/snarkjs/constant.cjs +1 -1
- package/functions/snarkjs/constant.d.ts +223 -1
- package/functions/snarkjs/constant.mjs +315 -94
- package/functions/snarkjs/constructEmporiumProof.cjs +1 -1
- package/functions/snarkjs/constructEmporiumProof.d.ts +6 -3
- package/functions/snarkjs/constructEmporiumProof.mjs +148 -84
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.d.ts +5 -3
- package/functions/snarkjs/constructGeneralZkProof.mjs +142 -86
- package/functions/snarkjs/generateCircomData.cjs +1 -1
- package/functions/snarkjs/generateCircomData.d.ts +3 -2
- package/functions/snarkjs/generateCircomData.mjs +33 -35
- package/functions/snarkjs/generateZkProof.cjs +1 -1
- package/functions/snarkjs/generateZkProof.d.ts +2 -2
- package/functions/snarkjs/generateZkProof.mjs +4 -15
- package/functions/snarkjs/generateZkProofEnclave.cjs +1 -0
- package/functions/snarkjs/generateZkProofEnclave.d.ts +6 -0
- package/functions/snarkjs/generateZkProofEnclave.mjs +26 -0
- package/functions/snarkjs/generateZkProofSelf.cjs +1 -0
- package/functions/snarkjs/generateZkProofSelf.d.ts +5 -0
- package/functions/snarkjs/generateZkProofSelf.mjs +17 -0
- package/functions/snarkjs/getOriginalSender.cjs +1 -0
- package/functions/snarkjs/getOriginalSender.d.ts +1 -0
- package/functions/snarkjs/getOriginalSender.mjs +5 -0
- package/functions/snarkjs/getZKFiles.cjs +1 -1
- package/functions/snarkjs/getZKFiles.d.ts +3 -2
- package/functions/snarkjs/getZKFiles.mjs +14 -5
- package/functions/utils/addresses.cjs +1 -0
- package/functions/utils/addresses.d.ts +4 -0
- package/functions/utils/addresses.mjs +20 -0
- package/functions/utils/amounts.utils.cjs +1 -1
- package/functions/utils/amounts.utils.d.ts +4 -1
- package/functions/utils/amounts.utils.mjs +29 -27
- package/functions/utils/arraysMatch.cjs +1 -0
- package/functions/utils/arraysMatch.d.ts +1 -0
- package/functions/utils/arraysMatch.mjs +4 -0
- package/functions/utils/axelar.utils.cjs +1 -1
- package/functions/utils/axelar.utils.d.ts +1 -0
- package/functions/utils/axelar.utils.mjs +32 -9
- package/functions/utils/cacheDevice.utils.cjs +1 -1
- package/functions/utils/cacheDevice.utils.mjs +11 -8
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.d.ts +10 -7
- package/functions/utils/cacheFunctions.mjs +62 -39
- package/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -0
- package/functions/utils/convertEmporiumOpToCallInfo.d.ts +2 -0
- package/functions/utils/convertEmporiumOpToCallInfo.mjs +10 -0
- package/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
- package/functions/utils/convertIntegrationProviderToExternalActionId.d.ts +2 -1
- package/functions/utils/convertIntegrationProviderToExternalActionId.mjs +7 -10
- package/functions/utils/encodeTokenWithId.cjs +1 -0
- package/functions/utils/encodeTokenWithId.d.ts +2 -0
- package/functions/utils/encodeTokenWithId.mjs +4 -0
- package/functions/utils/encryptInputForEnclave.cjs +1 -0
- package/functions/utils/encryptInputForEnclave.d.ts +8 -0
- package/functions/utils/encryptInputForEnclave.mjs +43 -0
- package/functions/utils/erc20tokenFunctions.cjs +1 -1
- package/functions/utils/erc20tokenFunctions.d.ts +8 -2
- package/functions/utils/erc20tokenFunctions.mjs +23 -14
- package/functions/utils/evmNetworkFunctions.cjs +1 -1
- package/functions/utils/evmNetworkFunctions.mjs +7 -4
- package/functions/utils/external-action.utils.d.ts +2 -2
- package/functions/utils/fees.utils.cjs +1 -0
- package/functions/utils/fees.utils.d.ts +2 -0
- package/functions/utils/fees.utils.mjs +14 -0
- package/functions/utils/getBlockExplorerUrl.cjs +1 -0
- package/functions/utils/getBlockExplorerUrl.d.ts +1 -0
- package/functions/utils/getBlockExplorerUrl.mjs +6 -0
- package/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -0
- package/functions/utils/getRecipientInfoFromUserKeys.d.ts +3 -0
- package/functions/utils/getRecipientInfoFromUserKeys.mjs +18 -0
- package/functions/utils/index.d.ts +12 -0
- package/functions/utils/involves-permit2-op.cjs +1 -0
- package/functions/utils/involves-permit2-op.d.ts +1 -0
- package/functions/utils/involves-permit2-op.mjs +5 -0
- package/functions/utils/merkleTree.utils.cjs +1 -0
- package/functions/utils/merkleTree.utils.d.ts +2 -0
- package/functions/utils/merkleTree.utils.mjs +19 -0
- package/functions/utils/prepareHinkal.d.ts +6 -0
- package/functions/utils/processUseApprovalUtxoData.cjs +1 -0
- package/functions/utils/processUseApprovalUtxoData.d.ts +3 -0
- package/functions/utils/processUseApprovalUtxoData.mjs +19 -0
- package/functions/utils/publicBalance.utils.cjs +1 -0
- package/functions/utils/publicBalance.utils.d.ts +5 -0
- package/functions/utils/publicBalance.utils.mjs +25 -0
- package/functions/utils/replaceAddressInCalldata.cjs +1 -0
- package/functions/utils/replaceAddressInCalldata.d.ts +1 -0
- package/functions/utils/replaceAddressInCalldata.mjs +7 -0
- package/functions/utils/rpc-int-encode.cjs +1 -0
- package/functions/utils/rpc-int-encode.d.ts +2 -0
- package/functions/utils/rpc-int-encode.mjs +8 -0
- package/functions/utils/serialize.utils.cjs +1 -1
- package/functions/utils/serialize.utils.d.ts +1 -0
- package/functions/utils/serialize.utils.mjs +3 -2
- package/functions/utils/string.utils.cjs +1 -1
- package/functions/utils/string.utils.d.ts +2 -0
- package/functions/utils/string.utils.mjs +28 -14
- package/functions/utils/time.utils.cjs +1 -1
- package/functions/utils/time.utils.d.ts +1 -0
- package/functions/utils/time.utils.mjs +4 -3
- package/functions/utils/token-check.utils.cjs +1 -0
- package/functions/utils/token-check.utils.d.ts +1 -0
- package/functions/utils/token-check.utils.mjs +10 -0
- package/functions/utils/upToDateState.cjs +1 -0
- package/functions/utils/upToDateState.d.ts +2 -0
- package/functions/utils/upToDateState.mjs +11 -0
- package/functions/utils/userAgent.cjs +1 -1
- package/functions/utils/userAgent.mjs +8 -8
- package/functions/web3/events/balanceChangedCustomHandler.cjs +1 -0
- package/functions/web3/events/balanceChangedCustomHandler.d.ts +2 -0
- package/functions/web3/events/balanceChangedCustomHandler.mjs +14 -0
- package/functions/web3/events/balanceChangedHandler.cjs +1 -1
- package/functions/web3/events/balanceChangedHandler.mjs +5 -4
- package/functions/web3/events/getApprovedBalance.cjs +1 -0
- package/functions/web3/events/getApprovedBalance.d.ts +7 -0
- package/functions/web3/events/getApprovedBalance.mjs +80 -0
- package/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/functions/web3/events/getInputUtxoAndBalance.d.ts +16 -3
- package/functions/web3/events/getInputUtxoAndBalance.mjs +128 -46
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/functions/web3/events/getShieldedBalance.mjs +70 -65
- package/functions/web3/events/index.d.ts +2 -0
- package/functions/web3/functionCalls/accessTokenCalls.cjs +1 -1
- package/functions/web3/functionCalls/accessTokenCalls.d.ts +2 -2
- package/functions/web3/functionCalls/accessTokenCalls.mjs +20 -18
- package/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/functions/web3/functionCalls/approveToken.mjs +8 -7
- package/functions/web3/functionCalls/approveTokensToHinkal.cjs +1 -0
- package/functions/web3/functionCalls/approveTokensToHinkal.d.ts +4 -0
- package/functions/web3/functionCalls/approveTokensToHinkal.mjs +11 -0
- package/functions/web3/functionCalls/estimateGasRelayer.cjs +1 -1
- package/functions/web3/functionCalls/estimateGasRelayer.d.ts +2 -2
- package/functions/web3/functionCalls/estimateGasRelayer.mjs +14 -8
- package/functions/web3/functionCalls/inHinkalApprovalCalls.cjs +1 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.d.ts +5 -0
- package/functions/web3/functionCalls/inHinkalApprovalCalls.mjs +32 -0
- package/functions/web3/functionCalls/relayFunctions.d.ts +1 -15
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.d.ts +2 -2
- package/functions/web3/functionCalls/transactCallDirect.mjs +31 -30
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
- package/functions/web3/functionCalls/transactCallRelayer.mjs +32 -9
- package/functions/web3/getContractMetadata.cjs +1 -0
- package/functions/web3/getContractMetadata.d.ts +5 -0
- package/functions/web3/getContractMetadata.mjs +30 -0
- package/functions/web3/odosAPI.cjs +1 -1
- package/functions/web3/odosAPI.d.ts +1 -2
- package/functions/web3/odosAPI.mjs +23 -19
- package/functions/web3/oneInchAPI.cjs +1 -1
- package/functions/web3/oneInchAPI.d.ts +1 -2
- package/functions/web3/oneInchAPI.mjs +20 -15
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +3 -2
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.d.ts +4 -4
- package/functions/web3/uniswapAPI.mjs +57 -43
- package/index.cjs +1 -1
- package/index.mjs +761 -639
- package/package.json +19 -8
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.d.ts +8 -3
- package/providers/EthersProviderAdapter.mjs +52 -43
- package/providers/WagmiProviderAdapter.cjs +1 -1
- package/providers/WagmiProviderAdapter.d.ts +4 -1
- package/providers/WagmiProviderAdapter.mjs +53 -56
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +18 -10
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +18 -10
- package/types/API.types.d.ts +21 -0
- package/types/ICacheDevice.d.ts +4 -3
- package/types/TransactionSimulator.types.d.ts +9 -0
- package/types/activities.types.cjs +1 -0
- package/types/activities.types.d.ts +45 -0
- package/types/activities.types.mjs +13 -0
- package/types/balances.types.cjs +1 -0
- package/types/balances.types.d.ts +17 -0
- package/types/balances.types.mjs +4 -0
- package/types/cache.types.cjs +1 -0
- package/types/cache.types.d.ts +27 -0
- package/types/cache.types.mjs +4 -0
- package/types/circom-data.types.d.ts +29 -9
- package/types/commitments.types.d.ts +6 -0
- package/types/contacts.types.d.ts +5 -0
- package/types/crypto.types.d.ts +1 -0
- package/types/earlyAccessCode.types.d.ts +4 -0
- package/types/ethereum-network.types.cjs +1 -1
- package/types/ethereum-network.types.d.ts +8 -3
- package/types/ethereum-network.types.mjs +1 -1
- package/types/external-action.types.cjs +1 -1
- package/types/external-action.types.d.ts +2 -1
- package/types/external-action.types.mjs +1 -1
- package/types/fee.types.d.ts +9 -0
- package/types/hinkal.types.cjs +1 -1
- package/types/hinkal.types.d.ts +48 -0
- package/types/hinkal.types.mjs +38 -13
- package/types/index.d.ts +9 -0
- package/types/kyc.types.cjs +1 -1
- package/types/kyc.types.d.ts +1 -1
- package/types/kyc.types.mjs +1 -1
- package/types/remote-proof.types.d.ts +15 -0
- package/types/rewards.types.d.ts +9 -0
- package/types/sandbox.types.cjs +1 -0
- package/types/sandbox.types.d.ts +157 -0
- package/types/sandbox.types.mjs +4 -0
- package/types/tenderly.api.types.d.ts +180 -0
- package/types/time.types.cjs +1 -1
- package/types/time.types.mjs +1 -1
- package/types/token-with-id.types.d.ts +4 -0
- package/types/token.types.d.ts +23 -0
- package/types/transactions.types.cjs +1 -1
- package/types/transactions.types.d.ts +31 -0
- package/types/transactions.types.mjs +8 -5
- package/types/wc.types.d.ts +89 -0
- package/types/with-id.types.d.ts +3 -0
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +26 -26
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.mjs +58 -50
- package/webworker/viteWorkerURL.constant.cjs +3 -3
- package/webworker/viteWorkerURL.constant.mjs +3 -3
- package/webworker/workerFactory.cjs +1 -1
- package/webworker/workerFactory.mjs +2 -2
- package/webworker/workerProxy.cjs +1 -1
- package/webworker/workerProxy.d.ts +11 -11
- package/webworker/workerProxy.mjs +24 -26
- package/webworker/zkProofWorker/zkProofWorker.types.d.ts +2 -0
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.mjs +47 -61
- package/functions/utils/memoize.utils.cjs +0 -1
- package/functions/utils/memoize.utils.mjs +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("ethers"),S=require("../../constants/chains.constants.cjs"),I=require("../../error-handling/error-codes.constants.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("ethers"),S=require("../../constants/chains.constants.cjs"),I=require("../../error-handling/error-codes.constants.cjs"),P=require("../../functions/pre-transaction/getFlatFees.cjs"),M=require("../../functions/pre-transaction/processAmountChanges.cjs"),N=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),T=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),U=require("../../functions/web3/events/getShieldedBalance.cjs"),_=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),k=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),F=require("../../types/hinkal.types.cjs"),i=require("../../types/external-action.types.cjs"),G=(e,r,t,n,l,d)=>{let a;return l===i.ExternalActionId.BeefyStake?(a=u.utils.defaultAbiCoder.encode(["uint8","address","uint256","uint256"],[Number(n),d,e[0][0].amount,e[0][0].timeStamp]),a):(r.length===1?a=u.utils.defaultAbiCoder.encode(["uint8","bytes","bytes","address"],[Number(n),r[0],"0x00",t]):r.length===2?a=u.utils.defaultAbiCoder.encode(["uint8","bytes","bytes","address"],[Number(n),r[0],r[1],t]):a=u.utils.defaultAbiCoder.encode(["uint8","bytes","bytes","address"],[Number(n),"0x00","0x00",t]),a)},O=(e,r,t)=>r===i.ExternalActionId.BeefyStake?t===F.BeefyAction.GetRewards?[!1,!0]:[!1,!1,!0]:e.map(n=>n>0n),L=async(e,r,t,n,l,d,a,E=!1)=>{const c=[...await U.addPaddingToUtxos(e,r,t)],p=`swapper${a?"MO":"M"}${t.length.toString()}x${c[0].length}x1`,s=a?i.ExternalActionId.BeefyStake:i.ExternalActionId.Beefy,{flatFees:f,feeUnit:q}=await P.getFlatFees(e.getCurrentChainId(),r,s,t,n);t=M.processAmountChanges({erc20Addresses:r,amountChanges:t,flatFees:f,feeUnit:q,externalActionId:s,action:n});const R=O(t,s,n),x=[];for(let o=0;o<r.length;o+=1){const{outputUtxos:B}=N.outputUtxoProcessing(e.userKeys,c[o],t[o]);x.push(B)}const{contractData:y}=S.networkRegistry[e.getCurrentChainId()],b=s===i.ExternalActionId.BeefyStake?y.beefyStakeExternalActionInstanceAddress:y.beefyExternalActionInstanceAddress,w=G(c,l,d,n,s,a),g=await e.getRandomRelay();if(!g)throw Error(I.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{zkCallData:A,circomData:C,dimData:m}=await T.constructZkProof("v1x0",e.merkleTreeHinkal,e.merkleTreeAccessToken,c,x,e.userKeys,p,s,b,w,e.generateProofRemotely,g,e.getCurrentChainId(),R,f);return E?await _.estimateGasRelayer(e,A,m,C):await k.transactCallRelayer(e.getCurrentChainId(),A,m,C)};exports.hinkalActionBeefy=L;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { utils as
|
|
1
|
+
import { utils as c } from "ethers";
|
|
2
2
|
import { networkRegistry as N } from "../../constants/chains.constants.mjs";
|
|
3
3
|
import { transactionErrorCodes as I } from "../../error-handling/error-codes.constants.mjs";
|
|
4
4
|
import { getFlatFees as M } from "../../functions/pre-transaction/getFlatFees.mjs";
|
|
5
5
|
import { processAmountChanges as T } from "../../functions/pre-transaction/processAmountChanges.mjs";
|
|
6
6
|
import { outputUtxoProcessing as U } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
7
|
-
import { constructZkProof as
|
|
7
|
+
import { constructZkProof as P } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
8
8
|
import { addPaddingToUtxos as F } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
9
9
|
import { estimateGasRelayer as L } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
|
|
10
10
|
import { transactCallRelayer as O } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
11
|
-
import { BeefyAction as
|
|
11
|
+
import { BeefyAction as $ } from "../../types/hinkal.types.mjs";
|
|
12
12
|
import { ExternalActionId as s } from "../../types/external-action.types.mjs";
|
|
13
|
-
const
|
|
13
|
+
const k = (t, r, e, o, f, u) => {
|
|
14
14
|
let a;
|
|
15
|
-
return
|
|
15
|
+
return f === s.BeefyStake ? (a = c.defaultAbiCoder.encode(
|
|
16
16
|
["uint8", "address", "uint256", "uint256"],
|
|
17
|
-
[Number(o),
|
|
18
|
-
), a) : (r.length === 1 ? a =
|
|
17
|
+
[Number(o), u, t[0][0].amount, t[0][0].timeStamp]
|
|
18
|
+
), a) : (r.length === 1 ? a = c.defaultAbiCoder.encode(
|
|
19
19
|
["uint8", "bytes", "bytes", "address"],
|
|
20
20
|
[Number(o), r[0], "0x00", e]
|
|
21
|
-
) : r.length === 2 ? a =
|
|
21
|
+
) : r.length === 2 ? a = c.defaultAbiCoder.encode(
|
|
22
22
|
["uint8", "bytes", "bytes", "address"],
|
|
23
23
|
[Number(o), r[0], r[1], e]
|
|
24
|
-
) : a =
|
|
24
|
+
) : a = c.defaultAbiCoder.encode(
|
|
25
25
|
["uint8", "bytes", "bytes", "address"],
|
|
26
26
|
[Number(o), "0x00", "0x00", e]
|
|
27
27
|
), a);
|
|
28
|
-
}, G = (t, r, e) => r === s.BeefyStake ? e ===
|
|
29
|
-
const
|
|
28
|
+
}, G = (t, r, e) => r === s.BeefyStake ? e === $.GetRewards ? [!1, !0] : [!1, !1, !0] : t.map((o) => o > 0n), X = async (t, r, e, o, f, u, a, A = !1) => {
|
|
29
|
+
const m = [...await F(t, r, e)], E = `swapper${a ? "MO" : "M"}${e.length.toString()}x${m[0].length}x1`, n = a ? s.BeefyStake : s.Beefy, { flatFees: l, feeUnit: w } = await M(
|
|
30
30
|
t.getCurrentChainId(),
|
|
31
31
|
r,
|
|
32
32
|
n,
|
|
@@ -41,34 +41,36 @@ const $ = (t, r, e, o, u, f) => {
|
|
|
41
41
|
externalActionId: n,
|
|
42
42
|
action: o
|
|
43
43
|
});
|
|
44
|
-
const
|
|
44
|
+
const R = G(e, n, o), d = [];
|
|
45
45
|
for (let i = 0; i < r.length; i += 1) {
|
|
46
|
-
const { outputUtxos: S } = U(t.userKeys,
|
|
46
|
+
const { outputUtxos: S } = U(t.userKeys, m[i], e[i]);
|
|
47
47
|
d.push(S);
|
|
48
48
|
}
|
|
49
|
-
const { contractData:
|
|
50
|
-
|
|
51
|
-
u,
|
|
49
|
+
const { contractData: x } = N[t.getCurrentChainId()], b = n === s.BeefyStake ? x.beefyStakeExternalActionInstanceAddress : x.beefyExternalActionInstanceAddress, B = k(
|
|
50
|
+
m,
|
|
52
51
|
f,
|
|
52
|
+
u,
|
|
53
53
|
o,
|
|
54
54
|
n,
|
|
55
55
|
a
|
|
56
|
-
),
|
|
57
|
-
if (!
|
|
56
|
+
), p = await t.getRandomRelay();
|
|
57
|
+
if (!p)
|
|
58
58
|
throw Error(I.RELAYER_NOT_AVAILABLE);
|
|
59
|
-
const { zkCallData: y, circomData: g, dimData: C } = await
|
|
59
|
+
const { zkCallData: y, circomData: g, dimData: C } = await P(
|
|
60
|
+
"v1x0",
|
|
60
61
|
t.merkleTreeHinkal,
|
|
61
62
|
t.merkleTreeAccessToken,
|
|
62
|
-
|
|
63
|
+
m,
|
|
63
64
|
d,
|
|
64
65
|
t.userKeys,
|
|
65
66
|
E,
|
|
66
67
|
n,
|
|
68
|
+
b,
|
|
67
69
|
B,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
t.generateProofRemotely,
|
|
71
|
+
p,
|
|
70
72
|
t.getCurrentChainId(),
|
|
71
|
-
|
|
73
|
+
R,
|
|
72
74
|
l
|
|
73
75
|
);
|
|
74
76
|
return A ? await L(t, y, C, g) : await O(t.getCurrentChainId(), y, C, g);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("ethers"),s=require("../../constants/chains.constants.cjs"),E=require("../../error-handling/error-codes.constants.cjs"),P=require("../../functions/pre-transaction/getFlatFees.cjs"),U=require("../../functions/pre-transaction/processAmountChanges.cjs"),L=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),S=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),T=require("../../functions/web3/events/getShieldedBalance.cjs"),_=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),v=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),y=require("../../types/hinkal.types.cjs"),F=require("../../types/external-action.types.cjs"),M=async(t,o,e,A,a,f=!1)=>{const r=[...await T.addPaddingToUtxos(t,o,e)],p=`swapperMO${e.length.toString()}x${r[0].length}x1`,c=s.getNonLocalhostChainId(t.getCurrentChainId()),i=F.ExternalActionId.Convex,{flatFees:u,feeUnit:m}=await P.getFlatFees(t.getCurrentChainId(),o,i,e,a);e=U.processAmountChanges({erc20Addresses:o,amountChanges:e,flatFees:u,feeUnit:m,externalActionId:i,action:a});const I=[y.ConvexAction.StakeLP,y.ConvexAction.UnStakeLP].includes(a)?[!1,!1,...c===s.chainIds.ethMainnet?[!0,!0]:[!0]]:[!1,...c===s.chainIds.ethMainnet?[!0,!0]:[!0]],l=[];for(let n=0;n<o.length;n+=1){const{outputUtxos:R}=L.outputUtxoProcessing(t.userKeys,r[n],e[n]);l.push(R)}const q=s.networkRegistry[t.getCurrentChainId()].contractData.convexExternalActionInstanceAddress,h=w.utils.defaultAbiCoder.encode(["uint8","uint256","uint256","uint256"],[Number(a),A,r[0][0].amount,r[0][0].timeStamp]),d=await t.getRandomRelay();if(!d)throw Error(E.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{zkCallData:C,circomData:g,dimData:x}=await S.constructZkProof("v1x0",t.merkleTreeHinkal,t.merkleTreeAccessToken,r,l,t.userKeys,p,i,q,h,t.generateProofRemotely,d,t.getCurrentChainId(),I,u);return f?await _.estimateGasRelayer(t,C,x,g):await v.transactCallRelayer(t.getCurrentChainId(),C,x,g)};exports.hinkalActionConvex=M;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { utils as
|
|
2
|
-
import { getNonLocalhostChainId as U, networkRegistry as
|
|
3
|
-
import { transactionErrorCodes as
|
|
4
|
-
import { getFlatFees as
|
|
1
|
+
import { utils as L } from "ethers";
|
|
2
|
+
import { getNonLocalhostChainId as U, networkRegistry as P, chainIds as d } from "../../constants/chains.constants.mjs";
|
|
3
|
+
import { transactionErrorCodes as T } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import { getFlatFees as h } from "../../functions/pre-transaction/getFlatFees.mjs";
|
|
5
5
|
import { processAmountChanges as D } from "../../functions/pre-transaction/processAmountChanges.mjs";
|
|
6
6
|
import { outputUtxoProcessing as M } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
7
7
|
import { constructZkProof as N } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
@@ -11,7 +11,7 @@ import { transactCallRelayer as F } from "../../functions/web3/functionCalls/tra
|
|
|
11
11
|
import { ConvexAction as C } from "../../types/hinkal.types.mjs";
|
|
12
12
|
import { ExternalActionId as b } from "../../types/external-action.types.mjs";
|
|
13
13
|
const Q = async (t, n, e, x, a, g = !1) => {
|
|
14
|
-
const r = [...await O(t, n, e)], A = `swapperMO${e.length.toString()}x${r[0].length}x1`, s = U(t.getCurrentChainId()), i = b.Convex, { flatFees: c, feeUnit: I } = await
|
|
14
|
+
const r = [...await O(t, n, e)], A = `swapperMO${e.length.toString()}x${r[0].length}x1`, s = U(t.getCurrentChainId()), i = b.Convex, { flatFees: c, feeUnit: I } = await h(
|
|
15
15
|
t.getCurrentChainId(),
|
|
16
16
|
n,
|
|
17
17
|
i,
|
|
@@ -28,16 +28,17 @@ const Q = async (t, n, e, x, a, g = !1) => {
|
|
|
28
28
|
});
|
|
29
29
|
const y = [C.StakeLP, C.UnStakeLP].includes(a) ? [!1, !1, ...s === d.ethMainnet ? [!0, !0] : [!0]] : [!1, ...s === d.ethMainnet ? [!0, !0] : [!0]], m = [];
|
|
30
30
|
for (let o = 0; o < n.length; o += 1) {
|
|
31
|
-
const { outputUtxos:
|
|
32
|
-
m.push(
|
|
31
|
+
const { outputUtxos: R } = M(t.userKeys, r[o], e[o]);
|
|
32
|
+
m.push(R);
|
|
33
33
|
}
|
|
34
|
-
const w =
|
|
34
|
+
const w = P[t.getCurrentChainId()].contractData.convexExternalActionInstanceAddress, E = L.defaultAbiCoder.encode(
|
|
35
35
|
["uint8", "uint256", "uint256", "uint256"],
|
|
36
36
|
[Number(a), x, r[0][0].amount, r[0][0].timeStamp]
|
|
37
37
|
), u = await t.getRandomRelay();
|
|
38
38
|
if (!u)
|
|
39
|
-
throw Error(
|
|
39
|
+
throw Error(T.RELAYER_NOT_AVAILABLE);
|
|
40
40
|
const { zkCallData: f, circomData: l, dimData: p } = await N(
|
|
41
|
+
"v1x0",
|
|
41
42
|
t.merkleTreeHinkal,
|
|
42
43
|
t.merkleTreeAccessToken,
|
|
43
44
|
r,
|
|
@@ -47,6 +48,7 @@ const Q = async (t, n, e, x, a, g = !1) => {
|
|
|
47
48
|
i,
|
|
48
49
|
w,
|
|
49
50
|
E,
|
|
51
|
+
t.generateProofRemotely,
|
|
50
52
|
u,
|
|
51
53
|
t.getCurrentChainId(),
|
|
52
54
|
y,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("ethers"),V=require("../../constants/protocol.constants.cjs"),S=require("../../constants/crvDynamic.registry.cjs"),m=require("../../constants/chains.constants.cjs"),U=require("../../error-handling/error-codes.constants.cjs"),_=require("../../functions/protocols/curve.protocols.cjs"),L=require("../../functions/pre-transaction/getFlatFees.cjs"),T=require("../../functions/pre-transaction/processAmountChanges.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("ethers"),V=require("../../constants/protocol.constants.cjs"),S=require("../../constants/crvDynamic.registry.cjs"),m=require("../../constants/chains.constants.cjs"),U=require("../../error-handling/error-codes.constants.cjs"),_=require("../../functions/protocols/curve.protocols.cjs"),L=require("../../functions/pre-transaction/getFlatFees.cjs"),T=require("../../functions/pre-transaction/processAmountChanges.cjs"),F=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),M=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),P=require("../../functions/web3/events/getShieldedBalance.cjs"),k=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),G=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),a=require("../../types/hinkal.types.cjs"),s=require("../../types/external-action.types.cjs"),b=(t,n,e,o)=>n?o?s.ExternalActionId.CurveCRVRewards:s.ExternalActionId.CurveCRV:S.getCalcTokenAmountWithDynamicArray(t).includes(e.toLowerCase())?s.ExternalActionId.CurveDynamic:s.ExternalActionId.Curve,W=(t,n)=>{const{contractData:e}=m.networkRegistry[t.getCurrentChainId()];switch(n){case s.ExternalActionId.Curve:return e.curveExternalActionInstanceAddress;case s.ExternalActionId.CurveDynamic:return e.curveExternalActionDynamicInstanceAddress;case s.ExternalActionId.CurveCRV:return e.curveExternalActionInstanceAddress;case s.ExternalActionId.CurveCRVRewards:return e.curveStakeExternalActionInstanceAddress;default:return e.curveExternalActionInstanceAddress}},N=(t,n,e)=>D.utils.defaultAbiCoder.encode(["uint8","address","uint256","uint256"],[Number(t),n,e[0][0].amount,e[0][0].timeStamp]),O=(t,n,e,o)=>{if([a.CurveAction.Deposit,a.CurveAction.WithdrawInt,a.CurveAction.WithdrawUint].includes(o))return t.map(r=>r>0n);if(o===a.CurveAction.WithdrawImbalance)return t.map(()=>!1);if([a.CurveAction.Stake,a.CurveAction.Unstake,a.CurveAction.GetCRV].includes(o)){let r=!1;return n.map(l=>(l.toLowerCase()===_.getCRV(e).toLowerCase()&&(r=!0),r))}return t.map(r=>r>0n)},$=async(t,n,e,o,r,l,p=!1)=>{const c=[...await P.addPaddingToUtxos(t,n,e)];let d=`swapperM${e.length.toString()}x${c[0].length}x1`;const C=r===a.CurveAction.GetCRV||r===a.CurveAction.Stake||r===a.CurveAction.Unstake;C&&(d=`swapperMO${e.length.toString()}x${c[0].length}x1`);const A=m.getNonLocalhostChainId(t.getCurrentChainId()),u=b(A,C,o,l),{flatFees:x,feeUnit:R}=await L.getFlatFees(t.getCurrentChainId(),n,u,e,r,V.curveWithdrawGasTokenAddress?.current);e=T.processAmountChanges({erc20Addresses:n,amountChanges:e,flatFees:x,feeUnit:R,externalActionId:u,action:r});const f=O(e,n,A,r),g=[];for(let i=0;i<n.length;i+=1){const{outputUtxos:h}=F.outputUtxoProcessing(t.userKeys,c[i],e[i]);g.push(h)}const w=W(t,u),q=N(r,o,c),y=await t.getRandomRelay();if(!y)throw Error(U.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{zkCallData:I,circomData:v,dimData:E}=await M.constructZkProof("v1x0",t.merkleTreeHinkal,t.merkleTreeAccessToken,c,g,t.userKeys,d,u,w,q,t.generateProofRemotely,y,t.getCurrentChainId(),f,x);return p?await k.estimateGasRelayer(t,I,E,v):await G.transactCallRelayer(t.getCurrentChainId(),I,E,v)};exports.hinkalActionCurve=$;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { utils as V } from "ethers";
|
|
2
2
|
import { curveWithdrawGasTokenAddress as L } from "../../constants/protocol.constants.mjs";
|
|
3
3
|
import { getCalcTokenAmountWithDynamicArray as U } from "../../constants/crvDynamic.registry.mjs";
|
|
4
|
-
import { getNonLocalhostChainId as
|
|
4
|
+
import { getNonLocalhostChainId as T, networkRegistry as h } from "../../constants/chains.constants.mjs";
|
|
5
5
|
import { transactionErrorCodes as M } from "../../error-handling/error-codes.constants.mjs";
|
|
6
6
|
import { getCRV as S } from "../../functions/protocols/curve.protocols.mjs";
|
|
7
7
|
import { getFlatFees as F } from "../../functions/pre-transaction/getFlatFees.mjs";
|
|
8
8
|
import { processAmountChanges as W } from "../../functions/pre-transaction/processAmountChanges.mjs";
|
|
9
|
-
import { outputUtxoProcessing as
|
|
10
|
-
import { constructZkProof as
|
|
11
|
-
import { addPaddingToUtxos as
|
|
9
|
+
import { outputUtxoProcessing as G } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
10
|
+
import { constructZkProof as N } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
11
|
+
import { addPaddingToUtxos as P } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
12
12
|
import { estimateGasRelayer as $ } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
|
|
13
13
|
import { transactCallRelayer as b } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
14
14
|
import { CurveAction as a } from "../../types/hinkal.types.mjs";
|
|
15
15
|
import { ExternalActionId as s } from "../../types/external-action.types.mjs";
|
|
16
|
-
const
|
|
17
|
-
const { contractData: e } =
|
|
16
|
+
const k = (t, n, e, o) => n ? o ? s.CurveCRVRewards : s.CurveCRV : U(t).includes(e.toLowerCase()) ? s.CurveDynamic : s.Curve, O = (t, n) => {
|
|
17
|
+
const { contractData: e } = h[t.getCurrentChainId()];
|
|
18
18
|
switch (n) {
|
|
19
19
|
case s.Curve:
|
|
20
20
|
return e.curveExternalActionInstanceAddress;
|
|
@@ -40,12 +40,12 @@ const O = (t, n, e, o) => n ? o ? s.CurveCRVRewards : s.CurveCRV : U(t).includes
|
|
|
40
40
|
return n.map((u) => (u.toLowerCase() === S(e).toLowerCase() && (r = !0), r));
|
|
41
41
|
}
|
|
42
42
|
return t.map((r) => r > 0n);
|
|
43
|
-
}, st = async (t, n, e, o, r, u,
|
|
44
|
-
const i = [...await
|
|
43
|
+
}, st = async (t, n, e, o, r, u, R = !1) => {
|
|
44
|
+
const i = [...await P(t, n, e)];
|
|
45
45
|
let d = `swapperM${e.length.toString()}x${i[0].length}x1`;
|
|
46
46
|
const l = r === a.GetCRV || r === a.Stake || r === a.Unstake;
|
|
47
47
|
l && (d = `swapperMO${e.length.toString()}x${i[0].length}x1`);
|
|
48
|
-
const C =
|
|
48
|
+
const C = T(t.getCurrentChainId()), m = k(C, l, o, u), { flatFees: f, feeUnit: I } = await F(
|
|
49
49
|
t.getCurrentChainId(),
|
|
50
50
|
n,
|
|
51
51
|
m,
|
|
@@ -57,19 +57,20 @@ const O = (t, n, e, o) => n ? o ? s.CurveCRVRewards : s.CurveCRV : U(t).includes
|
|
|
57
57
|
erc20Addresses: n,
|
|
58
58
|
amountChanges: e,
|
|
59
59
|
flatFees: f,
|
|
60
|
-
feeUnit:
|
|
60
|
+
feeUnit: I,
|
|
61
61
|
externalActionId: m,
|
|
62
62
|
action: r
|
|
63
63
|
});
|
|
64
64
|
const y = _(e, n, C, r), p = [];
|
|
65
65
|
for (let c = 0; c < n.length; c += 1) {
|
|
66
|
-
const { outputUtxos:
|
|
67
|
-
p.push(
|
|
66
|
+
const { outputUtxos: D } = G(t.userKeys, i[c], e[c]);
|
|
67
|
+
p.push(D);
|
|
68
68
|
}
|
|
69
|
-
const E =
|
|
69
|
+
const E = O(t, m), v = K(r, o, i), x = await t.getRandomRelay();
|
|
70
70
|
if (!x)
|
|
71
71
|
throw Error(M.RELAYER_NOT_AVAILABLE);
|
|
72
|
-
const { zkCallData: A, circomData: w, dimData: g } = await
|
|
72
|
+
const { zkCallData: A, circomData: w, dimData: g } = await N(
|
|
73
|
+
"v1x0",
|
|
73
74
|
t.merkleTreeHinkal,
|
|
74
75
|
t.merkleTreeAccessToken,
|
|
75
76
|
i,
|
|
@@ -78,13 +79,14 @@ const O = (t, n, e, o) => n ? o ? s.CurveCRVRewards : s.CurveCRV : U(t).includes
|
|
|
78
79
|
d,
|
|
79
80
|
m,
|
|
80
81
|
E,
|
|
81
|
-
|
|
82
|
+
v,
|
|
83
|
+
t.generateProofRemotely,
|
|
82
84
|
x,
|
|
83
85
|
t.getCurrentChainId(),
|
|
84
86
|
y,
|
|
85
87
|
f
|
|
86
88
|
);
|
|
87
|
-
return
|
|
89
|
+
return R ? await $(t, A, g, w) : await b(t.getCurrentChainId(), A, g, w);
|
|
88
90
|
};
|
|
89
91
|
export {
|
|
90
92
|
st as hinkalActionCurve
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../types/circom-data.types.cjs");require("../../constants/vite.constants.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");require("../../constants/kyc.constants.cjs");require("ethers");require("../../constants/contracts.constants.cjs");require("circomlibjs-hinkal-fork");require("../../error-handling/error-codes.constants.cjs");require("../crypto-keys/keys.cjs");require("idb-keyval");require("../../functions/utils/external-action.utils.cjs");require("../../constants/token-data/index.cjs");require("../../functions/utils/convertIntegrationProviderToExternalActionId.cjs");require("axios");require("../../constants/chains.constants.cjs");require("libsodium-wrappers");require("process");require("buffer");require("../../constants/reorg-depths.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/addresses.constants.cjs");require("../../constants/token.limits.constants.cjs");require("../../functions/utils/userAgent.cjs");require("../volatile-helper/VolatileHelper.cjs");require("node-forge");require("../../functions/web3/events/getShieldedBalance.cjs");require("../../functions/web3/events/getApprovedBalance.cjs");const A=require("../../functions/private-wallet/emporium.helpers.cjs"),v=require("../../functions/private-wallet/smartContractWalletCalculator.cjs"),g=async(e,r,i,t,q,u,a,n,l,o,c)=>{const s=e.userKeys.getWalletSalt(u),p=await v.calculateSmartContractWalletAddress(e.getCurrentChainId(),s),m=A.generateFundApproveAndTransactOps(e,r,i,t,q,p,a,n,l);return e.actionPrivateWallet(r,i.map(d=>-1n*d),r.map(()=>!1),m,u,o,void 0,c)};exports.hinkalActionFundApproveAndTransact=g;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RelayerTransaction } from '../../types/relayer.types';
|
|
2
|
+
import { IHinkal } from './IHinkal';
|
|
3
|
+
export declare const hinkalActionFundApproveAndTransact: (hinkal: IHinkal, erc20AddressesToFund: string[], fundAmounts: bigint[], approveTokenAddresses: string[], approveAmounts: bigint[], walletNonce: bigint, to: string, callDataString: string, value: bigint, feeToken?: string, onlyGasEstimate?: boolean) => Promise<RelayerTransaction | bigint>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "../../types/circom-data.types.mjs";
|
|
2
|
+
import "../../constants/vite.constants.mjs";
|
|
3
|
+
import "../../types/transactions.types.mjs";
|
|
4
|
+
import "../../types/curve.types.mjs";
|
|
5
|
+
import "../../types/activities.types.mjs";
|
|
6
|
+
import "../../constants/kyc.constants.mjs";
|
|
7
|
+
import "ethers";
|
|
8
|
+
import "../../constants/contracts.constants.mjs";
|
|
9
|
+
import "circomlibjs-hinkal-fork";
|
|
10
|
+
import "../../error-handling/error-codes.constants.mjs";
|
|
11
|
+
import "../crypto-keys/keys.mjs";
|
|
12
|
+
import "idb-keyval";
|
|
13
|
+
import "../../functions/utils/external-action.utils.mjs";
|
|
14
|
+
import "../../constants/token-data/index.mjs";
|
|
15
|
+
import "../../functions/utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
16
|
+
import "axios";
|
|
17
|
+
import "../../constants/chains.constants.mjs";
|
|
18
|
+
import "libsodium-wrappers";
|
|
19
|
+
import "process";
|
|
20
|
+
import "buffer";
|
|
21
|
+
import "../../constants/reorg-depths.constants.mjs";
|
|
22
|
+
import "../../constants/coingecko.constants.mjs";
|
|
23
|
+
import "../../constants/axelar.constants.mjs";
|
|
24
|
+
import "../../constants/rewards.constants.mjs";
|
|
25
|
+
import "../../constants/addresses.constants.mjs";
|
|
26
|
+
import "../../constants/token.limits.constants.mjs";
|
|
27
|
+
import "../../functions/utils/userAgent.mjs";
|
|
28
|
+
import "../volatile-helper/VolatileHelper.mjs";
|
|
29
|
+
import "node-forge";
|
|
30
|
+
import "../../functions/web3/events/getShieldedBalance.mjs";
|
|
31
|
+
import "../../functions/web3/events/getApprovedBalance.mjs";
|
|
32
|
+
import { generateFundApproveAndTransactOps as g } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
33
|
+
import { calculateSmartContractWalletAddress as u } from "../../functions/private-wallet/smartContractWalletCalculator.mjs";
|
|
34
|
+
const $ = async (t, r, o, m, i, p, a, e, n, s, c) => {
|
|
35
|
+
const l = t.userKeys.getWalletSalt(p), v = await u(t.getCurrentChainId(), l), A = g(
|
|
36
|
+
t,
|
|
37
|
+
r,
|
|
38
|
+
o,
|
|
39
|
+
m,
|
|
40
|
+
i,
|
|
41
|
+
v,
|
|
42
|
+
a,
|
|
43
|
+
e,
|
|
44
|
+
n
|
|
45
|
+
);
|
|
46
|
+
return t.actionPrivateWallet(
|
|
47
|
+
r,
|
|
48
|
+
o.map((d) => -1n * d),
|
|
49
|
+
// deltaAmounts
|
|
50
|
+
r.map(() => !1),
|
|
51
|
+
// onChainCreation
|
|
52
|
+
A,
|
|
53
|
+
p,
|
|
54
|
+
s,
|
|
55
|
+
void 0,
|
|
56
|
+
c
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
$ as hinkalActionFundApproveAndTransact
|
|
61
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("ethers"),F=require("../../constants/chains.constants.cjs"),P=require("../../error-handling/error-codes.constants.cjs"),M=require("../../functions/web3/events/getShieldedBalance.cjs"),U=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),S=require("../../functions/pre-transaction/getFlatFees.cjs"),_=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),h=require("../../functions/pre-transaction/processAmountChanges.cjs"),N=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),b=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),i=require("../../types/external-action.types.cjs"),o=require("../../types/hinkal.types.cjs"),v=(t,a)=>{if(t===o.LidoVariant.Ethereum)return a===o.LidoAction.Stake?i.ExternalActionId.LidoETH:i.ExternalActionId.LidoETHNFT;if(t===o.LidoVariant.Polygon)return a===o.LidoAction.Stake?i.ExternalActionId.LidoMATIC:i.ExternalActionId.LidoMATICNFT;throw new Error("Invalid LidoVariant used")},D=t=>T.ethers.utils.defaultAbiCoder.encode(["uint8"],[Number(t)]),G=async(t,a,n,s,r,d,g=!1)=>{const c=[...await M.addPaddingToUtxos(t,s,r,6,d)],p=c[0].length,f=`${n===o.LidoAction.Stake?"swapperM":"swapperToken"}2x${p}x1`,u=v(a,n),{flatFees:l,feeUnit:C}=await S.getFlatFees(t.getCurrentChainId(),s,u,r,n);r=h.processAmountChanges({erc20Addresses:s,amountChanges:r,flatFees:l,feeUnit:C,externalActionId:u,action:n});const w=n===o.LidoAction.Request?r.map(()=>!1):r.map(e=>e>0n),x=[];for(let e=0;e<s.length;e+=1){const{outputUtxos:R}=_.outputUtxoProcessing(t.userKeys,c[e],r[e],void 0,d[e]);x.push(R)}if(!await t.getRandomRelay())throw Error(P.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const{lidoExternalActionEthAddress:m,lidoExternalActionMaticAddress:q}=F.networkRegistry[t.getCurrentChainId()].contractData,A=a===o.LidoVariant.Ethereum?m:q;if(!A)throw new Error("Can't find external action address");const I=D(n),{zkCallData:E,circomData:y,dimData:L}=await U.constructZkProof("v1x0",t.merkleTreeHinkal,t.merkleTreeAccessToken,c,x,t.userKeys,f,u,A,I,t.generateProofRemotely,await t.getRandomRelay(),t.getCurrentChainId(),w,l);return g?await N.estimateGasRelayer(t,E,L,y):await b.transactCallRelayer(t.getCurrentChainId(),E,L,y)};exports.hinkalActionLido=G;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ethers as M } from "ethers";
|
|
2
2
|
import { networkRegistry as U } from "../../constants/chains.constants.mjs";
|
|
3
3
|
import { transactionErrorCodes as N } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
-
import { addPaddingToUtxos as
|
|
5
|
-
import { constructZkProof as
|
|
6
|
-
import { getFlatFees as
|
|
7
|
-
import { outputUtxoProcessing as
|
|
8
|
-
import { processAmountChanges as
|
|
9
|
-
import { estimateGasRelayer as
|
|
4
|
+
import { addPaddingToUtxos as P } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
5
|
+
import { constructZkProof as D } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
6
|
+
import { getFlatFees as v } from "../../functions/pre-transaction/getFlatFees.mjs";
|
|
7
|
+
import { outputUtxoProcessing as H } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
8
|
+
import { processAmountChanges as S } from "../../functions/pre-transaction/processAmountChanges.mjs";
|
|
9
|
+
import { estimateGasRelayer as b } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
|
|
10
10
|
import { transactCallRelayer as K } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
11
11
|
import { ExternalActionId as i } from "../../types/external-action.types.mjs";
|
|
12
12
|
import { LidoAction as s, LidoVariant as d } from "../../types/hinkal.types.mjs";
|
|
@@ -16,55 +16,57 @@ const _ = (t, a) => {
|
|
|
16
16
|
if (t === d.Polygon)
|
|
17
17
|
return a === s.Stake ? i.LidoMATIC : i.LidoMATICNFT;
|
|
18
18
|
throw new Error("Invalid LidoVariant used");
|
|
19
|
-
}, $ = (t) => M.utils.defaultAbiCoder.encode(["uint8"], [Number(t)]),
|
|
20
|
-
const c = [...await
|
|
19
|
+
}, $ = (t) => M.utils.defaultAbiCoder.encode(["uint8"], [Number(t)]), k = async (t, a, o, n, e, f, y = !1) => {
|
|
20
|
+
const c = [...await P(t, n, e, 6, f)], A = c[0].length, C = `${o === s.Stake ? "swapperM" : "swapperToken"}2x${A}x1`, m = _(a, o), { flatFees: p, feeUnit: L } = await v(
|
|
21
21
|
t.getCurrentChainId(),
|
|
22
22
|
n,
|
|
23
23
|
m,
|
|
24
24
|
e,
|
|
25
25
|
o
|
|
26
26
|
);
|
|
27
|
-
e =
|
|
27
|
+
e = S({
|
|
28
28
|
erc20Addresses: n,
|
|
29
29
|
amountChanges: e,
|
|
30
|
-
flatFees:
|
|
30
|
+
flatFees: p,
|
|
31
31
|
feeUnit: L,
|
|
32
32
|
externalActionId: m,
|
|
33
33
|
action: o
|
|
34
34
|
});
|
|
35
|
-
const
|
|
35
|
+
const g = o === s.Request ? e.map(() => !1) : e.map((r) => r > 0n), u = [];
|
|
36
36
|
for (let r = 0; r < n.length; r += 1) {
|
|
37
|
-
const { outputUtxos: F } =
|
|
37
|
+
const { outputUtxos: F } = H(
|
|
38
38
|
t.userKeys,
|
|
39
39
|
c[r],
|
|
40
40
|
e[r],
|
|
41
41
|
void 0,
|
|
42
|
-
|
|
42
|
+
f[r]
|
|
43
43
|
);
|
|
44
|
-
|
|
44
|
+
u.push(F);
|
|
45
45
|
}
|
|
46
46
|
if (!await t.getRandomRelay())
|
|
47
47
|
throw Error(N.RELAYER_NOT_AVAILABLE);
|
|
48
|
-
const { lidoExternalActionEthAddress:
|
|
48
|
+
const { lidoExternalActionEthAddress: T, lidoExternalActionMaticAddress: R } = U[t.getCurrentChainId()].contractData, x = a === d.Ethereum ? T : R;
|
|
49
49
|
if (!x)
|
|
50
50
|
throw new Error("Can't find external action address");
|
|
51
|
-
const
|
|
51
|
+
const I = $(o), { zkCallData: E, circomData: l, dimData: w } = await D(
|
|
52
|
+
"v1x0",
|
|
52
53
|
t.merkleTreeHinkal,
|
|
53
54
|
t.merkleTreeAccessToken,
|
|
54
55
|
c,
|
|
55
|
-
|
|
56
|
+
u,
|
|
56
57
|
t.userKeys,
|
|
57
58
|
C,
|
|
58
59
|
m,
|
|
59
60
|
x,
|
|
60
|
-
|
|
61
|
+
I,
|
|
62
|
+
t.generateProofRemotely,
|
|
61
63
|
await t.getRandomRelay(),
|
|
62
64
|
t.getCurrentChainId(),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
g,
|
|
66
|
+
p
|
|
65
67
|
);
|
|
66
|
-
return
|
|
68
|
+
return y ? await b(t, E, w, l) : await K(t.getCurrentChainId(), E, w, l);
|
|
67
69
|
};
|
|
68
70
|
export {
|
|
69
|
-
|
|
71
|
+
k as hinkalActionLido
|
|
70
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("ethers"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("ethers"),R=require("../../constants/protocol.constants.cjs"),Y=require("../../constants/chains.constants.cjs"),w=require("../../functions/utils/erc20tokenFunctions.cjs"),b=require("../../functions/pre-transaction/getFlatFees.cjs"),O=require("../../functions/pre-transaction/processAmountChanges.cjs"),U=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),W=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),H=require("../../functions/web3/events/getShieldedBalance.cjs"),v=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),G=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),x=require("../../functions/web3/functionCalls/transactCallDirect.cjs"),m=require("../../types/ethereum-network.types.cjs"),N=require("../../types/circom-data.types.cjs"),z=require("../../types/external-action.types.cjs"),t=require("../../types/hinkal.types.cjs"),L=require("../../error-handling/error-codes.constants.cjs"),$=e=>{let r=[];return e===t.PendleAction.Deposit?r=[!1,!0]:e===t.PendleAction.Withdraw?r=[!1,!0]:e===t.PendleAction.SwapFromYt?r=[!1,!0,!0]:e===t.PendleAction.SwapToYt?r=[!1,!1,!0]:e===t.PendleAction.SwapPt?r=[!1,!0]:e===t.PendleAction.Mint?r=[!1,!0,!1,!0]:e===t.PendleAction.Redeem?r=[!1,!1,!0,!0]:e===t.PendleAction.Checkpoint&&(r=[!1,!0]),r},B=(e,r)=>{const{pendleAction:o,ytAddress:c,userAddress:a,evmData:P}=e,i=P??"0x00",s=a??R.zeroAddress;if([t.PendleAction.Deposit,t.PendleAction.Withdraw,t.PendleAction.SwapFromYt,t.PendleAction.SwapToYt,t.PendleAction.SwapPt,t.PendleAction.Mint,t.PendleAction.Redeem,t.PendleAction.Checkpoint].includes(e.pendleAction))return F.utils.defaultAbiCoder.encode(["uint8","address","uint256","uint256","address","bool","bytes"],[o,c,r[0][0].amount,r[0][0].timeStamp,s,!0,i]);throw new Error("Not implemented")},K=async(e,r,o,c,a,P=!1)=>{const i=z.ExternalActionId.Pendle,{pendleAction:s}=c,l=[...await H.addPaddingToUtxos(e,r,o)],q=`swapperMO${o.length.toString()}x${l[0].length}x1`,{flatFees:y,feeUnit:T}=await b.getFlatFees(e.getCurrentChainId(),r,i,o,s,a);o=O.processAmountChanges({erc20Addresses:r,amountChanges:o,flatFees:y,feeUnit:T,externalActionId:i,action:s,gasTokenAddress:a});const p=[];for(let n=0;n<r.length;n+=1){const{outputUtxos:A}=W.outputUtxoProcessing(e.userKeys,l[n],o[n]);p.push(A)}const D=$(s),{contractData:E}=Y.networkRegistry[e.getCurrentChainId()],S=E?.pendleExternalActionInstanceAddress,h=B(c,l),C=s===t.PendleAction.Deposit||c.isRelayerOff?R.zeroAddress:await e.getRandomRelay();if(!C)throw Error(L.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const I=`0x0${s.toString(16)}`,_={...N.defaultHookData,preHookMetadata:I},{zkCallData:u,circomData:d,dimData:f}=await U.constructZkProof("v1x0",e.merkleTreeHinkal,e.merkleTreeAccessToken,l,p,e.userKeys,q,i,S,h,e.generateProofRemotely,C,e.getCurrentChainId(),D,y,_);if(P)return await v.estimateGasRelayer(e,u,f,d);const g=e.getCurrentChainId();if(s===t.PendleAction.Deposit){const n=w.getERC20Token(c.ytAddress,g);if(!n)throw Error("Yt Token not found");const A=e.getContractWithSigner(m.ContractType.PendleGeneralExternalAction),k=e.getContractWithSigner(m.ContractType.HinkalWrapper);return await x.transactCallDirect(e,o[0],n,u,d,f,A,k)}if(s===t.PendleAction.Withdraw&&c.isRelayerOff){const n=w.getERC20Token(c.ytAddress,g);if(!n)throw Error("Yt Token not found");return await x.transactCallDirect(e,o[0],n,u,d,f)}return await G.transactCallRelayer(e.getCurrentChainId(),u,f,d)};exports.hinkalActionPendle=K;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PendleMetadata } from '../../types/pendle.types';
|
|
2
2
|
import { IHinkal } from './IHinkal';
|
|
3
|
-
export declare const hinkalActionPendle: (hinkal: IHinkal, erc20Addresses: string[], amountChanges: bigint[], pendleMetadata: PendleMetadata, gasTokenAddress?: string, onlyGasEstimate?: boolean) => Promise<
|
|
3
|
+
export declare const hinkalActionPendle: (hinkal: IHinkal, erc20Addresses: string[], amountChanges: bigint[], pendleMetadata: PendleMetadata, gasTokenAddress?: string, onlyGasEstimate?: boolean) => Promise<any>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { utils as
|
|
1
|
+
import { utils as O } from "ethers";
|
|
2
2
|
import { zeroAddress as R } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { networkRegistry as
|
|
3
|
+
import { networkRegistry as U } from "../../constants/chains.constants.mjs";
|
|
4
4
|
import { getERC20Token as g } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
5
|
-
import { getFlatFees as
|
|
6
|
-
import { processAmountChanges as
|
|
7
|
-
import { constructZkProof as
|
|
5
|
+
import { getFlatFees as b } from "../../functions/pre-transaction/getFlatFees.mjs";
|
|
6
|
+
import { processAmountChanges as h } from "../../functions/pre-transaction/processAmountChanges.mjs";
|
|
7
|
+
import { constructZkProof as v } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
8
8
|
import { outputUtxoProcessing as L } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
9
9
|
import { addPaddingToUtxos as N } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
10
10
|
import { estimateGasRelayer as $ } from "../../functions/web3/functionCalls/estimateGasRelayer.mjs";
|
|
11
|
-
import { transactCallRelayer as
|
|
11
|
+
import { transactCallRelayer as k } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
12
12
|
import { transactCallDirect as A } from "../../functions/web3/functionCalls/transactCallDirect.mjs";
|
|
13
13
|
import { ContractType as E } from "../../types/ethereum-network.types.mjs";
|
|
14
14
|
import { defaultHookData as z } from "../../types/circom-data.types.mjs";
|
|
@@ -30,7 +30,7 @@ const _ = (t) => {
|
|
|
30
30
|
r.Redeem,
|
|
31
31
|
r.Checkpoint
|
|
32
32
|
].includes(t.pendleAction))
|
|
33
|
-
return
|
|
33
|
+
return O.defaultAbiCoder.encode(
|
|
34
34
|
["uint8", "address", "uint256", "uint256", "address", "bool", "bytes"],
|
|
35
35
|
[
|
|
36
36
|
s,
|
|
@@ -44,7 +44,7 @@ const _ = (t) => {
|
|
|
44
44
|
);
|
|
45
45
|
throw new Error("Not implemented");
|
|
46
46
|
}, ut = async (t, e, s, a, c, d = !1) => {
|
|
47
|
-
const i = G.Pendle, { pendleAction: n } = a, f = [...await N(t, e, s)], T = `swapperMO${s.length.toString()}x${f[0].length}x1`, { flatFees: w, feeUnit: D } = await
|
|
47
|
+
const i = G.Pendle, { pendleAction: n } = a, f = [...await N(t, e, s)], T = `swapperMO${s.length.toString()}x${f[0].length}x1`, { flatFees: w, feeUnit: D } = await b(
|
|
48
48
|
t.getCurrentChainId(),
|
|
49
49
|
e,
|
|
50
50
|
i,
|
|
@@ -52,7 +52,7 @@ const _ = (t) => {
|
|
|
52
52
|
n,
|
|
53
53
|
c
|
|
54
54
|
);
|
|
55
|
-
s =
|
|
55
|
+
s = h({
|
|
56
56
|
erc20Addresses: e,
|
|
57
57
|
amountChanges: s,
|
|
58
58
|
flatFees: w,
|
|
@@ -66,10 +66,11 @@ const _ = (t) => {
|
|
|
66
66
|
const { outputUtxos: p } = L(t.userKeys, f[o], s[o]);
|
|
67
67
|
x.push(p);
|
|
68
68
|
}
|
|
69
|
-
const S = _(n), { contractData: I } =
|
|
69
|
+
const S = _(n), { contractData: I } = U[t.getCurrentChainId()], P = I?.pendleExternalActionInstanceAddress, Y = B(a, f), y = n === r.Deposit || a.isRelayerOff ? R : await t.getRandomRelay();
|
|
70
70
|
if (!y)
|
|
71
71
|
throw Error(K.RELAYER_NOT_AVAILABLE);
|
|
72
|
-
const W = `0x0${n.toString(16)}`,
|
|
72
|
+
const W = `0x0${n.toString(16)}`, F = { ...z, preHookMetadata: W }, { zkCallData: m, circomData: u, dimData: l } = await v(
|
|
73
|
+
"v1x0",
|
|
73
74
|
t.merkleTreeHinkal,
|
|
74
75
|
t.merkleTreeAccessToken,
|
|
75
76
|
f,
|
|
@@ -79,11 +80,12 @@ const _ = (t) => {
|
|
|
79
80
|
i,
|
|
80
81
|
P,
|
|
81
82
|
Y,
|
|
83
|
+
t.generateProofRemotely,
|
|
82
84
|
y,
|
|
83
85
|
t.getCurrentChainId(),
|
|
84
86
|
S,
|
|
85
87
|
w,
|
|
86
|
-
|
|
88
|
+
F
|
|
87
89
|
);
|
|
88
90
|
if (d)
|
|
89
91
|
return await $(t, m, l, u);
|
|
@@ -92,7 +94,7 @@ const _ = (t) => {
|
|
|
92
94
|
const o = g(a.ytAddress, C);
|
|
93
95
|
if (!o)
|
|
94
96
|
throw Error("Yt Token not found");
|
|
95
|
-
const p = t.getContractWithSigner(E.PendleGeneralExternalAction),
|
|
97
|
+
const p = t.getContractWithSigner(E.PendleGeneralExternalAction), H = t.getContractWithSigner(E.HinkalWrapper);
|
|
96
98
|
return await A(
|
|
97
99
|
t,
|
|
98
100
|
s[0],
|
|
@@ -101,7 +103,7 @@ const _ = (t) => {
|
|
|
101
103
|
u,
|
|
102
104
|
l,
|
|
103
105
|
p,
|
|
104
|
-
|
|
106
|
+
H
|
|
105
107
|
);
|
|
106
108
|
}
|
|
107
109
|
if (n === r.Withdraw && a.isRelayerOff) {
|
|
@@ -110,7 +112,7 @@ const _ = (t) => {
|
|
|
110
112
|
throw Error("Yt Token not found");
|
|
111
113
|
return await A(t, s[0], o, m, u, l);
|
|
112
114
|
}
|
|
113
|
-
return await
|
|
115
|
+
return await k(t.getCurrentChainId(), m, l, u);
|
|
114
116
|
};
|
|
115
117
|
export {
|
|
116
118
|
ut as hinkalActionPendle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("ethers"),U=require("../../types/circom-data.types.cjs"),D=require("../../types/external-action.types.cjs"),y=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("../../types/activities.types.cjs");const g=require("../../functions/web3/events/getShieldedBalance.cjs"),I=require("../../functions/snarkjs/constructGeneralZkProof.cjs"),_=require("../../functions/pre-transaction/getFlatFees.cjs"),b=require("../../functions/pre-transaction/outputUtxoProcessing.cjs"),S=require("../../functions/pre-transaction/processAmountChanges.cjs"),T=require("../../functions/web3/functionCalls/estimateGasRelayer.cjs"),k=require("../../functions/web3/functionCalls/transactCallRelayer.cjs"),F=require("../../constants/chains.constants.cjs"),G=require("../../error-handling/error-codes.constants.cjs"),O=(e,t)=>{if(e===y.PendleLPAction.AddOrRemoveLiquidity)return t.length===3?[!1,!0,!1]:[!1,!0,!1,!1];if(e===y.PendleLPAction.Checkpoint)return[!1,!0];throw new Error("Unknown PendleLPAction not implemented")},v=(e,t)=>{const{pendleLPAction:r,lpAddress:n,evmData:a}=e;return h.ethers.utils.defaultAbiCoder.encode(["uint8","address","uint256","uint256","bytes"],[r,n,t[0][0].amount,t[0][0].timeStamp,a])},M=async(e,t,r,n,a,A=!1)=>{const i=D.ExternalActionId.PendleLP,{pendleLPAction:c}=n,s=[...await g.addPaddingToUtxos(e,t,r)],f=`swapperMO${r.length.toString()}x${s[0].length}x1`,{flatFees:l,feeUnit:C}=await _.getFlatFees(e.getCurrentChainId(),t,i,r,c,a);r=S.processAmountChanges({erc20Addresses:t,amountChanges:r,flatFees:l,feeUnit:C,externalActionId:i,action:c,gasTokenAddress:a});const u=[];for(let o=0;o<t.length;o+=1){const{outputUtxos:E}=b.outputUtxoProcessing(e.userKeys,s[o],r[o]);u.push(E)}const q=O(c,t),{contractData:x}=F.networkRegistry[e.getCurrentChainId()],w=x?.pendleLPExternalActionInstanceAddress,L=v(n,s),d=await e.getRandomRelay();if(!d)throw Error(G.transactionErrorCodes.RELAYER_NOT_AVAILABLE);const R={...U.defaultHookData},{zkCallData:m,circomData:P,dimData:p}=await I.constructZkProof("v1x0",e.merkleTreeHinkal,e.merkleTreeAccessToken,s,u,e.userKeys,f,i,w,L,e.generateProofRemotely,d,e.getCurrentChainId(),q,l,R);return A?await T.estimateGasRelayer(e,m,p,P):await k.transactCallRelayer(e.getCurrentChainId(),m,p,P)},B=async(e,t,r)=>{const n=[...await g.addPaddingToUtxos(e,[t],[-1n*r])];return{amount:n[0][0].amount,timestamp:n[0][0].timeStamp}};exports.hinkalActionPendleLP=M;exports.hinkalGetPendleLPClaimableParams=B;
|