This document outlines the standard procedures for building, deploying, and testing the LazorKit program and its associated SDK.
- Solana Tool Suite (latest stable)
- Rust
- Node.js & npm
- Shank CLI (for IDL generation)
- Codama CLI (for SDK generation)
/program: Rust smart contract (Pinocchio-based)- Highly optimized, zero-copy architecture (
NoPadding).
- Highly optimized, zero-copy architecture (
/sdk/lazorkit-ts: TypeScript SDK generated via Codama.- Contains generated instructions for interaction with the contract.
/tests-real-rpc: Integration tests running against a live RPC (Devnet/Localhost)./scripts: Automation utility scripts (e.g., syncing program IDs).
Whenever you redeploy the program to a new address, run the sync script to update all references across Rust, the SDK generator, and your tests:
./scripts/sync-program-id.sh <YOUR_NEW_PROGRAM_ID>Note: This script will update hardcoded IDs and typically trigger SDK regeneration automatically.
If you modify instruction parameters or account structures in the Rust program, you must regenerate both the IDL and the SDK:
- Update IDL (using Shank):
cd program && shank idl -o . --out-filename idl.json -p <YOUR_PROGRAM_ID>
- Regenerate SDK (using Codama):
cd sdk/lazorkit-ts && npm run generate
Tests are built to run against an actual RPC node (tests-real-rpc), ensuring realistic validation of behaviors like SlotHashes nonce verification and resource limits.
- Setup Env: Ensure
.envintests-real-rpc/has yourPRIVATE_KEY,RPC_URL, andWS_URL. - Run All Tests:
cd tests-real-rpc && npm run test:devnet
- Run Single Test File (Recommended for debugging):
cd tests-real-rpc && npm run test:devnet:file tests/instructions/create_wallet.test.ts
- Build the Program:
cargo build-sbf
- Deploy Program:
solana program deploy target/deploy/lazorkit_program.so -u d
- Publish IDL to Blockchain (So block explorers can decode your contract interactions):
# Run from root directory npx --force @solana-program/program-metadata write idl <YOUR_PROGRAM_ID> ./program/idl.json
- 429 Too Many Requests: The test suite handles this automatically with a retry loop. If failures persist, check your RPC provider credits or increase the sleep delay in
tests/common.ts. - Simulation Failed (Already Initialized): Devnet accounts persist. Change the
userSeedin your test file or use a freshgetRandomSeed()to create new wallet instances. - BigInt Serialization Error: Always use the provided
tryProcessInstructionhelper incommon.tsfor catching errors, as it automatically handlesBigIntconversion for logging. - InvalidSeeds / auth_payload errors: Ensure your generated
auth_payloadrespects the exactCodamalayout and is correctly appended to instruction data.