Skip to content

Commit

Permalink
refactor(experimental): add empty optional config object to RPC metho…
Browse files Browse the repository at this point in the history
…ds with no params

This fixes an issue where TS incorrectly types their returns as `unknown`

See #1389
  • Loading branch information
mcintyre94 committed Jul 17, 2023
1 parent 0e113c0 commit d73aa68
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 NO_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
NO_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 NO_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
NO_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 NO_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
NO_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 NO_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
NO_CONFIG?: Record<string, never>
): GetMaxShredInsertSlotApiResponse;
}

0 comments on commit d73aa68

Please sign in to comment.