Skip to content

Commit

Permalink
Add empty optional config object to RPC methods with no params
Browse files Browse the repository at this point in the history
This fixes an issue where TS incorrectly types their returns as `unknown`

See solana-labs#1389
  • Loading branch information
mcintyre94 committed Jul 14, 2023
1 parent d79809f commit 8fbbc10
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/rpc-core/src/rpc-methods/getEpochSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ type GetEpochScheduleApiResponse = Readonly<{
export interface GetEpochScheduleApi {
/**
* Returns the epoch schedule information from this cluster's genesis config
* Note that the optional config object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getEpochSchedule(): GetEpochScheduleApiResponse;
getEpochSchedule(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
config?: Record<string, never>
): GetEpochScheduleApiResponse;
}
6 changes: 5 additions & 1 deletion packages/rpc-core/src/rpc-methods/getFirstAvailableBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ type GetFirstAvailableBlockApiResponse = Slot;
export interface GetFirstAvailableBlockApi {
/**
* Returns the slot of the lowest confirmed block that has not been purged from the ledger
* Note that the optional config object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getFirstAvailableBlock(): GetFirstAvailableBlockApiResponse;
getFirstAvailableBlock(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
config?: Record<string, never>
): GetFirstAvailableBlockApiResponse;
}
6 changes: 5 additions & 1 deletion packages/rpc-core/src/rpc-methods/getMaxRetransmitSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ type GetMaxRetransmitSlotApiResponse = Slot;
export interface GetMaxRetransmitSlotApi {
/**
* Get the max slot seen from retransmit stage.
* Note that the optional config object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getMaxRetransmitSlot(): GetMaxRetransmitSlotApiResponse;
getMaxRetransmitSlot(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
config?: Record<string, never>
): GetMaxRetransmitSlotApiResponse;
}
6 changes: 5 additions & 1 deletion packages/rpc-core/src/rpc-methods/getMaxShredInsertSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ type GetMaxShredInsertSlotApiResponse = Slot;
export interface GetMaxShredInsertSlotApi {
/**
* Get the max slot seen from after shred insert.
* Note that the optional config object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getMaxShredInsertSlot(): GetMaxShredInsertSlotApiResponse;
getMaxShredInsertSlot(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
config?: Record<string, never>
): GetMaxShredInsertSlotApiResponse;
}

0 comments on commit 8fbbc10

Please sign in to comment.