@hinkal/common 0.3.2 → 0.3.3
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/README.md +15 -18
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +5 -5
- package/common/src/API/API.mjs +78 -78
- package/common/src/API/callRelayer.d.ts +3 -0
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +8 -7
- package/common/src/API/enclaveUtxoCalls.mjs +5 -3
- package/common/src/API/getOdosPriceForToken.cjs +1 -0
- package/common/src/API/getOdosPriceForToken.d.ts +1 -0
- package/common/src/API/getOdosPriceForToken.mjs +14 -0
- package/common/src/API/getWebsiteURL.d.ts +0 -1
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +0 -1
- package/common/src/API/index.mjs +1 -2
- package/common/src/API/rewardsUserCalls.cjs +1 -1
- package/common/src/API/rewardsUserCalls.d.ts +0 -2
- package/common/src/API/rewardsUserCalls.mjs +2 -3
- package/common/src/API/tenderly.api.cjs +1 -1
- package/common/src/API/tenderly.api.d.ts +5 -10
- package/common/src/API/tenderly.api.mjs +1 -1
- package/common/src/constants/addresses.constants.cjs +1 -1
- package/common/src/constants/addresses.constants.d.ts +4 -46
- package/common/src/constants/addresses.constants.mjs +19 -60
- package/common/src/constants/balance.constants.cjs +1 -0
- package/common/src/constants/balance.constants.d.ts +1 -0
- package/common/src/constants/balance.constants.mjs +4 -0
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +3 -1
- package/common/src/constants/chains.constants.mjs +117 -131
- package/common/src/constants/coingecko.constants.cjs +1 -1
- package/common/src/constants/coingecko.constants.d.ts +2 -0
- package/common/src/constants/coingecko.constants.mjs +1 -1
- package/common/src/constants/contracts.constants.cjs +1 -1
- package/common/src/constants/contracts.constants.d.ts +0 -109
- package/common/src/constants/contracts.constants.mjs +13 -22
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +6 -6
- package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-base.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -0
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +10 -0
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-localhost.json.mjs +0 -3
- package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +6 -8
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.mjs +1 -4
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.mjs +0 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.mjs +2 -2
- package/common/src/constants/deploy-data/deploy-data-tempo.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tempo.json.mjs +6 -7
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.mjs +2 -4
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.mjs +2 -4
- package/common/src/constants/deploy-data/index.cjs +1 -1
- package/common/src/constants/deploy-data/index.d.ts +2 -1
- package/common/src/constants/deploy-data/index.mjs +16 -15
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.mjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-tron.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-tron.json.mjs +2 -35
- package/common/src/constants/events.constants.cjs +1 -1
- package/common/src/constants/events.constants.mjs +3 -2
- package/common/src/constants/fees.constants.cjs +1 -1
- package/common/src/constants/fees.constants.mjs +2 -2
- package/common/src/constants/index.cjs +1 -1
- package/common/src/constants/index.d.ts +0 -1
- package/common/src/constants/index.mjs +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -2
- package/common/src/constants/protocol.constants.d.ts +3 -1
- package/common/src/constants/protocol.constants.mjs +2 -2
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +1 -2
- package/common/src/constants/server.constants.mjs +1 -2
- package/common/src/constants/tokens.constants.cjs +1 -1
- package/common/src/constants/tokens.constants.mjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.mjs +26 -22
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +36 -35
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +3 -3
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +60 -58
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +42 -47
- package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDeposit.d.ts +1 -0
- package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +50 -116
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +102 -92
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +3 -2
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +104 -59
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +4 -4
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.mjs +7 -3
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +51 -39
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +1 -2
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.mjs +53 -131
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.mjs +29 -47
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +3 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +70 -45
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +47 -45
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +8 -4
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +133 -81
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.mjs +16 -12
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +61 -54
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +87 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +95 -50
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +60 -34
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +29 -32
- package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.mjs +90 -0
- package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +40 -45
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.d.ts +8 -0
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.mjs +30 -0
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +35 -45
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +167 -95
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.cjs +1 -0
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.d.ts +27 -0
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.mjs +31 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +1 -0
- package/common/src/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/activity-db.mjs +34 -34
- package/common/src/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/signatures-db.mjs +11 -11
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +11 -10
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +14 -14
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +26 -26
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +15 -15
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.mjs +12 -16
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.d.ts +1 -0
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.mjs +8 -4
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.d.ts +1 -0
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +12 -12
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +12 -12
- package/common/src/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -1
- package/common/src/data-structures/event-service/helpers/ClientEventHelper.mjs +6 -6
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +27 -23
- package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +10 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +9 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.cjs +1 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.d.ts +3 -0
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.mjs +64 -54
- package/common/src/error-handling/error-codes.constants.cjs +1 -1
- package/common/src/error-handling/error-codes.constants.d.ts +6 -11
- package/common/src/error-handling/error-codes.constants.mjs +8 -13
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +27 -14
- package/common/src/externalABIs/index.cjs +1 -1
- package/common/src/externalABIs/index.d.ts +1 -113
- package/common/src/externalABIs/index.mjs +2 -6
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.mjs +8 -8
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.d.ts +0 -1
- package/common/src/functions/index.mjs +12 -15
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +39 -5
- package/common/src/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/common/src/functions/pre-transaction/getExternalSwapAddress.mjs +2 -18
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.d.ts +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.mjs +11 -10
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.mjs +12 -12
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +1 -2
- package/common/src/functions/pre-transaction/index.mjs +1 -2
- package/common/src/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +7 -8
- package/common/src/functions/pre-transaction/solana.cjs +1 -1
- package/common/src/functions/pre-transaction/solana.d.ts +13 -0
- package/common/src/functions/pre-transaction/solana.mjs +46 -22
- package/common/src/functions/pre-transaction/store-proof.cjs +1 -1
- package/common/src/functions/pre-transaction/store-proof.d.ts +1 -1
- package/common/src/functions/pre-transaction/store-proof.mjs +1 -0
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +1 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.mjs +12 -13
- package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.d.ts +0 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +38 -80
- package/common/src/functions/private-wallet/index.cjs +1 -1
- package/common/src/functions/private-wallet/index.d.ts +0 -1
- package/common/src/functions/private-wallet/index.mjs +0 -1
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.d.ts +2 -2
- package/common/src/functions/snarkjs/common.snarkjs.mjs +89 -52
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +32 -0
- package/common/src/functions/snarkjs/constant.mjs +32 -0
- package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +78 -65
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +4 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +44 -39
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -0
- package/common/src/functions/snarkjs/constructTxEnclave.d.ts +32 -0
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +162 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.cjs +1 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.d.ts +7 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.mjs +13 -0
- package/common/src/functions/snarkjs/generateCircomData.cjs +1 -1
- package/common/src/functions/snarkjs/generateCircomData.d.ts +1 -1
- package/common/src/functions/snarkjs/generateCircomData.mjs +33 -27
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.mjs +7 -7
- package/common/src/functions/snarkjs/generateZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateZkProof.mjs +9 -16
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +11 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +21 -3
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.cjs +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.d.ts +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.mjs +11 -0
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.d.ts +1 -0
- package/common/src/functions/utils/addresses.mjs +6 -2
- package/common/src/functions/utils/buildClaimableDepositPlan.d.ts +2 -2
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.mjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.d.ts +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.mjs +3 -1
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.mjs +1 -1
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.mjs +31 -31
- package/common/src/functions/utils/formatter.d.ts +1 -0
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +6 -6
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +11 -10
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +2 -2
- package/common/src/functions/utils/index.mjs +11 -10
- package/common/src/functions/utils/process.utils.cjs +1 -1
- package/common/src/functions/utils/process.utils.d.ts +0 -1
- package/common/src/functions/utils/process.utils.mjs +2 -11
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +2 -1
- package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/transfer-claimable.utils.mjs +2 -2
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.d.ts +5 -14
- package/common/src/functions/utils/tron.utils.mjs +91 -127
- package/common/src/functions/utils/waasStamp.cjs +1 -0
- package/common/src/functions/utils/waasStamp.d.ts +5 -0
- package/common/src/functions/utils/waasStamp.mjs +2 -0
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -8
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +44 -48
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.d.ts +4 -3
- package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +34 -25
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.mjs +88 -76
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +9 -6
- package/common/src/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.mjs +12 -12
- package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -0
- package/common/src/functions/web3/functionCalls/submitProof.d.ts +5 -0
- package/common/src/functions/web3/functionCalls/submitProof.mjs +26 -0
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.d.ts +7 -3
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.mjs +81 -87
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +6 -11
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +4 -2
- package/common/src/functions/web3/functionCalls/waitForErc20Approvals.cjs +1 -1
- package/common/src/functions/web3/functionCalls/waitForErc20Approvals.mjs +6 -6
- package/common/src/functions/web3/getContractMetadata.cjs +1 -1
- package/common/src/functions/web3/getContractMetadata.mjs +1 -1
- package/common/src/functions/web3/getTokenHolder.cjs +1 -1
- package/common/src/functions/web3/getTokenHolder.mjs +3 -2
- package/common/src/functions/web3/index.cjs +1 -1
- package/common/src/functions/web3/index.d.ts +0 -3
- package/common/src/functions/web3/index.mjs +0 -3
- package/common/src/functions/web3/lifiAPI.cjs +1 -1
- package/common/src/functions/web3/lifiAPI.mjs +1 -1
- package/common/src/providers/TronProviderAdapter.cjs +1 -1
- package/common/src/providers/TronProviderAdapter.mjs +7 -1
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +5 -5
- package/common/src/types/activities.types.cjs +1 -1
- package/common/src/types/activities.types.d.ts +0 -9
- package/common/src/types/activities.types.mjs +1 -1
- package/common/src/types/admin.types.cjs +1 -1
- package/common/src/types/admin.types.d.ts +3 -1
- package/common/src/types/admin.types.mjs +1 -1
- package/common/src/types/bridging-tx.types.d.ts +8 -0
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +2 -1
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/circom-data.types.d.ts +6 -0
- package/common/src/types/commitments.types.d.ts +2 -0
- package/common/src/types/dashboard-transaction.types.d.ts +3 -0
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +6 -15
- package/common/src/types/ethereum-network.types.mjs +1 -1
- package/common/src/types/external-action.types.cjs +1 -1
- package/common/src/types/external-action.types.d.ts +2 -5
- package/common/src/types/external-action.types.mjs +1 -1
- package/common/src/types/hinkal.types.cjs +1 -1
- package/common/src/types/hinkal.types.d.ts +4 -7
- package/common/src/types/hinkal.types.mjs +1 -1
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +2 -0
- package/common/src/types/index.mjs +1 -0
- package/common/src/types/near-intents.types.d.ts +1 -0
- package/common/src/types/offscreen.types.cjs +1 -1
- package/common/src/types/offscreen.types.d.ts +0 -1
- package/common/src/types/offscreen.types.mjs +1 -1
- package/common/src/types/pay-activities.types.d.ts +3 -0
- package/common/src/types/remote-proof.types.d.ts +0 -6
- package/common/src/types/remote-tx-build.types.d.ts +242 -0
- package/common/src/types/scheduled-transactions.types.d.ts +3 -0
- package/common/src/types/solana.types.d.ts +7 -0
- package/common/src/types/tenderly.api.types.d.ts +70 -0
- package/common/src/types/transact.types.cjs +1 -0
- package/common/src/types/transact.types.d.ts +53 -0
- package/common/src/types/transact.types.mjs +6 -0
- package/common/src/webworker/{logError-uy41lNp1.js → logError-CxZzSALU.js} +1 -1
- package/common/src/webworker/package.json +12 -12
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/snarkjsWorkerNode.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/utxoWorkerNode.cjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.cjs +3 -3
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
- package/common/src/webworker/workerProxy-swwPYw6e.js +1 -0
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
- package/index.cjs +1 -1
- package/index.mjs +1 -1
- package/internal/swapApi.cjs +1 -1
- package/internal/swapApi.d.ts +3 -3
- package/internal/swapApi.mjs +22 -25
- package/package.json +12 -12
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +3 -3
- package/services/Hinkal.mjs +7 -7
- package/types/IHinkal.d.ts +3 -3
- package/types/swap.types.d.ts +3 -20
- package/common/src/API/callOdosAPI.cjs +0 -1
- package/common/src/API/callOdosAPI.d.ts +0 -63
- package/common/src/API/callOdosAPI.mjs +0 -18
- package/common/src/API/callOneInchAPI.cjs +0 -1
- package/common/src/API/callOneInchAPI.d.ts +0 -24
- package/common/src/API/callOneInchAPI.mjs +0 -16
- package/common/src/constants/rewards.constants.d.ts +0 -2
- package/common/src/externalABIs/IQuoterV2.json.cjs +0 -1
- package/common/src/externalABIs/IQuoterV2.json.mjs +0 -203
- package/common/src/externalABIs/ISwapRouter.json.cjs +0 -1
- package/common/src/externalABIs/ISwapRouter.json.mjs +0 -537
- package/common/src/externalABIs/IUniswapV3Factory.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Factory.json.mjs +0 -188
- package/common/src/externalABIs/IUniswapV3Pool.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Pool.json.mjs +0 -938
- package/common/src/externalABIs/UniswapV2PoolAbi.json.cjs +0 -1
- package/common/src/externalABIs/UniswapV2PoolAbi.json.mjs +0 -78
- package/common/src/functions/pre-transaction/interaction-to-action.cjs +0 -1
- package/common/src/functions/pre-transaction/interaction-to-action.d.ts +0 -2
- package/common/src/functions/pre-transaction/interaction-to-action.mjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.cjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.d.ts +0 -3
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.mjs +0 -30
- package/common/src/functions/private-wallet/opProducer.cjs +0 -1
- package/common/src/functions/private-wallet/opProducer.d.ts +0 -5
- package/common/src/functions/private-wallet/opProducer.mjs +0 -3
- package/common/src/functions/snarkjs/generateZkProofEnclave.cjs +0 -1
- package/common/src/functions/snarkjs/generateZkProofEnclave.d.ts +0 -5
- package/common/src/functions/snarkjs/generateZkProofEnclave.mjs +0 -27
- package/common/src/functions/utils/get-signature-header.cjs +0 -1
- package/common/src/functions/utils/get-signature-header.d.ts +0 -5
- package/common/src/functions/utils/get-signature-header.mjs +0 -4
- package/common/src/functions/web3/odosAPI.cjs +0 -1
- package/common/src/functions/web3/odosAPI.d.ts +0 -5
- package/common/src/functions/web3/odosAPI.mjs +0 -35
- package/common/src/functions/web3/oneInchAPI.cjs +0 -1
- package/common/src/functions/web3/oneInchAPI.d.ts +0 -5
- package/common/src/functions/web3/oneInchAPI.mjs +0 -44
- package/common/src/functions/web3/uniswapAPI.cjs +0 -1
- package/common/src/functions/web3/uniswapAPI.d.ts +0 -16
- package/common/src/functions/web3/uniswapAPI.mjs +0 -60
- package/common/src/webworker/workerProxy-MheXtWa4.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={_format:`hh-sol-artifact-1`,abi:[{inputs:[],name:`token0`,outputs:[{internalType:`address`,name:``,type:`address`}],stateMutability:`view`,type:`function`},{inputs:[],name:`token1`,outputs:[{internalType:`address`,name:``,type:`address`}],stateMutability:`view`,type:`function`},{inputs:[],name:`stable`,outputs:[{internalType:`bool`,name:``,type:`bool`}],stateMutability:`view`,type:`function`},{inputs:[],name:`getReserves`,outputs:[{internalType:`uint256`,name:`_reserve0`,type:`uint256`},{internalType:`uint256`,name:`_reserve1`,type:`uint256`},{internalType:`uint256`,name:`_blockTimestampLast`,type:`uint256`}],stateMutability:`view`,type:`function`},{inputs:[],name:`totalSupply`,outputs:[{internalType:`uint256`,name:``,type:`uint256`}],stateMutability:`view`,type:`function`}],bytecode:`0x`,deployedBytecode:`0x`,linkReferences:{},deployedLinkReferences:{}};exports.default=e;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
var e = {
|
|
2
|
-
_format: "hh-sol-artifact-1",
|
|
3
|
-
abi: [
|
|
4
|
-
{
|
|
5
|
-
inputs: [],
|
|
6
|
-
name: "token0",
|
|
7
|
-
outputs: [{
|
|
8
|
-
internalType: "address",
|
|
9
|
-
name: "",
|
|
10
|
-
type: "address"
|
|
11
|
-
}],
|
|
12
|
-
stateMutability: "view",
|
|
13
|
-
type: "function"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
inputs: [],
|
|
17
|
-
name: "token1",
|
|
18
|
-
outputs: [{
|
|
19
|
-
internalType: "address",
|
|
20
|
-
name: "",
|
|
21
|
-
type: "address"
|
|
22
|
-
}],
|
|
23
|
-
stateMutability: "view",
|
|
24
|
-
type: "function"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
inputs: [],
|
|
28
|
-
name: "stable",
|
|
29
|
-
outputs: [{
|
|
30
|
-
internalType: "bool",
|
|
31
|
-
name: "",
|
|
32
|
-
type: "bool"
|
|
33
|
-
}],
|
|
34
|
-
stateMutability: "view",
|
|
35
|
-
type: "function"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
inputs: [],
|
|
39
|
-
name: "getReserves",
|
|
40
|
-
outputs: [
|
|
41
|
-
{
|
|
42
|
-
internalType: "uint256",
|
|
43
|
-
name: "_reserve0",
|
|
44
|
-
type: "uint256"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
internalType: "uint256",
|
|
48
|
-
name: "_reserve1",
|
|
49
|
-
type: "uint256"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
internalType: "uint256",
|
|
53
|
-
name: "_blockTimestampLast",
|
|
54
|
-
type: "uint256"
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
stateMutability: "view",
|
|
58
|
-
type: "function"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
inputs: [],
|
|
62
|
-
name: "totalSupply",
|
|
63
|
-
outputs: [{
|
|
64
|
-
internalType: "uint256",
|
|
65
|
-
name: "",
|
|
66
|
-
type: "uint256"
|
|
67
|
-
}],
|
|
68
|
-
stateMutability: "view",
|
|
69
|
-
type: "function"
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
bytecode: "0x",
|
|
73
|
-
deployedBytecode: "0x",
|
|
74
|
-
linkReferences: {},
|
|
75
|
-
deployedLinkReferences: {}
|
|
76
|
-
};
|
|
77
|
-
//#endregion
|
|
78
|
-
export { e as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../types/index.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "../../types/index.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../utils/caseInsensitive.utils.cjs`),t=require(`../../data-structures/utxo/Utxo.cjs`);var n=(n,r,i,a)=>{let{recipientInfo:o,amount:s,token:c}=n,[l,u,d,,,f]=o.split(`,`),p=r.findIndex(t=>t.find(t=>e.caseInsensitiveEqual(t.erc20TokenAddress,n?.token.erc20TokenAddress))!==void 0),m=new t.Utxo({amount:s,erc20TokenAddress:c.erc20TokenAddress,timeStamp:a,H0:[BigInt(u),BigInt(d)],stealthAddress:l,encryptionKey:f});if(p===-1)throw Error(`Private recipient index not found`);r.forEach((e,n)=>{if(n===p)e.push(m),i[n]+=s;else{let n=new t.Utxo({amount:0n,erc20TokenAddress:e[0].erc20TokenAddress,timeStamp:a,H0:[BigInt(u),BigInt(d)],stealthAddress:l,encryptionKey:f});e.push(n)}})};exports.recipientUtxoProcessing=n;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Utxo } from '../../data-structures/utxo/Utxo';
|
|
2
|
-
import { PrivateRecipientInfo } from '../../types/token.types';
|
|
3
|
-
export declare const recipientUtxoProcessing: (privateRecipientInfo: PrivateRecipientInfo, outputUtxosArray: Utxo[][], deltaChanges: bigint[], timeStamp: string) => void;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { caseInsensitiveEqual as e } from "../utils/caseInsensitive.utils.mjs";
|
|
2
|
-
import { Utxo as t } from "../../data-structures/utxo/Utxo.mjs";
|
|
3
|
-
//#region libs/shared/common/src/functions/pre-transaction/recipientUtxoProcessing.ts
|
|
4
|
-
var n = (n, r, i, a) => {
|
|
5
|
-
let { recipientInfo: o, amount: s, token: c } = n, [l, u, d, , , f] = o.split(","), p = r.findIndex((t) => t.find((t) => e(t.erc20TokenAddress, n?.token.erc20TokenAddress)) !== void 0), m = new t({
|
|
6
|
-
amount: s,
|
|
7
|
-
erc20TokenAddress: c.erc20TokenAddress,
|
|
8
|
-
timeStamp: a,
|
|
9
|
-
H0: [BigInt(u), BigInt(d)],
|
|
10
|
-
stealthAddress: l,
|
|
11
|
-
encryptionKey: f
|
|
12
|
-
});
|
|
13
|
-
if (p === -1) throw Error("Private recipient index not found");
|
|
14
|
-
r.forEach((e, n) => {
|
|
15
|
-
if (n === p) e.push(m), i[n] += s;
|
|
16
|
-
else {
|
|
17
|
-
let n = new t({
|
|
18
|
-
amount: 0n,
|
|
19
|
-
erc20TokenAddress: e[0].erc20TokenAddress,
|
|
20
|
-
timeStamp: a,
|
|
21
|
-
H0: [BigInt(u), BigInt(d)],
|
|
22
|
-
stealthAddress: l,
|
|
23
|
-
encryptionKey: f
|
|
24
|
-
});
|
|
25
|
-
e.push(n);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { n as recipientUtxoProcessing };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../externalABIs/index.cjs`),require(`./emporium.helpers.cjs`),require(`ethers`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./constant.cjs`),t=require(`../../data-structures/http/HttpClient.cjs`);require(`../../data-structures/http/index.cjs`);const n=require(`../utils/encryptInputForEnclave.cjs`),r=require(`./getZKFiles.cjs`);var i=e=>{if(e.startsWith(`http`)){let t=e.split(`/`).at(-1);if(!t)throw Error(`invalid verifierName`);return t}return e},a=async(a,o,s)=>{let c=o.map(e=>i(r.getWASMFile(e,a))),l=o.map(e=>i(r.getZKeyFile(e,a))),{keyCiphertext:u,inputCiphertext:d}=await n.makeEnclaveHandshakeAndEncryptInput(s),f={circuit_wasms:c,circuit_zkeys:l,inputs:d,key:u};return(await t.httpClient.post(`${e.ENCLAVE_URL}/generate-proofs`,f)).map(({zk_calldata:e,public_signals:t})=>({zkCallData:e,publicSignals:t}))};exports.generateZkProofEnclave=a;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ENCLAVE_URL as e } from "./constant.mjs";
|
|
2
|
-
import { httpClient as t } from "../../data-structures/http/HttpClient.mjs";
|
|
3
|
-
import "../../data-structures/http/index.mjs";
|
|
4
|
-
import { makeEnclaveHandshakeAndEncryptInput as n } from "../utils/encryptInputForEnclave.mjs";
|
|
5
|
-
import { getWASMFile as r, getZKeyFile as i } from "./getZKFiles.mjs";
|
|
6
|
-
//#region libs/shared/common/src/functions/snarkjs/generateZkProofEnclave.ts
|
|
7
|
-
var a = (e) => {
|
|
8
|
-
if (e.startsWith("http")) {
|
|
9
|
-
let t = e.split("/").at(-1);
|
|
10
|
-
if (!t) throw Error("invalid verifierName");
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
13
|
-
return e;
|
|
14
|
-
}, o = async (o, s, c) => {
|
|
15
|
-
let l = s.map((e) => a(r(e, o))), u = s.map((e) => a(i(e, o))), { keyCiphertext: d, inputCiphertext: f } = await n(c), p = {
|
|
16
|
-
circuit_wasms: l,
|
|
17
|
-
circuit_zkeys: u,
|
|
18
|
-
inputs: f,
|
|
19
|
-
key: d
|
|
20
|
-
};
|
|
21
|
-
return (await t.post(`${e}/generate-proofs`, p)).map(({ zk_calldata: e, public_signals: t }) => ({
|
|
22
|
-
zkCallData: e,
|
|
23
|
-
publicSignals: t
|
|
24
|
-
}));
|
|
25
|
-
};
|
|
26
|
-
//#endregion
|
|
27
|
-
export { o as generateZkProofEnclave };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=e=>({headers:{"x-user-signature":e}});exports.getSignatureHeader=e;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`./etherFunctions.cjs`),i=require(`../../API/callOdosAPI.cjs`);require(`../../error-handling/index.cjs`),require(`../../constants/index.cjs`);var a=async(a,o,s,c,l=.7)=>{try{let{odosResponse:n,status:u}=await i.callOdosAPI(a,{chainId:a===31337?e.localhostNetwork:a,inputTokens:[{tokenAddress:o?.wrappedErc20TokenAddress??o.erc20TokenAddress,amount:r.getAmountInWei(o,c).toString()}],outputTokens:[{tokenAddress:s?.wrappedErc20TokenAddress??s.erc20TokenAddress,proportion:1}],userAddr:e.networkRegistry[a].contractData.odosExternalActionInstanceAddress||t.zeroAddress,slippageLimitPercent:l,disableRFQs:!0});if(u!==`success`)throw Error(`Odos API Fetch Error`);return{outSwapAmountValue:BigInt(n.outputTokens[0].amount),odosDataValue:n.transaction.data}}catch(e){throw console.log({error:e}),Error(n.transactionErrorCodes.NO_ODOS_PRICE)}};exports.getOdosPrice=a;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ERC20Token } from '../../types';
|
|
2
|
-
export declare const getOdosPrice: (chainId: number, inSwapToken: ERC20Token, outSwapToken: ERC20Token, inSwapAmount: string, slippagePercentage?: number) => Promise<{
|
|
3
|
-
outSwapAmountValue: bigint;
|
|
4
|
-
odosDataValue: string;
|
|
5
|
-
}>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { localhostNetwork as e, networkRegistry as t } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { zeroAddress as n } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { transactionErrorCodes as r } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
-
import { getAmountInWei as i } from "./etherFunctions.mjs";
|
|
5
|
-
import { callOdosAPI as a } from "../../API/callOdosAPI.mjs";
|
|
6
|
-
import "../../error-handling/index.mjs";
|
|
7
|
-
import "../../constants/index.mjs";
|
|
8
|
-
//#region libs/shared/common/src/functions/web3/odosAPI.ts
|
|
9
|
-
var o = async (o, s, c, l, u = .7) => {
|
|
10
|
-
try {
|
|
11
|
-
let { odosResponse: r, status: d } = await a(o, {
|
|
12
|
-
chainId: o === 31337 ? e : o,
|
|
13
|
-
inputTokens: [{
|
|
14
|
-
tokenAddress: s?.wrappedErc20TokenAddress ?? s.erc20TokenAddress,
|
|
15
|
-
amount: i(s, l).toString()
|
|
16
|
-
}],
|
|
17
|
-
outputTokens: [{
|
|
18
|
-
tokenAddress: c?.wrappedErc20TokenAddress ?? c.erc20TokenAddress,
|
|
19
|
-
proportion: 1
|
|
20
|
-
}],
|
|
21
|
-
userAddr: t[o].contractData.odosExternalActionInstanceAddress || n,
|
|
22
|
-
slippageLimitPercent: u,
|
|
23
|
-
disableRFQs: !0
|
|
24
|
-
});
|
|
25
|
-
if (d !== "success") throw Error("Odos API Fetch Error");
|
|
26
|
-
return {
|
|
27
|
-
outSwapAmountValue: BigInt(r.outputTokens[0].amount),
|
|
28
|
-
odosDataValue: r.transaction.data
|
|
29
|
-
};
|
|
30
|
-
} catch (e) {
|
|
31
|
-
throw console.log({ error: e }), Error(r.NO_ODOS_PRICE);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
35
|
-
export { o as getOdosPrice };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`./etherFunctions.cjs`),i=require(`../../error-handling/logger.cjs`),a=require(`../../types/ethereum-network.types.cjs`);require(`../../types/index.cjs`),require(`../../error-handling/index.cjs`);const o=require(`./getContractMetadata.cjs`);require(`../../constants/index.cjs`);const s=require(`../../API/callOneInchAPI.cjs`);var c=`angstrom`,l=[e.chainIds.base],u=async e=>{if(l.includes(e))try{let t=await s.getOneInchLiquiditySources(e),n=t.filter(({id:e,title:t})=>!`${e} ${t}`.toLowerCase().includes(c));return!n.length||n.length===t.length?void 0:n.map(({id:e})=>e).join(`,`)}catch(e){i.Logger.log({error:e});return}},d=async(e,c,l,d,f=.7)=>{try{let n=await u(e),i=await s.callOneInchAPI(e,{fromTokenAddress:c.erc20TokenAddress===t.zeroAddress?t.oneInchZeroAddress:c.erc20TokenAddress,toTokenAddress:l.erc20TokenAddress===t.zeroAddress?t.oneInchZeroAddress:l.erc20TokenAddress,fromAddress:t.zeroAddress,destReceiver:o.getContractMetadata(a.ContractType.OneInchExternalActionContract,e).address,amount:r.getAmountInWei(c,d),slippage:f,disableEstimate:!0,allowPartialFill:!1,protocols:n});if(!i||!i.tx)throw Error(`OneInch API price fetch error`);return{outSwapAmountValue:BigInt(i.toAmount),oneInchDataValue:i.tx.data}}catch(e){throw i.Logger.log({error:e}),Error(n.transactionErrorCodes.NO_ONEINCH_PRICE)}};exports.getOneInchPrice=d;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ERC20Token } from '../../types';
|
|
2
|
-
export declare const getOneInchPrice: (chainId: number, inSwapToken: ERC20Token, outSwapToken: ERC20Token, inSwapAmount: string, slippagePercentage?: number) => Promise<{
|
|
3
|
-
outSwapAmountValue: bigint;
|
|
4
|
-
oneInchDataValue: string;
|
|
5
|
-
}>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { chainIds as e } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { oneInchZeroAddress as t, zeroAddress as n } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { transactionErrorCodes as r } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
-
import { getAmountInWei as i } from "./etherFunctions.mjs";
|
|
5
|
-
import { Logger as a } from "../../error-handling/logger.mjs";
|
|
6
|
-
import { ContractType as o } from "../../types/ethereum-network.types.mjs";
|
|
7
|
-
import "../../types/index.mjs";
|
|
8
|
-
import "../../error-handling/index.mjs";
|
|
9
|
-
import { getContractMetadata as s } from "./getContractMetadata.mjs";
|
|
10
|
-
import "../../constants/index.mjs";
|
|
11
|
-
import { callOneInchAPI as c, getOneInchLiquiditySources as l } from "../../API/callOneInchAPI.mjs";
|
|
12
|
-
//#region libs/shared/common/src/functions/web3/oneInchAPI.ts
|
|
13
|
-
var u = "angstrom", d = [e.base], f = async (e) => {
|
|
14
|
-
if (d.includes(e)) try {
|
|
15
|
-
let t = await l(e), n = t.filter(({ id: e, title: t }) => !`${e} ${t}`.toLowerCase().includes(u));
|
|
16
|
-
return !n.length || n.length === t.length ? void 0 : n.map(({ id: e }) => e).join(",");
|
|
17
|
-
} catch (e) {
|
|
18
|
-
a.log({ error: e });
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
}, p = async (e, l, u, d, p = .7) => {
|
|
22
|
-
try {
|
|
23
|
-
let r = await f(e), a = await c(e, {
|
|
24
|
-
fromTokenAddress: l.erc20TokenAddress === n ? t : l.erc20TokenAddress,
|
|
25
|
-
toTokenAddress: u.erc20TokenAddress === n ? t : u.erc20TokenAddress,
|
|
26
|
-
fromAddress: n,
|
|
27
|
-
destReceiver: s(o.OneInchExternalActionContract, e).address,
|
|
28
|
-
amount: i(l, d),
|
|
29
|
-
slippage: p,
|
|
30
|
-
disableEstimate: !0,
|
|
31
|
-
allowPartialFill: !1,
|
|
32
|
-
protocols: r
|
|
33
|
-
});
|
|
34
|
-
if (!a || !a.tx) throw Error("OneInch API price fetch error");
|
|
35
|
-
return {
|
|
36
|
-
outSwapAmountValue: BigInt(a.toAmount),
|
|
37
|
-
oneInchDataValue: a.tx.data
|
|
38
|
-
};
|
|
39
|
-
} catch (e) {
|
|
40
|
-
throw a.log({ error: e }), Error(r.NO_ONEINCH_PRICE);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
//#endregion
|
|
44
|
-
export { p as getOneInchPrice };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`./etherFunctions.cjs`),i=require(`../../error-handling/logError.cjs`),a=require(`../../types/ethereum-network.types.cjs`);require(`../../types/index.cjs`),require(`../../error-handling/index.cjs`),require(`../../constants/index.cjs`);let o=require(`ethers`);var s=async(e,r,i,a)=>{let o=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await r.getPool(i,a,e),fee:e})))).filter(({poolAddress:e})=>e!==t.zeroAddress),s=await Promise.all(o.map(async t=>({poolAddress:t.poolAddress,fee:t.fee,token1Balance:await e.balanceOf(t.poolAddress)}))),c=s.map(e=>e.token1Balance).reduce((e,t)=>t>=e?t:e,0n);if(c===0n)throw Error(n.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return s.find(e=>e.token1Balance===c)},c=async(t,n,r,o,s,c)=>{try{if(!e.networkRegistry[n].quoterV2Address)throw Error(`No Quoter Contract Provided`);return(await t.getContractWithFetcherByChainId(n,a.ContractType.UniswapV3QuoterContract,e.networkRegistry[n].quoterV2Address).quoteExactInputSingle.staticCall({tokenIn:r.wrappedErc20TokenAddress??r.erc20TokenAddress,tokenOut:o.wrappedErc20TokenAddress??o.erc20TokenAddress,fee:s,amountIn:c,sqrtPriceLimitX96:0})).amountOut}catch(e){throw i.logError(e),e}},l=async(t,n,r,i)=>{try{let o=t.getContractWithFetcherByChainId(n,a.ContractType.UniswapV3FactoryContract,e.networkRegistry[n].uniswapV3FactoryAddress),{fee:c}=await s(t.getContractWithFetcherByChainId(n,a.ContractType.ERC20Contract,i.wrappedErc20TokenAddress??i.erc20TokenAddress),o,r.wrappedErc20TokenAddress??r.erc20TokenAddress,i.wrappedErc20TokenAddress??i.erc20TokenAddress);return c}catch(e){throw console.log(`Error in getUniswapFee`,e),e}},u=async(e,t,i,a,s)=>{try{let n=await l(e,t,a,s),u=o.ethers.AbiCoder.defaultAbiCoder().encode([`uint24`],[n]);return{tokenPrice:await c(e,t,a,s,n,r.getAmountInWei(a,i)),poolFee:u}}catch{throw Error(n.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=l,exports.getUniswapPrice=u,exports.getUniswapPriceHelper=c,exports.searchPoolAndFee=s;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
import { ERC20Token } from '../../types';
|
|
3
|
-
import { IHinkal } from '../../data-structures/Hinkal/IHinkal';
|
|
4
|
-
interface PoolAndFee {
|
|
5
|
-
poolAddress: string;
|
|
6
|
-
fee: number;
|
|
7
|
-
token1Balance: bigint;
|
|
8
|
-
}
|
|
9
|
-
export declare const searchPoolAndFee: (token1Contract: ethers.Contract, factory: ethers.Contract, token0Address: string, token1Address: string) => Promise<PoolAndFee>;
|
|
10
|
-
export declare const getUniswapPriceHelper: (hinkal: IHinkal, chainId: number, token0: ERC20Token, token1: ERC20Token, fee: number, inSwapAmount: bigint) => Promise<bigint>;
|
|
11
|
-
export declare const getUniswapFee: (hinkal: IHinkal, chainId: number, token0: ERC20Token, token1: ERC20Token) => Promise<number>;
|
|
12
|
-
export declare const getUniswapPrice: (hinkal: IHinkal, chainId: number, inSwapAmount: string, inSwapToken: ERC20Token, outSwapToken: ERC20Token) => Promise<{
|
|
13
|
-
tokenPrice: bigint;
|
|
14
|
-
poolFee: string;
|
|
15
|
-
}>;
|
|
16
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { networkRegistry as e } from "../../constants/chains.constants.mjs";
|
|
2
|
-
import { zeroAddress as t } from "../../constants/protocol.constants.mjs";
|
|
3
|
-
import { transactionErrorCodes as n } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
-
import { getAmountInWei as r } from "./etherFunctions.mjs";
|
|
5
|
-
import { logError as i } from "../../error-handling/logError.mjs";
|
|
6
|
-
import { ContractType as a } from "../../types/ethereum-network.types.mjs";
|
|
7
|
-
import "../../types/index.mjs";
|
|
8
|
-
import "../../error-handling/index.mjs";
|
|
9
|
-
import "../../constants/index.mjs";
|
|
10
|
-
import { ethers as o } from "ethers";
|
|
11
|
-
//#region libs/shared/common/src/functions/web3/uniswapAPI.ts
|
|
12
|
-
var s = async (e, r, i, a) => {
|
|
13
|
-
let o = (await Promise.all([
|
|
14
|
-
100,
|
|
15
|
-
500,
|
|
16
|
-
3e3,
|
|
17
|
-
1e4
|
|
18
|
-
].map(async (e) => ({
|
|
19
|
-
poolAddress: await r.getPool(i, a, e),
|
|
20
|
-
fee: e
|
|
21
|
-
})))).filter(({ poolAddress: e }) => e !== t), s = await Promise.all(o.map(async (t) => ({
|
|
22
|
-
poolAddress: t.poolAddress,
|
|
23
|
-
fee: t.fee,
|
|
24
|
-
token1Balance: await e.balanceOf(t.poolAddress)
|
|
25
|
-
}))), c = s.map((e) => e.token1Balance).reduce((e, t) => t >= e ? t : e, 0n);
|
|
26
|
-
if (c === 0n) throw Error(n.UNISWAP_NOT_ENOUGH_LIQUIDITY);
|
|
27
|
-
return s.find((e) => e.token1Balance === c);
|
|
28
|
-
}, c = async (t, n, r, o, s, c) => {
|
|
29
|
-
try {
|
|
30
|
-
if (!e[n].quoterV2Address) throw Error("No Quoter Contract Provided");
|
|
31
|
-
return (await t.getContractWithFetcherByChainId(n, a.UniswapV3QuoterContract, e[n].quoterV2Address).quoteExactInputSingle.staticCall({
|
|
32
|
-
tokenIn: r.wrappedErc20TokenAddress ?? r.erc20TokenAddress,
|
|
33
|
-
tokenOut: o.wrappedErc20TokenAddress ?? o.erc20TokenAddress,
|
|
34
|
-
fee: s,
|
|
35
|
-
amountIn: c,
|
|
36
|
-
sqrtPriceLimitX96: 0
|
|
37
|
-
})).amountOut;
|
|
38
|
-
} catch (e) {
|
|
39
|
-
throw i(e), e;
|
|
40
|
-
}
|
|
41
|
-
}, l = async (t, n, r, i) => {
|
|
42
|
-
try {
|
|
43
|
-
let o = t.getContractWithFetcherByChainId(n, a.UniswapV3FactoryContract, e[n].uniswapV3FactoryAddress), { fee: c } = await s(t.getContractWithFetcherByChainId(n, a.ERC20Contract, i.wrappedErc20TokenAddress ?? i.erc20TokenAddress), o, r.wrappedErc20TokenAddress ?? r.erc20TokenAddress, i.wrappedErc20TokenAddress ?? i.erc20TokenAddress);
|
|
44
|
-
return c;
|
|
45
|
-
} catch (e) {
|
|
46
|
-
throw console.log("Error in getUniswapFee", e), e;
|
|
47
|
-
}
|
|
48
|
-
}, u = async (e, t, i, a, s) => {
|
|
49
|
-
try {
|
|
50
|
-
let n = await l(e, t, a, s), u = o.AbiCoder.defaultAbiCoder().encode(["uint24"], [n]);
|
|
51
|
-
return {
|
|
52
|
-
tokenPrice: await c(e, t, a, s, n, r(a, i)),
|
|
53
|
-
poolFee: u
|
|
54
|
-
};
|
|
55
|
-
} catch {
|
|
56
|
-
throw Error(n.NO_UNISWAP_PRICE);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
//#endregion
|
|
60
|
-
export { l as getUniswapFee, u as getUniswapPrice, c as getUniswapPriceHelper, s as searchPoolAndFee };
|