diff --git a/web/cashtab/src/components/Common/StyledCollapse.js b/web/cashtab/src/components/Common/StyledCollapse.js --- a/web/cashtab/src/components/Common/StyledCollapse.js +++ b/web/cashtab/src/components/Common/StyledCollapse.js @@ -51,3 +51,36 @@ } `} `; + +export const AdvancedCollapse = styled(Collapse)` + ${({ disabled = false, ...props }) => + disabled === true + ? ` + background: ${props.theme.buttons.secondary.background} !important; + .ant-collapse-header { + font-size: 18px; + font-weight: normal; + color: ${props.theme.buttons.secondary.color} !important; + svg { + color: ${props.theme.buttons.secondary.color} !important; + } + } + .ant-collapse-arrow { + font-size: 18px; + } + ` + : ` + background: ${props.theme.primary} !important; + .ant-collapse-header { + font-size: 18px; + font-weight: bold; + color: ${props.theme.contrast} !important; + svg { + color: ${props.theme.contrast} !important; + } + } + .ant-collapse-arrow { + font-size: 18px; + } + `} +`; diff --git a/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap b/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap --- a/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap +++ b/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap @@ -2,7 +2,7 @@ exports[`Configure with a wallet 1`] = `

@@ -342,7 +393,7 @@ exports[`Wallet with BCH balances and tokens 1`] = ` Array [
You currently have 0 XEC @@ -369,7 +420,7 @@ } >
= $ NaN USD
+
+
+
+
+ + + + Advanced +
+
+
+
@@ -681,14 +783,14 @@ exports[`Wallet with BCH balances and tokens and state field 1`] = ` Array [
0.06047469 XEC
,
$ NaN @@ -715,7 +817,7 @@ } >
= $ NaN USD
+
+
+
+
+ + + + Advanced +
+
+
+
@@ -1367,7 +1571,7 @@ exports[`Without wallet defined 1`] = ` Array [
You currently have 0 XEC @@ -1394,7 +1598,7 @@ } >
= $ NaN USD
+
+
+
+
+ + + + Advanced +
+
+
+
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 [

0.06047469 XEC
,
$ NaN @@ -226,10 +226,10 @@ onClick={[Function]} >
identicon of tokenId bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba
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);