Skip to content

Commit

Permalink
remove adjustable nonce setting (always on), fixed width for nonce to… (
Browse files Browse the repository at this point in the history
  • Loading branch information
mholtzman authored Feb 17, 2023
1 parent 19e1598 commit 684939a
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 145 deletions.
34 changes: 0 additions & 34 deletions app/dash/Notify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,6 @@ class Notify extends React.Component {
)
}

nonceWarning() {
return (
<div className='notifyBoxWrap' onMouseDown={(e) => e.stopPropagation()}>
<div className='notifyBoxSlide'>
<div className='notifyBox'>
<div className='notifyTitle'>Adjustable Nonce</div>
<div className='notifyBody'>
<div className='notifyBodyBlock notifyBodyBlockBig'>
<div>
Adjusting the nonce of a replacement transaction will cause it to become a new transaction
rather than a replacement, use with caution
</div>
</div>
</div>
<div className='notifyInput'>
<div
className='notifyInputOption notifyInputSingleButton'
onMouseDown={() => link.send('tray:action', 'backDash')}
>
<div className='notifyInputOptionText'>Got it!</div>
</div>
</div>
</div>
</div>
</div>
)
}

gasFeeWarning({ req = {}, feeUSD = '0.00', currentSymbol = 'ETH' }) {
return (
<div className='notifyBoxWrap' onMouseDown={(e) => e.stopPropagation()}>
Expand Down Expand Up @@ -498,12 +470,6 @@ class Notify extends React.Component {
)
} else if (notify === 'betaDisclosure') {
return <div className='notify cardShow'>{this.betaDisclosure()}</div>
} else if (notify === 'nonceWarning') {
return (
<div className='notify cardShow' onMouseDown={() => link.send('tray:action', 'backDash')}>
{this.nonceWarning()}
</div>
)
} else if (notify === 'gasFeeWarning') {
return <div className='notify cardShow'>{this.gasFeeWarning(notifyData)}</div>
} else if (notify === 'noSignerWarning') {
Expand Down
25 changes: 0 additions & 25 deletions app/dash/Settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,31 +154,6 @@ class Settings extends React.Component {
</div>
</div>

<div className='signerPermission localSetting' style={{ zIndex: 208 }}>
<div className='signerPermissionControls'>
<div className='signerPermissionSetting'>Adjustable Nonce</div>
<div
className={
this.store('main.nonceAdjust')
? 'signerPermissionToggle signerPermissionToggleOn'
: 'signerPermissionToggle'
}
onClick={() => {
link.send('tray:action', 'toggleNonceAdjust')
if (!this.store('main.nonceAdjust')) {
link.send('tray:action', 'navDash', {
view: 'notify',
data: { notify: 'nonceWarning', notifyData: {} }
})
}
}}
>
<div className='signerPermissionToggleSwitch' />
</div>
</div>
<div className='signerPermissionDetails'>{"Adds the ability to edit a transaction's nonce"}</div>
</div>

<div className='signerPermission localSetting' style={{ zIndex: 207 }}>
<div className='signerPermissionControls'>
<div className='signerPermissionSetting'>Show Account Name with ENS</div>
Expand Down
92 changes: 45 additions & 47 deletions app/tray/Account/Requests/TransactionRequest/ViewData/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,40 @@ const nonceHasBeenChanged = (req) => {
return req.data.nonce && req.payload.nonce !== req.data.nonce
}

const NonceValue = ({ req, nonce }) => {
return (
<>
<div style={{ width: '24px' }}>{nonce}</div>
<div className='txNonceControl'>
<div
className='txNonceButton txNonceButtonLower'
onMouseDown={() => {
link.send('tray:adjustNonce', req.handlerId, -1)
}}
>
{svg.octicon('chevron-down', { height: 14 })}
</div>
<div
className='txNonceButton txNonceButtonRaise'
onMouseDown={() => link.send('tray:adjustNonce', req.handlerId, 1)}
>
{svg.octicon('chevron-up', { height: 14 })}
</div>
{nonceHasBeenChanged(req) && (
<div
className='txNonceButton txNonceButtonReset'
onMouseDown={() => link.send('tray:resetNonce', req.handlerId)}
>
{svg.octicon('sync', { height: 14 })}
</div>
)}
</div>
</>
)
}

const TextValue = ({ value }) => <span>{value}</span>

const SimpleTxJSON = ({ json, req }) => {
return (
<div className='simpleJson'>
Expand All @@ -32,40 +66,17 @@ const SimpleTxJSON = ({ json, req }) => {
const bIndex = txFieldPriority.indexOf(b)
return aIndex > bIndex ? 1 : aIndex < bIndex ? -1 : 0
})
.map((key, o) => (
<div key={key + o} className='simpleJsonChild'>
<div className=' simpleJsonKey simpleJsonKeyTx'>{key.replace(/([A-Z])/g, ' $1').trim()}</div>
<div className='simpleJsonValue'>
{json[key]}
{key === 'nonce' ? (
<div className='txNonceControl'>
<div
className='txNonceButton txNonceButtonLower'
onMouseDown={() => {
link.send('tray:adjustNonce', req.handlerId, -1)
}}
>
{svg.octicon('chevron-down', { height: 14 })}
</div>
<div
className='txNonceButton txNonceButtonRaise'
onMouseDown={() => link.send('tray:adjustNonce', req.handlerId, 1)}
>
{svg.octicon('chevron-up', { height: 14 })}
</div>
{nonceHasBeenChanged(req) && (
<div
className='txNonceButton txNonceButtonReset'
onMouseDown={() => link.send('tray:resetNonce', req.handlerId)}
>
{svg.octicon('sync', { height: 14 })}
</div>
)}
</div>
) : null}
.map((key, o) => {
const value =
key === 'nonce' ? <NonceValue nonce={json[key]} req={req} /> : <TextValue value={json[key]} />

return (
<div key={key + o} className='simpleJsonChild'>
<div className=' simpleJsonKey simpleJsonKeyTx'>{key.replace(/([A-Z])/g, ' $1').trim()}</div>
<div className='simpleJsonValue'>{value}</div>
</div>
</div>
))}
)
})}
</div>
)
}
Expand All @@ -86,20 +97,6 @@ class ViewData extends React.Component {
}
}

