Skip to content

Commit

Permalink
remove nonce manual override from UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Farber98 committed Oct 2, 2024
1 parent b940c8d commit c41310f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
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
27 changes: 1 addition & 26 deletions src/screens/KeyManagement/EVMAccountRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,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 +123,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 +142,16 @@ 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,
) {
apiCall({
evmChainID: ethKey.chain.id,
address: ethKey.address,
nextNonce,
abandon,
enabled,
})
Expand Down Expand Up @@ -226,20 +215,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

0 comments on commit c41310f

Please sign in to comment.