Skip to content

Commit

Permalink
Merge pull request #3 from smartcontractkit/feature/reset
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryNguyen5 committed Sep 13, 2022
2 parents 35b7f44 + c6c81c1 commit 075de23
Show file tree
Hide file tree
Showing 8 changed files with 371 additions and 38 deletions.
13 changes: 13 additions & 0 deletions .changeset/many-timers-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@smartcontractkit/operator-ui': minor
---

Add "Key Admin Override" modal

The `/keys` page in Operator UI now exposes several admin commands, namely:

- An "abandon" checkbox to abandon all current transactions
- Enable/disable a key for a given chain
- Manually set the nonce for a key.

See [this PR](https://github.com/smartcontractkit/chainlink/pull/7406) for a screenshot example.
15 changes: 14 additions & 1 deletion @types/core/store/models.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ declare module 'core/store/models' {
httpURL: string
wsURL: string
}
export interface EVMKeysChainRequest {
address: string
evmChainID: string
nextNonce: ?integer
abandon: ?boolean
enabled: ?boolean
}

export type Chain = {
config: Record<string, JSONPrimitive>
Expand All @@ -80,6 +87,13 @@ declare module 'core/store/models' {
state: string
}

export type EVMKey = {
evmChainID: string
address: string
disabled: boolean
nonce: integer
}

// We really need to change the API for this. It not only returns levels but
// true/false for IsSQLEnabled
export type LogConfigLevel =
Expand Down Expand Up @@ -147,4 +161,3 @@ declare module 'core/store/models' {
spec: string
}
}

32 changes: 32 additions & 0 deletions src/api/v2/evmKeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as jsonapi from 'utils/json-api-client'
import * as models from 'core/store/models'

export const ENDPOINT = '/v2/keys/evm/chain'

export class EVMKeys {
constructor(private api: jsonapi.Api) {}

public chain = (
request: models.EVMKeysChainRequest,
): Promise<jsonapi.ApiResponse<models.EVMKey>> => {
const query = new URLSearchParams()

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))
}
if (request.enabled !== null) {
query.append('enabled', String(request.enabled))
}

const endpoint = ENDPOINT + '?' + query.toString()

return this.api.createResource<models.EVMKeysChainRequest, models.EVMKey>(
endpoint,
)()
}
}
2 changes: 2 additions & 0 deletions src/api/v2/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Api } from 'utils/json-api-client'
import { BulkDeleteRuns } from './bulkDeleteRuns'
import { Chains } from './chains'
import { EVMKeys } from './evmKeys'
import { Jobs } from './jobs'
import { LogConfig } from './logConfig'
import { Nodes } from './nodes'
Expand All @@ -15,4 +16,5 @@ export class V2 {
public nodes = new Nodes(this.api)
public jobs = new Jobs(this.api)
public webauthn = new WebAuthn(this.api)
public evmKeys = new EVMKeys(this.api)
}
Loading

0 comments on commit 075de23

Please sign in to comment.