@@ -20,7 +20,7 @@ import DeterministicIcon from './DeterministicIcon';
2020import Modal from './Modal' ;
2121
2222type Props = State & {
23- noBackArrow ?: boolean ;
23+ thirdPartyTx ?: boolean ;
2424 transaction ?: Transaction ;
2525 contractFuncParams ?: any [ ] ;
2626 onBack ?: ( ) => void ; // clicking back arrow
@@ -55,7 +55,7 @@ const Field = ({
5555 ) ;
5656
5757const TransactionModal = ( {
58- noBackArrow ,
58+ thirdPartyTx ,
5959 unsentBlock,
6060 onBack,
6161 onCancel = onBack ,
@@ -119,7 +119,7 @@ const TransactionModal = ({
119119 { ( ! ! transaction || ! ! unsentBlock ) && (
120120 < Modal
121121 fullscreen
122- noBackArrow = { noBackArrow || sendingTx }
122+ noBackArrow = { thirdPartyTx }
123123 heading = { unsentBlock ? i18n . confirmTransaction : i18n . transaction }
124124 onClose = { ( ) => onBack && onBack ( ) }
125125 className = "flex flex-col"
@@ -225,14 +225,8 @@ const TransactionModal = ({
225225 < Button theme = "highlight" label = { i18n . close } onClick = { onCloseAfterSend ! } />
226226 ) : (
227227 < >
228+ < Button theme = "foreground" label = { i18n . cancel } onClick = { onCancel ! } />
228229 < Button
229- disabled = { ! ! sendingTx }
230- theme = "foreground"
231- label = { i18n . cancel }
232- onClick = { onCancel ! }
233- />
234- < Button
235- disabled = { ! ! sendingTx }
236230 theme = "highlight"
237231 label = { i18n . confirm }
238232 onClick = { async ( ) => {
@@ -263,32 +257,35 @@ const TransactionModal = ({
263257 ) ;
264258 }
265259
266- const sanitizedBlock : AccountBlockBlock = {
267- // Don't want to send `block: res` in case the type of `res` changes and includes `privateKey`
268- // This ensures the private key is never sent to the content script
269- blockType : res . blockType ,
270- address : res . address ,
271- fee : res . fee ,
272- data : res . data ,
273- sendBlockHash : res . sendBlockHash ,
274- toAddress : res . toAddress ,
275- tokenId : res . tokenId ,
276- amount : res . amount ,
277- height : res . height ,
278- previousHash : res . previousHash ,
279- difficulty : res . difficulty ,
280- nonce : res . nonce ,
281- signature : res . signature ,
282- publicKey : res . publicKey ,
283- hash : res . hash ,
284- } ;
285- triggerInjectedScriptEvent ( {
286- type : 'writeAccountBlock' ,
287- payload : { block : sanitizedBlock } ,
288- } ) ;
260+ if ( thirdPartyTx ) {
261+ const sanitizedBlock : AccountBlockBlock = {
262+ // Don't want to send `block: res` in case the type of `res` changes and includes `privateKey`
263+ // This ensures the private key is never sent to the content script
264+ blockType : res . blockType ,
265+ address : res . address ,
266+ fee : res . fee ,
267+ data : res . data ,
268+ sendBlockHash : res . sendBlockHash ,
269+ toAddress : res . toAddress ,
270+ tokenId : res . tokenId ,
271+ amount : res . amount ,
272+ height : res . height ,
273+ previousHash : res . previousHash ,
274+ difficulty : res . difficulty ,
275+ nonce : res . nonce ,
276+ signature : res . signature ,
277+ publicKey : res . publicKey ,
278+ hash : res . hash ,
279+ } ;
280+ triggerInjectedScriptEvent ( {
281+ type : 'writeAccountBlock' ,
282+ payload : { block : sanitizedBlock } ,
283+ } ) ;
284+ }
289285 } catch ( e ) {
290286 console . log ( 'error:' , e ) ;
291287 toastError ( e ) ;
288+ } finally {
292289 sendingTxSet ( false ) ;
293290 }
294291 } }
@@ -299,6 +296,11 @@ const TransactionModal = ({
299296 ) }
300297 </ Modal >
301298 ) }
299+ { sendingTx && (
300+ < Modal spinner onClose = { ( ) => { } } >
301+ { null }
302+ </ Modal >
303+ ) }
302304 </ >
303305 ) ;
304306} ;
0 commit comments