@hinkal/common 0.3.6 → 0.3.7
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 +1 -0
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +6 -5
- package/common/src/API/API.mjs +75 -74
- package/common/src/API/admin-calls.cjs +1 -1
- package/common/src/API/admin-calls.d.ts +1 -1
- package/common/src/API/admin-calls.mjs +3 -1
- package/common/src/API/callLifiAPI.d.ts +1 -0
- package/common/src/API/callNearIntentsAPI.cjs +1 -1
- package/common/src/API/callNearIntentsAPI.mjs +2 -2
- package/common/src/API/callRelayer.cjs +1 -1
- package/common/src/API/callRelayer.d.ts +32 -1
- package/common/src/API/callRelayer.mjs +7 -1
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +16 -16
- package/common/src/API/enclaveUtxoCalls.mjs +3 -3
- package/common/src/API/evm-rpc-fallback.cjs +1 -0
- package/common/src/API/evm-rpc-fallback.d.ts +1 -0
- package/common/src/API/evm-rpc-fallback.mjs +17 -0
- package/common/src/API/evm-token-assets.cjs +1 -0
- package/common/src/API/evm-token-assets.d.ts +8 -0
- package/common/src/API/evm-token-assets.mjs +20 -0
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +1 -0
- package/common/src/API/index.mjs +1 -0
- package/common/src/API/route-config.cjs +1 -0
- package/common/src/API/route-config.d.ts +1 -0
- package/common/src/API/route-config.mjs +26 -0
- package/common/src/API/solana-nft-assets.cjs +1 -0
- package/common/src/API/solana-nft-assets.d.ts +1 -0
- package/common/src/API/solana-nft-assets.mjs +11 -0
- package/common/src/API/solana-priority-fee.cjs +1 -0
- package/common/src/API/solana-priority-fee.d.ts +3 -0
- package/common/src/API/solana-priority-fee.mjs +20 -0
- package/common/src/API/solana-rpc-fallback.cjs +1 -0
- package/common/src/API/solana-rpc-fallback.d.ts +1 -0
- package/common/src/API/solana-rpc-fallback.mjs +13 -0
- package/common/src/API/temporaryWalletCalls.cjs +1 -1
- package/common/src/API/temporaryWalletCalls.d.ts +0 -4
- package/common/src/API/temporaryWalletCalls.mjs +1 -5
- package/common/src/constants/balance.constants.d.ts +2 -0
- package/common/src/constants/bridging.constants.d.ts +1 -0
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +0 -3
- package/common/src/constants/chains.constants.mjs +33 -54
- package/common/src/constants/coingecko.constants.cjs +1 -1
- 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 +1 -0
- package/common/src/constants/contracts.constants.mjs +19 -15
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-base.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +3 -2
- package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +7 -6
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +3 -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 +3 -2
- 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 +18 -1
- 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/okx.constants.d.ts +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -2
- package/common/src/constants/protocol.constants.d.ts +4 -1
- package/common/src/constants/protocol.constants.mjs +3 -8
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +7 -2
- package/common/src/constants/server.constants.mjs +8 -3
- package/common/src/constants/vite.constants.cjs +1 -1
- package/common/src/constants/vite.constants.mjs +5 -23
- package/common/src/data-structures/ApprovalDBs/EventsPublicApprovalsDB.d.ts +1 -2
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.d.ts +4 -4
- package/common/src/data-structures/Hinkal/Hinkal.mjs +39 -39
- package/common/src/data-structures/Hinkal/IHinkal.d.ts +4 -4
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +11 -9
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.d.ts +2 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +81 -90
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +3 -5
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +100 -104
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +86 -93
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.d.ts +20 -7
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +51 -39
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +2 -2
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +15 -13
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +3 -5
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +88 -121
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.mjs +1 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +24 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +77 -58
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +1 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredProxySend.d.ts +5 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.d.ts +8 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaSponsoredShield.mjs +31 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransact.mjs +44 -42
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +29 -24
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +27 -24
- package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransact.mjs +73 -56
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +21 -18
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +19 -18
- package/common/src/data-structures/Hinkal/index.d.ts +2 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +2 -2
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.d.ts +0 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +55 -119
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +11 -61
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.d.ts +2 -0
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +41 -27
- package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +1 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +3 -0
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +1 -4
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.mjs +9 -6
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +2 -3
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +1 -0
- package/common/src/functions/pre-transaction/index.mjs +1 -1
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.cjs +1 -1
- package/common/src/functions/pre-transaction/merge-with-fee-structure-emporium.mjs +2 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.cjs +2 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.d.ts +5 -2
- package/common/src/functions/pre-transaction/sendV0Transaction.mjs +4 -4
- package/common/src/functions/pre-transaction/solanaTransfer.utils.cjs +1 -1
- package/common/src/functions/pre-transaction/solanaTransfer.utils.mjs +16 -15
- package/common/src/functions/pre-transaction/speculativeUtxo.cjs +1 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.d.ts +9 -0
- package/common/src/functions/pre-transaction/speculativeUtxo.mjs +19 -0
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.d.ts +9 -2
- package/common/src/functions/private-wallet/emporium.helpers.mjs +93 -74
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.d.ts +1 -0
- package/common/src/functions/snarkjs/common.snarkjs.mjs +36 -32
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +48 -0
- package/common/src/functions/snarkjs/constant.mjs +48 -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 +75 -71
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +27 -27
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -1
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +8 -3
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.mjs +10 -21
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.d.ts +2 -2
- package/common/src/functions/snarkjs/getMerkleTreeSiblingsAndRootHashes.mjs +3 -3
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +4 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +27 -18
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.mjs +19 -12
- package/common/src/functions/utils/bridge-arrival.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.d.ts +1 -0
- package/common/src/functions/utils/bridge-arrival.utils.mjs +15 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.cjs +1 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.d.ts +19 -0
- package/common/src/functions/utils/bridge-claimable-utxo.utils.mjs +24 -0
- package/common/src/functions/utils/bridge-claimable.utils.d.ts +2 -3
- package/common/src/functions/utils/create-provider.cjs +1 -1
- package/common/src/functions/utils/create-provider.d.ts +9 -2
- package/common/src/functions/utils/create-provider.mjs +42 -9
- package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.d.ts +2 -5
- package/common/src/functions/utils/deposit-claimable.utils.mjs +1 -6
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.d.ts +4 -8
- package/common/src/functions/utils/enclave-utxo-storage.mjs +13 -2
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.d.ts +2 -0
- package/common/src/functions/utils/fees.utils.mjs +15 -6
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.d.ts +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +5 -51
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +7 -23
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +6 -0
- package/common/src/functions/utils/index.mjs +10 -4
- package/common/src/functions/utils/nearIntents.utils.cjs +1 -1
- package/common/src/functions/utils/nearIntents.utils.mjs +27 -13
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.d.ts +0 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +35 -22
- package/common/src/functions/utils/recovery-balance.utils.cjs +1 -0
- package/common/src/functions/utils/recovery-balance.utils.d.ts +2 -0
- package/common/src/functions/utils/recovery-balance.utils.mjs +1 -0
- package/common/src/functions/utils/solana-program.utils.cjs +1 -0
- package/common/src/functions/utils/solana-program.utils.d.ts +3 -0
- package/common/src/functions/utils/solana-program.utils.mjs +17 -0
- package/common/src/functions/utils/solana-sponsored.utils.cjs +1 -0
- package/common/src/functions/utils/solana-sponsored.utils.d.ts +22 -0
- package/common/src/functions/utils/solana-sponsored.utils.mjs +30 -0
- package/common/src/functions/utils/solanaMint.utils.cjs +1 -1
- package/common/src/functions/utils/solanaMint.utils.d.ts +7 -0
- package/common/src/functions/utils/solanaMint.utils.mjs +18 -8
- package/common/src/functions/utils/sponsored-shield.utils.cjs +1 -0
- package/common/src/functions/utils/sponsored-shield.utils.d.ts +3 -0
- package/common/src/functions/utils/sponsored-shield.utils.mjs +3 -0
- package/common/src/functions/utils/temp-wallet.utils.cjs +1 -1
- package/common/src/functions/utils/temp-wallet.utils.d.ts +5 -4
- package/common/src/functions/utils/temp-wallet.utils.mjs +35 -14
- package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/transfer-claimable.utils.d.ts +1 -2
- package/common/src/functions/utils/transfer-claimable.utils.mjs +2 -5
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.d.ts +2 -2
- package/common/src/functions/utils/tron.utils.mjs +19 -18
- package/common/src/functions/utils/tronSimulation.utils.cjs +1 -1
- package/common/src/functions/utils/tronSimulation.utils.mjs +4 -6
- package/common/src/functions/utils/tx-confirmation.utils.cjs +1 -1
- package/common/src/functions/utils/tx-confirmation.utils.mjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +15 -25
- package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -1
- package/common/src/functions/web3/functionCalls/submitProof.mjs +6 -6
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +2 -2
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +8 -6
- package/common/src/functions/web3/getContractMetadata.cjs +1 -1
- package/common/src/functions/web3/getContractMetadata.mjs +1 -1
- package/common/src/functions/web3/getPublicAddressBalance.cjs +1 -1
- package/common/src/functions/web3/getPublicAddressBalance.d.ts +1 -2
- package/common/src/functions/web3/getPublicAddressBalance.mjs +6 -5
- package/common/src/functions/web3/index.cjs +1 -1
- package/common/src/functions/web3/index.d.ts +1 -1
- package/common/src/functions/web3/index.mjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.mjs +1 -2
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +35 -38
- package/common/src/types/bridging-tx.types.d.ts +1 -4
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +0 -1
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +9 -7
- 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 +1 -0
- package/common/src/types/external-action.types.mjs +1 -1
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +1 -1
- package/common/src/types/index.mjs +1 -1
- package/common/src/types/pay-activities.types.d.ts +3 -1
- package/common/src/types/remote-tx-build.types.d.ts +23 -0
- package/common/src/types/scheduled-transactions.types.d.ts +4 -12
- package/common/src/types/solana.types.cjs +1 -0
- package/common/src/types/solana.types.d.ts +5 -0
- package/common/src/types/solana.types.mjs +6 -0
- package/common/src/types/temp-wallet.types.d.ts +9 -0
- package/common/src/types/token.types.d.ts +1 -0
- package/common/src/webworker/logError-RKYfeI6h.js +2 -0
- package/common/src/webworker/package.json +20 -20
- 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 +28 -1
- package/common/src/webworker/viteWorkerURL.constant.mjs +27 -13
- package/common/src/webworker/workerProxy-COB7g4Qc.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/package.json +20 -20
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +2 -2
- package/services/Hinkal.mjs +3 -3
- package/types/IHinkal.d.ts +2 -2
- package/assets/snarkjsWorkerLauncher-SrStwJvX.js +0 -1
- package/assets/snarkjsWorkerLogic-DtIjisbE.js +0 -132
- package/assets/utxoWorkerLauncher-CIBeBAML.js +0 -1
- package/assets/utxoWorkerLogic-C8R4GSaf.js +0 -199
- package/assets/zkProofWorkerLauncher-DfwteloJ.js +0 -1
- package/assets/zkProofWorkerLogic-CY9y6rOV.js +0 -199
- package/common/src/API/deposit-and-withdraw-status-calls.cjs +0 -1
- package/common/src/API/deposit-and-withdraw-status-calls.d.ts +0 -21
- package/common/src/API/deposit-and-withdraw-status-calls.mjs +0 -13
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.cjs +0 -1
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.d.ts +0 -8
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.mjs +0 -30
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.cjs +0 -1
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.mjs +0 -31
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +0 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +0 -29
- package/common/src/functions/utils/enum.utils.cjs +0 -1
- package/common/src/functions/utils/enum.utils.mjs +0 -12
- package/common/src/functions/web3/getSolanaPriorityFee.cjs +0 -1
- package/common/src/functions/web3/getSolanaPriorityFee.d.ts +0 -3
- package/common/src/functions/web3/getSolanaPriorityFee.mjs +0 -26
- package/common/src/types/scheduled-transactions.types.cjs +0 -1
- package/common/src/types/scheduled-transactions.types.mjs +0 -6
- package/common/src/webworker/logError-Dex6ch32.js +0 -2
- package/common/src/webworker/workerProxy-BuJUMCQ4.js +0 -1
|
@@ -1,109 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { waitLittle as s } from "../../functions/utils/time.utils.mjs";
|
|
1
|
+
import { isNearIntentsBridgeSource as e, isSolanaLike as t } from "../../constants/chains.constants.mjs";
|
|
2
|
+
import { PAY_SEND_VARIABLE_RATE as n, zeroAddress as r } from "../../constants/protocol.constants.mjs";
|
|
3
|
+
import { caseInsensitiveEqual as i } from "../../functions/utils/caseInsensitive.utils.mjs";
|
|
4
|
+
import { transactionErrorCodes as a } from "../../error-handling/error-codes.constants.mjs";
|
|
5
|
+
import { getAmountInWei as o, randomBigInt as s } from "../../functions/web3/etherFunctions.mjs";
|
|
7
6
|
import { hashEthereumAddress as c } from "../../functions/utils/addresses.mjs";
|
|
8
7
|
import { ExternalActionId as l } from "../../types/external-action.types.mjs";
|
|
9
8
|
import { TemporaryWalletRecoveryDestination as u } from "../../types/token.types.mjs";
|
|
10
9
|
import { API as d } from "../../API/API.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { getErc20TokenFromAPI as f } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
11
|
+
import { AccountActions as p } from "../AccountActions/AccountActions.mjs";
|
|
13
12
|
import { getFeeStructure as m } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
14
13
|
import { createLifiBridgeOps as h, createTransaferEmporiumOpsBatch as g } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
15
14
|
import { SWAP_ROUTER_ADDRESSES as _ } from "../../constants/addresses.constants.mjs";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import "../../
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { getLifiPrice as M } from "../../functions/web3/lifiAPI.mjs";
|
|
15
|
+
import { DEFAULT_BRIDGING_SLIPPAGE_DECIMAL as v, NEAR_BRIDGE_QUOTE_DEADLINE_BUFFER_MS as y } from "../../constants/bridging.constants.mjs";
|
|
16
|
+
import { convertEmporiumOpToCallInfo as b } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
17
|
+
import { calculateModifiedFeeStructure as x, calculateTotalFee as S } from "../../functions/utils/fees.utils.mjs";
|
|
18
|
+
import { storeClaimableKeyInEnclave as C } from "../../functions/utils/enclave-utxo-storage.mjs";
|
|
19
|
+
import { waitForBridgeArrival as w } from "../../functions/utils/bridge-arrival.utils.mjs";
|
|
20
|
+
import { buildTempSubAccountForChain as T, deriveBridgeTempWallets as E } from "../../functions/utils/temp-wallet.utils.mjs";
|
|
21
|
+
import { getNearIntentsQuote as D } from "../../API/callNearIntentsAPI.mjs";
|
|
22
|
+
import { resolveNearAssetId as O } from "../../functions/utils/nearIntents.utils.mjs";
|
|
23
|
+
import { getLifiPrice as k } from "../../functions/web3/lifiAPI.mjs";
|
|
24
|
+
import { hinkalSolanaShieldBridged as A, resolveBridgeRecipient as j } from "../../functions/utils/bridge-claimable-utxo.utils.mjs";
|
|
27
25
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.ts
|
|
28
|
-
var
|
|
29
|
-
let { chainId:
|
|
30
|
-
if (!
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
var M = async (e, t, n, a, m, g, v, y) => {
|
|
27
|
+
let { chainId: b } = t, x = n.chainId, S = t.erc20TokenAddress, C = _[l.Lifi][b];
|
|
28
|
+
if (!C) throw Error(`LIFI not configured for chain ${b}`);
|
|
29
|
+
let w = s(6), { sourceSubAccount: T, destinationSubAccount: D } = E(e, b, x, w), O = p.getAddressFromSubAccount(b, T), A = p.getAddressFromSubAccount(x, D);
|
|
30
|
+
if (!O || !A) throw Error("Missing temp wallet address for LIFI bridge");
|
|
31
|
+
let { lifiDataValue: j, outSwapAmountValue: M, extraNativeTokenFee: N } = await k(t, n, a, m, O, A), P = {
|
|
32
|
+
calldata: j,
|
|
33
|
+
expectedAmount: M,
|
|
34
|
+
nativeFee: N
|
|
35
|
+
}, F = o(t, a), I = Array.from(new Set([b, x])), L = c(await e.getEthereumAddress());
|
|
36
|
+
await Promise.all(I.map((e) => d.addTemporaryWalletNonce(e, L, Number(w), u.Confidential)));
|
|
37
|
+
let R = i(S, r), z = P.nativeFee > 0n && !R, B = R ? F + P.nativeFee : F, V = [t], H = [-B];
|
|
38
|
+
if (z) {
|
|
39
|
+
let e = await f(b, r);
|
|
40
40
|
if (!e) throw Error("Native token not found for bridge fee");
|
|
41
|
-
|
|
41
|
+
V.push(e), H.push(-P.nativeFee);
|
|
42
42
|
}
|
|
43
|
-
let
|
|
43
|
+
let U = h(e, b, O, C, S, B, F, P), W = V.map((e, t) => ({
|
|
44
44
|
token: e,
|
|
45
|
-
amount:
|
|
45
|
+
amount: H[t]
|
|
46
46
|
}));
|
|
47
47
|
return {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
quote: O
|
|
48
|
+
tempSubAccount: D,
|
|
49
|
+
sourceTxHash: await e.actionPrivateWallet(b, V, H, H.map(() => !1), U, W, T, g ?? S, v, void 0, !1, void 0, y, void 0),
|
|
50
|
+
expectedAmount: P.expectedAmount
|
|
52
51
|
};
|
|
53
|
-
},
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, v = T(n);
|
|
75
|
-
}
|
|
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
|
-
if (!n) throw Error("Could not find recipient UTXO in bridge shield tx");
|
|
82
|
-
x = {
|
|
83
|
-
chainId: u,
|
|
84
|
-
senderAddress: await t.getEthereumAddressByChain(u),
|
|
85
|
-
recipientAddress: y.ethAddress,
|
|
86
|
-
claimableSignature: y.signature,
|
|
87
|
-
utxo: n
|
|
88
|
-
};
|
|
89
|
-
}
|
|
52
|
+
}, N = async (e, t, n, r, i, a, l, f) => {
|
|
53
|
+
let m = n.chainId, h = s(6), g = T(e, m, h), _ = p.getAddressFromSubAccount(m, g);
|
|
54
|
+
if (!_) throw Error("Missing temp wallet address for NEAR bridge");
|
|
55
|
+
let v = c(await e.getEthereumAddress());
|
|
56
|
+
await d.addTemporaryWalletNonce(m, v, Number(h), u.Confidential);
|
|
57
|
+
let [b, x] = await Promise.all([O(t.chainId, t.erc20TokenAddress), O(m, n.erc20TokenAddress)]), S = o(t, r), C = new Date(Date.now() + y).toISOString(), { quote: w } = await D({
|
|
58
|
+
dry: !1,
|
|
59
|
+
swapType: "EXACT_INPUT",
|
|
60
|
+
slippageTolerance: Math.round(i * 1e4) || 100,
|
|
61
|
+
originAsset: b,
|
|
62
|
+
depositType: "ORIGIN_CHAIN",
|
|
63
|
+
destinationAsset: x,
|
|
64
|
+
amount: S.toString(),
|
|
65
|
+
recipient: _,
|
|
66
|
+
recipientType: "DESTINATION_CHAIN",
|
|
67
|
+
refundTo: e.userKeys.getNearIntentsAccountId(),
|
|
68
|
+
refundType: "INTENTS",
|
|
69
|
+
deadline: C
|
|
70
|
+
});
|
|
71
|
+
if (!w.depositAddress) throw Error("NEAR Intents quote returned no deposit address");
|
|
72
|
+
let E = await e.withdraw([t], [-S], w.depositAddress, !1, a ?? t.erc20TokenAddress, l, void 0, f);
|
|
90
73
|
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
74
|
+
tempSubAccount: g,
|
|
75
|
+
sourceTxHash: typeof E == "string" ? E : E.hash,
|
|
76
|
+
expectedAmount: BigInt(w.amountOut)
|
|
94
77
|
};
|
|
95
|
-
},
|
|
96
|
-
let
|
|
97
|
-
if (!
|
|
98
|
-
let {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
destTxHash:
|
|
104
|
-
|
|
105
|
-
|
|
78
|
+
}, P = async (e, r, i, o, s) => {
|
|
79
|
+
let c = r.chainId, u = r.erc20TokenAddress, d = p.getAddressFromSubAccount(c, i);
|
|
80
|
+
if (!d) throw Error("Missing temp wallet address for bridge shield");
|
|
81
|
+
let { recipientInfo: f, claimable: h } = j(e, s);
|
|
82
|
+
if (h && await C(await e.getEthereumAddressByChain(c), h.ethAddress, h.keys.getShieldedPrivateKey(), c, h.signature), t(c)) return A(e, r, i, o, f);
|
|
83
|
+
let _ = g(e, c, [u], [o]), v = await x(c, r, o, await m(c, u, [u], l.Emporium, _.map((e) => b(e, d, c)), n)), y = o - S(o, v);
|
|
84
|
+
if (y <= 0n) throw Error(a.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
85
|
+
return {
|
|
86
|
+
destTxHash: await e.proxyToPrivate([r], [y], i, f, v.feeToken, v),
|
|
87
|
+
shieldedAmount: y
|
|
88
|
+
};
|
|
89
|
+
}, F = async (t, n, r, i, a, o = v, s, c, l) => {
|
|
90
|
+
let { tempSubAccount: u, sourceTxHash: d, expectedAmount: f } = e(n.chainId) ? await N(t, n, r, i, o, s, c, l) : await M(t, n, r, i, o, s, c, l), m = p.getAddressFromSubAccount(r.chainId, u);
|
|
91
|
+
if (!m) throw Error("Missing temp wallet address for bridge");
|
|
92
|
+
let { destTxHash: h, shieldedAmount: g } = await P(t, r, u, await w(r.chainId, m, r.erc20TokenAddress, f, o), a);
|
|
93
|
+
return {
|
|
94
|
+
sourceTxHash: d,
|
|
95
|
+
destTxHash: h,
|
|
96
|
+
destinationTokenAmount: g.toString()
|
|
106
97
|
};
|
|
107
98
|
};
|
|
108
99
|
//#endregion
|
|
109
|
-
export {
|
|
100
|
+
export { F as hinkalBridgePrivateToPrivate };
|
|
@@ -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(`../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 _=
|
|
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 _=new r.UserKeys(p),v=_.getShieldedPrivateKey();if(f.nullifyingKey&&BigInt(f.nullifyingKey)!==BigInt(v))throw Error(`Claimable UTXO key mismatch`);let y=u.getRecipientInfo(),b=i.Utxo.createFrom(f,{nullifyingKey:v}),x=m??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;
|
|
@@ -2,4 +2,4 @@ import { ERC20Token } from '../../types/token.types';
|
|
|
2
2
|
import { IHinkal } from './IHinkal';
|
|
3
3
|
import { FeeStructure } from '../../types/hinkal.types';
|
|
4
4
|
import { Utxo } from '../utxo/Utxo';
|
|
5
|
-
export declare const hinkalClaimUtxo: (hinkal: IHinkal, erc20Token: ERC20Token, utxo: Utxo,
|
|
5
|
+
export declare const hinkalClaimUtxo: (hinkal: IHinkal, erc20Token: ERC20Token, utxo: Utxo, claimableSignature: string, feeStructureOverride?: FeeStructure) => Promise<string>;
|
|
@@ -12,11 +12,9 @@ import { hinkalTransact as l } from "./hinkalTransact.mjs";
|
|
|
12
12
|
var u = async (u, d, f, p, m) => {
|
|
13
13
|
let h = s([d]), g = d.erc20TokenAddress;
|
|
14
14
|
if (!t(g, f.erc20TokenAddress)) throw Error("Off-chain UTXO token mismatch");
|
|
15
|
-
let _ =
|
|
16
|
-
if (
|
|
17
|
-
let
|
|
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);
|
|
15
|
+
let _ = new r(p), v = _.getShieldedPrivateKey();
|
|
16
|
+
if (f.nullifyingKey && BigInt(f.nullifyingKey) !== BigInt(v)) throw Error("Claimable UTXO key mismatch");
|
|
17
|
+
let y = u.getRecipientInfo(), b = i.createFrom(f, { nullifyingKey: v }), x = m ?? await c(h, g, [g], a.Transact);
|
|
20
18
|
if (!t(x.feeToken, g)) throw Error("Claim fee token mismatch: fee must be paid from claimed UTXO token");
|
|
21
19
|
let S = x.variableRate > 0n ? x.variableRate : e;
|
|
22
20
|
if (b.amount <= x.flatFee) throw Error(n.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
@@ -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(`../../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/
|
|
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/transact.types.cjs`),l=require(`../../API/API.cjs`),u=require(`../../functions/utils/token-check.utils.cjs`),d=require(`../../functions/utils/erc20tokenFunctions.cjs`),f=require(`../../functions/pre-transaction/constructAdminData.cjs`),p=require(`../AccountActions/AccountActions.cjs`),m=require(`../../functions/pre-transaction/getFeeStructure.cjs`),h=require(`../../functions/pre-transaction/speculativeUtxo.cjs`),g=require(`../../functions/private-wallet/emporium.helpers.cjs`),_=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),v=require(`./hinkalTransact.cjs`),y=require(`../../constants/addresses.constants.cjs`),b=require(`../../functions/utils/convertEmporiumOpToCallInfo.cjs`),x=require(`../../functions/utils/fees.utils.cjs`);require(`../../functions/utils/index.cjs`);const S=require(`./hinkalDepositOnChainUtxos.cjs`);var C=async(o,u,d,m,_,b,x,S)=>{if(m.length===0)throw Error(`No recipients to bridge`);let C=d.erc20TokenAddress,{contractData:w}=e.networkRegistry[u],{emporiumAddress:T}=w;if(!T)throw Error(`No Emporium Address`);let E=y.SWAP_ROUTER_ADDRESSES[s.ExternalActionId.Lifi][u];if(!E)throw Error(`LIFI not configured for chain ${u}`);let D=await o.getRandomRelay(u);if(!D)throw Error(i.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let O=await o.getEthereumAddressByChain(u),k=o.generateProofRemotely,A=k?5:1,j=[];for(let i=0;i<m.length;i+=A){let d=m.slice(i,i+A),y=await Promise.all(d.map(async({utxo:d,nativeUtxo:m,bridgeAmount:y,quote:w,temporarySubAccount:A,recipientAddress:j,destinationChainId:M,destinationTokenAddress:N},P)=>{let F=_[i+P];await l.API.addTemporaryWalletNonce(u,b,A.index);let I=n.caseInsensitiveEqual(C,t.zeroAddress),L=w.nativeFee>0n&&!I,R=[C],z=[-d.amount],B=[!1],V=[[d]];L&&m&&(R.push(t.zeroAddress),z.push(-m.amount),B.push(!1),V.push([m]));let H=g.createLifiBridgeOps(o,u,A.ethAddress,E,C,d.amount,y,w),U=f.constructAdminData(x,u,R,[-d.amount],O),[W,G]=await Promise.all([(async()=>{let n=a.randomBigInt(31),i=k?await g.encodeEmporiumMetadata(u,T,A.privateKey,H,r.poseidonFunction(n),p.AccountActions.getSignerAddressFromPrivateKey(e.getOnchainChainId(u),A.privateKey),F.flatFee):void 0;return v.hinkalTransact(o,{chainId:u,erc20Addresses:R,amountChanges:z,externalAddress:T,externalActionId:s.ExternalActionId.Emporium,externalActionMetadata:i,onChainCreation:B,feeStructure:F,relay:D??t.zeroAddress,messageSeed:n,inputUtxos:V,useBlockedUtxos:!0,speculative:S&&{pendingLeaves:S,inputUtxos:V.map(e=>e.map(h.toSpeculativeUtxo))},subAccountPrivateKey:A.privateKey,emporiumOps:H,submit:{mode:c.SubmitMode.ProofOnly}})})(),g.getAuthorizationDataIfNeeded(u,A.privateKey)]),{zkCallData:K,circomData:q,dimData:J,commitmentValidationData:Y,tronProofSignature:X}=W;return{zkCallData:K,dimData:J,circomData:q,commitmentValidationData:Y,authorizationData:G,recipientAddress:j,adminData:U,tronProofSignature:X,destinationChainId:M,destinationTokenAddress:N,destinationTokenAmount:w.expectedAmount.toString()}}));j.push(...y)}return j},w=e=>e.map(e=>e.quote.nativeFee),T=async(e,n,r,i)=>{let{chainId:a,hashedEthereumAddress:o,feeStructures:s,mainTokenAmounts:c}=i,{needsNativeDeposit:l,txCompletionTime:u,ref:f,action:p,hashedDashboardAccountId:m,preEstimateGas:h}=i,g=[n],v=[c];if(l){let e=await d.getErc20TokenFromAPI(a,t.zeroAddress);if(!e)throw Error(`No native token`);g.push(e),v.push(w(r))}let y=await S.prepareDepositOnChainUtxos(e,a,g,v),{depositedUtxos:b,pendingLeaves:x}=y,[T,E=[]]=b,D=r.map((e,t)=>({...e,utxo:T[t],nativeUtxo:l?E[t]:void 0})),[O,k]=await Promise.all([S.submitDepositOnChainUtxos(e,y,h),C(e,a,n,D,s,o,p,x)]);return{depositTxHash:O,scheduleId:await _.transactCallRelayerBatch(a,k,o,u,f,m,O)}},E=async(e,r,i,a,c,l,d,f,p=!0)=>{if(i.length===0)throw Error(`No recipients to bridge`);let h=r.erc20TokenAddress,_=u.validateAndGetChainId([r]),v=await e.getEthereumAddressByChain(_),S=y.SWAP_ROUTER_ADDRESSES[s.ExternalActionId.Lifi][_];if(!S)throw Error(`LIFI router not configured`);let C=n.caseInsensitiveEqual(h,t.zeroAddress),w;if(c)w=c;else{let n=i[0],r=C?n.bridgeAmount+n.quote.nativeFee:n.bridgeAmount,a=g.createLifiBridgeOps(e,_,n.temporarySubAccount.ethAddress,S,h,r,n.bridgeAmount,n.quote).map(e=>b.convertEmporiumOpToCallInfo(e,n.temporarySubAccount.ethAddress,_));w=await m.getFeeStructure(_,h,[h],s.ExternalActionId.Emporium,a,t.PAY_SEND_VARIABLE_RATE)}let E=i.reduce((e,t)=>e+t.quote.nativeFee,0n),D=i.map(e=>C?e.bridgeAmount+e.quote.nativeFee:e.bridgeAmount),O=await Promise.all(D.map(e=>x.calculateModifiedFeeStructure(_,r,e,w)));return T(e,r,i,{chainId:_,ethereumAddress:v,hashedEthereumAddress:o.hashEthereumAddress(v),feeStructures:O,mainTokenAmounts:D.map((e,t)=>e+O[t].flatFee),needsNativeDeposit:E>0n&&!C,txCompletionTime:a,ref:l,action:d,hashedDashboardAccountId:f?o.hashString(f):void 0,preEstimateGas:p})};exports.hinkalDepositAndBridge=E;
|
|
@@ -6,123 +6,119 @@ import { transactionErrorCodes as o } from "../../error-handling/error-codes.con
|
|
|
6
6
|
import { randomBigInt as s } from "../../functions/web3/etherFunctions.mjs";
|
|
7
7
|
import { hashEthereumAddress as c, hashString as l } from "../../functions/utils/addresses.mjs";
|
|
8
8
|
import { ExternalActionId as u } from "../../types/external-action.types.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import "../../
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { safeUpdateDepositAndWithdrawStatus as E } from "../../API/deposit-and-withdraw-status-calls.mjs";
|
|
24
|
-
import { hinkalDepositOnChainUtxos as D } from "./hinkalDepositOnChainUtxos.mjs";
|
|
25
|
-
import { convertEmporiumOpToCallInfo as O } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
26
|
-
import { calculateGrossAmountWithFee as k } from "../../functions/utils/fees.utils.mjs";
|
|
9
|
+
import { SubmitMode as d } from "../../types/transact.types.mjs";
|
|
10
|
+
import { API as f } from "../../API/API.mjs";
|
|
11
|
+
import { validateAndGetChainId as p } from "../../functions/utils/token-check.utils.mjs";
|
|
12
|
+
import { getErc20TokenFromAPI as m } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
13
|
+
import { constructAdminData as h } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
14
|
+
import { AccountActions as g } from "../AccountActions/AccountActions.mjs";
|
|
15
|
+
import { getFeeStructure as _ } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
16
|
+
import { toSpeculativeUtxo as v } from "../../functions/pre-transaction/speculativeUtxo.mjs";
|
|
17
|
+
import { createLifiBridgeOps as y, encodeEmporiumMetadata as b, getAuthorizationDataIfNeeded as x } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
18
|
+
import { transactCallRelayerBatch as S } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
19
|
+
import { hinkalTransact as C } from "./hinkalTransact.mjs";
|
|
20
|
+
import { SWAP_ROUTER_ADDRESSES as w } from "../../constants/addresses.constants.mjs";
|
|
21
|
+
import { convertEmporiumOpToCallInfo as T } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
|
|
22
|
+
import { calculateModifiedFeeStructure as E } from "../../functions/utils/fees.utils.mjs";
|
|
27
23
|
import "../../functions/utils/index.mjs";
|
|
28
|
-
import "
|
|
24
|
+
import { prepareDepositOnChainUtxos as D, submitDepositOnChainUtxos as O } from "./hinkalDepositOnChainUtxos.mjs";
|
|
29
25
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalDepositAndBridge.ts
|
|
30
|
-
var
|
|
31
|
-
if (
|
|
32
|
-
let
|
|
33
|
-
if (!
|
|
34
|
-
let
|
|
35
|
-
if (!
|
|
36
|
-
let
|
|
37
|
-
if (!
|
|
38
|
-
let
|
|
39
|
-
for (let t = 0; t <
|
|
40
|
-
let o =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
var k = async (n, c, l, p, m, _, S, T) => {
|
|
27
|
+
if (p.length === 0) throw Error("No recipients to bridge");
|
|
28
|
+
let E = l.erc20TokenAddress, { contractData: D } = t[c], { emporiumAddress: O } = D;
|
|
29
|
+
if (!O) throw Error("No Emporium Address");
|
|
30
|
+
let k = w[u.Lifi][c];
|
|
31
|
+
if (!k) throw Error(`LIFI not configured for chain ${c}`);
|
|
32
|
+
let A = await n.getRandomRelay(c);
|
|
33
|
+
if (!A) throw Error(o.RELAYER_NOT_AVAILABLE);
|
|
34
|
+
let j = await n.getEthereumAddressByChain(c), M = n.generateProofRemotely, N = M ? 5 : 1, P = [];
|
|
35
|
+
for (let t = 0; t < p.length; t += N) {
|
|
36
|
+
let o = p.slice(t, t + N), l = await Promise.all(o.map(async ({ utxo: o, nativeUtxo: l, bridgeAmount: p, quote: w, temporarySubAccount: D, recipientAddress: N, destinationChainId: P, destinationTokenAddress: F }, I) => {
|
|
37
|
+
let L = m[t + I];
|
|
38
|
+
await f.addTemporaryWalletNonce(c, _, D.index);
|
|
39
|
+
let R = i(E, r), z = w.nativeFee > 0n && !R, B = [E], V = [-o.amount], H = [!1], U = [[o]];
|
|
40
|
+
z && l && (B.push(r), V.push(-l.amount), H.push(!1), U.push([l]));
|
|
41
|
+
let W = y(n, c, D.ethAddress, k, E, o.amount, p, w), G = h(S, c, B, [-o.amount], j), [K, q] = await Promise.all([(async () => {
|
|
42
|
+
let t = s(31), i = M ? await b(c, O, D.privateKey, W, a(t), g.getSignerAddressFromPrivateKey(e(c), D.privateKey), L.flatFee) : void 0;
|
|
43
|
+
return C(n, {
|
|
47
44
|
chainId: c,
|
|
48
|
-
erc20Addresses:
|
|
49
|
-
amountChanges:
|
|
50
|
-
externalAddress:
|
|
45
|
+
erc20Addresses: B,
|
|
46
|
+
amountChanges: V,
|
|
47
|
+
externalAddress: O,
|
|
51
48
|
externalActionId: u.Emporium,
|
|
52
49
|
externalActionMetadata: i,
|
|
53
|
-
onChainCreation:
|
|
54
|
-
feeStructure:
|
|
55
|
-
relay:
|
|
50
|
+
onChainCreation: H,
|
|
51
|
+
feeStructure: L,
|
|
52
|
+
relay: A ?? r,
|
|
56
53
|
messageSeed: t,
|
|
57
|
-
inputUtxos:
|
|
54
|
+
inputUtxos: U,
|
|
58
55
|
useBlockedUtxos: !0,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
speculative: T && {
|
|
57
|
+
pendingLeaves: T,
|
|
58
|
+
inputUtxos: U.map((e) => e.map(v))
|
|
59
|
+
},
|
|
60
|
+
subAccountPrivateKey: D.privateKey,
|
|
61
|
+
emporiumOps: W,
|
|
62
|
+
submit: { mode: d.ProofOnly }
|
|
62
63
|
});
|
|
63
|
-
})(),
|
|
64
|
+
})(), x(c, D.privateKey)]), { zkCallData: J, circomData: Y, dimData: X, commitmentValidationData: Z, tronProofSignature: Q } = K;
|
|
64
65
|
return {
|
|
65
|
-
zkCallData:
|
|
66
|
-
dimData:
|
|
67
|
-
circomData:
|
|
68
|
-
commitmentValidationData:
|
|
69
|
-
authorizationData:
|
|
70
|
-
recipientAddress:
|
|
71
|
-
adminData:
|
|
72
|
-
tronProofSignature:
|
|
73
|
-
destinationChainId:
|
|
74
|
-
destinationTokenAddress:
|
|
75
|
-
destinationTokenAmount:
|
|
66
|
+
zkCallData: J,
|
|
67
|
+
dimData: X,
|
|
68
|
+
circomData: Y,
|
|
69
|
+
commitmentValidationData: Z,
|
|
70
|
+
authorizationData: q,
|
|
71
|
+
recipientAddress: N,
|
|
72
|
+
adminData: G,
|
|
73
|
+
tronProofSignature: Q,
|
|
74
|
+
destinationChainId: P,
|
|
75
|
+
destinationTokenAddress: F,
|
|
76
|
+
destinationTokenAmount: w.expectedAmount.toString()
|
|
76
77
|
};
|
|
77
78
|
}));
|
|
78
|
-
|
|
79
|
+
P.push(...l);
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return await E({
|
|
88
|
-
id: y,
|
|
89
|
-
chainId: c,
|
|
90
|
-
hashedEthereumAddress: v,
|
|
91
|
-
phase: d.AFTER_SCHEDULE_WITHDRAW,
|
|
92
|
-
scheduleId: B
|
|
93
|
-
}), B;
|
|
94
|
-
}, j = async (e, t, a, o, s, d, f, p, g = !0) => {
|
|
95
|
-
let _ = t.erc20TokenAddress, x = m([t]), S = p ? l(p) : void 0, C = c(await e.getEthereumAddressByChain(x)), w = T[u.Lifi][x];
|
|
96
|
-
if (!w) throw Error("LIFI router not configured");
|
|
97
|
-
let E, j = i(_, r);
|
|
98
|
-
if (s) E = s;
|
|
99
|
-
else {
|
|
100
|
-
let t = a[0], r = j ? t.bridgeAmount + t.quote.nativeFee : t.bridgeAmount, i = b(e, x, t.temporarySubAccount.ethAddress, w, _, r, t.bridgeAmount, t.quote).map((e) => O(e, t.temporarySubAccount.ethAddress, x));
|
|
101
|
-
E = await v(x, _, [_], u.Emporium, i, n);
|
|
102
|
-
}
|
|
103
|
-
let M = {
|
|
104
|
-
feeToken: E.feeToken,
|
|
105
|
-
flatFee: 0n,
|
|
106
|
-
variableRate: 0n
|
|
107
|
-
}, N = a.reduce((e, t) => e + t.quote.nativeFee, 0n) > 0n && !i(_, r), P = a.map((e) => k(j ? e.bridgeAmount + e.quote.nativeFee : e.bridgeAmount, E)), F = a.map((e) => e.recipientAddress), { userDepositedUtxos: I, statusId: L, depositTxHash: R } = await D(e, x, t, P, F, M, C, g), z = [];
|
|
108
|
-
if (N) {
|
|
109
|
-
let t = await h(x, r);
|
|
110
|
-
if (!t) throw Error("No native token");
|
|
111
|
-
let { userDepositedUtxos: n } = await D(e, x, t, a.map((e) => k(e.quote.nativeFee, {
|
|
112
|
-
feeToken: E.feeToken,
|
|
113
|
-
flatFee: 0n,
|
|
114
|
-
variableRate: E.variableRate
|
|
115
|
-
})), F, M, C, g);
|
|
116
|
-
z = n;
|
|
81
|
+
return P;
|
|
82
|
+
}, A = (e) => e.map((e) => e.quote.nativeFee), j = async (e, t, n, i) => {
|
|
83
|
+
let { chainId: a, hashedEthereumAddress: o, feeStructures: s, mainTokenAmounts: c } = i, { needsNativeDeposit: l, txCompletionTime: u, ref: d, action: f, hashedDashboardAccountId: p, preEstimateGas: h } = i, g = [t], _ = [c];
|
|
84
|
+
if (l) {
|
|
85
|
+
let e = await m(a, r);
|
|
86
|
+
if (!e) throw Error("No native token");
|
|
87
|
+
g.push(e), _.push(A(n));
|
|
117
88
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
89
|
+
let v = await D(e, a, g, _), { depositedUtxos: y, pendingLeaves: b } = v, [x, C = []] = y, w = n.map((e, t) => ({
|
|
90
|
+
...e,
|
|
91
|
+
utxo: x[t],
|
|
92
|
+
nativeUtxo: l ? C[t] : void 0
|
|
93
|
+
})), [T, E] = await Promise.all([O(e, v, h), k(e, a, t, w, s, o, f, b)]);
|
|
94
|
+
return {
|
|
95
|
+
depositTxHash: T,
|
|
96
|
+
scheduleId: await S(a, E, o, u, d, p, T)
|
|
125
97
|
};
|
|
98
|
+
}, M = async (e, t, a, o, s, d, f, m, h = !0) => {
|
|
99
|
+
if (a.length === 0) throw Error("No recipients to bridge");
|
|
100
|
+
let g = t.erc20TokenAddress, v = p([t]), b = await e.getEthereumAddressByChain(v), x = w[u.Lifi][v];
|
|
101
|
+
if (!x) throw Error("LIFI router not configured");
|
|
102
|
+
let S = i(g, r), C;
|
|
103
|
+
if (s) C = s;
|
|
104
|
+
else {
|
|
105
|
+
let t = a[0], r = S ? t.bridgeAmount + t.quote.nativeFee : t.bridgeAmount, i = y(e, v, t.temporarySubAccount.ethAddress, x, g, r, t.bridgeAmount, t.quote).map((e) => T(e, t.temporarySubAccount.ethAddress, v));
|
|
106
|
+
C = await _(v, g, [g], u.Emporium, i, n);
|
|
107
|
+
}
|
|
108
|
+
let D = a.reduce((e, t) => e + t.quote.nativeFee, 0n), O = a.map((e) => S ? e.bridgeAmount + e.quote.nativeFee : e.bridgeAmount), k = await Promise.all(O.map((e) => E(v, t, e, C)));
|
|
109
|
+
return j(e, t, a, {
|
|
110
|
+
chainId: v,
|
|
111
|
+
ethereumAddress: b,
|
|
112
|
+
hashedEthereumAddress: c(b),
|
|
113
|
+
feeStructures: k,
|
|
114
|
+
mainTokenAmounts: O.map((e, t) => e + k[t].flatFee),
|
|
115
|
+
needsNativeDeposit: D > 0n && !S,
|
|
116
|
+
txCompletionTime: o,
|
|
117
|
+
ref: d,
|
|
118
|
+
action: f,
|
|
119
|
+
hashedDashboardAccountId: m ? l(m) : void 0,
|
|
120
|
+
preEstimateGas: h
|
|
121
|
+
});
|
|
126
122
|
};
|
|
127
123
|
//#endregion
|
|
128
|
-
export {
|
|
124
|
+
export { M as hinkalDepositAndBridge };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);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`),i=require(`../utxo/Utxo.cjs`),a=require(`../../functions/utils/addresses.cjs`),o=require(`../../functions/utils/tron.utils.cjs`),s=require(`../../types/external-action.types.cjs`),c=require(`../../types/
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);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`),i=require(`../utxo/Utxo.cjs`),a=require(`../../functions/utils/addresses.cjs`),o=require(`../../functions/utils/tron.utils.cjs`),s=require(`../../types/external-action.types.cjs`),c=require(`../../types/transact.types.cjs`),l=require(`../../functions/utils/token-check.utils.cjs`),u=require(`../crypto-keys/encryptDecryptUtxo.cjs`),d=require(`../../functions/pre-transaction/constructAdminData.cjs`),f=require(`../../functions/pre-transaction/getFeeStructure.cjs`),p=require(`../../functions/pre-transaction/speculativeUtxo.cjs`),m=require(`../../functions/web3/functionCalls/transactCallDirectTron.cjs`),h=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),g=require(`./hinkalTransact.cjs`);require(`../../functions/index.cjs`);const _=require(`./hinkalDepositOnChainUtxos.cjs`);let v=require(`ethers`);var y=async(e,a,s,l,u,f,m,h)=>{if(l.length===0)throw Error(`userDepositedUtxos must not be empty`);let _=s.erc20TokenAddress,[v,y]=await Promise.all([e.getRandomRelay(a),e.getEthereumAddressByChain(a)]);if(!v)throw Error(r.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let b=e.generateProofRemotely?5:1,x=[],S=o.addressToHexFormat(y);for(let r=0;r<l.length;r+=b){let s=l.slice(r,r+b),y=await Promise.all(s.map(async({recipientAddress:s,utxo:l},y)=>{let b=r+y,x=o.addressToHexFormat(s),C=n.caseInsensitiveEqual(l.erc20TokenAddress,_)?l:i.Utxo.createFrom(l,{erc20TokenAddress:_}),w=d.constructAdminData(f,a,[_],[-l.amount],S),{zkCallData:T,circomData:E,dimData:D,commitmentValidationData:O,tronProofSignature:k}=await g.hinkalTransact(e,{chainId:a,erc20Addresses:[_],amountChanges:[-l.amount],externalAddress:x,feeStructure:u,relay:v??t.zeroAddress,inputUtxos:[[C]],useBlockedUtxos:!0,speculative:h&&{pendingLeaves:h,inputUtxos:[[p.toSpeculativeUtxo(C)]]},submit:{mode:c.SubmitMode.ProofOnly},skipLock:!0});return{zkCallData:T,dimData:D,circomData:E,commitmentValidationData:O,adminData:w,recipientAddress:s,tronProofSignature:k,destinationChainId:m?.chainId,destinationTokenAddress:m?.tokenAddress,destinationTokenAmount:m?.tokenAmounts?.[b]}}));x.push(...y)}return x},b=async(e,t,n,r,i)=>{let{chainId:a,hashedEthereumAddress:o,feeStructure:s,action:c,destination:l}=i,{txCompletionTime:u,ref:d,hashedDashboardAccountId:f,preEstimateGas:p}=i,m=n.map(e=>e+s.flatFee),g=await _.prepareDepositOnChainUtxos(e,a,[t],[m]),{depositedUtxos:v,pendingLeaves:b}=g,x=v[0].map((e,t)=>({recipientAddress:r[t],utxo:e})),[S,C]=await Promise.all([_.submitDepositOnChainUtxos(e,g,p),y(e,a,t,x,s,c,l,b)]);return{depositTxHash:S,scheduleId:await h.transactCallRelayerBatch(a,C,o,u,d,f,S)}},x=async(e,t,n,r,i)=>{let{chainId:a,ethereumAddress:s,hashedEthereumAddress:l,feeStructure:d,action:f,destination:p}=i,{txCompletionTime:_,ref:b,hashedDashboardAccountId:x,preEstimateGas:S}=i,C=n.map(e=>e+d.flatFee),w=C.reduce((e,t)=>e+t,0n),T=await g.hinkalTransact(e,{chainId:a,erc20Addresses:[t.erc20TokenAddress],amountChanges:[w],externalAddress:s,selfOutputAmounts:C,createBlockedUtxos:!0,forceEmptyUtxos:!0,submit:{mode:c.SubmitMode.ProofOnly}}),E=T.circomData.encryptedOutputs?.[0];if(!E||E.length!==C.length)throw Error(`Deposit proof is missing encryptedOutputs for the deposited UTXOs`);let D=E.map((t,n)=>({recipientAddress:r[n],utxo:u.decryptUtxo(v.ethers.getBytes(t),e.userKeys)})),O=T.circomData.outCommitments.flat().map(e=>BigInt(e)).filter(e=>e!==0n).map(e=>e.toString()),[k,A]=await Promise.all([(async()=>{o.swapTronBCoordinate(T.zkCallData);let n=await m.transactCallDirectTron(e,a,w,t,T.zkCallData,T.circomData,T.dimData,void 0,void 0,S,T.tronProofSignature);if(!n)throw Error(`Deposit transaction hash not found`);return n})(),y(e,a,t,D,d,f,p,O)]);return{depositTxHash:k,scheduleId:await h.transactCallRelayerBatch(a,A,l,_,b,x,k)}},S=async(t,n,r,i,c,u,d,p,m,h=!0,g)=>{let _=l.validateAndGetChainId([n]),v=n.erc20TokenAddress,y=o.addressToHexFormat(await t.getEthereumAddressByChain(_)),S={chainId:_,ethereumAddress:y,hashedEthereumAddress:a.hashEthereumAddress(y),feeStructure:u??await f.getFeeStructure(_,v,[v],s.ExternalActionId.Transact,[],10n),txCompletionTime:c,ref:d,action:p,hashedDashboardAccountId:m?a.hashString(m):void 0,preEstimateGas:h,destination:g};if(!e.isTronLike(_))return b(t,n,r,i,S);if(r.length>4)throw Error(`Tron supports at most 4 recipients per deposit - no circuit emits more outputs`);return x(t,n,r,i,S)};exports.hinkalDepositAndWithdraw=S;
|
|
@@ -2,6 +2,6 @@ import { IHinkal } from './IHinkal';
|
|
|
2
2
|
import { AdminTransactionType, DepositAndSendExtendedResult, ERC20Token, RecipientUtxo } from '../../types';
|
|
3
3
|
import { DestinationMetadata } from '../../types/bridging-tx.types';
|
|
4
4
|
import { FeeStructure } from '../../types/hinkal.types';
|
|
5
|
-
export declare const hinkalWithdrawBatch: (hinkal: IHinkal, chainId: number, erc20Token: ERC20Token, userDepositedUtxos: RecipientUtxo[], feeStructure: FeeStructure, hashedEthereumAddress: string,
|
|
5
|
+
export declare const hinkalWithdrawBatch: (hinkal: IHinkal, chainId: number, erc20Token: ERC20Token, userDepositedUtxos: RecipientUtxo[], feeStructure: FeeStructure, hashedEthereumAddress: string, txCompletionTime?: number, ref?: string, action?: AdminTransactionType, hashedDashboardAccountId?: string, destination?: DestinationMetadata) => Promise<string>;
|
|
6
6
|
export declare const hinkalDepositAndWithdraw: (hinkal: IHinkal, erc20Token: ERC20Token, recipientAmounts: bigint[], recipientAddresses: string[], txCompletionTime?: number, feeStructureOverride?: FeeStructure, // Should be passed fee for only one withdraw transaction, multiplication happening in this function
|
|
7
7
|
ref?: string, action?: AdminTransactionType, dashboardAccountId?: string, preEstimateGas?: boolean, destination?: DestinationMetadata) => Promise<DepositAndSendExtendedResult>;
|