@hinkal/common 0.3.2 → 0.3.4
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 +16 -19
- package/common/src/API/API.cjs +1 -1
- package/common/src/API/API.d.ts +5 -5
- package/common/src/API/API.mjs +78 -78
- package/common/src/API/callRelayer.d.ts +3 -0
- package/common/src/API/enclaveUtxoCalls.cjs +1 -1
- package/common/src/API/enclaveUtxoCalls.d.ts +8 -7
- package/common/src/API/enclaveUtxoCalls.mjs +5 -3
- package/common/src/API/getOdosPriceForToken.cjs +1 -0
- package/common/src/API/getOdosPriceForToken.d.ts +1 -0
- package/common/src/API/getOdosPriceForToken.mjs +14 -0
- package/common/src/API/getWebsiteURL.d.ts +0 -1
- package/common/src/API/index.cjs +1 -1
- package/common/src/API/index.d.ts +0 -1
- package/common/src/API/index.mjs +1 -2
- package/common/src/API/rewardsUserCalls.cjs +1 -1
- package/common/src/API/rewardsUserCalls.d.ts +0 -2
- package/common/src/API/rewardsUserCalls.mjs +2 -3
- package/common/src/API/tenderly.api.cjs +1 -1
- package/common/src/API/tenderly.api.d.ts +5 -10
- package/common/src/API/tenderly.api.mjs +1 -1
- package/common/src/constants/addresses.constants.cjs +1 -1
- package/common/src/constants/addresses.constants.d.ts +4 -46
- package/common/src/constants/addresses.constants.mjs +19 -60
- package/common/src/constants/balance.constants.cjs +1 -0
- package/common/src/constants/balance.constants.d.ts +1 -0
- package/common/src/constants/balance.constants.mjs +4 -0
- package/common/src/constants/chains.constants.cjs +1 -1
- package/common/src/constants/chains.constants.d.ts +3 -1
- package/common/src/constants/chains.constants.mjs +117 -131
- package/common/src/constants/coingecko.constants.cjs +1 -1
- package/common/src/constants/coingecko.constants.d.ts +2 -0
- package/common/src/constants/coingecko.constants.mjs +1 -1
- package/common/src/constants/contracts.constants.cjs +1 -1
- package/common/src/constants/contracts.constants.d.ts +0 -109
- package/common/src/constants/contracts.constants.mjs +13 -22
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arbMainnet.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-arcTestnet.json.mjs +6 -6
- package/common/src/constants/deploy-data/deploy-data-base.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-base.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.cjs +1 -0
- package/common/src/constants/deploy-data/deploy-data-bnbMainnet.json.mjs +10 -0
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-ethMainnet.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-localhost.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-localhost.json.mjs +0 -3
- package/common/src/constants/deploy-data/deploy-data-optimism.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimism.json.mjs +6 -8
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-optimismTest.json.mjs +1 -4
- package/common/src/constants/deploy-data/deploy-data-polygon.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-polygon.json.mjs +1 -3
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-sepoliaTestnet.json.mjs +0 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-solana.json.mjs +2 -2
- package/common/src/constants/deploy-data/deploy-data-tempo.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tempo.json.mjs +6 -7
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronMainnet.json.mjs +2 -4
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.cjs +1 -1
- package/common/src/constants/deploy-data/deploy-data-tronNile.json.mjs +2 -4
- package/common/src/constants/deploy-data/index.cjs +1 -1
- package/common/src/constants/deploy-data/index.d.ts +2 -1
- package/common/src/constants/deploy-data/index.mjs +16 -15
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-solana.json.mjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-tron.json.cjs +1 -1
- package/common/src/constants/deploy-data/shared-deploy-data-tron.json.mjs +2 -35
- package/common/src/constants/events.constants.cjs +1 -1
- package/common/src/constants/events.constants.mjs +3 -2
- package/common/src/constants/fees.constants.cjs +1 -1
- package/common/src/constants/fees.constants.mjs +2 -2
- package/common/src/constants/index.cjs +1 -1
- package/common/src/constants/index.d.ts +0 -1
- package/common/src/constants/index.mjs +1 -0
- package/common/src/constants/protocol.constants.cjs +2 -2
- package/common/src/constants/protocol.constants.d.ts +3 -1
- package/common/src/constants/protocol.constants.mjs +2 -2
- package/common/src/constants/server.constants.cjs +1 -1
- package/common/src/constants/server.constants.d.ts +1 -2
- package/common/src/constants/server.constants.mjs +1 -2
- package/common/src/constants/tokens.constants.cjs +1 -1
- package/common/src/constants/tokens.constants.mjs +1 -1
- package/common/src/crypto/index.cjs +1 -1
- package/common/src/crypto/index.d.ts +0 -1
- package/common/src/crypto/index.mjs +0 -1
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.mjs +26 -22
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.cjs +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.d.ts +1 -1
- package/common/src/data-structures/Hinkal/handleAutoDepositBack.mjs +36 -35
- package/common/src/data-structures/Hinkal/hinkalActionReceive.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalActionReceive.mjs +3 -3
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalBridgePrivateToPrivate.mjs +60 -58
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalClaimUtxo.mjs +42 -47
- package/common/src/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDeposit.d.ts +1 -0
- package/common/src/data-structures/Hinkal/hinkalDeposit.mjs +50 -116
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndBridge.mjs +102 -92
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.d.ts +3 -2
- package/common/src/data-structures/Hinkal/hinkalDepositAndWithdraw.mjs +104 -59
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalDepositOnChainUtxos.mjs +4 -4
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalNearDepositAndBridge.mjs +7 -3
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalPrivateWallet.mjs +51 -39
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.d.ts +1 -2
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.mjs +53 -131
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalProoflessDeposit.utils.mjs +29 -47
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalProxyToPrivate.mjs +3 -3
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.mjs +70 -45
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.mjs +47 -45
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.d.ts +8 -4
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.mjs +133 -81
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.d.ts +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProoflessDeposit.mjs +16 -12
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.d.ts +2 -2
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.mjs +61 -54
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.mjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.mjs +87 -51
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.d.ts +1 -0
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.mjs +95 -50
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.mjs +60 -34
- package/common/src/data-structures/Hinkal/hinkalSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSwap.mjs +29 -32
- package/common/src/data-structures/Hinkal/hinkalTransact.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.d.ts +3 -0
- package/common/src/data-structures/Hinkal/hinkalTransact.mjs +90 -0
- package/common/src/data-structures/Hinkal/hinkalTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalTransfer.mjs +40 -45
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.cjs +1 -0
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.d.ts +8 -0
- package/common/src/data-structures/Hinkal/hinkalTronDepositToSelf.mjs +30 -0
- package/common/src/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdraw.mjs +35 -45
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.mjs +167 -95
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.cjs +1 -0
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.d.ts +27 -0
- package/common/src/data-structures/Hinkal/prepareTronDepositToSelf.mjs +31 -0
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.mjs +1 -0
- package/common/src/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/activity-db.mjs +34 -34
- package/common/src/data-structures/IndexedDB/signatures-db.cjs +1 -1
- package/common/src/data-structures/IndexedDB/signatures-db.mjs +11 -11
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.mjs +11 -10
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.mjs +14 -14
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.mjs +26 -26
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/PrivateTokensDB.mjs +15 -15
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/TempoPublicTokensDB.mjs +12 -16
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.d.ts +1 -0
- package/common/src/data-structures/TokenDBs/TronPublicTokensDB.mjs +8 -4
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.d.ts +1 -0
- package/common/src/data-structures/crypto-keys/decodeUTXO.mjs +12 -12
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.mjs +12 -12
- package/common/src/data-structures/event-service/helpers/ClientEventHelper.cjs +1 -1
- package/common/src/data-structures/event-service/helpers/ClientEventHelper.mjs +6 -6
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/solana/AbstractSolanaCommitmentsSnapshotService.mjs +27 -23
- package/common/src/data-structures/merkle-tree/MerkleTree.cjs +1 -1
- package/common/src/data-structures/merkle-tree/MerkleTree.d.ts +10 -0
- package/common/src/data-structures/merkle-tree/MerkleTree.mjs +9 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.cjs +1 -1
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.d.ts +3 -0
- package/common/src/data-structures/private-balances/HinkalPrivateBalanceController.mjs +64 -54
- package/common/src/error-handling/error-codes.constants.cjs +1 -1
- package/common/src/error-handling/error-codes.constants.d.ts +6 -11
- package/common/src/error-handling/error-codes.constants.mjs +8 -13
- package/common/src/error-handling/get-error.message.cjs +1 -1
- package/common/src/error-handling/get-error.message.mjs +27 -14
- package/common/src/externalABIs/index.cjs +1 -1
- package/common/src/externalABIs/index.d.ts +1 -113
- package/common/src/externalABIs/index.mjs +2 -6
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.cjs +1 -1
- package/common/src/functions/auto-deposit-back-helpers/select-gas-token.mjs +8 -8
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.d.ts +0 -1
- package/common/src/functions/index.mjs +12 -15
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.cjs +1 -1
- package/common/src/functions/pre-transaction/calculateSolanaNullifierCount.mjs +39 -5
- package/common/src/functions/pre-transaction/getExternalSwapAddress.cjs +1 -1
- package/common/src/functions/pre-transaction/getExternalSwapAddress.mjs +2 -18
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.d.ts +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.mjs +11 -10
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.cjs +1 -1
- package/common/src/functions/pre-transaction/getVolatileTransferAmount.mjs +12 -12
- package/common/src/functions/pre-transaction/index.cjs +1 -1
- package/common/src/functions/pre-transaction/index.d.ts +1 -2
- package/common/src/functions/pre-transaction/index.mjs +1 -2
- package/common/src/functions/pre-transaction/outputUtxoProcessing.cjs +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.d.ts +1 -1
- package/common/src/functions/pre-transaction/outputUtxoProcessing.mjs +7 -8
- package/common/src/functions/pre-transaction/solana.cjs +1 -1
- package/common/src/functions/pre-transaction/solana.d.ts +13 -0
- package/common/src/functions/pre-transaction/solana.mjs +46 -22
- package/common/src/functions/pre-transaction/store-proof.cjs +1 -1
- package/common/src/functions/pre-transaction/store-proof.d.ts +1 -1
- package/common/src/functions/pre-transaction/store-proof.mjs +1 -0
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs +1 -1
- package/common/src/functions/pre-transaction/waitForDepositedUtxosInMerkleTree.mjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.mjs +12 -13
- package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.d.ts +0 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.mjs +38 -80
- package/common/src/functions/private-wallet/index.cjs +1 -1
- package/common/src/functions/private-wallet/index.d.ts +0 -1
- package/common/src/functions/private-wallet/index.mjs +0 -1
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.d.ts +2 -2
- package/common/src/functions/snarkjs/common.snarkjs.mjs +89 -52
- package/common/src/functions/snarkjs/constant.cjs +1 -1
- package/common/src/functions/snarkjs/constant.d.ts +32 -0
- package/common/src/functions/snarkjs/constant.mjs +32 -0
- package/common/src/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/constructGeneralZkProof.mjs +78 -65
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.d.ts +4 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.mjs +44 -39
- package/common/src/functions/snarkjs/constructTxEnclave.cjs +1 -0
- package/common/src/functions/snarkjs/constructTxEnclave.d.ts +32 -0
- package/common/src/functions/snarkjs/constructTxEnclave.mjs +162 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.cjs +1 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.d.ts +7 -0
- package/common/src/functions/snarkjs/fetchTronInsertionSiblings.mjs +13 -0
- package/common/src/functions/snarkjs/generateCircomData.cjs +1 -1
- package/common/src/functions/snarkjs/generateCircomData.d.ts +1 -1
- package/common/src/functions/snarkjs/generateCircomData.mjs +33 -27
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateMainAndCommitmentZkProof.mjs +7 -7
- package/common/src/functions/snarkjs/generateZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/generateZkProof.d.ts +1 -1
- package/common/src/functions/snarkjs/generateZkProof.mjs +9 -16
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.d.ts +11 -0
- package/common/src/functions/snarkjs/signedMessageHash.mjs +21 -3
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.cjs +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.d.ts +1 -0
- package/common/src/functions/snarkjs/verifySignedEnclaveResponse.mjs +11 -0
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/addresses.d.ts +1 -0
- package/common/src/functions/utils/addresses.mjs +6 -2
- package/common/src/functions/utils/buildClaimableDepositPlan.d.ts +2 -2
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.cjs +1 -1
- package/common/src/functions/utils/convertIntegrationProviderToExternalActionId.mjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.d.ts +1 -1
- package/common/src/functions/utils/deposit-claimable.utils.mjs +3 -1
- package/common/src/functions/utils/enclave-utxo-storage.cjs +1 -1
- package/common/src/functions/utils/enclave-utxo-storage.mjs +1 -1
- package/common/src/functions/utils/fees.utils.cjs +1 -1
- package/common/src/functions/utils/fees.utils.mjs +31 -31
- package/common/src/functions/utils/formatter.d.ts +1 -0
- package/common/src/functions/utils/getUtxosFromReceipt.utils.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceipt.utils.mjs +6 -6
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.mjs +11 -10
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.d.ts +2 -2
- package/common/src/functions/utils/index.mjs +11 -10
- package/common/src/functions/utils/process.utils.cjs +1 -1
- package/common/src/functions/utils/process.utils.d.ts +0 -1
- package/common/src/functions/utils/process.utils.mjs +2 -11
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.mjs +2 -1
- package/common/src/functions/utils/transfer-claimable.utils.cjs +1 -1
- package/common/src/functions/utils/transfer-claimable.utils.mjs +2 -2
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.d.ts +5 -14
- package/common/src/functions/utils/tron.utils.mjs +91 -127
- package/common/src/functions/utils/waasStamp.cjs +1 -0
- package/common/src/functions/utils/waasStamp.d.ts +5 -0
- package/common/src/functions/utils/waasStamp.mjs +2 -0
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.d.ts +3 -8
- package/common/src/functions/web3/events/getInputUtxoAndBalance.mjs +44 -48
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.d.ts +4 -3
- package/common/src/functions/web3/events/getInputUtxosEnclave.mjs +34 -25
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.d.ts +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.mjs +88 -76
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.cjs +1 -1
- package/common/src/functions/web3/fetchSolanaMerkleTreeRootHash.mjs +9 -6
- package/common/src/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.mjs +12 -12
- package/common/src/functions/web3/functionCalls/submitProof.cjs +1 -0
- package/common/src/functions/web3/functionCalls/submitProof.d.ts +5 -0
- package/common/src/functions/web3/functionCalls/submitProof.mjs +26 -0
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.d.ts +7 -3
- package/common/src/functions/web3/functionCalls/transactCallDirectTron.mjs +81 -87
- package/common/src/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallRelayer.d.ts +6 -11
- package/common/src/functions/web3/functionCalls/transactCallRelayer.mjs +4 -2
- package/common/src/functions/web3/functionCalls/waitForErc20Approvals.cjs +1 -1
- package/common/src/functions/web3/functionCalls/waitForErc20Approvals.mjs +6 -6
- package/common/src/functions/web3/getContractMetadata.cjs +1 -1
- package/common/src/functions/web3/getContractMetadata.mjs +1 -1
- package/common/src/functions/web3/getTokenHolder.cjs +1 -1
- package/common/src/functions/web3/getTokenHolder.mjs +3 -2
- package/common/src/functions/web3/index.cjs +1 -1
- package/common/src/functions/web3/index.d.ts +0 -3
- package/common/src/functions/web3/index.mjs +0 -3
- package/common/src/functions/web3/lifiAPI.cjs +1 -1
- package/common/src/functions/web3/lifiAPI.mjs +1 -1
- package/common/src/providers/TronProviderAdapter.cjs +1 -1
- package/common/src/providers/TronProviderAdapter.mjs +7 -1
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.mjs +5 -5
- package/common/src/types/activities.types.cjs +1 -1
- package/common/src/types/activities.types.d.ts +0 -9
- package/common/src/types/activities.types.mjs +1 -1
- package/common/src/types/admin.types.cjs +1 -1
- package/common/src/types/admin.types.d.ts +3 -1
- package/common/src/types/admin.types.mjs +1 -1
- package/common/src/types/bridging-tx.types.d.ts +8 -0
- package/common/src/types/cache.types.cjs +1 -1
- package/common/src/types/cache.types.d.ts +2 -1
- package/common/src/types/cache.types.mjs +1 -1
- package/common/src/types/circom-data.types.d.ts +6 -0
- package/common/src/types/commitments.types.d.ts +2 -0
- package/common/src/types/dashboard-transaction.types.d.ts +3 -0
- package/common/src/types/ethereum-network.types.cjs +1 -1
- package/common/src/types/ethereum-network.types.d.ts +6 -15
- package/common/src/types/ethereum-network.types.mjs +1 -1
- package/common/src/types/external-action.types.cjs +1 -1
- package/common/src/types/external-action.types.d.ts +2 -5
- package/common/src/types/external-action.types.mjs +1 -1
- package/common/src/types/hinkal.types.cjs +1 -1
- package/common/src/types/hinkal.types.d.ts +4 -7
- package/common/src/types/hinkal.types.mjs +1 -1
- package/common/src/types/index.cjs +1 -1
- package/common/src/types/index.d.ts +2 -0
- package/common/src/types/index.mjs +1 -0
- package/common/src/types/near-intents.types.d.ts +1 -0
- package/common/src/types/offscreen.types.cjs +1 -1
- package/common/src/types/offscreen.types.d.ts +0 -1
- package/common/src/types/offscreen.types.mjs +1 -1
- package/common/src/types/pay-activities.types.d.ts +3 -0
- package/common/src/types/remote-proof.types.d.ts +0 -6
- package/common/src/types/remote-tx-build.types.d.ts +242 -0
- package/common/src/types/scheduled-transactions.types.d.ts +3 -0
- package/common/src/types/solana.types.d.ts +7 -0
- package/common/src/types/tenderly.api.types.d.ts +70 -0
- package/common/src/types/transact.types.cjs +1 -0
- package/common/src/types/transact.types.d.ts +53 -0
- package/common/src/types/transact.types.mjs +6 -0
- package/common/src/webworker/{logError-uy41lNp1.js → logError-CxZzSALU.js} +1 -1
- package/common/src/webworker/package.json +12 -12
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/snarkjsWorkerNode.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/utxoWorkerNode.cjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.cjs +3 -3
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
- package/common/src/webworker/workerProxy-swwPYw6e.js +1 -0
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/zkProofWorkerNode.cjs +1 -1
- package/index.cjs +1 -1
- package/index.mjs +1 -1
- package/internal/swapApi.cjs +1 -1
- package/internal/swapApi.d.ts +3 -3
- package/internal/swapApi.mjs +22 -25
- package/package.json +12 -12
- package/services/Hinkal.cjs +1 -1
- package/services/Hinkal.d.ts +3 -3
- package/services/Hinkal.mjs +7 -7
- package/types/IHinkal.d.ts +3 -3
- package/types/swap.types.d.ts +3 -20
- package/common/src/API/callOdosAPI.cjs +0 -1
- package/common/src/API/callOdosAPI.d.ts +0 -63
- package/common/src/API/callOdosAPI.mjs +0 -18
- package/common/src/API/callOneInchAPI.cjs +0 -1
- package/common/src/API/callOneInchAPI.d.ts +0 -24
- package/common/src/API/callOneInchAPI.mjs +0 -16
- package/common/src/constants/rewards.constants.d.ts +0 -2
- package/common/src/crypto/ecdh-dual-path.cjs +0 -1
- package/common/src/crypto/ecdh-dual-path.d.ts +0 -13
- package/common/src/crypto/ecdh-dual-path.mjs +0 -6
- package/common/src/externalABIs/IQuoterV2.json.cjs +0 -1
- package/common/src/externalABIs/IQuoterV2.json.mjs +0 -203
- package/common/src/externalABIs/ISwapRouter.json.cjs +0 -1
- package/common/src/externalABIs/ISwapRouter.json.mjs +0 -537
- package/common/src/externalABIs/IUniswapV3Factory.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Factory.json.mjs +0 -188
- package/common/src/externalABIs/IUniswapV3Pool.json.cjs +0 -1
- package/common/src/externalABIs/IUniswapV3Pool.json.mjs +0 -938
- package/common/src/externalABIs/UniswapV2PoolAbi.json.cjs +0 -1
- package/common/src/externalABIs/UniswapV2PoolAbi.json.mjs +0 -78
- package/common/src/functions/pre-transaction/interaction-to-action.cjs +0 -1
- package/common/src/functions/pre-transaction/interaction-to-action.d.ts +0 -2
- package/common/src/functions/pre-transaction/interaction-to-action.mjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.cjs +0 -1
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.d.ts +0 -3
- package/common/src/functions/pre-transaction/recipientUtxoProcessing.mjs +0 -30
- package/common/src/functions/private-wallet/opProducer.cjs +0 -1
- package/common/src/functions/private-wallet/opProducer.d.ts +0 -5
- package/common/src/functions/private-wallet/opProducer.mjs +0 -3
- package/common/src/functions/snarkjs/generateZkProofEnclave.cjs +0 -1
- package/common/src/functions/snarkjs/generateZkProofEnclave.d.ts +0 -5
- package/common/src/functions/snarkjs/generateZkProofEnclave.mjs +0 -27
- package/common/src/functions/utils/get-signature-header.cjs +0 -1
- package/common/src/functions/utils/get-signature-header.d.ts +0 -5
- package/common/src/functions/utils/get-signature-header.mjs +0 -4
- package/common/src/functions/web3/odosAPI.cjs +0 -1
- package/common/src/functions/web3/odosAPI.d.ts +0 -5
- package/common/src/functions/web3/odosAPI.mjs +0 -35
- package/common/src/functions/web3/oneInchAPI.cjs +0 -1
- package/common/src/functions/web3/oneInchAPI.d.ts +0 -5
- package/common/src/functions/web3/oneInchAPI.mjs +0 -44
- package/common/src/functions/web3/uniswapAPI.cjs +0 -1
- package/common/src/functions/web3/uniswapAPI.d.ts +0 -16
- package/common/src/functions/web3/uniswapAPI.mjs +0 -60
- package/common/src/webworker/workerProxy-MheXtWa4.js +0 -1
|
@@ -8,65 +8,89 @@ import { Utxo as s } from "../utxo/Utxo.mjs";
|
|
|
8
8
|
import { ExternalActionId as c } from "../../types/external-action.types.mjs";
|
|
9
9
|
import "../../types/index.mjs";
|
|
10
10
|
import { validateAndGetChainId as l } from "../../functions/utils/token-check.utils.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import { getFeeStructure as
|
|
13
|
-
import { constructSolanaZkProof as f } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
|
|
11
|
+
import { finalizeSolanaTxEnclaveCallRelay as u, prepareSolanaTxEnclaveCall as d } from "../../functions/snarkjs/constructTxEnclave.mjs";
|
|
12
|
+
import { getFeeStructure as f } from "../../functions/pre-transaction/getFeeStructure.mjs";
|
|
14
13
|
import { solanaTransactCallRelayer as p } from "../../functions/web3/functionCalls/transactCallRelayer.mjs";
|
|
15
|
-
import {
|
|
14
|
+
import { constructSolanaZkProof as m } from "../../functions/snarkjs/constructSolanaZkProof.mjs";
|
|
16
15
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.ts
|
|
17
|
-
var h = async (
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
var h = async (e, t, r, i, a, o, s, c, l, f, p) => {
|
|
17
|
+
let { jobId: m, signedMessageHash: h } = await d(e, {
|
|
18
|
+
chainId: t,
|
|
19
|
+
mintAddresses: [r],
|
|
20
|
+
amountChanges: i,
|
|
21
|
+
relayAddress: a,
|
|
22
|
+
recipient: n,
|
|
23
|
+
signer: a,
|
|
24
|
+
functionName: "transfer",
|
|
25
|
+
accounts: o,
|
|
26
|
+
relayerFee: l,
|
|
27
|
+
variableRate: 0n,
|
|
28
|
+
hinkalInstructions: [],
|
|
29
|
+
remainingAccounts: [],
|
|
30
|
+
recipientAddress: s,
|
|
31
|
+
recipientAmounts: [c],
|
|
32
|
+
inputCommitments: [p]
|
|
33
|
+
}, f), { R8: g, S: _ } = f.signEddsa(BigInt(h));
|
|
34
|
+
return u(m, {
|
|
35
|
+
R8: g,
|
|
36
|
+
S: _
|
|
37
|
+
}, t);
|
|
38
|
+
}, g = async (u, d, g, _, v) => {
|
|
39
|
+
let y = l([d]), b = d.erc20TokenAddress;
|
|
40
|
+
if (g.getTokenAddress(y) !== b) throw Error("Off-chain UTXO token mismatch");
|
|
41
|
+
let x = v ? new a(v) : new a(g.nullifyingKey, g.nullifyingKey);
|
|
42
|
+
if (!g.nullifyingKey && !v) throw Error("Claimable UTXO nullifyingKey is missing");
|
|
43
|
+
let S = x.getShieldedPrivateKey();
|
|
44
|
+
if (g.nullifyingKey && g.nullifyingKey !== S) throw Error("Claimable UTXO key mismatch");
|
|
45
|
+
let { originalDeployer: C } = e[y].contractData;
|
|
46
|
+
if (!C) throw Error("missing data");
|
|
47
|
+
let w = s.createFrom(g, { nullifyingKey: S }), T = _ ?? await f(y, b, [b], c.Transact, void 0, void 0, {
|
|
48
|
+
mintTo: b,
|
|
49
|
+
nullifierCount: 1,
|
|
50
|
+
rootInsertCount: 2
|
|
29
51
|
});
|
|
30
|
-
if (
|
|
31
|
-
let
|
|
32
|
-
if (
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
35
|
-
let
|
|
52
|
+
if (T.feeToken !== b) throw Error("Claim fee token mismatch: fee must be paid from claimed UTXO token");
|
|
53
|
+
let E = T.variableRate > 0n ? T.variableRate : t;
|
|
54
|
+
if (w.amount <= T.flatFee) throw Error(r.INSUFFICIENT_FUNDS_TO_TRANSACT);
|
|
55
|
+
let D = w.amount - T.flatFee, O = D * E / 10000n, k = D - O;
|
|
56
|
+
if (k <= 0n) throw Error(r.RECIPIENT_AMOUNT_INVALID);
|
|
57
|
+
let A = T.flatFee + O, j = u.getRecipientInfo(), [M, N, P, , , F] = j.split(",");
|
|
36
58
|
if (!N || !P || !M || !F) throw Error("Invalid recipient info");
|
|
37
59
|
let I = o().toString(), L = new s({
|
|
38
60
|
amount: 0n,
|
|
39
|
-
erc20TokenAddress:
|
|
40
|
-
mintAddress:
|
|
41
|
-
nullifyingKey:
|
|
42
|
-
spendingPublicKey:
|
|
61
|
+
erc20TokenAddress: w.erc20TokenAddress,
|
|
62
|
+
mintAddress: w.mintAddress,
|
|
63
|
+
nullifyingKey: x.getShieldedPrivateKey(),
|
|
64
|
+
spendingPublicKey: x.getSpendingKeyPair().pubSpendingBJJPoint
|
|
43
65
|
}), R = new s({
|
|
44
66
|
amount: 0n,
|
|
45
|
-
erc20TokenAddress:
|
|
46
|
-
mintAddress:
|
|
47
|
-
nullifyingKey:
|
|
67
|
+
erc20TokenAddress: w.erc20TokenAddress,
|
|
68
|
+
mintAddress: w.mintAddress,
|
|
69
|
+
nullifyingKey: x.getShieldedPrivateKey(),
|
|
48
70
|
timeStamp: I,
|
|
49
|
-
spendingPublicKey:
|
|
71
|
+
spendingPublicKey: x.getSpendingKeyPair().pubSpendingBJJPoint
|
|
50
72
|
}), z = new s({
|
|
51
|
-
amount:
|
|
52
|
-
erc20TokenAddress:
|
|
53
|
-
mintAddress:
|
|
73
|
+
amount: k,
|
|
74
|
+
erc20TokenAddress: w.erc20TokenAddress,
|
|
75
|
+
mintAddress: w.mintAddress,
|
|
54
76
|
timeStamp: I,
|
|
55
77
|
H0: [BigInt(N), BigInt(P)],
|
|
56
78
|
stealthAddress: M,
|
|
57
79
|
encryptionKey: F
|
|
58
|
-
}), B = [
|
|
80
|
+
}), B = [w, L], V = [R, z], H = await u.getRandomRelay(y, !0);
|
|
59
81
|
if (!H) throw Error(r.RELAYER_NOT_AVAILABLE);
|
|
60
|
-
let U =
|
|
82
|
+
let U = {
|
|
83
|
+
recipient: H,
|
|
84
|
+
mint: b === "11111111111111111111111111111111" ? void 0 : b
|
|
85
|
+
};
|
|
86
|
+
if (u.generateProofRemotely) return h(u, y, b, [-(k + A)], H, U, j, k, A, x, w.getCommitment());
|
|
87
|
+
let W = a.findCorrectRandomization(i(31), x.getShieldedPrivateKey()), G = {
|
|
61
88
|
tokenNumber: 1,
|
|
62
89
|
nullifierAmount: B.length,
|
|
63
90
|
outputAmount: V.length
|
|
64
|
-
},
|
|
65
|
-
recipient: H,
|
|
66
|
-
mint: x === "11111111111111111111111111111111" ? void 0 : x
|
|
67
|
-
};
|
|
91
|
+
}, { proofAArr: K, proofBArr: q, proofCArr: J, publicInputsArr: Y, commitmentValidationData: X, rootHashHinkalIndex: Z, encryptedOutputs: Q } = await m(u.merkleTreeHinkalByChain[y], x, [b], [B], [V], W, A, 0n, n, H, G, void 0, y);
|
|
68
92
|
return p({
|
|
69
|
-
chainId:
|
|
93
|
+
chainId: y,
|
|
70
94
|
relayAddress: H,
|
|
71
95
|
functionName: "transfer",
|
|
72
96
|
args: {
|
|
@@ -74,13 +98,14 @@ var h = async (h, g, _, v, y) => {
|
|
|
74
98
|
proofBArr: q,
|
|
75
99
|
proofCArr: J,
|
|
76
100
|
publicInputsArr: Y,
|
|
77
|
-
encryptedOutputs:
|
|
78
|
-
relayerFee:
|
|
79
|
-
dimensions:
|
|
101
|
+
encryptedOutputs: Q,
|
|
102
|
+
relayerFee: A.toString(),
|
|
103
|
+
dimensions: G,
|
|
104
|
+
rootHashIndex: Z.toString()
|
|
80
105
|
},
|
|
81
|
-
accounts:
|
|
106
|
+
accounts: U,
|
|
82
107
|
commitmentValidationData: X
|
|
83
108
|
});
|
|
84
109
|
};
|
|
85
110
|
//#endregion
|
|
86
|
-
export {
|
|
111
|
+
export { g as hinkalSolanaClaimUtxo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../functions/utils/solanaMint.utils.cjs`),o=require(`../../functions/utils/addresses.cjs`),s=require(`../../functions/utils/token-check.utils.cjs`),c=require(`../../functions/snarkjs/common.snarkjs.cjs`),l=require(`../../functions/pre-transaction/solana.cjs`),u=require(`../../functions/pre-transaction/constructAdminData.cjs`),d=require(`../../error-handling/retrySolanaError.cjs`),f=require(`../../API/admin-calls.cjs`),p=require(`./hinkalProoflessDeposit.utils.cjs`);require(`../../functions/pre-transaction/solanaTransfer.utils.cjs`);let m=require(`@solana/web3.js`),h=require(`@coral-xyz/anchor`);var g=(n,r)=>{let i=s.validateAndGetChainId([r]),o=r.erc20TokenAddress,{hinkalIdl:c,hinkalAddress:u,originalDeployer:d}=e.networkRegistry[i].contractData;if(!c)throw Error(`No IDL configured for Solana program on this network`);if(!d)throw Error(`missing original deployer`);let f=n.getSolanaProgram(c),p=n.getSolanaPublicKey(),{connection:h,wallet:g}=f.provider;if(!g)throw Error(`missing solana wallet`);let _=new m.PublicKey(d),v=new m.PublicKey(u),{mintPublicKey:y}=a.formatMintAddress(o),b=y.toString()===t.solanaNativeAddress;return{chainId:i,mintAddress:o,program:f,publicKey:p,connection:h,wallet:g,originalDeployer:_,mintPublicKey:y,mint:b?null:y,atasValue:b?null:void 0,storageAccount:l.getStorageAccountPublicKey(v,_),storageVault:l.getStorageVaultPublicKey(v,_),merkleAccount:l.getMerkleAccountPublicKey(v,_)}},_=(e,t,n)=>{let
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../functions/utils/solanaMint.utils.cjs`),o=require(`../../functions/utils/addresses.cjs`),s=require(`../../functions/utils/token-check.utils.cjs`),c=require(`../../functions/snarkjs/common.snarkjs.cjs`),l=require(`../../functions/pre-transaction/solana.cjs`),u=require(`../../functions/pre-transaction/constructAdminData.cjs`),d=require(`../../error-handling/retrySolanaError.cjs`),f=require(`../../API/admin-calls.cjs`),p=require(`./hinkalProoflessDeposit.utils.cjs`);require(`../../functions/pre-transaction/solanaTransfer.utils.cjs`);let m=require(`@solana/web3.js`),h=require(`@coral-xyz/anchor`);var g=(n,r)=>{let i=s.validateAndGetChainId([r]),o=r.erc20TokenAddress,{hinkalIdl:c,hinkalAddress:u,originalDeployer:d}=e.networkRegistry[i].contractData;if(!c)throw Error(`No IDL configured for Solana program on this network`);if(!d)throw Error(`missing original deployer`);let f=n.getSolanaProgram(c),p=n.getSolanaPublicKey(),{connection:h,wallet:g}=f.provider;if(!g)throw Error(`missing solana wallet`);let _=new m.PublicKey(d),v=new m.PublicKey(u),{mintPublicKey:y}=a.formatMintAddress(o),b=y.toString()===t.solanaNativeAddress;return{chainId:i,mintAddress:o,program:f,publicKey:p,connection:h,wallet:g,originalDeployer:_,mintPublicKey:y,mint:b?null:y,atasValue:b?null:void 0,storageAccount:l.getStorageAccountPublicKey(v,_),storageVault:l.getStorageVaultPublicKey(v,_),merkleAccount:l.getMerkleAccountPublicKey(v,_)}},_=async(e,t,n,r,i)=>{let a=n.map(e=>l.buildAnchorStealthAddressStructure(e)),o=p.buildProoflessEncryptedOutputs(n,r).map(e=>Buffer.from(e.slice(2),`hex`)),{current:s,next:c}=await l.resolveSolanaRootBuckets(e.program,e.merkleAccount,t.length);return e.program.methods.multiPaymentDeposit(t.map(e=>new h.BN(e.toString())),a,o,i).accounts({mint:e.mint,signer:e.publicKey,signerAta:e.atasValue,originalDeployer:e.originalDeployer,storageAccount:e.storageAccount,storageVault:e.storageVault,merkleAccount:e.merkleAccount,rootBucketCurrent:s,rootBucketNext:c??e.program.programId,storageVaultAta:e.atasValue}).instruction()},v=async(e,t,n,r)=>{for(let i=0;i<10;i+=1){let a=i===9;try{let{blockhash:i,lastValidBlockHeight:a}=await e.getLatestBlockhash(),o=new m.VersionedTransaction(new m.TransactionMessage({payerKey:n,recentBlockhash:i,instructions:r}).compileToV0Message()),s=await t.signTransaction(o),c=await e.sendTransaction(s);return await e.confirmTransaction({signature:c,blockhash:i,lastValidBlockHeight:a},`confirmed`),c}catch(e){if(d.shouldRetryForSolanaError(e)&&!a)continue;throw e}}return``},y=(e,t)=>{if(e.length===0)throw Error(`amounts must not be empty`);if(e.length!==t.length)throw Error(`amounts and stealthAddressStructures length mismatch`);if(e.some(e=>e<=0n))throw Error(`all amounts must be positive`);p.assertNoDuplicateStealthAddressStructures(t)},b=async(e,t,n,r,i,a=!1,o,s=!1)=>{y(n,r);let c=g(e,t),l=u.constructAdminData(o,c.chainId,Array(n.length).fill(c.mintAddress),n,await e.getEthereumAddress()),d=await _(c,n,r,i,a);if(s){let{blockhash:e}=await c.connection.getLatestBlockhash(),t=new m.Transaction().add(d);return t.recentBlockhash=e,t.feePayer=c.publicKey,Buffer.from(t.serialize({requireAllSignatures:!1})).toString(`base64`)}let p=await v(c.connection,c.wallet,c.publicKey,[d]);return await f.emitTxPublicData(l),p},x=async(e,t,n,a=!1)=>{let o=e.userKeys.getShieldedPrivateKey(),s=c.calcStealthAddressStructure(i.UserKeys.findCorrectRandomization(r.randomBigInt(31),o),o,e.userKeys.getSpendingKeyPair().pubSpendingBJJPoint),l=i.UserKeys.getEncryptionKeyPair(o).publicKey;return b(e,n,[t],[s],[l],!1,void 0,a)},S=async(e,t,r,i,a=!1,s)=>{if(!o.isValidPrivateAddress(i))throw Error(n.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);let c=o.constructStealthAddressStructure(i),l=o.getEncryptionKeyFromRecipientInfo(i);return b(e,r,[t],[c],[l],!1,s,a)};exports.hinkalSolanaDeposit=x,exports.hinkalSolanaDepositForOther=S,exports.submitSolanaProoflessDeposit=b;
|
|
@@ -2,7 +2,7 @@ import { StealthAddressStructure } from '../../types/circom-data.types';
|
|
|
2
2
|
import { ERC20Token } from '../../types/token.types';
|
|
3
3
|
import { IHinkal } from './IHinkal';
|
|
4
4
|
import { AdminTransactionType } from '../../types/admin.types';
|
|
5
|
-
export declare const submitSolanaProoflessDeposit: (hinkal: IHinkal, token: ERC20Token, amounts: bigint[], stealthAddressStructures: StealthAddressStructure[], action?: AdminTransactionType, returnTxData?: boolean) => Promise<string>;
|
|
6
|
-
export declare const hinkalSolanaProoflessDepositWithPublicFee: (hinkal: IHinkal, token: ERC20Token, amounts: bigint[], stealthAddressStructures: StealthAddressStructure[], feeAmount: bigint, action?: AdminTransactionType) => Promise<string>;
|
|
5
|
+
export declare const submitSolanaProoflessDeposit: (hinkal: IHinkal, token: ERC20Token, amounts: bigint[], stealthAddressStructures: StealthAddressStructure[], recipientEncryptionKeys: string[], createBlockedUtxos?: boolean, action?: AdminTransactionType, returnTxData?: boolean) => Promise<string>;
|
|
6
|
+
export declare const hinkalSolanaProoflessDepositWithPublicFee: (hinkal: IHinkal, token: ERC20Token, amounts: bigint[], stealthAddressStructures: StealthAddressStructure[], recipientEncryptionKeys: string[], feeAmount: bigint, createBlockedUtxos?: boolean, action?: AdminTransactionType) => Promise<string>;
|
|
7
7
|
export declare const hinkalSolanaDeposit: (hinkal: IHinkal, amount: bigint, token: ERC20Token, returnTxData?: boolean) => Promise<string>;
|
|
8
8
|
export declare const hinkalSolanaDepositForOther: (hinkal: IHinkal, amount: bigint, token: ERC20Token, recipientInfo: string, returnTxData?: boolean, action?: AdminTransactionType) => Promise<string>;
|
|
@@ -4,43 +4,43 @@ import { transactionErrorCodes as n } from "../../error-handling/error-codes.con
|
|
|
4
4
|
import { randomBigInt as r } from "../../functions/web3/etherFunctions.mjs";
|
|
5
5
|
import { UserKeys as i } from "../crypto-keys/keys.mjs";
|
|
6
6
|
import { formatMintAddress as a } from "../../functions/utils/solanaMint.utils.mjs";
|
|
7
|
-
import { constructStealthAddressStructure as o,
|
|
8
|
-
import { validateAndGetChainId as
|
|
9
|
-
import { calcStealthAddressStructure as
|
|
10
|
-
import { buildAnchorStealthAddressStructure as
|
|
11
|
-
import { constructAdminData as
|
|
12
|
-
import { shouldRetryForSolanaError as
|
|
13
|
-
import { emitTxPublicData as
|
|
14
|
-
import { assertNoDuplicateStealthAddressStructures as
|
|
7
|
+
import { constructStealthAddressStructure as o, getEncryptionKeyFromRecipientInfo as s, isValidPrivateAddress as c } from "../../functions/utils/addresses.mjs";
|
|
8
|
+
import { validateAndGetChainId as l } from "../../functions/utils/token-check.utils.mjs";
|
|
9
|
+
import { calcStealthAddressStructure as u } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
10
|
+
import { buildAnchorStealthAddressStructure as d, getMerkleAccountPublicKey as f, getStorageAccountPublicKey as p, getStorageVaultPublicKey as m, resolveSolanaRootBuckets as h } from "../../functions/pre-transaction/solana.mjs";
|
|
11
|
+
import { constructAdminData as g } from "../../functions/pre-transaction/constructAdminData.mjs";
|
|
12
|
+
import { shouldRetryForSolanaError as _ } from "../../error-handling/retrySolanaError.mjs";
|
|
13
|
+
import { emitTxPublicData as v } from "../../API/admin-calls.mjs";
|
|
14
|
+
import { assertNoDuplicateStealthAddressStructures as y, buildProoflessEncryptedOutputs as b } from "./hinkalProoflessDeposit.utils.mjs";
|
|
15
15
|
import "../../functions/pre-transaction/solanaTransfer.utils.mjs";
|
|
16
|
-
import { PublicKey as
|
|
17
|
-
import { BN as
|
|
16
|
+
import { PublicKey as x, Transaction as S, TransactionMessage as C, VersionedTransaction as w } from "@solana/web3.js";
|
|
17
|
+
import { BN as T } from "@coral-xyz/anchor";
|
|
18
18
|
//#region libs/shared/common/src/data-structures/Hinkal/hinkalSolanaDeposit.ts
|
|
19
|
-
var
|
|
20
|
-
let i =
|
|
19
|
+
var E = (n, r) => {
|
|
20
|
+
let i = l([r]), o = r.erc20TokenAddress, { hinkalIdl: s, hinkalAddress: c, originalDeployer: u } = e[i].contractData;
|
|
21
21
|
if (!s) throw Error("No IDL configured for Solana program on this network");
|
|
22
22
|
if (!u) throw Error("missing original deployer");
|
|
23
|
-
let
|
|
23
|
+
let d = n.getSolanaProgram(s), h = n.getSolanaPublicKey(), { connection: g, wallet: _ } = d.provider;
|
|
24
24
|
if (!_) throw Error("missing solana wallet");
|
|
25
|
-
let
|
|
25
|
+
let v = new x(u), y = new x(c), { mintPublicKey: b } = a(o), S = b.toString() === t;
|
|
26
26
|
return {
|
|
27
27
|
chainId: i,
|
|
28
28
|
mintAddress: o,
|
|
29
|
-
program:
|
|
29
|
+
program: d,
|
|
30
30
|
publicKey: h,
|
|
31
31
|
connection: g,
|
|
32
32
|
wallet: _,
|
|
33
|
-
originalDeployer:
|
|
34
|
-
mintPublicKey:
|
|
35
|
-
mint: S ? null :
|
|
33
|
+
originalDeployer: v,
|
|
34
|
+
mintPublicKey: b,
|
|
35
|
+
mint: S ? null : b,
|
|
36
36
|
atasValue: S ? null : void 0,
|
|
37
|
-
storageAccount:
|
|
38
|
-
storageVault:
|
|
39
|
-
merkleAccount:
|
|
37
|
+
storageAccount: p(y, v),
|
|
38
|
+
storageVault: m(y, v),
|
|
39
|
+
merkleAccount: f(y, v)
|
|
40
40
|
};
|
|
41
|
-
},
|
|
42
|
-
let
|
|
43
|
-
return e.program.methods.multiPaymentDeposit(t.map((e) => new
|
|
41
|
+
}, D = async (e, t, n, r, i) => {
|
|
42
|
+
let a = n.map((e) => d(e)), o = b(n, r).map((e) => Buffer.from(e.slice(2), "hex")), { current: s, next: c } = await h(e.program, e.merkleAccount, t.length);
|
|
43
|
+
return e.program.methods.multiPaymentDeposit(t.map((e) => new T(e.toString())), a, o, i).accounts({
|
|
44
44
|
mint: e.mint,
|
|
45
45
|
signer: e.publicKey,
|
|
46
46
|
signerAta: e.atasValue,
|
|
@@ -48,13 +48,15 @@ var C = (n, r) => {
|
|
|
48
48
|
storageAccount: e.storageAccount,
|
|
49
49
|
storageVault: e.storageVault,
|
|
50
50
|
merkleAccount: e.merkleAccount,
|
|
51
|
+
rootBucketCurrent: s,
|
|
52
|
+
rootBucketNext: c ?? e.program.programId,
|
|
51
53
|
storageVaultAta: e.atasValue
|
|
52
54
|
}).instruction();
|
|
53
|
-
},
|
|
55
|
+
}, O = async (e, t, n, r) => {
|
|
54
56
|
for (let i = 0; i < 10; i += 1) {
|
|
55
57
|
let a = i === 9;
|
|
56
58
|
try {
|
|
57
|
-
let { blockhash: i, lastValidBlockHeight: a } = await e.getLatestBlockhash(), o = new
|
|
59
|
+
let { blockhash: i, lastValidBlockHeight: a } = await e.getLatestBlockhash(), o = new w(new C({
|
|
58
60
|
payerKey: n,
|
|
59
61
|
recentBlockhash: i,
|
|
60
62
|
instructions: r
|
|
@@ -65,32 +67,32 @@ var C = (n, r) => {
|
|
|
65
67
|
lastValidBlockHeight: a
|
|
66
68
|
}, "confirmed"), c;
|
|
67
69
|
} catch (e) {
|
|
68
|
-
if (
|
|
70
|
+
if (_(e) && !a) continue;
|
|
69
71
|
throw e;
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
return "";
|
|
73
|
-
},
|
|
75
|
+
}, k = (e, t) => {
|
|
74
76
|
if (e.length === 0) throw Error("amounts must not be empty");
|
|
75
77
|
if (e.length !== t.length) throw Error("amounts and stealthAddressStructures length mismatch");
|
|
76
78
|
if (e.some((e) => e <= 0n)) throw Error("all amounts must be positive");
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
let
|
|
81
|
-
if (
|
|
82
|
-
let { blockhash: e } = await
|
|
83
|
-
return t.recentBlockhash = e, t.feePayer =
|
|
79
|
+
y(t);
|
|
80
|
+
}, A = async (e, t, n, r, i, a = !1, o, s = !1) => {
|
|
81
|
+
k(n, r);
|
|
82
|
+
let c = E(e, t), l = g(o, c.chainId, Array(n.length).fill(c.mintAddress), n, await e.getEthereumAddress()), u = await D(c, n, r, i, a);
|
|
83
|
+
if (s) {
|
|
84
|
+
let { blockhash: e } = await c.connection.getLatestBlockhash(), t = new S().add(u);
|
|
85
|
+
return t.recentBlockhash = e, t.feePayer = c.publicKey, Buffer.from(t.serialize({ requireAllSignatures: !1 })).toString("base64");
|
|
84
86
|
}
|
|
85
|
-
let
|
|
86
|
-
return await
|
|
87
|
-
},
|
|
88
|
-
let o = e.userKeys.getShieldedPrivateKey(), s =
|
|
89
|
-
return
|
|
90
|
-
},
|
|
91
|
-
if (!
|
|
92
|
-
let
|
|
93
|
-
return
|
|
87
|
+
let d = await O(c.connection, c.wallet, c.publicKey, [u]);
|
|
88
|
+
return await v(l), d;
|
|
89
|
+
}, j = async (e, t, n, a = !1) => {
|
|
90
|
+
let o = e.userKeys.getShieldedPrivateKey(), s = u(i.findCorrectRandomization(r(31), o), o, e.userKeys.getSpendingKeyPair().pubSpendingBJJPoint), c = i.getEncryptionKeyPair(o).publicKey;
|
|
91
|
+
return A(e, n, [t], [s], [c], !1, void 0, a);
|
|
92
|
+
}, M = async (e, t, r, i, a = !1, l) => {
|
|
93
|
+
if (!c(i)) throw Error(n.RECIPIENT_FORMAT_INCORRECT);
|
|
94
|
+
let u = o(i), d = s(i);
|
|
95
|
+
return A(e, r, [t], [u], [d], !1, l, a);
|
|
94
96
|
};
|
|
95
97
|
//#endregion
|
|
96
|
-
export {
|
|
98
|
+
export { j as hinkalSolanaDeposit, M as hinkalSolanaDepositForOther, A as submitSolanaProoflessDeposit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../functions/utils/time.utils.cjs`),o=require(`../utxo/Utxo.cjs`),s=require(`../../functions/utils/solanaMint.utils.cjs`),c=require(`../../functions/utils/addresses.cjs`),l=require(`../../types/external-action.types.cjs`),u=require(`../../types/scheduled-transactions.types.cjs`);require(`../../types/index.cjs`);const d=require(`../../functions/utils/token-check.utils.cjs`),f=require(`../../functions/snarkjs/common.snarkjs.cjs`),p=require(`../../functions/pre-transaction/solana.cjs`),m=require(`../../functions/pre-transaction/constructAdminData.cjs`),h=require(`../../functions/pre-transaction/sendV0Transaction.cjs`),
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../functions/web3/etherFunctions.cjs`),i=require(`../crypto-keys/keys.cjs`),a=require(`../../functions/utils/time.utils.cjs`),o=require(`../utxo/Utxo.cjs`),s=require(`../../functions/utils/solanaMint.utils.cjs`),c=require(`../../functions/utils/addresses.cjs`),l=require(`../../types/external-action.types.cjs`),u=require(`../../types/scheduled-transactions.types.cjs`);require(`../../types/index.cjs`);const d=require(`../../functions/utils/token-check.utils.cjs`),f=require(`../../functions/snarkjs/common.snarkjs.cjs`),p=require(`../../functions/pre-transaction/solana.cjs`),m=require(`../../functions/pre-transaction/constructAdminData.cjs`),h=require(`../../functions/snarkjs/constructTxEnclave.cjs`),g=require(`../../functions/pre-transaction/sendV0Transaction.cjs`),_=require(`../../functions/pre-transaction/getFeeStructure.cjs`),v=require(`../../functions/pre-transaction/waitForDepositedUtxosInMerkleTree.cjs`);require(`../../functions/pre-transaction/index.cjs`);const y=require(`../../functions/web3/functionCalls/transactCallRelayer.cjs`),b=require(`./hinkalProoflessDeposit.utils.cjs`),x=require(`../../API/deposit-and-withdraw-status-calls.cjs`),S=require(`../../functions/utils/getUtxosFromReceiptSolana.cjs`),C=require(`../../functions/utils/fees.utils.cjs`);require(`../../functions/web3/index.cjs`);const w=require(`../../functions/snarkjs/constructSolanaZkProof.cjs`);require(`../../functions/index.cjs`);let T=require(`@solana/web3.js`),E=require(`@coral-xyz/anchor`);var D=(n,a,o,c)=>{let{hinkalIdl:l,hinkalAddress:u,originalDeployer:d}=e.networkRegistry[a].contractData;if(!l)throw Error(`No IDL configured for Solana program on this network`);if(!d)throw Error(`missing original deployer`);let m=n.userKeys.getShieldedPrivateKey(),h=n.getSolanaProgram(l),g=n.getSolanaPublicKey(),_=new T.PublicKey(d),v=new T.PublicKey(u),{mintPublicKey:y}=s.formatMintAddress(o.erc20TokenAddress),b=y.toString(),x=p.getStorageAccountPublicKey(v,_),S=p.getStorageVaultPublicKey(v,_),C=p.getMerkleAccountPublicKey(v,_),w=c.map(()=>f.calcStealthAddressStructure(i.UserKeys.findCorrectRandomization(r.randomBigInt(31),m),m,n.userKeys.getSpendingKeyPair().pubSpendingBJJPoint)),E=w.map(e=>p.buildAnchorStealthAddressStructure(e)),D=i.UserKeys.getEncryptionKeyPair(m).publicKey,O=b===t.solanaNativeAddress;return{program:h,publicKey:g,originalDeployer:_,mint:O?null:y,atasValue:O?null:void 0,storageAccount:x,storageVault:S,merkleAccount:C,amounts:c,mintAddressString:b,stealthAddressStructures:w,anchorStealthStructures:E,ownEncryptionKey:D}},O=async e=>{let t=b.buildProoflessEncryptedOutputs(e.stealthAddressStructures,e.amounts.map(()=>e.ownEncryptionKey)).map(e=>Buffer.from(e.slice(2),`hex`)),{current:n,next:r}=await p.resolveSolanaRootBuckets(e.program,e.merkleAccount,e.amounts.length);return e.program.methods.multiPaymentDeposit(e.amounts.map(e=>new E.BN(e.toString())),e.anchorStealthStructures,t,!0).accounts({mint:e.mint,signer:e.publicKey,signerAta:e.atasValue,originalDeployer:e.originalDeployer,storageAccount:e.storageAccount,storageVault:e.storageVault,merkleAccount:e.merkleAccount,rootBucketCurrent:n,rootBucketNext:r??e.program.programId,storageVaultAta:e.atasValue})},k=async(e,t,n,r,i,a,o)=>{let c=r.map(e=>e+C.calculateTotalFee(e,a)),l=D(e,t,n,c),d=(await x.updateDepositAndWithdrawStatus({chainId:t,hashedEthereumAddress:o,phase:u.DepositAndWithdrawPhase.BEFORE_DEPOSIT})).id??void 0,f=await(await O(l)).rpc(),p=await l.program.provider.connection.getLatestBlockhash();await l.program.provider.connection.confirmTransaction({blockhash:p.blockhash,lastValidBlockHeight:p.lastValidBlockHeight,signature:f},`finalized`);let m=await g.fetchSolanaTransaction(l.program.provider.connection,f,`finalized`);if(!m)throw Error(`Transaction missing`);await x.safeUpdateDepositAndWithdrawStatus({id:d,chainId:t,hashedEthereumAddress:o,phase:u.DepositAndWithdrawPhase.AFTER_DEPOSIT,depositTxHash:f});let{compressedAddress:h}=s.formatMintAddress(n.erc20TokenAddress),_=S.getOnChainUtxosFromReceiptSolana(m,l.program,e.userKeys,h),v=[],y=[..._];return i.forEach((e,t)=>{let n=c[t],r=y.find(e=>e.amount===n);if(!r)throw Error(`Could not find newly created UTXO with amount ${n} for recipient ${e}.`);v.push({recipientAddress:e,utxo:r}),y.splice(y.indexOf(r),1)}),{userDepositedUtxos:v,depositTxHash:f,statusId:d}},A=async(e,t,n,r,i,a,o,s)=>{let{jobId:c,signedMessageHash:l}=await h.prepareSolanaTxEnclaveCall(e,{chainId:t,mintAddresses:[n],amountChanges:[-r.amount],relayAddress:a,recipient:i,signer:a,functionName:`transact`,accounts:o,relayerFee:s.flatFee,variableRate:s.variableRate,hinkalInstructions:[],remainingAccounts:[],inputCommitments:[r.getCommitment()],useBlockedUtxos:!0}),{R8:u,S:d}=e.userKeys.signEddsa(BigInt(l));return h.finalizeSolanaTxEnclaveCall(c,{R8:u,S:d})},j=async(c,l,d,f,p,h,g,_,v,b,S,T,E,D)=>{let O=d.erc20TokenAddress;if(f.length===0)throw Error(`userDepositedUtxos must not be empty`);let{originalDeployer:k}=e.networkRegistry[l].contractData;if(!k)throw Error(`missing data`);let j=await c.getRandomRelay(l,!0);if(!j)throw Error(n.transactionErrorCodes.RELAYER_NOT_AVAILABLE);let M=a.getCurrentTimeInSeconds().toString(),N=c.generateProofRemotely,P=N?5:1,F=[];for(let e=0;e<f.length;e+=P){let n=f.slice(e,e+P),a=await Promise.all(n.map(async({recipientAddress:n,utxo:a},u)=>{let f=e+u,h={recipient:n,mint:O===`11111111111111111111111111111111`?void 0:O},_=await C.calculateModifiedFeeStructure(l,d,g[f],p),v=m.constructAdminData(S,l,[O],[g[f]],await c.getEthereumAddress());if(N){let{solanaArgs:e,commitmentValidationData:t}=await A(c,l,O,a,n,j,h,_);return{relayAddress:j,functionName:`transact`,chainId:l,recipientAmount:g[f].toString(),args:e,accounts:h,adminData:v,commitmentValidationData:t,displayRecipient:E?.[f],destinationChainId:D?.chainId,destinationTokenAddress:D?.tokenAddress,destinationTokenAmount:D?.tokenAmounts?.[f]}}let{compressedAddress:y}=s.formatMintAddress(t.solanaNativeAddress),b=new o.Utxo({amount:0n,mintAddress:O,erc20TokenAddress:y,nullifyingKey:c.userKeys.getShieldedPrivateKey(),timeStamp:M,spendingPublicKey:c.userKeys.getSpendingKeyPair().pubSpendingBJJPoint}),x=[a,b],T=[b],k=i.UserKeys.findCorrectRandomization(r.randomBigInt(31),c.userKeys.getShieldedPrivateKey()),P={tokenNumber:1,nullifierAmount:x.length,outputAmount:T.length},{proofAArr:F,proofBArr:I,proofCArr:L,publicInputsArr:R,commitmentValidationData:z,rootHashHinkalIndex:B,encryptedOutputs:V}=await w.constructSolanaZkProof(c.merkleTreeHinkalByChain[l],c.userKeys,[O],[x],[T],k,_.flatFee,_.variableRate,n,j,P,void 0,l);return{relayAddress:j,functionName:`transact`,chainId:l,recipientAmount:g[f].toString(),args:{proofAArr:F,proofBArr:I,proofCArr:L,publicInputsArr:R,encryptedOutputs:V,relayerFee:_.flatFee.toString(),dimensions:P,rootHashIndex:B.toString()},accounts:h,adminData:v,commitmentValidationData:z,displayRecipient:E?.[f],destinationChainId:D?.chainId,destinationTokenAddress:D?.tokenAddress,destinationTokenAmount:D?.tokenAmounts?.[f]}}));F.push(...a)}await x.safeUpdateDepositAndWithdrawStatus({id:_,chainId:l,hashedEthereumAddress:h,phase:u.DepositAndWithdrawPhase.BEFORE_SCHEDULE_WITHDRAW});let I=await y.solanaTransactCallRelayerBatch(l,F,h,v,b,T);return await x.safeUpdateDepositAndWithdrawStatus({id:_,chainId:l,hashedEthereumAddress:h,phase:u.DepositAndWithdrawPhase.AFTER_SCHEDULE_WITHDRAW,scheduleId:I}),I},M=async(e,t,n,r,i,a,o,s,u,f,p)=>{let m=d.validateAndGetChainId([t]),h=t.erc20TokenAddress,g=c.hashEthereumAddress(await e.getEthereumAddressByChain(m)),y=u?c.hashString(u):void 0,b=a??await _.getFeeStructure(m,h,[h],l.ExternalActionId.Transact,[],5n,{mintTo:h,recipient:r[0],nullifierCount:1}),{userDepositedUtxos:x,depositTxHash:S,statusId:C}=await k(e,m,t,n,r,b,g);return await v.waitForDepositedUtxosInMerkleTree(e,m,x),{depositTxHash:S,scheduleId:await j(e,m,t,x,b,g,n,C,i,o,s,y,f,p)}};exports.hinkalSolanaDepositAndWithdraw=M;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DestinationMetadata } from '../../types/bridging-tx.types';
|
|
1
2
|
import { FeeStructure } from '../../types/hinkal.types';
|
|
2
3
|
import { IHinkal } from './IHinkal';
|
|
3
4
|
import { PublicKey } from '@solana/web3.js';
|
|
@@ -13,12 +14,15 @@ export declare const buildMultiPaymentDepositSetup: (hinkal: IHinkal, chainId: n
|
|
|
13
14
|
storageVault: PublicKey;
|
|
14
15
|
merkleAccount: PublicKey;
|
|
15
16
|
amounts: bigint[];
|
|
17
|
+
mintAddressString: string;
|
|
18
|
+
stealthAddressStructures: import('../..').StealthAddressStructure[];
|
|
16
19
|
anchorStealthStructures: import('../..').AnchorStealthAddressStructure[];
|
|
20
|
+
ownEncryptionKey: string;
|
|
17
21
|
};
|
|
18
22
|
export type MultiPaymentDepositSetup = ReturnType<typeof buildMultiPaymentDepositSetup>;
|
|
19
|
-
export declare const buildMultiPaymentDepositBuilder: (setup: MultiPaymentDepositSetup) => import('@coral-xyz/anchor/dist/cjs/program/namespace/methods').MethodsBuilder<import('@coral-xyz/anchor').Idl, import('@coral-xyz/anchor/dist/cjs/idl').IdlInstruction & {
|
|
23
|
+
export declare const buildMultiPaymentDepositBuilder: (setup: MultiPaymentDepositSetup) => Promise<import('@coral-xyz/anchor/dist/cjs/program/namespace/methods').MethodsBuilder<import('@coral-xyz/anchor').Idl, import('@coral-xyz/anchor/dist/cjs/idl').IdlInstruction & {
|
|
20
24
|
name: string;
|
|
21
|
-
}, import('@coral-xyz/anchor/dist/cjs/idl').IdlInstructionAccountItem
|
|
22
|
-
export declare const hinkalSolanaWithdrawBatch: (hinkal: IHinkal, chainId: number, token: ERC20Token, userDepositedUtxos: RecipientUtxo[], feeStructure: FeeStructure, hashedEthereumAddress: string, recipientAmounts: bigint[], statusId: string | undefined, txCompletionTime?: number, ref?: string, action?: AdminTransactionType, hashedDashboardAccountId?: string, displayRecipients?: string[]) => Promise<string>;
|
|
25
|
+
}, import('@coral-xyz/anchor/dist/cjs/idl').IdlInstructionAccountItem>>;
|
|
26
|
+
export declare const hinkalSolanaWithdrawBatch: (hinkal: IHinkal, chainId: number, token: ERC20Token, userDepositedUtxos: RecipientUtxo[], feeStructure: FeeStructure, hashedEthereumAddress: string, recipientAmounts: bigint[], statusId: string | undefined, txCompletionTime?: number, ref?: string, action?: AdminTransactionType, hashedDashboardAccountId?: string, displayRecipients?: string[], destination?: DestinationMetadata) => Promise<string>;
|
|
23
27
|
export declare const hinkalSolanaDepositAndWithdraw: (hinkal: IHinkal, token: ERC20Token, recipientAmounts: bigint[], recipientAddresses: string[], txCompletionTime?: number, feeStructureOverride?: FeeStructure, // Should be passed fee for only one withdraw transaction, multiplication happening in this function
|
|
24
|
-
ref?: string, action?: AdminTransactionType, dashboardAccountId?: string, displayRecipients?: string[]) => Promise<DepositAndSendExtendedResult>;
|
|
28
|
+
ref?: string, action?: AdminTransactionType, dashboardAccountId?: string, displayRecipients?: string[], destination?: DestinationMetadata) => Promise<DepositAndSendExtendedResult>;
|