From 7aa9a47f11408da21289365db6f4b65a6d270cff Mon Sep 17 00:00:00 2001 From: shivaji43 Date: Mon, 25 Nov 2024 18:30:25 +0530 Subject: [PATCH 1/3] added blockheight to BlockResponse and VersionedBlockResponse --- src/connection.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/connection.ts b/src/connection.ts index 950a4a808f21..0434a75eeef8 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -1294,6 +1294,8 @@ export type ParsedTransactionWithMeta = { * A processed block fetched from the RPC API */ export type BlockResponse = { + /** Block height of this block */ + blockHeight: number | null; /** Blockhash of this block */ blockhash: Blockhash; /** Blockhash of this block's parent */ @@ -1410,6 +1412,8 @@ export type ParsedNoneModeBlockResponse = Omit< * A processed block fetched from the RPC API */ export type VersionedBlockResponse = { + /** Block height of this block */ + blockHeight: number | null; /** Blockhash of this block */ blockhash: Blockhash; /** Blockhash of this block's parent */ From 2965d8c33e7ea32ad88448bce02d3df3f19476e9 Mon Sep 17 00:00:00 2001 From: shivaji43 Date: Tue, 26 Nov 2024 01:33:01 +0530 Subject: [PATCH 2/3] implemented superstruct validation --- src/connection.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/connection.ts b/src/connection.ts index 0434a75eeef8..98a124a43afb 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -2554,6 +2554,7 @@ const GetConfirmedBlockRpcResult = jsonRpcResult( ), rewards: optional(array(RewardsResult)), blockTime: nullable(number()), + blockHeight: nullable(number()), }), ), ); @@ -2569,6 +2570,7 @@ const GetBlockSignaturesRpcResult = jsonRpcResult( parentSlot: number(), signatures: array(string()), blockTime: nullable(number()), + blockHeight: nullable(number()), }), ), ); From d7730cd900c2d90645290cb721dcb4467bc2d2c6 Mon Sep 17 00:00:00 2001 From: shivaji43 Date: Tue, 26 Nov 2024 01:44:51 +0530 Subject: [PATCH 3/3] implemented more superstruct validation --- src/connection.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/connection.ts b/src/connection.ts index 98a124a43afb..8dba0e852e86 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -1999,6 +1999,7 @@ const GetConfirmedSignaturesForAddress2RpcResult = jsonRpcResult( err: TransactionErrorResult, memo: nullable(string()), blockTime: optional(nullable(number())), + blockHeight: nullable(number()), }), ), ); @@ -2014,6 +2015,7 @@ const GetSignaturesForAddressRpcResult = jsonRpcResult( err: TransactionErrorResult, memo: nullable(string()), blockTime: optional(nullable(number())), + blockHeight: nullable(number()), }), ), );