renderNonce() {
const { accountId, handlerId, step } = this.props
const req = this.store('main.accounts', accountId, 'requests', handlerId)
const { data } = req
const tx = { nonce: 'TBD', ...data }
const nonce = tx.nonce
return (
<div className='requestMetaNonce'>
<div className='txNonceLabel'>Nonce</div>
<div className={'txNonceNumber'}>{nonce}</div>
</div>
)
}

renderDecodedData() {
const { req } = this.props
return req.decodedData ? (
Expand Down Expand Up @@ -169,6 +166,7 @@ class ViewData extends React.Component {
const { req } = this.props
const { data } = req
const tx = { nonce: 'TBD', ...data }

return (
<div className='accountViewScroll cardShow'>
{/* <div className='txViewData'>
Expand Down
37 changes: 0 additions & 37 deletions app/tray/Notify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,34 +105,6 @@ class Notify extends React.Component {
)
}

nonceWarning() {
return (
<div className='notifyBoxWrap' onMouseDown={(e) => e.stopPropagation()}>
<div className='notifyBoxSlide'>
<div className='notifyBox'>
<div className='notifyTitle'>Adjustable Nonce</div>
<div className='notifyBody'>
<div className='notifyBodyBlock notifyBodyBlockBig'>
<div>
Adjusting the nonce of a replacement transaction will cause it to become a new transaction
rather than a replacement, use with caution
</div>
</div>
</div>
<div className='notifyInput'>
<div
className='notifyInputOption notifyInputSingleButton'
onMouseDown={() => this.store.notify()}
>
<div className='notifyInputOptionText'>Got it!</div>
</div>
</div>
</div>
</div>
</div>
)
}

gasFeeWarning({ req = {}, feeUSD = '0.00', currentSymbol = 'ETH' }) {
return (
<div className='notifyBoxWrap' onMouseDown={(e) => e.stopPropagation()}>
Expand Down Expand Up @@ -537,15 +509,6 @@ class Notify extends React.Component {
)
} else if (notify === 'betaDisclosure') {
return <div className='notify cardShow'>{this.betaDisclosure()}</div>
} else if (notify === 'nonceWarning') {
return (
<div className='notify cardShow' onMouseDown={() => this.store.notify()}>
{/* <div className='notifyCloseButton' onMouseDown={() => this.store.notify()}>
{'close'}
</div> */}
{this.nonceWarning()}
</div>
)
} else if (notify === 'updateOriginChain') {
return (
<div className='notify cardShow' onMouseDown={() => this.store.notify()}>
Expand Down
1 change: 0 additions & 1 deletion main/store/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ module.exports = {
setLaunch: (u, launch) => u('main.launch', (_) => launch),
toggleLaunch: (u) => u('main.launch', (launch) => !launch),
toggleReveal: (u) => u('main.reveal', (reveal) => !reveal),
toggleNonceAdjust: (u) => u('main.nonceAdjust', (nonceAdjust) => !nonceAdjust),
toggleShowLocalNameWithENS: (u) =>
u('main.showLocalNameWithENS', (showLocalNameWithENS) => !showLocalNameWithENS),
setPermission: (u, address, permission) => {
Expand Down
1 change: 0 additions & 1 deletion main/store/state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ const initial = {
// showUSDValue: main('showUSDValue', true),
launch: main('launch', false),
reveal: main('reveal', false),
nonceAdjust: main('nonceAdjust', false),
showLocalNameWithENS: main('showLocalNameWithENS', false),
autohide: main('autohide', false),
accountCloseLock: main('accountCloseLock', false),
Expand Down

0 comments on commit 684939a

Please sign in to comment.