mcjohnson-sdk
v1.0.1
Published
SDK for building McJohnson mini apps
Maintainers
Readme
McJohnson Mini App Developer SDK
Build, test, and publish mini-applications for the McJohnson Wallet ecosystem.
🎯 What is This?
This SDK provides command-line tools for mini app developers to:
- 🚀 Bootstrap new mini app projects
- 📦 Package apps into distributable bundles
- 🔐 Sign manifests for verification
- 📤 Publish to IPFS for decentralized distribution
- 🧪 Test locally with live preview server
Note: This SDK is for McJohnson mini app developers
🚀 Quick Start
Installation
npm install -g mcjohnson-sdkCreate Your First Mini App
# Create new project
mcj init my-first-app
# Enter the directory
cd my-first-app
# Start development server
mcj dev --qr
# Scan QR code with McJohnson Wallet to test📦 CLI Commands
mcj init <name>
Create a new mini app project with a starter template.
mcj init my-gameCreates:
my-game/
├── manifest.json
├── index.html
├── styles.css
├── app.js
└── README.mdmcj dev [options]
Start a local development server to test your app.
Options:
--qr- Display QR code for mobile testing--port=<port>- Custom port (default: 3000)
# Basic dev server
mcj dev
# With QR code for mobile testing
mcj dev --qr
# Custom port
mcj dev --port=8080Testing Workflow:
- Run
mcj dev --qrin your project - Open McJohnson Wallet on your phone
- Go to Developer Portal
- Scan QR code or enter URL manually
- Your app opens in the production environment with all permissions
mcj build [options]
Package your mini app into a distributable .zip file.
# Build current directory
mcj build
# Build specific directory
mcj build ./my-app
# Custom output name
mcj build . my-app-v1.0.0.zipOutput: dist.zip containing your entire app
mcj sign <command>
Sign your manifest for cryptographic verification.
Generate Keys (one-time):
mcj sign gen-keysCreates public.key and private.key
Sign Manifest:
mcj sign sign manifest.jsonCreates manifest.sig
Verify Signature:
mcj sign verify manifest.json manifest.sig public.keymcj publish <file>
Publish your app package to IPFS.
mcj publish dist.zipOutput:
✅ Published to IPFS!
CID: QmXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Users can install via:
https://ipfs.io/ipfs/QmXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXmcj test
Validate your manifest and check for common issues.
mcj testChecks:
- ✅ Valid manifest.json
- ✅ Required files present
- ✅ Icon dimensions
- ⚠️ File size warnings
- ⚠️ Missing optional files
🎨 Project Structure
my-miniapp/
├── manifest.json # App metadata & permissions
├── index.html # Entry point
├── styles.css # Styling (optional)
├── app.js # Your app logic (optional)
├── assets/ # Images, fonts, etc.
│ ├── icon-48.png
│ └── icon-96.png
└── README.md # Documentation📋 Manifest Format
Required Fields:
{
"name": "My Mini App",
"version": "1.0.0",
"entry": "index.html",
"description": "A brief description of your app",
"developer": "Your Name",
"category": "Games",
"permissions": ["wallet", "username"],
"icons": {
"48": "assets/icon-48.png",
"96": "assets/icon-96.png"
}
}Optional Fields:
{
"punchline": "Short catchy description",
"website": "https://yoursite.com",
"supportUrl": "https://yoursite.com/support",
"termsUrl": "https://yoursite.com/terms",
"privacyUrl": "https://yoursite.com/privacy"
}Categories:
- Games
- Finance
- Tools
- Social
- NFTs
- Marketplace
- Utilities
Available Permissions:
wallet- Access wallet address & balanceusername- Access user's handlesign- Request transaction signingcamera- Access device cameralocation- Access GPS locationstorage- Store data locallynotifications- Send push notifications
🌐 Using the SDK Bridge
Inside your mini app's JavaScript:
// Wait for SDK
async function waitForSDK() {
return new Promise((resolve) => {
if (typeof window.mcj !== 'undefined') {
resolve();
} else {
setTimeout(() => waitForSDK().then(resolve), 100);
}
});
}
// Get wallet address
await waitForSDK();
const result = await window.mcj.wallet.getAddress();
if (result.ok) {
console.log('Address:', result.address);
}
// Get balance
const balance = await window.mcj.wallet.getBalance();
console.log('Balance:', balance.balance, 'LTCO');
// Sign transaction
const tx = {
meta: {
transfer: {
to: '0x123...',
amount: '1000000000000000000' // 1 LTCO
}
},
chainId: 137
};
const signed = await window.mcj.wallet.sign(tx);
// Open camera
const photo = await window.mcj.camera.open({ quality: 0.8 });
// Get location
const location = await window.mcj.location.get();
// Send notification
await window.mcj.notifications.send('Hello!', 'From my app');Full API documentation: API_REFERENCE.md
📤 Publishing Your App
Step 1: Prepare Your App
# Validate manifest
mcj test
# Build package
mcj buildStep 2: Sign Your App (Recommended)
# Generate keys (first time only)
mcj sign gen-keys
# Sign manifest
mcj sign sign manifest.jsonStep 3: Publish to IPFS
mcj publish dist.zipOutput CID: QmXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Step 4: Submit to App Registry
To get your app featured in the Explore tab:
- Go to Registry Submissions
- Click "New Issue" → "Mini App Submission"
- Fill out the template with:
- IPFS CID
- Screenshots (2+)
manifest.jsonpublic.key(if signed)- Privacy policy URL
- Submit and wait for review (3-5 days)
Alternatively, email: Registry Team
🧪 Testing Your App
Option 1: Dev Server (Recommended)
mcj dev --qr- Scan QR code with McJohnson App
- Go to Developer Portal in wallet > Settings
- Your app opens in production environment
- All SDK features work
- Make changes, save, and refresh
Option 2: Manual Installation (not available yet)
- Build your app:
mcj build - Copy
dist.zipto your device - In wallet, go to Settings → Developer Tools
- Install from file
Option 3: IPFS Testing
# Publish to IPFS
mcj publish dist.zip
# Copy the CID (QmXXX...)In wallet:
- Go to Explore tab
- Tap "Install from IPFS"
- Paste CID
- Install and test
📚 Documentation
- 📖 Quick Start Guide - Build your first app
- 🔧 API Reference - Complete SDK documentation
- 🤝 Contributing - How to contribute
🎯 Use Cases
Perfect for building:
- 🎮 Games - Casual games, leaderboards
- 💰 DeFi Tools - Swaps, staking dashboards
- 🎨 NFT Apps - Galleries, minting tools
- 📊 Analytics - Portfolio trackers, charts
- 🛍️ Marketplaces - Buy/sell/trade
- 🤝 Social Apps - Forums, DAOs
- 🔧 Utilities - Calculators, converters
Note - there are no limitations as longs as you follow the miniapp guidelines
🔒 Security Best Practices
- ✅ Request minimum permissions needed
- ✅ Handle permission denials gracefully
- ✅ Never store sensitive data in localStorage
- ✅ Validate all user inputs
- ✅ Use HTTPS for external resources
- ✅ Sign your manifests for verification
- ✅ Test on real devices
🐛 Troubleshooting
SDK Not Available
// ❌ Bad
const address = await window.mcj.wallet.getAddress();
// ✅ Good
await waitForSDK();
const address = await window.mcj.wallet.getAddress();Permission Denied
try {
const result = await window.mcj.camera.open();
if (!result.ok && result.error === 'permission_denied') {
alert('Camera permission required. Enable in app settings.');
}
} catch (error) {
console.error('Camera error:', error);
}Dev Server Won't Connect
- ✅ Ensure phone and computer are on same WiFi
- ✅ Check firewall allows incoming connections
- ✅ Try using IP address instead of localhost
- ✅ Verify dev server is running
Build Fails
# Clean and rebuild
rm -rf dist.zip node_modules
npm install
mcj build🆘 Support
- 📧 Email: [email protected]
- 💬 Discord: Join Community
- 🐛 Issues: GitHub Issues
- 📚 Docs: Full Documentation
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
📄 License
MIT © McJohnson Team
🚀 Get Started Now
npm install -g mcjohnson-sdk
mcj init my-first-app
cd my-first-app
mcj dev --qrBuild the future of decentralized applications! 🎉
