@@ -233,7 +233,7 @@ const ConfirmModalToAddr = ({ toaddr, info }: ConfirmModalToAddrProps) => {
233233
234234 return (
235235 < div className = { cstyles . well } >
236- < div className = { [ cstyles . flexspacebetween , cstyles . margintoplarge ] . join ( " " ) } >
236+ < div className = { [ cstyles . flexspacebetween , cstyles . margintopsmall ] . join ( " " ) } >
237237 < div className = { [ styles . confirmModalAddress ] . join ( " " ) } >
238238 { Utils . splitStringIntoChunks ( toaddr . to , 6 ) . join ( " " ) }
239239 </ div >
@@ -257,6 +257,7 @@ const ConfirmModalToAddr = ({ toaddr, info }: ConfirmModalToAddrProps) => {
257257// Internal because we're using withRouter just below
258258type ConfirmModalProps = {
259259 sendPageState : SendPageState ;
260+ totalBalance : TotalBalance ;
260261 info : Info ;
261262 sendTransaction : ( sendJson : SendManyJson [ ] , setSendProgress : ( p ?: SendProgress ) => void ) => Promise < string > ;
262263 clearToAddrs : ( ) => void ;
@@ -268,6 +269,7 @@ type ConfirmModalProps = {
268269
269270const ConfirmModalInternal : React . FC < RouteComponentProps & ConfirmModalProps > = ( {
270271 sendPageState,
272+ totalBalance,
271273 info,
272274 sendTransaction,
273275 clearToAddrs,
@@ -281,6 +283,28 @@ const ConfirmModalInternal: React.FC<RouteComponentProps & ConfirmModalProps> =
281283 const sendingTotal = sendPageState . toaddrs . reduce ( ( s , t ) => s + t . amount , 0.0 ) + defaultFee ;
282284 const { bigPart, smallPart } = Utils . splitZecAmountIntoBigSmall ( sendingTotal ) ;
283285
286+ // Determine the tx privacy level
287+ let privacyLevel = "" ;
288+ // 1. If we're sending to a t-address, it is "transparent"
289+ const isToTransparent = sendPageState . toaddrs . map ( ( to ) => Utils . isTransparent ( to . to ) ) . reduce ( ( p , c ) => p || c , false ) ;
290+ if ( isToTransparent ) {
291+ privacyLevel = "Transparent" ;
292+ } else {
293+ // 2. If we're sending to sapling or orchard, and don't have enough funds in the pool, it is "AmountsRevealed"
294+ const toSapling = sendPageState . toaddrs
295+ . map ( ( to ) => ( Utils . isSapling ( to . to ) ? to . amount : 0 ) )
296+ . reduce ( ( s , c ) => s + c , 0 ) ;
297+ const toOrchard = sendPageState . toaddrs
298+ . map ( ( to ) => ( Utils . isUnified ( to . to ) ? to . amount : 0 ) )
299+ . reduce ( ( s , c ) => s + c , 0 ) ;
300+ if ( toSapling > totalBalance . spendableZ || toOrchard > totalBalance . uabalance ) {
301+ privacyLevel = "AmountsRevealed" ;
302+ } else {
303+ // Else, it is a shielded transaction
304+ privacyLevel = "Shielded" ;
305+ }
306+ }
307+
284308 const sendButton = ( ) => {
285309 // First, close the confirm modal.
286310 closeModal ( ) ;
@@ -367,6 +391,19 @@ const ConfirmModalInternal: React.FC<RouteComponentProps & ConfirmModalProps> =
367391 ) ) }
368392 </ div >
369393 < ConfirmModalToAddr toaddr = { { to : "Fee" , amount : defaultFee , memo : "" } } info = { info } />
394+
395+ < div className = { cstyles . well } >
396+ < div className = { [ cstyles . flexspacebetween , cstyles . margintoplarge ] . join ( " " ) } >
397+ < div className = { [ styles . confirmModalAddress ] . join ( " " ) } > Privacy Level</ div >
398+ < div className = { [ cstyles . verticalflex , cstyles . right ] . join ( " " ) } >
399+ < div className = { cstyles . large } >
400+ < div >
401+ < span > { privacyLevel } </ span >
402+ </ div >
403+ </ div >
404+ </ div >
405+ </ div >
406+ </ div >
370407 </ ScrollPane >
371408
372409 < div className = { cstyles . buttoncontainer } >
@@ -640,6 +677,7 @@ export default class Send extends PureComponent<Props, SendState> {
640677
641678 < ConfirmModal
642679 sendPageState = { sendPageState }
680+ totalBalance = { totalBalance }
643681 info = { info }
644682 sendTransaction = { sendTransaction }
645683 openErrorModal = { openErrorModal }
0 commit comments