Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BCFR-963] - Remove Nonce Manual Override setting from UI #89

Merged
merged 7 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/friendly-cooks-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smartcontractkit/operator-ui': patch
---

remove Next Nonce Manual Override UI setting as it is no longer connected to any backend functionality. This reduces UI complexity and avoids confussions.
2 changes: 0 additions & 2 deletions @types/core/store/models.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ declare module 'core/store/models' {
export interface EVMKeysChainRequest {
address: string
evmChainID: string
nextNonce: ?integer
abandon: ?boolean
enabled: ?boolean
}
Expand Down Expand Up @@ -91,7 +90,6 @@ declare module 'core/store/models' {
evmChainID: string
address: string
disabled: boolean
nonce: integer
}

// We really need to change the API for this. It not only returns levels but
Expand Down
3 changes: 0 additions & 3 deletions src/api/v2/evmKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ export class EVMKeys {

query.append('address', request.address)
query.append('evmChainID', request.evmChainID)
if (request.nextNonce !== null) {
query.append('nextNonce', request.nextNonce)
}
if (request.abandon !== null) {
query.append('abandon', String(request.abandon))
}
Expand Down
33 changes: 2 additions & 31 deletions src/screens/KeyManagement/EVMAccountRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TableRow from '@material-ui/core/TableRow'
import Typography from '@material-ui/core/Typography'
import Dialog from '@material-ui/core/Dialog'
import Grid from '@material-ui/core/Grid'
import TextField from '@material-ui/core/TextField'
import Checkbox from '@material-ui/core/Checkbox'
import FormGroup from '@material-ui/core/FormGroup'
import FormControlLabel from '@material-ui/core/FormControlLabel'
Expand Down Expand Up @@ -95,20 +94,17 @@ interface Props {
function apiCall({
evmChainID,
address,
nextNonce,
abandon,
enabled,
}: {
evmChainID: string
address: string
nextNonce: bigint | null
abandon: boolean
enabled: boolean
}): Promise<ApiResponse<EVMKey>> {
const definition: EVMKeysChainRequest = {
evmChainID,
address,
nextNonce,
abandon,
enabled,
}
Expand All @@ -126,22 +122,17 @@ const UnstyledEVMAccountRow: React.FC<Props> = ({

const [modalOpen, setModalOpen] = useState(false)
const [enabled, setEnabled] = useState(!ethKey.isDisabled)
const [nextNonce, setNextNonce] = useState<bigint | null>(null)
const [abandon, setAbandon] = useState(false)

const onSubmit = (event: React.SyntheticEvent) => {
event.preventDefault()
handleUpdate(nextNonce, abandon, enabled)
handleUpdate(abandon, enabled)
}

const handleEnabledCheckboxChange = () => {
setEnabled(!enabled)
}

const handleNextNonceFieldChange = (event: any) => {
setNextNonce(event.target.value)
}

const handleAbandonCheckboxChange = () => {
setAbandon(!abandon)
}
Expand All @@ -150,19 +141,13 @@ const UnstyledEVMAccountRow: React.FC<Props> = ({
setModalOpen(false)
// reset state
setAbandon(false)
setNextNonce(null)
setEnabled(!ethKey.isDisabled)
}

async function handleUpdate(
nextNonce: bigint | null,
abandon: boolean,
enabled: boolean,
) {
async function handleUpdate(abandon: boolean, enabled: boolean) {
apiCall({
evmChainID: ethKey.chain.id,
address: ethKey.address,
nextNonce,
abandon,
enabled,
})
Expand Down Expand Up @@ -226,20 +211,6 @@ const UnstyledEVMAccountRow: React.FC<Props> = ({
label="Enabled"
/>
</FormGroup>
<FormGroup>
<FormControlLabel
className={classes.infoText}
color="secondary"
control={
<TextField
name="nextNonceField"
type="number"
onChange={handleNextNonceFieldChange}
/>
}
label="Next nonce manual override (optional)"
/>
</FormGroup>
<FormGroup>
<FormControlLabel
className={classes.infoText}
Expand Down
Loading