diff --git a/web/cashtab/src/components/Send/Send.js b/web/cashtab/src/components/Send/Send.js --- a/web/cashtab/src/components/Send/Send.js +++ b/web/cashtab/src/components/Send/Send.js @@ -31,12 +31,7 @@ } from '@components/Common/Atoms'; // Note jestBCH is only used for unit tests; BCHJS must be mocked for jest -const SendBCH = ({ - jestBCH, - passLoadingStatus, - filledAddress, - callbackTxId, -}) => { +const SendBCH = ({ jestBCH, passLoadingStatus }) => { // use balance parameters from wallet.state object and not legacy balances parameter from walletState, if user has migrated wallet // this handles edge case of user with old wallet who has not opened latest Cashtab version yet @@ -71,7 +66,7 @@ const [formData, setFormData] = useState({ dirty: true, value: '', - address: filledAddress || '', + address: '', }); const [queryStringText, setQueryStringText] = useState(null); const [sendBchAddressError, setSendBchAddressError] = useState(false); @@ -205,10 +200,9 @@ BCH, wallet, slpBalancesAndUtxos.nonSlpUtxos, - filledAddress || cleanAddress, + cleanAddress, bchValue, currency.defaultFee, - callbackTxId, ); notification.success({ @@ -440,7 +434,6 @@ > handleAddressChange(e), required: true, - value: filledAddress || formData.address, + value: formData.address, }} >
{ - const { sendBch } = useBCH(); - const BCH = new BCHJS(); - const callback = jest.fn(); - const { - expectedTxId, - expectedHex, - utxos, - wallet, - destinationAddress, - sendAmount, - } = sendBCHMock; - - BCH.RawTransactions.sendRawTransaction = jest - .fn() - .mockResolvedValue(expectedTxId); - expect( - await sendBch( - BCH, - wallet, - utxos, - destinationAddress, - sendAmount, - 1.01, - callback, - ), - ).toBe(`${currency.blockExplorerUrl}/tx/${expectedTxId}`); - expect(BCH.RawTransactions.sendRawTransaction).toHaveBeenCalledWith( - expectedHex, - ); - expect(callback).toHaveBeenCalledWith(expectedTxId); - }); - it(`Throws error if called trying to send one base unit ${currency.ticker} more than available in utxo set`, async () => { const { sendBch } = useBCH(); const BCH = new BCHJS(); diff --git a/web/cashtab/src/hooks/useBCH.js b/web/cashtab/src/hooks/useBCH.js --- a/web/cashtab/src/hooks/useBCH.js +++ b/web/cashtab/src/hooks/useBCH.js @@ -821,11 +821,7 @@ destinationAddress, sendAmount, feeInSatsPerByte, - callbackTxId, - encodedOpReturn, ) => { - // Note: callbackTxId is a callback function that accepts a txid as its only parameter - try { if (!sendAmount) { return null; @@ -873,9 +869,7 @@ transactionBuilder.addInput(txid, vout); inputUtxos.push(utxo); - txFee = encodedOpReturn - ? calcFee(BCH, inputUtxos, 3, feeInSatsPerByte) - : calcFee(BCH, inputUtxos, 2, feeInSatsPerByte); + txFee = calcFee(BCH, inputUtxos, 2, feeInSatsPerByte); if (originalAmount.minus(satoshisToSend).minus(txFee).gte(0)) { break; @@ -909,10 +903,6 @@ throw error; } - if (encodedOpReturn) { - transactionBuilder.addOutput(encodedOpReturn, 0); - } - // add output w/ address and amount to send transactionBuilder.addOutput( BCH.Address.toCashAddress(destinationAddress), @@ -950,10 +940,6 @@ console.log(`${currency.ticker} txid`, txidStr[0]); } let link; - - if (callbackTxId) { - callbackTxId(txidStr); - } if (process.env.REACT_APP_NETWORK === `mainnet`) { link = `${currency.blockExplorerUrl}/tx/${txidStr}`; } else {