@hinkal/common 0.3.1 → 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 +12 -37
- package/common/src/API/API.mjs +80 -105
- package/common/src/API/callRelayer.d.ts +3 -0
- package/common/src/API/dashboardAccountMemberCalls.cjs +1 -1
- package/common/src/API/dashboardAccountMemberCalls.d.ts +15 -0
- package/common/src/API/dashboardAccountMemberCalls.mjs +5 -2
- package/common/src/API/dashboardPayoutCalls.cjs +1 -1
- package/common/src/API/dashboardPayoutCalls.d.ts +2 -1
- package/common/src/API/dashboardPayoutCalls.mjs +4 -1
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +17 -8
- 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 +1 -3
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +1 -3
- package/common/src/API/index.mjs +3 -5
- package/common/src/API/payoutNotificationStateCalls.cjs +1 -0
- package/common/src/API/payoutNotificationStateCalls.d.ts +10 -0
- package/common/src/API/payoutNotificationStateCalls.mjs +10 -0
- package/common/src/API/proxyAccountsCalls.cjs +1 -1
- package/common/src/API/proxyAccountsCalls.d.ts +2 -3
- package/common/src/API/proxyAccountsCalls.mjs +11 -10
- package/common/src/API/rewardsUserCalls.cjs +1 -1
- package/common/src/API/rewardsUserCalls.d.ts +1 -40
- package/common/src/API/rewardsUserCalls.mjs +2 -10
- package/common/src/API/scheduled-transactions-calls.d.ts +1 -0
- package/common/src/API/temporaryWalletCalls.cjs +1 -1
- package/common/src/API/temporaryWalletCalls.mjs +8 -8
- 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/API/weeklyAnalyticCalls.cjs +1 -1
- package/common/src/API/weeklyAnalyticCalls.d.ts +1 -11
- package/common/src/API/weeklyAnalyticCalls.mjs +2 -5
- 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 -138
- 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 +9 -31
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +6 -9
- 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 +6 -9
- 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 +6 -9
- 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 -9
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.mjs +5 -9
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +6 -9
- 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-evm.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-evm.json.mjs +19 -45
- 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 -46
- package/common/src/constants/enclaveAuth.constants.d.ts +5 -0
- 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 +1 -3
- package/common/src/constants/index.mjs +1 -1
- package/common/src/constants/mediaUrls.constants.d.ts +0 -1
- package/common/src/constants/pay.constants.d.ts +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -1
- package/common/src/constants/protocol.constants.d.ts +10 -6
- package/common/src/constants/protocol.constants.mjs +4 -11
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +6 -30
- package/common/src/constants/server.constants.mjs +11 -43
- package/common/src/constants/tokens.constants.cjs +1 -1
- package/common/src/constants/tokens.constants.mjs +1 -1
- package/common/src/crypto/ecdh.cjs +1 -1
- package/common/src/crypto/ecdh.mjs +2 -9
- package/common/src/crypto/index.cjs +1 -1
- package/common/src/crypto/index.mjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.d.ts +4 -8
- package/common/src/data-structures/Hinkal/Hinkal.mjs +88 -100
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +5 -9
- 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 +24 -23
- 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 +59 -57
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +42 -50
- 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 -119
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +108 -100
- 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 +105 -64
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +33 -43
- 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/hinkalPalEvmDeposit.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalPalTronDepositPrepare.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +50 -38
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +2 -3
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.mjs +52 -117
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.mjs +26 -32
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +6 -6
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +71 -51
- 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 -51
- 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 +155 -102
- 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 +97 -52
- 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 +39 -44
- 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 -49
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +170 -101
- package/common/src/data-structures/Hinkal/index.d.ts +0 -1
- 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 +5 -4
- package/common/src/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/contact-db.d.ts +0 -1
- package/common/src/data-structures/IndexedDB/contact-db.mjs +14 -28
- package/common/src/data-structures/IndexedDB/key-val-store.cjs +1 -1
- package/common/src/data-structures/IndexedDB/key-val-store.d.ts +2 -0
- package/common/src/data-structures/IndexedDB/key-val-store.mjs +14 -0
- package/common/src/data-structures/IndexedDB/private-balances-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/private-balances-db.d.ts +1 -0
- package/common/src/data-structures/IndexedDB/private-balances-db.mjs +3 -0
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs +1 -1
- package/common/src/data-structures/MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs +25 -25
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +15 -14
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +7 -7
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +30 -30
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +6 -6
- 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 +22 -18
- package/common/src/data-structures/WalletManager/WalletManager.d.ts +1 -0
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.cjs +1 -1
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.d.ts +1 -0
- package/common/src/data-structures/cacheDevices/BaseCacheDevice.mjs +3 -0
- package/common/src/data-structures/cacheDevices/FileCacheDevice.cjs +1 -1
- package/common/src/data-structures/cacheDevices/FileCacheDevice.d.ts +3 -0
- package/common/src/data-structures/cacheDevices/FileCacheDevice.mjs +12 -3
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.d.ts +9 -9
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +37 -47
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.d.ts +2 -3
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.mjs +26 -22
- package/common/src/data-structures/crypto-keys/keys.cjs +1 -1
- package/common/src/data-structures/crypto-keys/keys.d.ts +12 -27
- package/common/src/data-structures/crypto-keys/keys.mjs +61 -79
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +1 -2
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +14 -20
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.d.ts +1 -1
- package/common/src/data-structures/event-service/evm/ClientBlockchainEventEmitter.mjs +2 -2
- 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 +29 -19
- package/common/src/data-structures/provider-adapter/IProviderAdapter.d.ts +0 -1
- package/common/src/data-structures/utxo/Utxo.cjs +1 -1
- package/common/src/data-structures/utxo/Utxo.d.ts +1 -4
- package/common/src/data-structures/utxo/Utxo.mjs +7 -17
- package/common/src/error-handling/error-codes.constants.cjs +2 -2
- package/common/src/error-handling/error-codes.constants.d.ts +6 -14
- package/common/src/error-handling/error-codes.constants.mjs +21 -31
- 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/error-handling/index.cjs +1 -1
- package/common/src/error-handling/index.d.ts +1 -0
- package/common/src/error-handling/index.mjs +1 -0
- 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/index.cjs +1 -1
- package/common/src/functions/index.d.ts +0 -1
- package/common/src/functions/index.mjs +13 -16
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.cjs +1 -1
- package/common/src/functions/pre-transaction/buildCommitmentValidationData.mjs +36 -38
- 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 +9 -12
- package/common/src/functions/pre-transaction/solana-public-signals.d.ts +1 -0
- 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 -21
- 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.d.ts +1 -2
- package/common/src/functions/private-wallet/emporium.helpers.mjs +75 -50
- 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 +34 -76
- 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 +3 -4
- package/common/src/functions/snarkjs/common.snarkjs.mjs +97 -62
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +183 -144
- package/common/src/functions/snarkjs/constant.mjs +183 -145
- 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 +69 -57
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.cjs +1 -0
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.d.ts +7 -0
- package/common/src/functions/snarkjs/constructSignatureFromMnemonicProofInput.mjs +2 -0
- 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 +63 -62
- 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/fetchMerkleTreeSiblings.d.ts +1 -3
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.d.ts +1 -0
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.mjs +14 -5
- 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 +41 -31
- 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/generateSignatureFromMnemonicProof.cjs +1 -0
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.d.ts +2 -0
- package/common/src/functions/snarkjs/generateSignatureFromMnemonicProof.mjs +3 -0
- 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/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.d.ts +2 -0
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +18 -12
- package/common/src/functions/snarkjs/getZKFiles.cjs +1 -1
- package/common/src/functions/snarkjs/getZKFiles.mjs +9 -3
- package/common/src/functions/snarkjs/index.cjs +1 -1
- package/common/src/functions/snarkjs/index.d.ts +2 -0
- package/common/src/functions/snarkjs/index.mjs +2 -0
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +12 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +23 -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 -1
- package/common/src/functions/utils/addresses.mjs +13 -12
- package/common/src/functions/utils/bridge-flow.utils.d.ts +1 -1
- package/common/src/functions/utils/buildClaimableDepositPlan.d.ts +3 -2
- package/common/src/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -1
- package/common/src/functions/utils/convertEmporiumOpToCallInfo.mjs +5 -10
- 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.d.ts +3 -0
- package/common/src/functions/utils/enclave-utxo-storage.mjs +1 -1
- package/common/src/functions/utils/enclaveSessionSigning.cjs +1 -0
- package/common/src/functions/utils/enclaveSessionSigning.d.ts +16 -0
- package/common/src/functions/utils/enclaveSessionSigning.mjs +2 -0
- package/common/src/functions/utils/encodeTokenWithId.cjs +1 -1
- package/common/src/functions/utils/encodeTokenWithId.d.ts +1 -2
- package/common/src/functions/utils/encodeTokenWithId.mjs +2 -5
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.d.ts +1 -0
- package/common/src/functions/utils/fees.utils.mjs +32 -28
- package/common/src/functions/utils/formatter.d.ts +1 -0
- package/common/src/functions/utils/getDataFromTransaction.d.ts +4 -3
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.cjs +1 -1
- package/common/src/functions/utils/getRecipientInfoFromUserKeys.mjs +2 -3
- 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 +17 -18
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +7 -3
- package/common/src/functions/utils/index.mjs +16 -11
- package/common/src/functions/utils/legacyKeys.cjs +1 -0
- package/common/src/functions/utils/legacyKeys.d.ts +10 -0
- package/common/src/functions/utils/legacyKeys.mjs +8 -0
- package/common/src/functions/utils/mnemonics.cjs +1 -1
- package/common/src/functions/utils/mnemonics.mjs +4 -6
- package/common/src/functions/utils/nearIntents.utils.cjs +1 -1
- package/common/src/functions/utils/nearIntents.utils.mjs +1 -1
- package/common/src/functions/utils/networks.utils.d.ts +1 -0
- package/common/src/functions/utils/prepareHinkal.cjs +1 -1
- package/common/src/functions/utils/prepareHinkal.d.ts +1 -3
- package/common/src/functions/utils/prepareHinkal.mjs +2 -1
- 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/resolve-domain-address.cjs +1 -0
- package/common/src/functions/utils/resolve-domain-address.d.ts +4 -0
- package/common/src/functions/utils/resolve-domain-address.mjs +3 -0
- package/common/src/functions/utils/serialize-utxos.utils.cjs +1 -1
- package/common/src/functions/utils/serialize-utxos.utils.mjs +6 -4
- 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 -142
- package/common/src/functions/utils/validateWalletAddress.cjs +1 -0
- package/common/src/functions/utils/validateWalletAddress.d.ts +1 -0
- package/common/src/functions/utils/validateWalletAddress.mjs +2 -0
- package/common/src/functions/utils/voidWallets.utils.cjs +1 -0
- package/common/src/functions/utils/voidWallets.utils.d.ts +4 -0
- package/common/src/functions/utils/voidWallets.utils.mjs +1 -0
- 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/etherFunctions.d.ts +1 -0
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.d.ts +5 -12
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +50 -61
- 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 +2 -2
- package/common/src/functions/web3/events/getShieldedBalance.mjs +89 -85
- 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.d.ts +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.mjs +21 -107
- package/common/src/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
- package/common/src/functions/web3/functionCalls/constructBatchCall.d.ts +2 -2
- package/common/src/functions/web3/functionCalls/constructBatchCall.mjs +23 -18
- 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 -53
- 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/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/EthersProviderAdapter.cjs +1 -1
- package/common/src/providers/EthersProviderAdapter.d.ts +0 -1
- package/common/src/providers/EthersProviderAdapter.mjs +0 -3
- package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.d.ts +0 -1
- package/common/src/providers/SolanaProviderAdapter.mjs +0 -3
- package/common/src/providers/TronProviderAdapter.cjs +1 -1
- package/common/src/providers/TronProviderAdapter.d.ts +0 -1
- package/common/src/providers/TronProviderAdapter.mjs +7 -4
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.d.ts +0 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +0 -4
- package/common/src/types/API.types.d.ts +0 -4
- package/common/src/types/WeeklyAnalytics.types.d.ts +1 -26
- 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 +3 -2
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/circom-data.types.cjs +1 -1
- package/common/src/types/circom-data.types.d.ts +32 -27
- package/common/src/types/circom-data.types.mjs +1 -1
- package/common/src/types/commitments.types.d.ts +2 -0
- package/common/src/types/dashboard-account.d.ts +15 -0
- package/common/src/types/dashboard-payout.types.d.ts +1 -0
- package/common/src/types/dashboard-transaction.types.d.ts +3 -0
- package/common/src/types/enclaveApi.types.d.ts +78 -0
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +8 -27
- 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 +4 -8
- 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 +12 -29
- package/common/src/types/hinkal.types.mjs +12 -20
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +5 -5
- package/common/src/types/index.mjs +1 -1
- package/common/src/types/near-intents.types.d.ts +1 -0
- package/common/src/types/new-rewards.type.d.ts +0 -70
- 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/payout-notification.types.d.ts +11 -0
- package/common/src/types/proxy-progress.types.d.ts +5 -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/snark.types.d.ts +1 -3
- 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/token.types.cjs +1 -1
- package/common/src/types/token.types.mjs +1 -3
- 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/types/transaction.types.d.ts +0 -1
- package/common/src/types/transactions.types.d.ts +0 -1
- package/common/src/webworker/logError-CxZzSALU.js +2 -0
- 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 +4 -5
- package/services/Hinkal.mjs +11 -14
- package/types/IHinkal.d.ts +4 -5
- package/types/swap.types.d.ts +3 -20
- package/common/src/API/accessCodeCalls.cjs +0 -1
- package/common/src/API/accessCodeCalls.d.ts +0 -23
- package/common/src/API/accessCodeCalls.mjs +0 -13
- package/common/src/API/brotherhoodCalls.cjs +0 -1
- package/common/src/API/brotherhoodCalls.d.ts +0 -82
- package/common/src/API/brotherhoodCalls.mjs +0 -17
- 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 -18
- package/common/src/API/callOneInchAPI.mjs +0 -13
- package/common/src/API/generate-trading-points.cjs +0 -1
- package/common/src/API/generate-trading-points.d.ts +0 -27
- package/common/src/API/generate-trading-points.mjs +0 -23
- package/common/src/API/leaderboardCalls.cjs +0 -1
- package/common/src/API/leaderboardCalls.d.ts +0 -14
- package/common/src/API/leaderboardCalls.mjs +0 -8
- package/common/src/API/referralsCalls.cjs +0 -1
- package/common/src/API/referralsCalls.d.ts +0 -22
- package/common/src/API/referralsCalls.mjs +0 -11
- package/common/src/API/send-telegram-callback.cjs +0 -1
- package/common/src/API/send-telegram-callback.d.ts +0 -7
- package/common/src/API/send-telegram-callback.mjs +0 -11
- package/common/src/constants/mystery-boxes.constants.d.ts +0 -0
- package/common/src/constants/price-impact.constants.d.ts +0 -2
- package/common/src/constants/rewards.constants.d.ts +0 -15
- package/common/src/constants/tasks.constants.cjs +0 -1
- package/common/src/constants/tasks.constants.d.ts +0 -9
- package/common/src/constants/tasks.constants.mjs +0 -124
- package/common/src/data-structures/Hinkal/hinkalMultiSend.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalMultiSend.d.ts +0 -3
- package/common/src/data-structures/Hinkal/hinkalMultiSend.mjs +0 -12
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.d.ts +0 -6
- package/common/src/data-structures/Hinkal/hinkalProoflessDepositViaWrapper.mjs +0 -128
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.cjs +0 -1
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.d.ts +0 -22
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.mjs +0 -34
- 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 -32
- 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/bit.operations.cjs +0 -1
- package/common/src/functions/utils/bit.operations.d.ts +0 -3
- package/common/src/functions/utils/bit.operations.mjs +0 -4
- 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 -34
- 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/types/brotherhood-user.types.d.ts +0 -11
- package/common/src/types/crypto.types.d.ts +0 -8
- package/common/src/types/generatePoints.d.ts +0 -14
- package/common/src/types/new-rewards.type.cjs +0 -1
- package/common/src/types/new-rewards.type.mjs +0 -10
- package/common/src/types/referral.types.d.ts +0 -12
- package/common/src/types/rewards.types.d.ts +0 -34
- package/common/src/types/token-with-id.types.d.ts +0 -4
- package/common/src/webworker/logError-BR5TJP6T.js +0 -2
- package/common/src/webworker/workerProxy-Ddzxn23N.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../functions/utils/time.utils.cjs`),o=require(`../../
|
|
1
|
+
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../functions/utils/time.utils.cjs`),o=require(`../../functions/utils/addresses.cjs`),s=require(`../../types/external-action.types.cjs`),c=require(`../../types/token.types.cjs`),l=require(`../../API/API.cjs`),u=require(`../../error-handling/logger.cjs`),d=require(`../../functions/utils/erc20tokenFunctions.cjs`),f=require(`../../functions/pre-transaction/getFeeStructure.cjs`),p=require(`../../functions/private-wallet/emporium.helpers.cjs`),m=require(`../../constants/addresses.constants.cjs`),h=require(`../../constants/bridging.constants.cjs`),g=require(`../../constants/tx-confirmation.constants.cjs`);require(`../../constants/index.cjs`);const _=require(`../../functions/utils/tx-confirmation.utils.cjs`),v=require(`../../functions/utils/getUtxosFromReceipt.utils.cjs`),y=require(`../../functions/utils/getRecipientInfoFromUserKeys.cjs`),b=require(`../../functions/utils/convertEmporiumOpToCallInfo.cjs`),x=require(`../../functions/utils/publicBalance.utils.cjs`),S=require(`../../functions/utils/fees.utils.cjs`),C=require(`../../functions/utils/temp-wallet.utils.cjs`),w=require(`../../functions/web3/lifiAPI.cjs`);var T=async(n,i,a,u,f,h,g)=>{let{chainId:_}=i,v=a.chainId,y=i.erc20TokenAddress,b=m.SWAP_ROUTER_ADDRESSES[s.ExternalActionId.Lifi][_];if(!b)throw Error(`LIFI not configured for chain ${_}`);let x=r.randomBigInt(6),{privateKey:S,ethAddress:T}=C.deriveTempWallet(n,_,x),{lifiDataValue:E,outSwapAmountValue:D,extraNativeTokenFee:O}=await w.getLifiPrice(i,a,u,f,T,T),k={calldata:E,expectedAmount:D,nativeFee:O},A=r.getAmountInWei(i,u),j=C.buildTempSubAccount(x,S,T),M=o.hashEthereumAddress(await n.getEthereumAddressByChain(_));await Promise.all([l.API.addTemporaryWalletNonce(_,M,Number(x),c.TemporaryWalletRecoveryDestination.Confidential),l.API.addTemporaryWalletNonce(v,M,Number(x),c.TemporaryWalletRecoveryDestination.Confidential)]);let N=t.caseInsensitiveEqual(y,e.zeroAddress),P=k.nativeFee>0n&&!N,F=N?A+k.nativeFee:A,I=[i],L=[-F];if(P){let t=await d.getErc20TokenFromAPI(_,e.zeroAddress);if(!t)throw Error(`Native token not found for bridge fee`);I.push(t),L.push(-k.nativeFee)}let R=p.createLifiBridgeOps(n,_,T,b,y,F,A,k),z=I.map((e,t)=>({token:e,amount:L[t]}));return{nonce:x,tempSubAccount:j,sourceTxHash:await n.actionPrivateWallet(_,I,L,L.map(()=>!1),R,z,j,h??y,void 0,void 0,!1,void 0,g,void 0),quote:k}},E=async(e,t,n,r,i)=>{let o=BigInt(Math.round(i*h.SLIPPAGE_SCALING_FACTOR)),s=r.expectedAmount-r.expectedAmount*o/BigInt(h.SLIPPAGE_SCALING_FACTOR),c=s>0n?s:1n,l=Date.now()+h.BRIDGE_ARRIVAL_TIMEOUT_MS;for(;Date.now()<l;){let r=await x.getPublicBalanceByTokenAddress(e,t,n);if(r!==null&&r>=c)return r;await a.waitLittle(h.BRIDGE_ARRIVAL_POLL_INTERVAL_MS)}throw Error(`Bridge did not land on destination temp wallet ${t} on chain ${e} within timeout.`)},D=async(t,r,a,o,c,l)=>{let u=r.chainId,d=r.erc20TokenAddress,m=a.ethAddress;if(!m)throw Error(`Missing temp wallet address for bridge shield`);let h=p.createTransaferEmporiumOpsBatch(t,u,[d],[o]),x=await S.calculateModifiedFeeStructure(u,r,o,await f.getFeeStructure(u,d,[d],s.ExternalActionId.Emporium,h.map(e=>b.convertEmporiumOpToCallInfo(e,m,u)),e.PAY_SEND_VARIABLE_RATE)),C=o-S.calculateTotalFee(o,x);if(C<=0n)throw Error(n.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT);let w,T;if(`recipientInfo`in c)w=c.recipientInfo;else{let e=t.userKeys.getClaimableSignatureFromNonce(c.claimableNonce),n=new i.UserKeys(e);T={signature:e,keys:n,ethAddress:c.recipientEthAddress},w=y.getRecipientInfoFromUserKeys(n)}let E=await t.proxyToPrivate([r],[C],a,w,x.feeToken,x,l),D;if(T){let e=await _.waitForEthereumTransactionConfirmation(u,E,{evmTimeoutMs:g.RELAYER_TX_CONFIRMATION_TIMEOUT});if(!e)throw Error(`Could not fetch receipt for bridge shield tx ${E}`);let[n]=v.getUtxosFromReceipt(e,t,u,d,T.keys.getShieldedPrivateKey());if(!n)throw Error(`Could not find recipient UTXO in bridge shield tx`);D={chainId:u,senderAddress:await t.getEthereumAddressByChain(u),recipientAddress:T.ethAddress,claimableSignature:T.signature,utxo:n}}return{destTxHash:E,pendingEnclaveUtxo:D,shieldedAmount:C}},O=async(e,t,n,r,i,a=h.DEFAULT_BRIDGING_SLIPPAGE_DECIMAL,s,c)=>{let{nonce:d,tempSubAccount:f,sourceTxHash:p,quote:m}=await T(e,t,n,r,a,s,c),g=f.ethAddress;if(!g)throw Error(`Missing temp wallet address for bridge`);let{destTxHash:_,pendingEnclaveUtxo:v,shieldedAmount:y}=await D(e,n,f,await E(n.chainId,g,n.erc20TokenAddress,m,a),i,c),b=o.hashEthereumAddress(await e.getEthereumAddressByChain(n.chainId)),x=[t.chainId,n.chainId];return(await Promise.allSettled(x.map(e=>l.API.removeTemporaryWalletNonce(e,b,Number(d))))).forEach((e,t)=>{e.status===`rejected`&&u.Logger.error(`Failed to remove temp-wallet nonce on chain ${x[t]}`,e.reason)}),{sourceTxHash:p,destTxHash:_,pendingEnclaveUtxo:v,destinationTokenAmount:y.toString()}};exports.hinkalBridgePrivateToPrivate=O;
|
|
@@ -4,103 +4,105 @@ import { transactionErrorCodes as r } from "../../error-handling/error-codes.con
|
|
|
4
4
|
import { getAmountInWei as i, randomBigInt as a } from "../../functions/web3/etherFunctions.mjs";
|
|
5
5
|
import { UserKeys as o } from "../crypto-keys/keys.mjs";
|
|
6
6
|
import { waitLittle as s } from "../../functions/utils/time.utils.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { hashEthereumAddress as c } from "../../functions/utils/addresses.mjs";
|
|
8
|
+
import { ExternalActionId as l } from "../../types/external-action.types.mjs";
|
|
9
|
+
import { TemporaryWalletRecoveryDestination as u } from "../../types/token.types.mjs";
|
|
10
|
+
import { API as d } from "../../API/API.mjs";
|
|
11
|
+
import { Logger as f } from "../../error-handling/logger.mjs";
|
|
12
12
|
import { getErc20TokenFromAPI as p } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
13
13
|
import { getFeeStructure as m } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
14
|
+
import { createLifiBridgeOps as h, createTransaferEmporiumOpsBatch as g } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
15
|
+
import { SWAP_ROUTER_ADDRESSES as _ } from "../../constants/addresses.constants.mjs";
|
|
16
|
+
import { BRIDGE_ARRIVAL_POLL_INTERVAL_MS as v, BRIDGE_ARRIVAL_TIMEOUT_MS as y, DEFAULT_BRIDGING_SLIPPAGE_DECIMAL as b, SLIPPAGE_SCALING_FACTOR as x } from "../../constants/bridging.constants.mjs";
|
|
17
|
+
import { RELAYER_TX_CONFIRMATION_TIMEOUT as S } from "../../constants/tx-confirmation.constants.mjs";
|
|
17
18
|
import "../../constants/index.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { getRecipientInfoFromUserKeys as S } from "../../functions/utils/getRecipientInfoFromUserKeys.mjs";
|
|
20
|
-
import { getPublicBalanceByTokenAddress as C } from "../../functions/utils/publicBalance.utils.mjs";
|
|
19
|
+
import { waitForEthereumTransactionConfirmation as C } from "../../functions/utils/tx-confirmation.utils.mjs";
|
|
21
20
|
import { getUtxosFromReceipt as w } from "../../functions/utils/getUtxosFromReceipt.utils.mjs";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
21
|
+
import { getRecipientInfoFromUserKeys as T } from "../../functions/utils/getRecipientInfoFromUserKeys.mjs";
|
|
22
|
+
import { convertEmporiumOpToCallInfo as E } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
23
|
+
import { getPublicBalanceByTokenAddress as D } from "../../functions/utils/publicBalance.utils.mjs";
|
|
24
|
+
import { calculateModifiedFeeStructure as O, calculateTotalFee as k } from "../../functions/utils/fees.utils.mjs";
|
|
25
|
+
import { buildTempSubAccount as A, deriveTempWallet as j } from "../../functions/utils/temp-wallet.utils.mjs";
|
|
26
26
|
import { getLifiPrice as M } from "../../functions/web3/lifiAPI.mjs";
|
|
27
27
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.ts
|
|
28
|
-
var N = async (e, r, o, s,
|
|
29
|
-
let { chainId:
|
|
30
|
-
if (!
|
|
31
|
-
let
|
|
32
|
-
calldata:
|
|
33
|
-
expectedAmount:
|
|
34
|
-
nativeFee:
|
|
35
|
-
},
|
|
36
|
-
await Promise.all([
|
|
37
|
-
let F = n(
|
|
28
|
+
var N = async (e, r, o, s, f, m, g) => {
|
|
29
|
+
let { chainId: v } = r, y = o.chainId, b = r.erc20TokenAddress, x = _[l.Lifi][v];
|
|
30
|
+
if (!x) throw Error(`LIFI not configured for chain ${v}`);
|
|
31
|
+
let S = a(6), { privateKey: C, ethAddress: w } = j(e, v, S), { lifiDataValue: T, outSwapAmountValue: E, extraNativeTokenFee: D } = await M(r, o, s, f, w, w), O = {
|
|
32
|
+
calldata: T,
|
|
33
|
+
expectedAmount: E,
|
|
34
|
+
nativeFee: D
|
|
35
|
+
}, k = i(r, s), N = A(S, C, w), P = c(await e.getEthereumAddressByChain(v));
|
|
36
|
+
await Promise.all([d.addTemporaryWalletNonce(v, P, Number(S), u.Confidential), d.addTemporaryWalletNonce(y, P, Number(S), u.Confidential)]);
|
|
37
|
+
let F = n(b, t), I = O.nativeFee > 0n && !F, L = F ? k + O.nativeFee : k, R = [r], z = [-L];
|
|
38
38
|
if (I) {
|
|
39
|
-
let e = await p(
|
|
39
|
+
let e = await p(v, t);
|
|
40
40
|
if (!e) throw Error("Native token not found for bridge fee");
|
|
41
|
-
R.push(e), z.push(-
|
|
41
|
+
R.push(e), z.push(-O.nativeFee);
|
|
42
42
|
}
|
|
43
|
-
let B =
|
|
43
|
+
let B = h(e, v, w, x, b, L, k, O), V = R.map((e, t) => ({
|
|
44
44
|
token: e,
|
|
45
45
|
amount: z[t]
|
|
46
46
|
}));
|
|
47
47
|
return {
|
|
48
|
-
nonce:
|
|
48
|
+
nonce: S,
|
|
49
49
|
tempSubAccount: N,
|
|
50
|
-
sourceTxHash: await e.actionPrivateWallet(
|
|
51
|
-
quote:
|
|
50
|
+
sourceTxHash: await e.actionPrivateWallet(v, R, z, z.map(() => !1), B, V, N, m ?? b, void 0, void 0, !1, void 0, g, void 0),
|
|
51
|
+
quote: O
|
|
52
52
|
};
|
|
53
53
|
}, P = async (e, t, n, r, i) => {
|
|
54
|
-
let a = BigInt(Math.round(i *
|
|
54
|
+
let a = BigInt(Math.round(i * x)), o = r.expectedAmount - r.expectedAmount * a / BigInt(x), c = o > 0n ? o : 1n, l = Date.now() + y;
|
|
55
55
|
for (; Date.now() < l;) {
|
|
56
|
-
let r = await
|
|
56
|
+
let r = await D(e, t, n);
|
|
57
57
|
if (r !== null && r >= c) return r;
|
|
58
|
-
await s(
|
|
58
|
+
await s(v);
|
|
59
59
|
}
|
|
60
60
|
throw Error(`Bridge did not land on destination temp wallet ${t} on chain ${e} within timeout.`);
|
|
61
|
-
}, F = async (t, n, i, a, s,
|
|
61
|
+
}, F = async (t, n, i, a, s, c) => {
|
|
62
62
|
let u = n.chainId, d = n.erc20TokenAddress, f = i.ethAddress;
|
|
63
63
|
if (!f) throw Error("Missing temp wallet address for bridge shield");
|
|
64
|
-
let p =
|
|
65
|
-
if (
|
|
66
|
-
let
|
|
67
|
-
if ("recipientInfo" in s)
|
|
64
|
+
let p = g(t, u, [d], [a]), h = await O(u, n, a, await m(u, d, [d], l.Emporium, p.map((e) => E(e, f, u)), e)), _ = a - k(a, h);
|
|
65
|
+
if (_ <= 0n) throw Error(r.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
66
|
+
let v, y;
|
|
67
|
+
if ("recipientInfo" in s) v = s.recipientInfo;
|
|
68
68
|
else {
|
|
69
69
|
let e = t.userKeys.getClaimableSignatureFromNonce(s.claimableNonce), n = new o(e);
|
|
70
|
-
|
|
70
|
+
y = {
|
|
71
71
|
signature: e,
|
|
72
72
|
keys: n,
|
|
73
73
|
ethAddress: s.recipientEthAddress
|
|
74
|
-
},
|
|
74
|
+
}, v = T(n);
|
|
75
75
|
}
|
|
76
|
-
let
|
|
77
|
-
if (
|
|
78
|
-
let e = await
|
|
79
|
-
if (!e) throw Error(`Could not fetch receipt for bridge shield tx ${
|
|
80
|
-
let [n] = w(e, t, u, d,
|
|
76
|
+
let b = await t.proxyToPrivate([n], [_], i, v, h.feeToken, h, c), x;
|
|
77
|
+
if (y) {
|
|
78
|
+
let e = await C(u, b, { evmTimeoutMs: S });
|
|
79
|
+
if (!e) throw Error(`Could not fetch receipt for bridge shield tx ${b}`);
|
|
80
|
+
let [n] = w(e, t, u, d, y.keys.getShieldedPrivateKey());
|
|
81
81
|
if (!n) throw Error("Could not find recipient UTXO in bridge shield tx");
|
|
82
|
-
|
|
82
|
+
x = {
|
|
83
83
|
chainId: u,
|
|
84
84
|
senderAddress: await t.getEthereumAddressByChain(u),
|
|
85
|
-
recipientAddress:
|
|
86
|
-
claimableSignature:
|
|
85
|
+
recipientAddress: y.ethAddress,
|
|
86
|
+
claimableSignature: y.signature,
|
|
87
87
|
utxo: n
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
return {
|
|
91
|
-
destTxHash:
|
|
92
|
-
pendingEnclaveUtxo:
|
|
91
|
+
destTxHash: b,
|
|
92
|
+
pendingEnclaveUtxo: x,
|
|
93
|
+
shieldedAmount: _
|
|
93
94
|
};
|
|
94
|
-
}, I = async (e, t, n, r, i, a =
|
|
95
|
-
let { nonce:
|
|
95
|
+
}, I = async (e, t, n, r, i, a = b, o, s) => {
|
|
96
|
+
let { nonce: l, tempSubAccount: u, sourceTxHash: p, quote: m } = await N(e, t, n, r, a, o, s), h = u.ethAddress;
|
|
96
97
|
if (!h) throw Error("Missing temp wallet address for bridge");
|
|
97
|
-
let { destTxHash: g, pendingEnclaveUtxo: _ } = await F(e, n,
|
|
98
|
-
return (await Promise.allSettled(
|
|
99
|
-
e.status === "rejected" &&
|
|
98
|
+
let { destTxHash: g, pendingEnclaveUtxo: _, shieldedAmount: v } = await F(e, n, u, await P(n.chainId, h, n.erc20TokenAddress, m, a), i, s), y = c(await e.getEthereumAddressByChain(n.chainId)), x = [t.chainId, n.chainId];
|
|
99
|
+
return (await Promise.allSettled(x.map((e) => d.removeTemporaryWalletNonce(e, y, Number(l))))).forEach((e, t) => {
|
|
100
|
+
e.status === "rejected" && f.error(`Failed to remove temp-wallet nonce on chain ${x[t]}`, e.reason);
|
|
100
101
|
}), {
|
|
101
102
|
sourceTxHash: p,
|
|
102
103
|
destTxHash: g,
|
|
103
|
-
pendingEnclaveUtxo: _
|
|
104
|
+
pendingEnclaveUtxo: _,
|
|
105
|
+
destinationTokenAmount: v.toString()
|
|
104
106
|
};
|
|
105
107
|
};
|
|
106
108
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/
|
|
1
|
+
const e=require(`../../constants/protocol.constants.cjs`),t=require(`../../functions/utils/caseInsensitive.utils.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../crypto-keys/keys.cjs`),i=require(`../utxo/Utxo.cjs`),a=require(`../../types/external-action.types.cjs`),o=require(`../../types/transact.types.cjs`),s=require(`../../functions/utils/token-check.utils.cjs`),c=require(`../../functions/pre-transaction/getFeeStructure.cjs`),l=require(`./hinkalTransact.cjs`);var u=async(u,d,f,p,m)=>{let h=s.validateAndGetChainId([d]),g=d.erc20TokenAddress;if(!t.caseInsensitiveEqual(g,f.erc20TokenAddress))throw Error(`Off-chain UTXO token mismatch`);let _=m?new r.UserKeys(m):new r.UserKeys(f.nullifyingKey,f.nullifyingKey);if(!f.nullifyingKey&&!m)throw Error(`Claimable UTXO nullifyingKey is missing`);let v=_.getShieldedPrivateKey();if(f.nullifyingKey&&f.nullifyingKey!==v)throw Error(`Claimable UTXO key mismatch`);let y=u.getRecipientInfo(),b=i.Utxo.createFrom(f,{nullifyingKey:v}),x=p??await c.getFeeStructure(h,g,[g],a.ExternalActionId.Transact);if(!t.caseInsensitiveEqual(x.feeToken,g))throw Error(`Claim fee token mismatch: fee must be paid from claimed UTXO token`);let S=x.variableRate>0n?x.variableRate:e.HINKAL_PRIVATE_SEND_VARIABLE_RATE;if(b.amount<=x.flatFee)throw Error(n.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT);let C=b.amount-x.flatFee,w=C*S/10000n,T=C-w;if(T<=0n)throw Error(n.transactionErrorCodes.RECIPIENT_AMOUNT_INVALID);let E={feeToken:x.feeToken,flatFee:x.flatFee+w,variableRate:0n},D=[-b.amount],O=await u.getRandomRelay(h,!0);if(!O)throw Error(n.transactionErrorCodes.RELAYER_NOT_AVAILABLE);return l.hinkalTransact(u,{chainId:h,erc20Addresses:[g],amountChanges:D,externalAddress:O,feeStructure:E,relay:O,recipientAddress:[y],recipientAmounts:[[T]],inputUtxos:[[b]],userKeys:_,submit:{mode:o.SubmitMode.Relayer}})};exports.hinkalClaimUtxo=u;
|
|
@@ -1,54 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { outputUtxoProcessing as d } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
12
|
-
import { getFeeStructure as f } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
13
|
-
import { constructZkProof as p } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
14
|
-
import { transactCallRelayer as m } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
1
|
+
import { HINKAL_PRIVATE_SEND_VARIABLE_RATE as e } from "../../constants/protocol.constants.mjs";
|
|
2
|
+
import { caseInsensitiveEqual as t } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
3
|
+
import { transactionErrorCodes as n } from "../../error-handling/error-codes.constants.mjs";
|
|
4
|
+
import { UserKeys as r } from "../crypto-keys/keys.mjs";
|
|
5
|
+
import { Utxo as i } from "../utxo/Utxo.mjs";
|
|
6
|
+
import { ExternalActionId as a } from "../../types/external-action.types.mjs";
|
|
7
|
+
import { SubmitMode as o } from "../../types/transact.types.mjs";
|
|
8
|
+
import { validateAndGetChainId as s } from "../../functions/utils/token-check.utils.mjs";
|
|
9
|
+
import { getFeeStructure as c } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
10
|
+
import { hinkalTransact as l } from "./hinkalTransact.mjs";
|
|
15
11
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalClaimUtxo.ts
|
|
16
|
-
var
|
|
17
|
-
let
|
|
18
|
-
if (!
|
|
19
|
-
let
|
|
20
|
-
if (!
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}), k = v ?? await f(b, S, [S], s.Transact);
|
|
33
|
-
if (!n(k.feeToken, S)) throw Error("Claim fee token mismatch: fee must be paid from claimed UTXO token");
|
|
34
|
-
let A = k.variableRate > 0n ? k.variableRate : t;
|
|
35
|
-
if (D.amount <= k.flatFee) throw Error(r.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
36
|
-
let j = D.amount - k.flatFee, M = j * A / 10000n, N = j - M;
|
|
37
|
-
if (N <= 0n) throw Error(r.RECIPIENT_AMOUNT_INVALID);
|
|
38
|
-
let P = {
|
|
39
|
-
feeToken: k.feeToken,
|
|
40
|
-
flatFee: k.flatFee + M,
|
|
12
|
+
var u = async (u, d, f, p, m) => {
|
|
13
|
+
let h = s([d]), g = d.erc20TokenAddress;
|
|
14
|
+
if (!t(g, f.erc20TokenAddress)) throw Error("Off-chain UTXO token mismatch");
|
|
15
|
+
let _ = m ? new r(m) : new r(f.nullifyingKey, f.nullifyingKey);
|
|
16
|
+
if (!f.nullifyingKey && !m) throw Error("Claimable UTXO nullifyingKey is missing");
|
|
17
|
+
let v = _.getShieldedPrivateKey();
|
|
18
|
+
if (f.nullifyingKey && f.nullifyingKey !== v) throw Error("Claimable UTXO key mismatch");
|
|
19
|
+
let y = u.getRecipientInfo(), b = i.createFrom(f, { nullifyingKey: v }), x = p ?? await c(h, g, [g], a.Transact);
|
|
20
|
+
if (!t(x.feeToken, g)) throw Error("Claim fee token mismatch: fee must be paid from claimed UTXO token");
|
|
21
|
+
let S = x.variableRate > 0n ? x.variableRate : e;
|
|
22
|
+
if (b.amount <= x.flatFee) throw Error(n.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
23
|
+
let C = b.amount - x.flatFee, w = C * S / 10000n, T = C - w;
|
|
24
|
+
if (T <= 0n) throw Error(n.RECIPIENT_AMOUNT_INVALID);
|
|
25
|
+
let E = {
|
|
26
|
+
feeToken: x.feeToken,
|
|
27
|
+
flatFee: x.flatFee + w,
|
|
41
28
|
variableRate: 0n
|
|
42
|
-
},
|
|
43
|
-
if (!
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
}, D = [-b.amount], O = await u.getRandomRelay(h, !0);
|
|
30
|
+
if (!O) throw Error(n.RELAYER_NOT_AVAILABLE);
|
|
31
|
+
return l(u, {
|
|
32
|
+
chainId: h,
|
|
33
|
+
erc20Addresses: [g],
|
|
34
|
+
amountChanges: D,
|
|
35
|
+
externalAddress: O,
|
|
36
|
+
feeStructure: E,
|
|
37
|
+
relay: O,
|
|
38
|
+
recipientAddress: [y],
|
|
39
|
+
recipientAmounts: [[T]],
|
|
40
|
+
inputUtxos: [[b]],
|
|
41
|
+
userKeys: _,
|
|
42
|
+
submit: { mode: o.Relayer }
|
|
43
|
+
});
|
|
52
44
|
};
|
|
53
45
|
//#endregion
|
|
54
|
-
export {
|
|
46
|
+
export { u as hinkalClaimUtxo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../
|
|
1
|
+
const e=require(`../../error-handling/error-codes.constants.cjs`),t=require(`../../functions/utils/addresses.cjs`),n=require(`../../functions/utils/tron.utils.cjs`),r=require(`../../types/transact.types.cjs`),i=require(`../../functions/utils/token-check.utils.cjs`),a=require(`../../functions/pre-transaction/constructAdminData.cjs`),o=require(`./hinkalTransact.cjs`),s=require(`../../API/admin-calls.cjs`);var c=async(e,t,a,s=!0,c=!1)=>{let l=i.validateAndGetChainId(t);return o.hinkalTransact(e,{chainId:l,erc20Addresses:t.map(e=>e.erc20TokenAddress),amountChanges:a,externalAddress:n.addressToHexFormat(await e.getEthereumAddressByChain(l)),submit:{mode:r.SubmitMode.Self,erc20Tokens:t,approvalAmounts:a,preEstimateGas:s,returnTxData:c}})},l=async(c,l,u,d,f=!0,p=!1,m)=>{if(d.length===0)throw Error(`recipientInfos must not be empty`);if(u.length!==d.length)throw Error(`amountsByRecipient must have one entry per recipientInfo`);let h=i.validateAndGetChainId(l),g=l.map(e=>e.erc20TokenAddress);d.forEach((n,r)=>{if(!t.isValidPrivateAddress(n))throw Error(e.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);if(u[r].length!==g.length)throw Error(`Each amountsByRecipient entry must have one amount per erc20Token`)});let _=g.map((e,t)=>u.reduce((e,n)=>e+n[t],0n)),v=n.addressToHexFormat(await c.getEthereumAddressByChain(h)),y=await o.hinkalTransact(c,{chainId:h,erc20Addresses:g,amountChanges:_.map(()=>0n),externalAddress:v,recipientAddress:d,recipientAmounts:u,forceEmptyUtxos:!0,submit:{mode:r.SubmitMode.Self,erc20Tokens:l,approvalAmounts:_,preEstimateGas:f,returnTxData:p}});return s.emitTxPublicData(a.constructAdminData(m,h,g,_,await c.getEthereumAddress())),y},u=async(e,t,n,r,i=!0,a=!1,o)=>l(e,t,[n],[r],i,a,o);exports.hinkalDeposit=c,exports.hinkalDepositForOther=u;
|
|
@@ -3,4 +3,5 @@ import { Types as TronWebTypes } from 'tronweb';
|
|
|
3
3
|
import { IHinkal } from './IHinkal';
|
|
4
4
|
import { AdminTransactionType, ERC20Token } from '../../types';
|
|
5
5
|
export declare const hinkalDeposit: (hinkal: IHinkal, erc20Tokens: ERC20Token[], amountChanges: bigint[], preEstimateGas?: boolean, returnTxData?: boolean) => Promise<ethers.TransactionResponse | ethers.TransactionRequest | string | TronWebTypes.Transaction<TronWebTypes.TriggerSmartContract>>;
|
|
6
|
+
export declare const hinkalDepositForOthers: (hinkal: IHinkal, erc20Tokens: ERC20Token[], amountsByRecipient: bigint[][], recipientInfos: string[], preEstimateGas?: boolean, returnTxData?: boolean, action?: AdminTransactionType) => Promise<ethers.TransactionResponse | ethers.TransactionRequest | string | TronWebTypes.Transaction<TronWebTypes.TriggerSmartContract>>;
|
|
6
7
|
export declare const hinkalDepositForOther: (hinkal: IHinkal, erc20Tokens: ERC20Token[], amountChanges: bigint[], recipientInfo: string, preEstimateGas?: boolean, returnTxData?: boolean, action?: AdminTransactionType) => Promise<ethers.TransactionResponse | ethers.TransactionRequest | string | TronWebTypes.Transaction<TronWebTypes.TriggerSmartContract>>;
|
|
@@ -1,121 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { validateAndGetChainId as v } from "../../functions/utils/token-check.utils.mjs";
|
|
10
|
-
import { addPaddingToUtxos as y } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
11
|
-
import { outputUtxoProcessing as b } from "../../functions/pre-transaction/outputUtxoProcessing.mjs";
|
|
12
|
-
import { constructAdminData as x } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
13
|
-
import { simulateTronTransaction as S } from "../../functions/utils/tronSimulation.utils.mjs";
|
|
14
|
-
import { constructZkProof as C } from "../../functions/snarkjs/constructGeneralZkProof.mjs";
|
|
15
|
-
import { waitForTronErc20Approvals as w } from "../../functions/web3/functionCalls/waitForErc20Approvals.mjs";
|
|
16
|
-
import { transactCallDirect as T } from "../../functions/web3/functionCalls/transactCallDirect.mjs";
|
|
17
|
-
import { emitTxPublicData as E } from "../../API/admin-calls.mjs";
|
|
1
|
+
import { transactionErrorCodes as e } from "../../error-handling/error-codes.constants.mjs";
|
|
2
|
+
import { isValidPrivateAddress as t } from "../../functions/utils/addresses.mjs";
|
|
3
|
+
import { addressToHexFormat as n } from "../../functions/utils/tron.utils.mjs";
|
|
4
|
+
import { SubmitMode as r } from "../../types/transact.types.mjs";
|
|
5
|
+
import { validateAndGetChainId as i } from "../../functions/utils/token-check.utils.mjs";
|
|
6
|
+
import { constructAdminData as a } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
7
|
+
import { hinkalTransact as o } from "./hinkalTransact.mjs";
|
|
8
|
+
import { emitTxPublicData as s } from "../../API/admin-calls.mjs";
|
|
18
9
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalDeposit.ts
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
feeLimit: n,
|
|
61
|
-
callValue: F,
|
|
62
|
-
input: e
|
|
63
|
-
}, [], T);
|
|
64
|
-
return t;
|
|
65
|
-
}
|
|
66
|
-
await u(y, T, C, D), D.size > 0 && await w(y, T, C, Array.from(D.entries()).map(([e, t]) => ({
|
|
67
|
-
tokenAddress: e,
|
|
68
|
-
requiredAmount: t
|
|
69
|
-
}))), l && (await S(r, C, "transact", x, [
|
|
70
|
-
M,
|
|
71
|
-
O,
|
|
72
|
-
k,
|
|
73
|
-
A,
|
|
74
|
-
N,
|
|
75
|
-
P
|
|
76
|
-
], T, E > 0n ? E : void 0), await d(y, r, C, T, p(x, "transact", [
|
|
77
|
-
M,
|
|
78
|
-
O,
|
|
79
|
-
k,
|
|
80
|
-
A,
|
|
81
|
-
N,
|
|
82
|
-
P
|
|
83
|
-
]), E));
|
|
84
|
-
let I = await y.contract(x, C).transact(M, O, k, A, N, P).send({
|
|
85
|
-
feeLimit: n,
|
|
86
|
-
callValue: F
|
|
87
|
-
}), L = typeof I == "string" ? I : I?.txid ?? I?.transaction?.txID;
|
|
88
|
-
if (!L) throw Error("Tron deposit failed (missing txid)");
|
|
89
|
-
return L;
|
|
90
|
-
}, A = async (t, n, a, o = !0, s = !1) => {
|
|
91
|
-
let c = v(n), l = e(c), u = n.map((e) => e.erc20TokenAddress), [{ externalActionData: d, contractTransaction: f, contractToApprove: p }, { inputUtxosArray: m, outputUtxosArray: h }] = await Promise.all([D(t, c), O(t, c, u, a)]), { zkCallData: g, circomData: _, dimData: y } = await C(t.merkleTreeHinkalByChain[c], m, h, t.userKeys, d.externalActionId, d.externalAddress, d.externalActionMetadata, t.generateProofRemotely, i, r, c);
|
|
92
|
-
return l ? await k(t, c, n, a, g, _, y, o, s) : await T(t, c, a, n, g, _, y, p, f, o, s);
|
|
93
|
-
}, j = async (t, n, o, l, u = !0, d = !1, f) => {
|
|
94
|
-
let p = v(n), m = e(p), h = n.map((e) => e.erc20TokenAddress), [g, _, y, , b] = l.split(",");
|
|
95
|
-
if (!c(l)) throw Error(a.RECIPIENT_FORMAT_INCORRECT);
|
|
96
|
-
let S = h.map((e) => [new s({
|
|
97
|
-
amount: 0n,
|
|
98
|
-
erc20TokenAddress: e,
|
|
99
|
-
nullifyingKey: t.userKeys.getShieldedPrivateKey(),
|
|
100
|
-
spendingPublicKey: t.userKeys.getSpendingKeyPair().pubSpendingBJJPoint,
|
|
101
|
-
isNewStyle: !0
|
|
102
|
-
}), new s({
|
|
103
|
-
amount: 0n,
|
|
104
|
-
erc20TokenAddress: e,
|
|
105
|
-
nullifyingKey: t.userKeys.getShieldedPrivateKey(),
|
|
106
|
-
spendingPublicKey: t.userKeys.getSpendingKeyPair().pubSpendingBJJPoint,
|
|
107
|
-
isNewStyle: !0
|
|
108
|
-
})]), w = h.map((e, t) => [new s({
|
|
109
|
-
amount: o[t],
|
|
110
|
-
erc20TokenAddress: e,
|
|
111
|
-
H0: [BigInt(_), BigInt(y)],
|
|
112
|
-
stealthAddress: g,
|
|
113
|
-
encryptionKey: b,
|
|
114
|
-
isNewStyle: !0
|
|
115
|
-
})]), { externalActionData: O, contractTransaction: A, contractToApprove: j } = await D(t, p), { zkCallData: M, circomData: N, dimData: P } = await C(t.merkleTreeHinkalByChain[p], S, w, t.userKeys, O.externalActionId, O.externalAddress, O.externalActionMetadata, t.generateProofRemotely, i, r, p);
|
|
116
|
-
if (m) return await k(t, p, n, o, M, N, P, u, d);
|
|
117
|
-
let F = await T(t, p, o, n, M, N, P, j, A, u, d);
|
|
118
|
-
return E(x(f, p, h, o, await t.getEthereumAddress())), F;
|
|
119
|
-
};
|
|
10
|
+
var c = async (e, t, a, s = !0, c = !1) => {
|
|
11
|
+
let l = i(t);
|
|
12
|
+
return o(e, {
|
|
13
|
+
chainId: l,
|
|
14
|
+
erc20Addresses: t.map((e) => e.erc20TokenAddress),
|
|
15
|
+
amountChanges: a,
|
|
16
|
+
externalAddress: n(await e.getEthereumAddressByChain(l)),
|
|
17
|
+
submit: {
|
|
18
|
+
mode: r.Self,
|
|
19
|
+
erc20Tokens: t,
|
|
20
|
+
approvalAmounts: a,
|
|
21
|
+
preEstimateGas: s,
|
|
22
|
+
returnTxData: c
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}, l = async (c, l, u, d, f = !0, p = !1, m) => {
|
|
26
|
+
if (d.length === 0) throw Error("recipientInfos must not be empty");
|
|
27
|
+
if (u.length !== d.length) throw Error("amountsByRecipient must have one entry per recipientInfo");
|
|
28
|
+
let h = i(l), g = l.map((e) => e.erc20TokenAddress);
|
|
29
|
+
d.forEach((n, r) => {
|
|
30
|
+
if (!t(n)) throw Error(e.RECIPIENT_FORMAT_INCORRECT);
|
|
31
|
+
if (u[r].length !== g.length) throw Error("Each amountsByRecipient entry must have one amount per erc20Token");
|
|
32
|
+
});
|
|
33
|
+
let _ = g.map((e, t) => u.reduce((e, n) => e + n[t], 0n)), v = n(await c.getEthereumAddressByChain(h)), y = await o(c, {
|
|
34
|
+
chainId: h,
|
|
35
|
+
erc20Addresses: g,
|
|
36
|
+
amountChanges: _.map(() => 0n),
|
|
37
|
+
externalAddress: v,
|
|
38
|
+
recipientAddress: d,
|
|
39
|
+
recipientAmounts: u,
|
|
40
|
+
forceEmptyUtxos: !0,
|
|
41
|
+
submit: {
|
|
42
|
+
mode: r.Self,
|
|
43
|
+
erc20Tokens: l,
|
|
44
|
+
approvalAmounts: _,
|
|
45
|
+
preEstimateGas: f,
|
|
46
|
+
returnTxData: p
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return s(a(m, h, g, _, await c.getEthereumAddress())), y;
|
|
50
|
+
}, u = async (e, t, n, r, i = !0, a = !1, o) => l(e, t, [n], [r], i, a, o);
|
|
120
51
|
//#endregion
|
|
121
|
-
export {
|
|
52
|
+
export { c as hinkalDeposit, u as hinkalDepositForOther };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../functions/utils/caseInsensitive.utils.cjs`),r=require(`../../error-handling/error-codes.constants.cjs`),
|
|
1
|
+
const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../functions/utils/caseInsensitive.utils.cjs`),r=require(`../../crypto/poseidon.cjs`),i=require(`../../error-handling/error-codes.constants.cjs`),a=require(`../../functions/web3/etherFunctions.cjs`),o=require(`../../functions/utils/addresses.cjs`),s=require(`../../types/external-action.types.cjs`),c=require(`../../types/scheduled-transactions.types.cjs`),l=require(`../../types/transact.types.cjs`);require(`../../types/index.cjs`);const u=require(`../../API/API.cjs`),d=require(`../../functions/utils/token-check.utils.cjs`),f=require(`../../functions/utils/erc20tokenFunctions.cjs`),p=require(`../../functions/pre-transaction/constructAdminData.cjs`),m=require(`../AccountActions/AccountActions.cjs`),h=require(`../../functions/pre-transaction/getFeeStructure.cjs`),g=require(`../../functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs`),_=require(`../../functions/private-wallet/emporium.helpers.cjs`),v=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),y=require(`./hinkalTransact.cjs`),b=require(`../../constants/addresses.constants.cjs`),x=require(`../../API/deposit-and-withdraw-status-calls.cjs`),S=require(`./hinkalDepositOnChainUtxos.cjs`),C=require(`../../functions/utils/convertEmporiumOpToCallInfo.cjs`),w=require(`../../functions/utils/fees.utils.cjs`);require(`../../functions/utils/index.cjs`),require(`../../functions/index.cjs`);var T=async(o,d,f,h,g,S,C,w,T,E,D)=>{if(h.length===0)throw Error(`No recipients to bridge`);let O=f.erc20TokenAddress,{contractData:k}=e.networkRegistry[d],{emporiumAddress:A}=k;if(!A)throw Error(`No Emporium Address`);let j=b.SWAP_ROUTER_ADDRESSES[s.ExternalActionId.Lifi][d];if(!j)throw Error(`LIFI not configured for chain ${d}`);let M=await o.getRandomRelay(d);if(!M)throw Error(i.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let N=await o.getEthereumAddressByChain(d),P=o.generateProofRemotely,F=P?5:1,I=[];for(let i=0;i<h.length;i+=F){let c=h.slice(i,i+F),f=await Promise.all(c.map(async({utxo:i,nativeUtxo:c,bridgeAmount:f,quote:h,temporarySubAccount:v,recipientAddress:b,destinationChainId:x,destinationTokenAddress:C})=>{await u.API.addTemporaryWalletNonce(d,S,v.index);let w=n.caseInsensitiveEqual(O,t.zeroAddress),T=h.nativeFee>0n&&!w,D=[O],k=[-i.amount],F=[!1],I=[[i]];T&&c&&(D.push(t.zeroAddress),k.push(-c.amount),F.push(!1),I.push([c]));let L=_.createLifiBridgeOps(o,d,v.ethAddress,j,O,i.amount,f,h),R=p.constructAdminData(E,d,D,[-i.amount],N),[z,B]=await Promise.all([(async()=>{let n=a.randomBigInt(31),i=P?await _.encodeEmporiumMetadata(d,A,v.privateKey,L,r.poseidonFunction(n),m.AccountActions.getSignerAddressFromPrivateKey(e.getOnchainChainId(d),v.privateKey)):void 0;return y.hinkalTransact(o,{chainId:d,erc20Addresses:D,amountChanges:k,externalAddress:A,externalActionId:s.ExternalActionId.Emporium,externalActionMetadata:i,onChainCreation:F,feeStructure:g,relay:M??t.zeroAddress,messageSeed:n,inputUtxos:I,useBlockedUtxos:!0,subAccountPrivateKey:v.privateKey,emporiumOps:L,submit:{mode:l.SubmitMode.ProofOnly}})})(),_.getAuthorizationDataIfNeeded(d,v.privateKey)]),{zkCallData:V,circomData:H,dimData:U,commitmentValidationData:W,tronProofSignature:G}=z;return{zkCallData:V,dimData:U,circomData:H,commitmentValidationData:W,authorizationData:B,recipientAddress:b,adminData:R,tronProofSignature:G,destinationChainId:x,destinationTokenAddress:C,destinationTokenAmount:h.expectedAmount.toString()}}));I.push(...f)}await x.safeUpdateDepositAndWithdrawStatus({id:C,chainId:d,hashedEthereumAddress:S,phase:c.DepositAndWithdrawPhase.BEFORE_SCHEDULE_WITHDRAW});let L=await v.transactCallRelayerBatch(d,I,S,w,T,D);return await x.safeUpdateDepositAndWithdrawStatus({id:C,chainId:d,hashedEthereumAddress:S,phase:c.DepositAndWithdrawPhase.AFTER_SCHEDULE_WITHDRAW,scheduleId:L}),L},E=async(e,r,i,a,c,l,u,p,m=!0)=>{let v=r.erc20TokenAddress,y=d.validateAndGetChainId([r]),x=p?o.hashString(p):void 0,E=o.hashEthereumAddress(await e.getEthereumAddressByChain(y)),D=b.SWAP_ROUTER_ADDRESSES[s.ExternalActionId.Lifi][y];if(!D)throw Error(`LIFI router not configured`);let O,k=n.caseInsensitiveEqual(v,t.zeroAddress);if(c)O=c;else{let n=i[0],r=k?n.bridgeAmount+n.quote.nativeFee:n.bridgeAmount,a=_.createLifiBridgeOps(e,y,n.temporarySubAccount.ethAddress,D,v,r,n.bridgeAmount,n.quote).map(e=>C.convertEmporiumOpToCallInfo(e,n.temporarySubAccount.ethAddress,y));O=await h.getFeeStructure(y,v,[v],s.ExternalActionId.Emporium,a,t.PAY_SEND_VARIABLE_RATE)}let A={feeToken:O.feeToken,flatFee:0n,variableRate:0n},j=i.reduce((e,t)=>e+t.quote.nativeFee,0n)>0n&&!n.caseInsensitiveEqual(v,t.zeroAddress),M=i.map(e=>w.calculateGrossAmountWithFee(k?e.bridgeAmount+e.quote.nativeFee:e.bridgeAmount,O)),N=i.map(e=>e.recipientAddress),{userDepositedUtxos:P,statusId:F,depositTxHash:I}=await S.hinkalDepositOnChainUtxos(e,y,r,M,N,A,E,m),L=[];if(j){let n=await f.getErc20TokenFromAPI(y,t.zeroAddress);if(!n)throw Error(`No native token`);let{userDepositedUtxos:r}=await S.hinkalDepositOnChainUtxos(e,y,n,i.map(e=>w.calculateGrossAmountWithFee(e.quote.nativeFee,{feeToken:O.feeToken,flatFee:0n,variableRate:O.variableRate})),N,A,E,m);L=r}return await g.waitForDepositedUtxosInMerkleTree(e,y,[...P,...L]),{depositTxHash:I,scheduleId:await T(e,y,r,i.map((e,t)=>({...e,utxo:P[t].utxo,nativeUtxo:j?L[t]?.utxo:void 0})),O,E,F,a,l,u,x)}};exports.hinkalDepositAndBridge=E;
|