Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-baths-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it changes response, thought a changeset is needed?

'@solana/kit': patch
---

Add loadedAccountsDataSize to simulateTransaction response
1 change: 1 addition & 0 deletions packages/errors/src/json-rpc-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export interface RpcSimulateTransactionResult {
)[];
}[]
| null;
loadedAccountsDataSize: number | null;
logs: string[] | null;
returnData: {
data: [string, 'base64'];
Expand Down
3 changes: 3 additions & 0 deletions packages/rpc-api/src/__tests__/send-transaction-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ describe('sendTransaction', () => {
accounts: null,
cause: new SolanaError(SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND),
innerInstructions: null,
loadedAccountsDataSize: 0,
logs: [],
returnData: null,
unitsConsumed: 0,
Expand Down Expand Up @@ -283,6 +284,7 @@ describe('sendTransaction', () => {
accounts: null,
cause: new SolanaError(SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE),
innerInstructions: null,
loadedAccountsDataSize: 0,
logs: [],
returnData: null,
unitsConsumed: 0,
Expand Down Expand Up @@ -315,6 +317,7 @@ describe('sendTransaction', () => {
accounts: null,
cause: new SolanaError(SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND),
innerInstructions: null,
loadedAccountsDataSize: 0,
logs: [],
returnData: null,
unitsConsumed: 0,
Expand Down
13 changes: 12 additions & 1 deletion packages/rpc-api/src/__tests__/simulate-transaction-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ describe('simulateTransaction', () => {
accounts: null,
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -284,6 +285,7 @@ describe('simulateTransaction', () => {
accounts: null,
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -324,6 +326,7 @@ describe('simulateTransaction', () => {
accounts: null,
err: 'BlockhashNotFound',
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -364,6 +367,7 @@ describe('simulateTransaction', () => {
accounts: null,
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: {
blockhash: expect.any(String),
Expand Down Expand Up @@ -470,6 +474,7 @@ describe('simulateTransaction', () => {
accounts: null,
err: 'AccountNotFound',
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -520,6 +525,7 @@ describe('simulateTransaction', () => {
],
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -570,6 +576,7 @@ describe('simulateTransaction', () => {
],
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -637,6 +644,7 @@ describe('simulateTransaction', () => {
],
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -688,6 +696,7 @@ describe('simulateTransaction', () => {
],
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -737,7 +746,7 @@ describe('simulateTransaction', () => {
],
err: null,
innerInstructions: null,

loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -793,6 +802,7 @@ describe('simulateTransaction', () => {
],
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down Expand Up @@ -834,6 +844,7 @@ describe('simulateTransaction', () => {
accounts: null,
err: null,
innerInstructions: null,
loadedAccountsDataSize: expect.any(Number),
logs: expect.any(Array),
replacementBlockhash: null,
returnData: null,
Expand Down
1 change: 1 addition & 0 deletions packages/rpc-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ function getAllowedNumericKeypaths(): AllowedNumericKeypaths<RpcApi<SolanaRpcApi
['delinquent', KEYPATH_WILDCARD, 'commission'],
],
simulateTransaction: [
['value', 'loadedAccountsDataSize'],
...jsonParsedAccountsConfigs.map(c => ['value', 'accounts', KEYPATH_WILDCARD, ...c]),
...innerInstructionsConfigs.map(c => ['value', 'innerInstructions', KEYPATH_WILDCARD, ...c]),
],
Expand Down
2 changes: 2 additions & 0 deletions packages/rpc-api/src/simulateTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type WithInnerInstructionsConfig = Readonly<{
type SimulateTransactionApiResponseBase = Readonly<{
/** If the transaction failed, this property will contain the error */
err: TransactionError | null;
/** The number of bytes of all accounts loaded by this transaction */
loadedAccountsDataSize?: number;
/**
* Array of log messages the transaction instructions output during execution, `null` if
* simulation failed before the transaction was able to execute (for example due to an invalid
Expand Down
Loading