{"slug": "your-solana-bot-signs-whatever-the-api-sends-back-here-s-a-one-line-check-npm", "title": "Your Solana bot signs whatever the API sends back. Here's a one-line check (npm + PyPI).", "summary": "A developer released solana-pulse, a zero-dependency npm and PyPI package that adds a pre-signing check to Solana bots and AI agents with wallets. The checkBeforeSign function sends the unsigned transaction to the Solana Pulse gateway, which decodes each step, dry-runs it on mainnet, and returns OK, REVIEW or BLOCK with per-wallet SOL and token changes, blocking drainer approvals, authority changes and expired blockhashes. An optional expected-action parameter returns MISMATCH when a transaction moves a different amount or token than intended, and the tool fails closed when the service is unreachable; the author reports tx_matches confirmed 80 of 80 transfers and 26 of 27 swaps, with the outlier flagged for paying a bot 1.54%.", "body_md": "Over the last few weeks I read the signing code of a lot of open-source Solana bots and agents: trading bots, copy traders, launchpad tools, AI agents with a wallet. The same pattern shows up again and again:\n\n``` js\nconst tx = VersionedTransaction.deserialize(Buffer.from(body.swapTransaction, \"base64\"));\ntx.sign([wallet]);              // signs whatever came back\nawait connection.sendTransaction(tx);\n```\n\nThe transaction is built by someone else (Jupiter's `/swap` or Ultra `/order`, PumpPortal, a launchpad API) and the bot signs it without reading it. Most of the time that's fine. But if the response is ever wrong (a bad config, a compromised endpoint, a proxy in between, a decimals slip), the key signs it anyway: an extra transfer out of the wallet, a different output token, a swap that pays someone else. A bot that trades on its own signs without anyone watching.\n\nSo I packaged the check I use myself into one line.\n\n```\nnpm install solana-pulse\njs\nimport { checkBeforeSign } from \"solana-pulse\";\n\nawait checkBeforeSign(tx);   // throws PulseBlockedError unless Pulse answers OK\ntx.sign([wallet]);\n```\n\nNo dependencies: it uses `fetch` (Node 18+, browsers, edge runtimes) and takes base64, bytes, or a `@solana/web3.js` `Transaction` / `VersionedTransaction`.\n\n```\npip install solana-pulse\npython\nfrom solana_pulse import check_before_sign\n\ncheck_before_sign(swap_tx)   # raises PulseBlocked unless Pulse answers OK\nsigned = VersionedTransaction(swap_tx.message, [keypair])\n```\n\nAlso zero dependencies.\n\n`checkBeforeSign` sends the **unsigned** transaction to [Solana Pulse](https://solana-pulse-gateway-1021990235790.us-central1.run.app/), which decodes every step, dry-runs it on live mainnet, and answers **OK**, **REVIEW** or **BLOCK** with each wallet's SOL and token changes. It blocks drainer approvals, authority changes, accounts closed to someone else, transactions that would fail, and expired blockhashes.\n\nFor swaps and transfers you can go one step further and say what you *meant*:\n\n```\n// Jupiter swap: sells exactly 0.5 SOL and pays the bought USDC back to your own wallet, nothing else.\nawait checkBeforeSign(tx, { expected: { action: \"swap\", sell: \"SOL\", amount: \"0.5\", buy: USDC_MINT } });\n\n// Transfer built from \"send 5 USDC to X\":\nawait checkBeforeSign(tx, { expected: { token: USDC_MINT, amount: \"5\", to: recipient } });\n```\n\nIf the transaction moves a different amount, a different token, pays someone else, or does anything extra, you get `MISMATCH` and the field that's off.\n\n**Fail-closed by design:** if Pulse can't be reached, `checkBeforeSign` throws too. \"Not checked\" is never treated as \"safe\".\n\n`tx_matches` confirmed 80 of 80 transfers and 26 of 27 swaps. The 27th paid a bot 1.54%, so it was flagged.\nIt's a small benchmark, not a proof, and \"OK\" means none of the traps Pulse knows about are present. No check can promise a transaction is safe.\n\nEach tool gives **25 free calls a day** per caller, no key needed. After that a check costs **$0.02 USDC**, paid per request with [x402](https://github.com/x402-foundation/x402). Calls that fail are never charged.\n\n`npm install agentkit-solana-pulse` adds `check_tx`, `token_safety` and a checked sign-and-send action.`npm install elizaos-plugin-solana-pulse`.` https://solana-pulse-gateway-1021990235790.us-central1.run.app/mcp`.\nIf you'd rather not depend on an outside service, the same idea works with plain RPC: call `simulateTransaction` with your wallet in `accounts` and compare the balance changes to the quote before signing. Please do *something* before that `.sign()`.\n\nQuestions or a signing flow you want a second pair of eyes on? Ask in the comments. Code: [GitHub](https://github.com/Timothymycompc/solana-pulse-ai-agent-gateway) · [npm](https://www.npmjs.com/package/solana-pulse) · [PyPI](https://pypi.org/project/solana-pulse/)", "url": "https://wpnews.pro/news/your-solana-bot-signs-whatever-the-api-sends-back-here-s-a-one-line-check-npm", "canonical_source": "https://dev.to/timothymycompc/your-solana-bot-signs-whatever-the-api-sends-back-heres-a-one-line-check-npm-pypi-5d0o", "published_at": "2026-11-15 23:36:57+00:00", "updated_at": "2026-11-15 23:50:59.617927+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["Solana Pulse", "Jupiter", "PumpPortal", "solana-pulse", "x402", "agentkit-solana-pulse", "elizaos-plugin-solana-pulse"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/your-solana-bot-signs-whatever-the-api-sends-back-here-s-a-one-line-check-npm", "markdown": "https://wpnews.pro/news/your-solana-bot-signs-whatever-the-api-sends-back-here-s-a-one-line-check-npm.md", "text": "https://wpnews.pro/news/your-solana-bot-signs-whatever-the-api-sends-back-here-s-a-one-line-check-npm.txt", "jsonld": "https://wpnews.pro/news/your-solana-bot-signs-whatever-the-api-sends-back-here-s-a-one-line-check-npm.jsonld"}}