diff --git a/packages/neuron-ui/src/components/History/RowExtend.tsx b/packages/neuron-ui/src/components/History/RowExtend.tsx index 8012a6c6b7..d5e4088756 100644 --- a/packages/neuron-ui/src/components/History/RowExtend.tsx +++ b/packages/neuron-ui/src/components/History/RowExtend.tsx @@ -84,6 +84,10 @@ const RowExtend = ({ column, columns, isMainnet, id, bestBlockNumber, isWatchOnl useEffect(() => { setAmendabled(false) + // @ts-ignore + getOnChainTransaction(hash).then(res => { + console.log('OnChainTransaction----', res) + }) if (status !== 'success' && column.type !== 'receive' && !isWatchOnly) { getOnChainTransaction(hash).then(tx => { // @ts-expect-error Replace-By-Fee (RBF) diff --git a/packages/neuron-wallet/src/services/transaction-sender.ts b/packages/neuron-wallet/src/services/transaction-sender.ts index a0681e4673..4e2938dd79 100644 --- a/packages/neuron-wallet/src/services/transaction-sender.ts +++ b/packages/neuron-wallet/src/services/transaction-sender.ts @@ -58,6 +58,9 @@ interface PathAndPrivateKey { privateKey: string } +// @ts-ignore +let arr = [] + export default class TransactionSender { static MULTI_SIGN_ARGS_LENGTH = 58 @@ -97,24 +100,56 @@ export default class TransactionSender { } public async broadcastTx(walletID: string = '', tx: Transaction, amendHash = '') { + arr.push({ walletID, tx, amendHash }) + // @ts-ignore + logger.info('arr----', arr) + if (arr.length % 2 !== 0) { + return Promise.resolve('') + } + // @ts-ignore + logger.info('arr--process---', arr) const currentNetwork = NetworksService.getInstance().getCurrent() const rpc = generateRPC(currentNetwork.remote, currentNetwork.type) - await rpc.sendTransaction(tx.toSDKRawTransaction(), 'passthrough') - const txHash = tx.hash! - await TransactionPersistor.saveSentTx(tx, txHash) - await MultisigService.saveSentMultisigOutput(tx) - if (amendHash) { - await AmendTransactionService.save(txHash, amendHash) - } + // @ts-ignore + arr.slice(-2).forEach(async item => { + // @ts-ignore + await rpc.sendTransaction(item.tx.toSDKRawTransaction(), 'passthrough') + const txHash = item.tx.hash! - if (walletID) { - const wallet = WalletService.getInstance().get(walletID) - await wallet.checkAndGenerateAddresses() - } - return txHash + await TransactionPersistor.saveSentTx(item.tx, txHash) + await MultisigService.saveSentMultisigOutput(item.tx) + if (item.amendHash) { + await AmendTransactionService.save(txHash, item.amendHash) + } + + if (item.walletID) { + const wallet = WalletService.getInstance().get(item.walletID) + await wallet.checkAndGenerateAddresses() + } + }) + return tx.hash! } + // public async broadcastTx(walletID: string = '', tx: Transaction, amendHash = '') { + // const currentNetwork = NetworksService.getInstance().getCurrent() + // const rpc = generateRPC(currentNetwork.remote, currentNetwork.type) + // await rpc.sendTransaction(tx.toSDKRawTransaction(), 'passthrough') + // const txHash = tx.hash! + + // await TransactionPersistor.saveSentTx(tx, txHash) + // await MultisigService.saveSentMultisigOutput(tx) + // if (amendHash) { + // await AmendTransactionService.save(txHash, amendHash) + // } + + // if (walletID) { + // const wallet = WalletService.getInstance().get(walletID) + // await wallet.checkAndGenerateAddresses() + // } + // return txHash + // } + public async sign( walletID: string = '', transaction: Transaction,