feat(plugin-misc): add transaction simulation pre-flight skill - #590
Open
spektre-labs wants to merge 1 commit into
Open
feat(plugin-misc): add transaction simulation pre-flight skill#590spektre-labs wants to merge 1 commit into
spektre-labs wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new
SIMULATE_TRANSACTIONagent skill toplugin-misc: a transaction simulation pre-flight action.Given a base64-encoded serialized transaction, it simulates it against current chain state and returns a clean structured result:
It supports both legacy
TransactionandVersionedTransaction(triesVersionedTransaction.deserializefirst, falls back toTransaction.from), and uses{ sigVerify: false, replaceRecentBlockhash: true }for versioned transactions so unsigned/about-to-be-built transactions can be checked.Why
This is the runtime complement to static safety checks: an agent can dry-run a transaction before signing or sending it.
core/src/utils/send_tx.tssimulates internally as part of sending, but there was no standalone, agent-callable simulation skill — this fills that gap.API
simulateTransactionPreflight(agent, base64Tx, opts?)SIMULATE_TRANSACTION(zod schema{ transaction: string })Both are wired into the misc plugin's
methodsandactions, following the existingottersecintegration pattern (tools/+actions/+ index registration).Fail-safe by design
The tool never throws. Any deserialize or RPC failure resolves to
willSucceed: falsewithsummary: "⛔ could not simulate — do not assume safe", so a caller can never mistake an unsimulated transaction for a safe one.Verification done
pnpm run build:coreandpnpm run build:plugin-misc— clean (CJS + ESM + DTS).biome checkon the new files +index.ts— clean (matches repo style).willSucceed: false, never throws) — passes.@solana/web3.js, already a dependency).