Skip to content

Conversation

@steveluscher
Copy link
Contributor

@steveluscher steveluscher commented Jun 27, 2024

Closes #2763.

Test Plan

Notice how index and stackHeight are number instead of bigint here.

 const { value } = await rpc
    .simulateTransaction(
        'A8VSjQsioqTM0kyF9hiBLl/D7NlMU69OObLMEALuTzERsr/FJIN4YqOe45SUfkXhH0CI6xClzFEa+/V9/vSiFQoKf75MXBgQPY4gzn6iz86ZzhnydQvNcn5sbJZc6xmS9ey7fj6+v5xkqFshX1b/Mg86WH2DO0xK0kjq7+IWi8YEvD9ZHU0X9fO//akP12jMPJJ67DsoEwgPB630jd5qMFMOMlESOql5YHf9zKBMhJYYx2wZAJMSEQfyVwB3lV0KA4ADAQcNDQ4WRO2tB+MVLamVDMyF3NM9vIycJ5ID5PpIfjp5VnCuCoZk81s1sWU+MG/teETSzT0CK69Xbi9jn/suK3F7CmuzKkWQgpJ5e5NZRWj4wiXXxozEFV8KQyFP9RZQUDVBFHMYdkG3nmJJ/WeMvFrr+E6Ux/obRtql7j1H4ZCkztUBfGU0Be9QIK1utAyLKHqj3w6JeFK9kEohbF/PhFil1VgBR6+Uey25nUP1St50fjufSPx6NYjlxB12FyxZ3PelAwZGb+UhFzL/7K26csOb57yM5bvF9xJrLEObOkAAAAALcGWx49F8RTidUn9rBMPNWLhscxqg/bVJttG8A/gpRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABqfVFxh70WY12tQEVf3CwMEkxo8hVnWl27rLXwgAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqYyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZBUpTWpkpIQZNJOhxYNo4fHw1td28kruB5B+oQEEFRI2BRFO9Mxdx1WGvTJ9EjfepI2IH1WujnvFkbak/EULbEQUGAAkDZAAAAAAAAAAGAAUC1TEDAAcJAwQBAgACCAkKqgEqABEAAABNeSBORlQgQ29sbGVjdGlvbgMAAABBQkNMAAAAaHR0cHM6Ly9pcGZzLmZpbGViYXNlLmlvL2lwZnMvUW1RWThpSkNMYTJWS3FRZEs1N2lZVUV1OUpvYXNMRFN6N3lBZ0RWWGhoMzd5eQAAAQEAAABrsypFkIKSeXuTWUVo+MIl18aMxBVfCkMhT/UWUFA1QQFkAAEAAAABAAAAAAAAAAAAAAABAAcPBQIDBAcBAgcACAkKCwcHCysAAQAAAAAAAAAADAAFMGdiaDUA',
        {encoding: 'base64', innerInstructions: true, replaceRecentBlockhash: true},
    )
    .send();
> value.innerInstructions
[ { index: 2, instructions: [ [Object] ] } ]
> value.innerInstructions[0].instructions
[
  {
    parsed: { info: [Object], type: 'transfer' },
    program: 'system',
    programId: '11111111111111111111111111111111',
    stackHeight: 2
  }
]

@changeset-bot
Copy link

changeset-bot bot commented Jun 27, 2024

🦋 Changeset detected

