icRamp Devlog #7 — Extra: Creating spl tokens

icRamp Devlog #7 — Extra: Creating spl tokens

9/10/20252 min • icramp
SolanaSPL TokensDevnetTests

In this post I'm open-sourcing a tiny utility (inside the Solana backend) to spin a devnet SPL token, publish Metaplex metadata, and fund a Solflare wallet for testing icRamp solana orders.

TL;DR to use now

# 1) create
cd backend/solana/scripts/token_deploy
cp .env.example .env && nano .env   # set OWNER
source .env
./create_devnet_token.sh
 
# 2) metadata
# put your gist raw URL in URI inside .env
source .env
node set_token_metadata.mjs
 
# 3) mint & send more
source .env
AMOUNT=75000 ./mint_and_send.sh

Folder

.
├── create_devnet_token.sh
├── mint_and_send.sh
├── package.json
├── README.md
└── set_token_metadata.mjs

0) Prepare env

cd backend/solana/scripts/token_deploy
cp .env.example .env
# edit OWNER=... (your Solflare pubkey)

1) Create the token

source .env
./create_devnet_token.sh

This:

  • Creates the mint with DECIMALS (default 5)
  • Mints INITIAL_SUPPLY (default 100000) to your authority ATA
  • Transfers MINT_TO_SOLFLARE (default 50000) to your Solflare OWNER
  • Writes the mint address to .mint and MINT=... into .env

2) Publish metadata

Create a public JSON (GitHub Gist raw URL) like:

{
  "name": "BONK",
  "symbol": "BONK",
  "description": "Devnet BONK clone for local icRamp testing.",
  "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQfxnrbtCKDBeUUpPI6gDeVAVvqYw1TkZMu-Us5BTuYQlhBEEsKgVnHDczXdJtQt4ulcXE&usqp=CAU",
  "extensions": { "website": "https://bonkcoin.com" }
}

Set URI in .env to that raw link, then:

source .env
node set_token_metadata.mjs

You'll see something like:

OK metadata tx: 5sW...t2m4C5d3
symbol=BONK uri=https://gist.githubusercontent.com/.../bonk.json

3) Mint more & send

source .env
 
# Mint + transfer 100000 tokens to Solflare OWNER
AMOUNT=100000 ./mint_and_send.sh
 
# Or transfer only (if you still have balance)
ONLY_TRANSFER=1 AMOUNT=25000 ./mint_and_send.sh

Example output (devnet)

$ spl-token mint $MINT 100000 --owner $KEY
spl-token transfer $MINT 100000 $SOLFLARE_OWNER \
  --owner $KEY --fee-payer $KEY
Minting 100000 tokens to mint-authority ATA…
  Token: HbA6BgBmA3X6X8jtts5X2ZiJXXxZQKDbQR4s5XCD82pr
  Recipient: 3CG6Q7zVuSDmBhmsNymK9nbHuavYvUaFW2TV8Zt3SE1L
 
Signature: 29dMBZimFbTNZoig51Jt9gRGgtnVXvApWdWToNTsK96f2oAn5DzL86VpxrDEq8vQpP3XiWSQNB64PivZYaGxRaY7
 
Transferring 100000 tokens to CnzUv9EqfVv5yiYWugHiVzmvuBBzRxHYK64DkLhSWsUj…
  Sender: 3CG6Q7zVuSDmBhmsNymK9nbHuavYvUaFW2TV8Zt3SE1L
  Recipient: CnzUv9EqfVv5yiYWugHiVzmvuBBzRxHYK64DkLhSWsUj
  Recipient associated token account: HPjv2kMWeMZYfpayjaG7ooCtDpBRzG3gwn8oqjFoVVzD
 
Signature: 4X7xJ9wAFKJBWLuooGwEEdj9svncxVNRPvyQJNpnGdu5ykmptjRZeDS4FfEbNVvJcJPKC4gkQoNPWUZN77ptus4a

Verify

spl-token supply "$MINT"
spl-token balance "$MINT" --owner "$OWNER"
spl-token mint-info "$MINT"

Notes

  • Amounts are human units (respect DECIMALS).
  • If you disabled mint authority, you can't mint more.
  • --fund-recipient auto-creates the recipient ATA if needed.

Stay Updated

Get notified when I publish new articles about Web3 development, hackathon experiences, and cryptography insights.

You might also like

icRamp Devlog #9 — Testing Saga 2: PocketIC Solana Mocks & Test Harness

We continue the Solana testing story by building a clean HTTP-outcall mocking layer, composable responders, and readable integration tests.

icRamp Devlog #8 — Testing Saga 1: Refractor and Solana Test Expansion

We refractored and improved our testing architecture and expanded it to include a fully-fledged solana backend canister integration test flow.

icRamp Devlog #11 — Testing Saga 4: Vault State (SOL + SPL), Full Suite Green

We finish the vault branch for SOL and SPL: deposits, cancels, locks, unlocks, and completion — entirely in-canister state. Plus, the full Solana suite now passes.