You currently have 0
XEC
@@ -1394,7 +1598,7 @@
}
>
=
$ NaN USD
+
diff --git a/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap b/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap
--- a/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap
+++ b/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap
@@ -3,14 +3,14 @@
exports[`Wallet with BCH balances 1`] = `
Array [
You need some
XEC
in your wallet to create tokens.
,
0
@@ -60,7 +60,7 @@
,
You need at least
@@ -83,14 +83,14 @@
exports[`Wallet with BCH balances and tokens 1`] = `
Array [
You need some
XEC
in your wallet to create tokens.
,
0
@@ -140,7 +140,7 @@
You need at least
@@ -163,14 +163,14 @@
exports[`Wallet with BCH balances and tokens and state field 1`] = `
Array [
$
NaN
@@ -226,10 +226,10 @@
onClick={[Function]}
>
6.001
@@ -261,14 +261,14 @@
exports[`Wallet without BCH balance 1`] = `
Array [
You need some
XEC
in your wallet to create tokens.
,
0
@@ -318,7 +318,7 @@
,
You need at least
@@ -341,14 +341,14 @@
exports[`Without wallet defined 1`] = `
Array [
You need some
XEC
in your wallet to create tokens.
,
0
@@ -398,7 +398,7 @@
,
You need at least
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
@@ -241,9 +241,8 @@
// Here in cashtab, destinationAddress is in bitcoincash: format
// In the API response of tokenInfo, this will be in simpleledger: format
// So, must convert to simpleledger
- const receivingSlpAddress = BCH.SLP.Address.toSLPAddress(
- destinationAddress,
- );
+ const receivingSlpAddress =
+ BCH.SLP.Address.toSLPAddress(destinationAddress);
const { transactionType, sendInputsFull, sendOutputsFull } = tokenInfo;
const sendingTokenAddresses = [];
@@ -393,9 +392,8 @@
try {
hydratedUtxoDetails = await Promise.all(hydrateUtxosPromises);
- const flattenedBatchedHydratedUtxos = flattenBatchedHydratedUtxos(
- hydratedUtxoDetails,
- );
+ const flattenedBatchedHydratedUtxos =
+ flattenBatchedHydratedUtxos(hydratedUtxoDetails);
return flattenedBatchedHydratedUtxos;
} catch (err) {
console.log(`Error in Promise.all(hydrateUtxosPromises)`);
@@ -607,9 +605,8 @@
}
// Generate the OP_RETURN entry for an SLP GENESIS transaction.
- const script = BCH.SLP.TokenType1.generateGenesisOpReturn(
- configObj,
- );
+ const script =
+ BCH.SLP.TokenType1.generateGenesisOpReturn(configObj);
// OP_RETURN needs to be the first output in the transaction.
transactionBuilder.addOutput(script, 0);
@@ -872,6 +869,7 @@
destinationAddress,
sendAmount,
feeInSatsPerByte,
+ optionalOpReturnMsg,
) => {
try {
if (!sendAmount) {
@@ -935,9 +933,8 @@
let isValidChangeAddress;
try {
REMAINDER_ADDR = inputUtxos[0].address;
- isValidChangeAddress = BCH.Address.isCashAddress(
- REMAINDER_ADDR,
- );
+ isValidChangeAddress =
+ BCH.Address.isCashAddress(REMAINDER_ADDR);
} catch (err) {
isValidChangeAddress = false;
}
@@ -945,6 +942,21 @@
REMAINDER_ADDR = wallet.Path1899.cashAddress;
}
+ // Start of building the OP_RETURN output.
+ // only build the OP_RETURN output if the user supplied it
+ if (
+ typeof optionalOpReturnMsg !== 'undefined' &&
+ optionalOpReturnMsg !== ''
+ ) {
+ const script = [
+ BCH.Script.opcodes.OP_RETURN,
+ Buffer.from(`${optionalOpReturnMsg}`),
+ ];
+ const data = BCH.Script.encode(script);
+ transactionBuilder.addOutput(data, 0);
+ }
+ // End of building the OP_RETURN output.
+
// amount to send back to the remainder address.
const remainder = originalAmount.minus(satoshisToSend).minus(txFee);