Latest commit: 5fa6c60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 37 packages
Name Type
@solana/rpc-api Patch
@solana/rpc Patch
@solana/sysvars Patch
@solana/web3.js-experimental Patch
@solana/rpc-graphql Patch
@solana/transaction-confirmation Patch
@solana/accounts Patch
@solana/addresses Patch
@solana/assertions Patch
@solana/codecs-core Patch
@solana/codecs-data-structures Patch
@solana/codecs-numbers Patch
@solana/codecs-strings Patch
@solana/codecs Patch
@solana/compat Patch
@solana/errors Patch
@solana/fast-stable-stringify Patch
@solana/functional Patch
@solana/instructions Patch
@solana/keys Patch
@solana/options Patch
@solana/programs Patch
@solana/react Patch
@solana/rpc-parsed-types Patch
@solana/rpc-spec-types Patch
@solana/rpc-spec Patch
@solana/rpc-subscriptions-api Patch
@solana/rpc-subscriptions-spec Patch
@solana/rpc-subscriptions-transport-websocket Patch
@solana/rpc-subscriptions Patch
@solana/rpc-transformers Patch
@solana/rpc-transport-http Patch
@solana/rpc-types Patch
@solana/signers Patch
@solana/transaction-messages Patch
@solana/transactions Patch
@solana/webcrypto-ed25519-polyfill Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@steveluscher steveluscher requested review from buffalojoec, lorisleiva and mcintyre94 and removed request for buffalojoec and lorisleiva June 27, 2024 21:37
@steveluscher steveluscher force-pushed the 06-27-correct_the_type_of_innerinstructions_in_json_rpc_errors branch from e40a06c to e06c2fd Compare June 27, 2024 21:41
@steveluscher steveluscher force-pushed the 06-27-you_can_now_request_innerinstructions_with_simulation branch 2 times, most recently from 84924be to 7c30ca8 Compare June 27, 2024 21:42
TransactionForFullMetaInnerInstructionsParsed | TransactionForFullMetaInnerInstructionsUnparsed
>;

export interface SimulateTransactionApi extends RpcApiMethods {
Copy link
Contributor Author

@steveluscher steveluscher Jun 27, 2024

Choose a reason for hiding this comment

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

I had to double the number of overloads here, to be able to express ‘inner instructions on’ and ‘inner instructions off’ :(

This still keeps us under the (current) max of 24, but as soon as we want to add replacedBlockhash to the response, we're hosed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh crap that's rough.

}>;

type TransactionForFullMetaInnerInstructionsUnparsed = Readonly<{
export type TransactionForFullMetaInnerInstructionsUnparsed = Readonly<{
Copy link
Contributor Author

@steveluscher steveluscher Jun 27, 2024

Choose a reason for hiding this comment

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

@mcintyre94, is there a reason we don't use these in getTransaction? They're copy/pasted in, and I feel like there was a reason for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure, but my guess would be that it was before we untangled the rpc packages and it would have caused a circular dependency mess. Probably can be changed now!

Copy link
Contributor Author

cc/ @0xIchigo

@steveluscher steveluscher force-pushed the 06-27-correct_the_type_of_innerinstructions_in_json_rpc_errors branch from e06c2fd to fd7152b Compare June 28, 2024 00:20
@steveluscher steveluscher force-pushed the 06-27-you_can_now_request_innerinstructions_with_simulation branch from 7c30ca8 to 8cc8346 Compare June 28, 2024 00:20
Copy link
Contributor

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Lgtm, but I'm also curious why we weren't using those types.

TransactionForFullMetaInnerInstructionsParsed | TransactionForFullMetaInnerInstructionsUnparsed
>;

export interface SimulateTransactionApi extends RpcApiMethods {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh crap that's rough.

Comment on lines +110 to +113
type SimulateTransactionApiResponseWithInnerInstructions = SolanaRpcResponse<
TransactionForFullMetaInnerInstructionsParsed | TransactionForFullMetaInnerInstructionsUnparsed
>;

Copy link
Contributor

Choose a reason for hiding this comment

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

Starting to regret what I might have signed up for with this comment....

Copy link
Contributor Author

steveluscher commented Jun 28, 2024

Merge activity

  • Jun 27, 5:34 PM PDT: @steveluscher started a stack merge that includes this pull request via Graphite.
  • Jun 27, 5:38 PM PDT: Graphite rebased this pull request as part of a merge.
  • Jun 27, 5:39 PM PDT: @steveluscher merged this pull request with Graphite.

@steveluscher steveluscher force-pushed the 06-27-correct_the_type_of_innerinstructions_in_json_rpc_errors branch from fd7152b to 1d55a13 Compare June 28, 2024 00:35
Base automatically changed from 06-27-correct_the_type_of_innerinstructions_in_json_rpc_errors to master June 28, 2024 00:37
@steveluscher steveluscher force-pushed the 06-27-you_can_now_request_innerinstructions_with_simulation branch from 8cc8346 to 5fa6c60 Compare June 28, 2024 00:37
@steveluscher steveluscher merged commit 91fb1f3 into master Jun 28, 2024
@steveluscher steveluscher deleted the 06-27-you_can_now_request_innerinstructions_with_simulation branch June 28, 2024 00:39
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.94.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Contributor

Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Experimental: simulateTransaction - support innerInstructions

4 participants