From 5bb7d21fc707db2c147b55c15e42726c27a946cd Mon Sep 17 00:00:00 2001 From: steveluscher Date: Thu, 27 Jun 2024 16:32:44 +0000 Subject: [PATCH] Correct the return type of `simulateTransaction` when accounts are not loaded --- .changeset/fast-cars-knock.md | 5 +++++ packages/rpc-api/src/simulateTransaction.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/fast-cars-knock.md diff --git a/.changeset/fast-cars-knock.md b/.changeset/fast-cars-knock.md new file mode 100644 index 00000000000..a929f42677e --- /dev/null +++ b/.changeset/fast-cars-knock.md @@ -0,0 +1,5 @@ +--- +'@solana/rpc-api': patch +--- + +Fixed a TypeScript error where the return value of `simulateTransaction` claimed there was an `accounts` property at the top level when it is in fact `value.accounts` diff --git a/packages/rpc-api/src/simulateTransaction.ts b/packages/rpc-api/src/simulateTransaction.ts index 6c1da83aa2a..9e25cce729c 100644 --- a/packages/rpc-api/src/simulateTransaction.ts +++ b/packages/rpc-api/src/simulateTransaction.ts @@ -127,7 +127,7 @@ export interface SimulateTransactionApi extends RpcApiMethods { simulateTransaction( base58EncodedWireTransaction: Base58EncodedBytes, config?: SigVerifyAndReplaceRecentBlockhashConfig & SimulateTransactionConfigBase, - ): SimulateTransactionApiResponseBase & { accounts: null }; + ): SimulateTransactionApiResponseBase & SolanaRpcResponse<{ readonly accounts: null }>; /** Simulate sending a transaction */ simulateTransaction( @@ -160,5 +160,5 @@ export interface SimulateTransactionApi extends RpcApiMethods { simulateTransaction( base64EncodedWireTransaction: Base64EncodedWireTransaction, config: SigVerifyAndReplaceRecentBlockhashConfig & SimulateTransactionConfigBase & { encoding: 'base64' }, - ): SimulateTransactionApiResponseBase & { accounts: null }; + ): SimulateTransactionApiResponseBase & SolanaRpcResponse<{ readonly accounts: null }>; }