From a85ecea556c49aabec48ad8007c8ea4cb0bbed2c Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 3 Aug 2026 14:31:45 -0700 Subject: [PATCH] Add more RPC endpoints to schema. --- src/lib/rpc/account_representative.ts | 8 ++++++ src/lib/rpc/accounts_balances.ts | 16 +++++++++++ src/lib/rpc/accounts_frontiers.ts | 19 +++++++++++++ src/lib/rpc/accounts_representatives.ts | 18 ++++++++++++ src/lib/rpc/block_info.ts | 24 ++++++++-------- src/lib/rpc/blocks_info.ts | 37 +++++++++++++++++++++++++ src/lib/rpc/process.ts | 14 +++++----- src/lib/rpc/schema.ts | 10 +++++++ 8 files changed, 127 insertions(+), 19 deletions(-) create mode 100644 src/lib/rpc/account_representative.ts create mode 100644 src/lib/rpc/accounts_balances.ts create mode 100644 src/lib/rpc/accounts_frontiers.ts create mode 100644 src/lib/rpc/accounts_representatives.ts create mode 100644 src/lib/rpc/blocks_info.ts diff --git a/src/lib/rpc/account_representative.ts b/src/lib/rpc/account_representative.ts new file mode 100644 index 0000000..3ea15a7 --- /dev/null +++ b/src/lib/rpc/account_representative.ts @@ -0,0 +1,8 @@ +//! SPDX-FileCopyrightText: 2026 Chris Duncan +//! SPDX-License-Identifier: GPL-3.0-or-later + +export const account_representative = Object.freeze({ + fields: [ + 'representative', + ], +}) diff --git a/src/lib/rpc/accounts_balances.ts b/src/lib/rpc/accounts_balances.ts new file mode 100644 index 0000000..ecf49b1 --- /dev/null +++ b/src/lib/rpc/accounts_balances.ts @@ -0,0 +1,16 @@ +//! SPDX-FileCopyrightText: 2026 Chris Duncan +//! SPDX-License-Identifier: GPL-3.0-or-later + +export const accounts_balances = Object.freeze({ + fields: [ + 'balances', + ], + balances: { + address: { + fields: [ + 'balance', + 'receivable', + ], + }, + }, +}) diff --git a/src/lib/rpc/accounts_frontiers.ts b/src/lib/rpc/accounts_frontiers.ts new file mode 100644 index 0000000..90ac81f --- /dev/null +++ b/src/lib/rpc/accounts_frontiers.ts @@ -0,0 +1,19 @@ +//! SPDX-FileCopyrightText: 2026 Chris Duncan +//! SPDX-License-Identifier: GPL-3.0-or-later + +export const accounts_frontiers = Object.freeze({ + fields: [ + 'errors', + 'frontiers', + ], + errors: { + address: { + error: {}, + }, + }, + frontiers: { + address: { + hash: {}, + }, + }, +}) diff --git a/src/lib/rpc/accounts_representatives.ts b/src/lib/rpc/accounts_representatives.ts new file mode 100644 index 0000000..5d58d0e --- /dev/null +++ b/src/lib/rpc/accounts_representatives.ts @@ -0,0 +1,18 @@ +//! SPDX-FileCopyrightText: 2026 Chris Duncan +//! SPDX-License-Identifier: GPL-3.0-or-later + +export const accounts_representatives = Object.freeze({ + fields: [ + 'representatives', + ], + errors: { + address: { + error: {}, + }, + }, + representatives: { + address: { + representative: {}, + }, + }, +}) diff --git a/src/lib/rpc/block_info.ts b/src/lib/rpc/block_info.ts index f286d06..fc2ec56 100644 --- a/src/lib/rpc/block_info.ts +++ b/src/lib/rpc/block_info.ts @@ -2,6 +2,18 @@ //! SPDX-License-Identifier: GPL-3.0-or-later export const block_info = Object.freeze({ + fields: [ + 'amount', + 'balance', + 'block_account', + 'confirmed', + 'contents', + 'height', + 'linked_account', + 'local_timestamp', + 'subtype', + 'successor', + ], contents: { fields: [ 'account', @@ -15,16 +27,4 @@ export const block_info = Object.freeze({ 'work', ], }, - fields: [ - 'amount', - 'balance', - 'block_account', - 'confirmed', - 'contents', - 'height', - 'linked_account', - 'local_timestamp', - 'subtype', - 'successor', - ], }) diff --git a/src/lib/rpc/blocks_info.ts b/src/lib/rpc/blocks_info.ts new file mode 100644 index 0000000..532dc27 --- /dev/null +++ b/src/lib/rpc/blocks_info.ts @@ -0,0 +1,37 @@ +//! SPDX-FileCopyrightText: 2026 Chris Duncan +//! SPDX-License-Identifier: GPL-3.0-or-later + +export const blocks_info = Object.freeze({ + fields: [ + 'blocks', + ], + blocks: { + hash: { + fields: [ + 'amount', + 'balance', + 'block_account', + 'confirmed', + 'contents', + 'height', + 'linked_account', + 'local_timestamp', + 'subtype', + 'successor', + ], + contents: { + fields: [ + 'account', + 'balance', + 'link', + 'link_as_account', + 'previous', + 'representative', + 'signature', + 'type', + 'work', + ], + }, + }, + }, +}) diff --git a/src/lib/rpc/process.ts b/src/lib/rpc/process.ts index 99461d4..776bc9b 100644 --- a/src/lib/rpc/process.ts +++ b/src/lib/rpc/process.ts @@ -2,6 +2,13 @@ //! SPDX-License-Identifier: GPL-3.0-or-later export const process = Object.freeze({ + fields: [ + 'action', + 'async', + 'block', + 'json_block', + 'subtype', + ], block: { fields: [ 'account', @@ -15,11 +22,4 @@ export const process = Object.freeze({ 'work', ], }, - fields: [ - 'action', - 'async', - 'block', - 'json_block', - 'subtype', - ], }) diff --git a/src/lib/rpc/schema.ts b/src/lib/rpc/schema.ts index a88be1f..d4655b7 100644 --- a/src/lib/rpc/schema.ts +++ b/src/lib/rpc/schema.ts @@ -1,11 +1,21 @@ //! SPDX-FileCopyrightText: 2026 Chris Duncan //! SPDX-License-Identifier: GPL-3.0-or-later import { account_info } from './account_info' +import { account_representative } from './account_representative' +import { accounts_balances } from './accounts_balances' +import { accounts_frontiers } from './accounts_frontiers' +import { accounts_representatives } from './accounts_representatives' import { block_info } from './block_info' +import { blocks_info } from './blocks_info' import { process } from './process' export const Schema = Object.freeze({ account_info, + account_representative, + accounts_balances, + accounts_frontiers, + accounts_representatives, block_info, + blocks_info, process, }) -- 2.52.0