This guide shows how to test the instruction parsers we've built.
bun run dev:cliThis starts the local Solana RPC server on http://localhost:8899
bun run test:parsersThis will:
- Create 24 different transaction types
- Print results with explorer links
- Show a summary of success/failures
Open http://localhost:3000 and search for the transaction signatures or addresses from the script output.
The script tests the instruction parsers we've implemented:
| Category | Instructions |
|---|---|
| Mint Init | InitializeMint, InitializeMint2 |
| Account Init | InitializeAccount, InitializeAccount2, InitializeAccount3, Create ATA |
| Minting | MintTo, MintToChecked |
| Transfers | Transfer, TransferChecked, Transfer (by delegate) |
| Approvals | Approve, ApproveChecked, Revoke |
| Burning | Burn, BurnChecked |
| Freeze/Thaw | FreezeAccount, ThawAccount |
| Authority | SetAuthority (2 variants) |
| Multisig | InitializeMultisig, InitializeMultisig2 |
| Utilities | SyncNative, CloseAccount |
- InitializeImmutableOwner - Rarely used standalone
- Reallocate - Extension-specific
- AmountToUiAmount - Conversion utility
- UiAmountToAmount - Conversion utility
- InitializeMintCloseAuthority - Extension-specific
- InitializePermanentDelegate - Extension-specific
- InitializeNonTransferableMint - Extension-specific
These can be manually tested or added to the script as needed.
π Testing All Instruction Parsers
π‘ RPC: http://localhost:8899
π Explorer: http://localhost:3000
π° Funding accounts...
π Test Accounts:
Payer: 7xK8DqP9...
Owner: 5mN2rTY8...
Delegate: 9pL43wQX...
π Testing Mint Initialization Instructions...
β
InitializeMint
Signature: 4Zx9K8mPQ...
Explorer: http://localhost:3000/tx/4Zx9K8mPQ...
β
InitializeMint2
Signature: 2Hy7L5nRW...
Explorer: http://localhost:3000/tx/2Hy7L5nRW...
...
π TEST SUMMARY
================================================================================
β
Successful: 24/24
β Failed: 0/24
π Successfully Tested Instructions:
β’ InitializeMint (http://localhost:3000/tx/...)
β’ InitializeMint2 (http://localhost:3000/tx/...)
...
For each transaction, check:
- β
Should show:
"mintToChecked" - β Should NOT show:
"unknown"or raw data
Example for MintToChecked:
{
"type": "mintToChecked",
"info": {
"account": "...",
"mint": "...",
"mintAuthority": "...",
"tokenAmount": {
"amount": "1000000000",
"decimals": 9,
"uiAmount": 1.0,
"uiAmountString": "1"
}
}
}Compare with https://explorer.solana.com to ensure compatibility.
- Source, destination, authority, etc.
- Should have addresses, not just indices
Error: connect ECONNREFUSED 127.0.0.1:8899
Fix: Make sure RPC server is running: bun run dev:cli
Fix: Check that the explorer is running (usually starts with RPC server)
This is expected if:
- Accounts already closed
- Authorities changed
- State conflicts
The script continues and shows which ones succeeded.
Restart the RPC server to get a clean slate:
# Stop with Ctrl+C
bun run dev:cliThen re-run the test script.
You can also test parsers manually:
# Get a transaction
curl -X POST http://localhost:8899 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": [
"SIGNATURE_HERE",
{ "encoding": "jsonParsed" }
]
}'import { Connection } from "@solana/web3.js";
const connection = new Connection("http://localhost:8899");
const tx = await connection.getParsedTransaction("SIGNATURE_HERE");
console.log(JSON.stringify(tx, null, 2));Create a new script in scripts/:
import { Connection, Keypair } from "@solana/web3.js";
import { createMintToInstruction } from "@solana/spl-token";
const connection = new Connection("http://localhost:8899");
// Your test logic hereRun with:
bun run scripts/your-test.tsOnce Phase 2 parsers are added, we'll extend this script to test:
- Transfer Fee instructions
- Interest Bearing instructions
- Confidential Transfer instructions
- etc.
Current: 30/45 core Token-2022 instructions (67%)
After Phase 2: ~80% coverage (including extensions)
- scripts/README.md - Detailed script documentation
- docs/parser-progress.md - Parser status
- docs/parser-enhancement-plan.md - Roadmap
Last Updated: January 2025
Script: scripts/test-all-parsers.ts