lumos-luna-sdk
v2.6.3
Published
Lumos Luna SDK - The first AI-native SDK for Terra Classic (LUNC) & Terra 2.0 (LUNA). Build revolutionary dApps with ease.
Maintainers
Keywords
Readme
Live Demo
| App | URL | What it does | |-----|-----|-------------| | Luna Identity App | luid.fitlex.me | Mobile wallet + DeFi + on-chain identity in one PWA | | Marketing Site | lunar.fitlex.me | Ecosystem overview, live on-chain stats, AI burn rate |
Luna Identity App
A full-featured mobile wallet and DeFi app for Terra Classic, installable as a PWA. Try it at luid.fitlex.me.
Wallet
- Create or import wallet (BIP39 mnemonic, Terra Classic HD path)
- Send LUNC to any address (Binance, MEXC, other wallets) with memo support
- Receive with scannable QR code
- Balance display for LUNC + USTC with manual refresh
- Transaction history (sends, receives, swaps, contract calls)
- Encrypted local storage (AES-256-GCM) with password visibility toggle
Identity (On-Chain)
- Register a SoulBound digital citizenship by burning LUNC
- ID Card with QR code for public verification (
/verify/[address]) - Level system — burn more to level up (Citizen → Senator → Founder)
- Governance — create and vote on proposals (level 3+)
DeFi
- Swap LUNC → USTC on TerraSwap with live pool quotes, slippage control, price impact warnings
- Stable Vault — mint lUSD (1:1 USDC-backed) / redeem USDC, with identity-based fee discounts
- Proof of Burn — burn LUNC and receive immutable on-chain receipts
Tech
- Next.js 14 PWA (installable on iOS/Android)
- CosmJS signing (DirectSecp256k1HdWallet + SigningCosmWasmClient)
- Live on-chain data from Terra Classic LCD
- LUNC price, AI Oracle burn rate, market data via CoinGecko
What is Lumos Luna?
Lumos Luna is a complete DeFi ecosystem for Terra Classic (LUNC) with 6 smart contracts deployed on mainnet, an AI-powered burn oracle, and a 1:1 USDC-backed stablecoin with identity-based fee discounts.
Philosophy:
- Contracts are the truth, SDK is comfort
- README replaces whitepaper
- Usage creates standard, not marketing
Deployed Contracts (Mainnet)
All 6 contracts are live on Terra Classic Mainnet (columbus-5):
| Contract | Address | Admin | Status |
|----------|---------|-------|--------|
| AI Burn Oracle | terra19yr...633nf | Oracle only | Active |
| Luna Identity | terra1xm4...fykwslsmjuj | Config only | Active |
| Proof-of-Burn | terra188f...387uq0ch3d0 | Immutable | Active |
| Negative-Staking | terra13kz...qlscqnegaws | Config only | Active |
| Burn Calculator Pro | terra19yr...633nf | Immutable | Active |
| Stable Vault V2 | terra1klz...jrs5uq8p9rh0 | Pause only | Active |
Ecosystem Overview
Stable Vault V2 — 1:1 USDC-Backed Stablecoin (lUSD)
The flagship contract. Deposit USDC, receive lUSD at a 1:1 ratio. The vault enforces a strict invariant: supply always equals reserves.
What makes V2 special: it integrates with Luna Identity for fee discounts.
| Identity Level | Fee | Discount | |---------------|-----|----------| | No Identity | 0.30% | — | | Level 1 | 0.20% | 10 bps | | Level 2 | 0.15% | 15 bps | | Level 3 | 0.10% | 20 bps | | Level 4 | 0.05% | 25 bps | | Level 5+ | FREE | 30 bps |
All collected fees are permanently burned.
Luna Identity — SoulBound Citizenship NFTs
Non-transferable on-chain identity with a full wallet and DeFi suite. Burn LUNC to register, level up through contributions, unlock fee discounts in Stable Vault V2. Includes send/receive, DEX swap, TX history, and governance voting. Try it at luid.fitlex.me.
Governance Voting — On-Chain Proposals
Identity holders can vote on ecosystem proposals. Voting power scales with your identity level — no token-weighted voting, purely reputation-based through proven LUNC burns.
| Level | Title | Voting Power | |-------|-------|-------------| | 1-2 | Citizen/Resident | No voting rights | | 3 | Patriot | 1 vote | | 4 | Guardian | 2 votes | | 5+ | Senator+ | Votes = level |
Level 5+ (Senator) can also create proposals. Voting costs only gas (~0.5 LUNC), no additional burn required.
AI Burn Oracle — Market-Adaptive Burn Rate
Claude AI analyzes market data every 8 hours and adjusts the LUNC burn rate on-chain. Fully transparent, all recommendations stored on-chain with reasoning.
Proof-of-Burn — Verifiable Burn Receipts
Every LUNC burn gets an immutable on-chain receipt. Composable with other contracts for access control.
Negative Staking — Deflationary Staking
Stake LUNC, 10% gets burned. You receive governance weight proportional to amount × lock_time. The longer you lock, the more influence you earn.
Burn Calculator Pro — On-Chain Compute
Calculates optimal burn amounts based on current market conditions and AI Oracle data.
Installation
npm install lumos-luna-sdkQuick Start
Read-Only (No Wallet Required)
import { LumosPrimitives } from 'lumos-luna-sdk';
const lumos = new LumosPrimitives();
// Get burn statistics
const burnStats = await lumos.proofOfBurn.getStats();
console.log('Total burned:', burnStats.data.total_burned);
// Get staking statistics
const stakingStats = await lumos.staking.getStats();
console.log('Total staked:', stakingStats.total_staked);
// Verify vault invariant (supply == reserves)
const invariant = await lumos.vault.verifyInvariant();
console.log('Invariant holds:', invariant.holds); // Always trueWith Wallet (Write Operations)
import { LumosPrimitives } from 'lumos-luna-sdk';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
const lumos = new LumosPrimitives();
// Connect wallet
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(process.env.MNEMONIC, {
prefix: 'terra'
});
const [account] = await wallet.getAccounts();
const client = await SigningCosmWasmClient.connectWithSigner(
'https://terra-classic-rpc.publicnode.com',
wallet
);
lumos.connect(client, account.address);
// Burn LUNC and get proof
const proof = await lumos.proofOfBurn.burn('1000000'); // 1 LUNC
console.log('Burn proof:', proof.txHash);
// Stake with negative yield
const stake = await lumos.staking.stake('10000000', 30); // 10 LUNC, 30 days
console.log('Staked:', stake.txHash);The Three Primitives
1. Proof-of-Burn Registry
Burn LUNC and receive a non-transferable on-chain proof.
Invariant: proof.burned_amount == actual_burned
// Burn and get proof
const result = await lumos.proofOfBurn.burn('1000000');
// Get your proofs
const proofs = await lumos.proofOfBurn.getProofsByBurner('terra1...');
// Get global stats
const stats = await lumos.proofOfBurn.getStats();Use cases:
- Verifiable burn history
- Access control based on burn amount
- Composable with other contracts
2. Negative-Yield Staking
Staking that costs LUNC. Part of your stake is burned.
Invariant: stake_weight = amount * time_locked
Config: burn_ratio = 10% (configurable by admin)
// Stake 10 LUNC for 30 days (10% burned = 1 LUNC)
const result = await lumos.staking.stake('10000000', 30);
// Check your stake
const info = await lumos.staking.getStakeInfo('terra1...');
// Unstake after lock period
const unstake = await lumos.staking.unstake('9000000');
// Get leaderboard
const leaders = await lumos.staking.getLeaderboard(10);What you get:
- Governance weight (stake_weight)
- Priority access
- Proof of commitment
3. Invariant-Only Stable Vault
1:1 USDC-collateralized stablecoin. No algorithm, no governance.
Invariant: total_supply(lUSD) == balance(USDC_vault) - ALWAYS
// Deposit USDC, get lUSD (1:1)
const mint = await lumos.vault.mint('1000000'); // 1 USDC = 1 lUSD
// Burn lUSD, get USDC back (1:1)
const burn = await lumos.vault.burn('1000000'); // 1 lUSD = 1 USDC
// Verify invariant
const check = await lumos.vault.verifyInvariant();
console.log('Supply:', check.supply);
console.log('Reserves:', check.reserves);
console.log('Holds:', check.holds); // Always trueGuarantees:
- No algorithmic peg
- No LUNC collateral
- Mathematical enforcement, not market mechanisms
AI Oracle (Optional)
An AI-powered service that analyzes market data and suggests optimal burn rates.
Features:
- Real-time price data from CoinGecko
- Sentiment analysis
- AI-enhanced recommendations (OpenRouter/OpenAI)
- Automatic contract updates
Run locally:
cd services/ai-oracle
npm install
OPENROUTER_API_KEY=sk-or-... npm run run-onceWith wallet (submits to contract):
MNEMONIC="your 24 words" OPENROUTER_API_KEY=sk-or-... npm run run-onceAPI Reference
LumosPrimitives
const lumos = new LumosPrimitives(config?: {
lcd?: string; // Default: mainnet LCD
contracts?: {
proofOfBurn?: string; // Override contract address
negativeStaking?: string;
stableVault?: string;
};
});Proof of Burn
| Method | Description |
|--------|-------------|
| burn(amount) | Burn LUNC, get proof |
| getStats() | Total burned, proof count |
| getProof(id) | Get specific proof |
| getProofsByBurner(address) | Get all proofs for address |
Negative Staking
| Method | Description |
|--------|-------------|
| stake(amount, lockDays) | Stake LUNC (part burned) |
| unstake(amount) | Unstake after lock period |
| getStats() | Total staked, total burned |
| getStakeInfo(address) | Get stake info for address |
| getLeaderboard(limit) | Top stakers by weight |
Stable Vault
| Method | Description |
|--------|-------------|
| mint(usdcAmount) | Deposit USDC, get lUSD |
| burn(lusdAmount) | Burn lUSD, get USDC |
| getState() | Total supply, reserves |
| verifyInvariant() | Check supply == reserves |
| isFullyBacked() | Returns true (always) |
Environment Variables
Create a .env file:
# Wallet (for write operations)
MNEMONIC="your 24 word mnemonic phrase"
# AI Provider (for AI Oracle)
OPENROUTER_API_KEY="sk-or-..."
# or
OPENAI_API_KEY="sk-..."Legacy SDK Features
The SDK also includes the original LunaSDK for general Terra operations:
import { LunaSDK } from 'lumos-luna-sdk';
const sdk = new LunaSDK({
chain: 'lunc',
mnemonic: process.env.MNEMONIC
});
// Standard operations
await sdk.getBalance();
await sdk.send('terra1...', '1000000');
await sdk.burn('1000000');
// AI features (with API key)
await sdk.ai.complete('What is LUNC?');
await sdk.ai.generateImage('Terra phoenix');
// NFT minting
await sdk.nft.mintGenerative({ prompt: '...' });See /examples folder for complete usage examples.
Project Structure
/apps
/luna-identity # Next.js PWA — luid.fitlex.me
/src/components # SendModal, ReceiveModal, SwapPanel, StableVault, Governance, ...
/src/lib # secure-wallet.ts, api.ts, store.ts, constants.ts
/burnfeed # Burn feed viewer
/contracts # Rust CosmWasm smart contracts (Cargo workspace)
/proof-of-burn # Verifiable burn receipts
/negative-staking # Deflationary staking (10% burn)
/stable-vault # V1 — 1:1 USDC vault
/stable-vault-v2 # V2 — with Identity integration & fee burning
/luna-identity # SoulBound citizenship NFTs
/burn-calculator-pro # On-chain burn rate calculator
/burn-rate-calculator
/burn-calculator
/terra-recovery
/public-site # Marketing site — lunar.fitlex.me
/src
/primitives # SDK wrappers for contracts
/identity # Identity client
/services
/ai-oracle # AI burn rate recommender (Claude AI, every 8h)Building
# Build SDK
npm run build
# Run tests
npm test
# Build contracts (requires Rust)
cd contracts/proof-of-burn
cargo build --release --target wasm32-unknown-unknownContributing
- Fork the repository
- Create feature branch (
git checkout -b feature/xyz) - Commit changes (
git commit -m 'Add xyz') - Push branch (
git push origin feature/xyz) - Open Pull Request
See CONTRIBUTING.md for details.
License
MIT License - see LICENSE
