Skip to content

Commit

Permalink
refactor(experimental): type reconciliation: GetSupplyApi
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Jul 2, 2024
1 parent e8b8687 commit c8ca790
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions packages/rpc-api/src/getSupply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type GetSupplyConfig = Readonly<{
commitment?: Commitment;
}>;

type GetSupplyApiResponseBase = SolanaRpcResponse<{
type GetSupplyApiResponseBase = Readonly<{
/** Circulating supply in lamports */
circulating: LamportsUnsafeBeyond2Pow53Minus1;
/** Non-circulating supply in lamports */
Expand All @@ -17,21 +17,17 @@ type GetSupplyApiResponseBase = SolanaRpcResponse<{

type GetSupplyApiResponseWithNonCirculatingAccounts = GetSupplyApiResponseBase &
Readonly<{
value: Readonly<{
/** an array of account addresses of non-circulating accounts */
nonCirculatingAccounts: Address[];
}>;
/** an array of account addresses of non-circulating accounts */
nonCirculatingAccounts: Address[];
}>;

type GetSupplyApiResponseWithoutNonCirculatingAccounts = GetSupplyApiResponseBase &
Readonly<{
value: Readonly<{
/** As per the docs:
* "If `excludeNonCirculatingAccountsList` is enabled, the returned array will be empty."
* See: https://solana.com/docs/rpc/http/getsupply
*/
nonCirculatingAccounts: never[];
}>;
/** As per the docs:
* "If `excludeNonCirculatingAccountsList` is enabled, the returned array will be empty."
* See: https://solana.com/docs/rpc/http/getsupply
*/
nonCirculatingAccounts: never[];
}>;

export interface GetSupplyApi extends RpcApiMethods {
Expand All @@ -43,11 +39,11 @@ export interface GetSupplyApi extends RpcApiMethods {
Readonly<{
excludeNonCirculatingAccountsList: true;
}>,
): GetSupplyApiResponseWithoutNonCirculatingAccounts;
): SolanaRpcResponse<GetSupplyApiResponseWithoutNonCirculatingAccounts>;
getSupply(
config?: GetSupplyConfig &
Readonly<{
excludeNonCirculatingAccountsList?: false;
}>,
): GetSupplyApiResponseWithNonCirculatingAccounts;
): SolanaRpcResponse<GetSupplyApiResponseWithNonCirculatingAccounts>;
}

0 comments on commit c8ca790

Please sign in to comment.