Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Printr SVM Scripts

TypeScript scripts for token launch, bonding curve trading, and Proof of Belief staking on Solana via the Printr chain-abstracted launchpad.


What's Inside

Script Command What it does
devnet-setup.ts npm run airdrop Generate wallet + request devnet SOL
launch.ts npm run launch Quote → create token → sign → submit → poll
trade.ts npm run trade Buy or sell on the DBC bonding curve
stake.ts npm run stake Lock tokens in the Proof of Belief pool
status.ts npm run status Check deployment & graduation progress

Quick Start (Devnet)

# 1. Install dependencies
npm install

# 2. Copy and configure environment
cp .env.example .env

# 3. Generate a wallet and get free devnet SOL (no config needed)
npm run airdrop

# 4. Edit .env — set TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DESCRIPTION
#    Leave SOLANA_NETWORK=devnet for testing

# 5. Launch your token
npm run launch

# 6. Check deployment status
npm run status

# 7. Buy some of your token on the bonding curve
#    (TRADE_TOKEN_ID is auto-filled in .env after launch)
TRADE_DIRECTION=buy TRADE_AMOUNT_SOL=0.005 npm run trade

# 8. Stake your tokens to earn trading fees
npm run stake

How Printr Works

Your Wallet
    │
    ▼
POST /print/quote ──► Cost estimate (gas + x-chain fees + initial buy)
    │
    ▼
POST /print ─────────► Unsigned SVM instruction payload
    │                   { mint_address, ixs[], lookup_table? }
    ▼
buildAndSignTx() ────► VersionedTransaction (v0 + ALT)
    │
    ▼
Solana Mainnet/Devnet
    │
    ▼
Printr backend polls on-chain, registers token, cascades to other chains via Axelar/LayerZero
    │
    ▼
Token is LIVE on DBC bonding curve → tradeable immediately
    │
    ▼  (when graduation threshold is hit)
Meteora DAMM v1/v2 ──► Post-graduation AMM (use Jupiter for trading)

Key Technologies

  • Axelar ITS + LayerZero v2 — cross-chain deployment
  • Meteora Dynamic Bonding Curve (DBC) — pre-graduation AMM (dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN)
  • Meteora DAMM v1/v2 — post-graduation AMM
  • CAIP-2/CAIP-10 — chain + account identifiers (solana:5eykt...:WalletAddress)

Environment Variables

All configuration lives in .env. Full documentation is in .env.example.

Critical fields

Variable Description
SOLANA_NETWORK devnet (testing) or mainnet-beta (production)
SVM_WALLET_PRIVATE_KEY Base64-encoded secret key — auto-generated by npm run airdrop (base58 exports also work)
PRINTR_API_KEY Partner API key (optional — public key used by default)
TOKEN_NAME / TOKEN_SYMBOL Your token's name and ticker
INITIAL_BUY_SOL SOL to spend on your creator buy
FEE_SINK stake_pool enables staking rewards
TRADE_TOKEN_ID Auto-filled after launch

Script Details

npm run airdrop (devnet only)

  • Generates a new keypair if SVM_WALLET_PRIVATE_KEY is missing
  • Requests up to 2 SOL from the devnet faucet
  • Saves the key to .env automatically
  • Falls back to https://faucet.solana.com if the RPC faucet fails

npm run launch

  1. Calls GET /print/quote for cost breakdown
  2. Encodes your token image to base64 (uses placeholder if file missing on devnet)
  3. Calls POST /print → receives raw Solana instructions
  4. Builds a VersionedTransaction (v0) with Address Lookup Table compression
  5. Simulates, then signs + submits
  6. Polls GET /tokens/{id}/deployments until all chains are live
  7. Auto-saves TRADE_TOKEN_ID + TRADE_MINT_ADDRESS back to .env

npm run trade

  • Reads TRADE_TOKEN_ID from .env (or .last-token.json)
  • Verifies the token is live on Solana
  • Derives the DBC pool PDA from curveProperties.basePairAddresses[0]
  • Builds a swapQuoteToBase (buy) or swapBaseToQuote (sell) instruction
  • Simulates → sends

Note: Printr's Trading API is "coming soon". This script interacts with the Meteora DBC program directly, which is the same program Printr uses under the hood.

npm run stake

  • Derives the staking_pool and staking_position PDAs from the mint
  • Stakes tokens into the pool (locked, earning fees)
  • Run with STAKE_ACTION=claim to collect accumulated SOL rewards

Staking only works if the token was created with FEE_SINK=stake_pool.

npm run status

  • Prints deployment status per chain
  • Shows graduation percentage (100% = ready to migrate to Meteora DAMM)
  • Lists recent Printr tokens if no token ID is set

Devnet vs Mainnet

Devnet Mainnet
Network SOLANA_NETWORK=devnet SOLANA_NETWORK=mainnet-beta
SOL cost Free (faucet) Real SOL
Printr API Same preview API Same preview API
Graduation threshold $1,000 (beta) $1,000 (beta) / $69,000 (prod)
DBC Program Same address Same address
Explorer solscan.io?cluster=devnet solscan.io

File Structure

printr-svm-scripts/
├── src/
│   ├── config.ts          # Env loading, wallet, network constants
│   ├── api.ts             # Typed Printr REST API client
│   ├── tx-builder.ts      # SVM payload → VersionedTransaction
│   ├── devnet-setup.ts    # Airdrop + wallet generation
│   ├── launch.ts          # Token creation script
│   ├── trade.ts           # Bonding curve buy/sell
│   ├── stake.ts           # Proof of Belief staking + claim
│   └── status.ts          # Deployment status checker
├── .env.example           # All env vars documented
├── .env                   # Your local config (git-ignored)
├── .last-token.json       # Auto-saved after launch (git-ignored)
├── token-image.png        # Your token image (optional)
├── package.json
└── tsconfig.json

Security Notes

  • Never commit .env or .last-token.json to git — they contain your private key
  • On devnet, the auto-generated wallet is throwaway — generate a fresh one for mainnet
  • Use environment-level secrets (GitHub Secrets, etc.) in CI/CD — not hardcoded keys
  • The PRINTR_API_KEY is optional; without it the public AI-integration key is used

Troubleshooting

Simulation failed on launch:

  • Check you have enough SOL (npm run airdrop)
  • Ensure your image is ≤ 500 KB and square
  • The Printr preview API may have temporary issues — retry in a few minutes

Trade simulation failed:

  • Token must be live (check npm run status)
  • The DBC pool PDAs are derived from basePairAddresses[0] in the token metadata — ensure it's populated
  • After graduation, use Jupiter (https://jup.ag) instead

Stake simulation failed:

  • Token must have been created with FEE_SINK=stake_pool
  • You must hold tokens before staking (buy some first)
  • The staking pool PDA must be initialized on-chain by Printr's backend

Airdrop failed:


Resources

About

CLI scripts for Printr token launch, Meteora DBC trading, and Proof of Belief staking on Solana devnet and mainnet.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages