{
- 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 {