crytom-sdk
v1.1.0
Published
Official Node.js SDK for the Crytom Developer API v1 – crypto payments, wallets, invoices, and more.
Maintainers
Readme
Crytom Node.js SDK
The official Node.js library for the Crytom Developer API (v1). Integrate professional crypto payments, per-user wallets, and cross-chain wrapping into your platform with ease.
🚀 Features
- 🛡️ Automatic HMAC Signing: Handles the mandatory
X-Crytom-SignatureandX-Crytom-Timestampheaders for you. - 👛 Per-User Wallets: Provision unique deposit addresses for your customers (USDT, BTC, STX, etc.).
- 💳 Payments & Checkout: Create hosted checkout sessions or headless invoices.
- 💸 Payouts & Mass Payouts: Programmatic withdrawals and batch payments.
- 💱 Real-time Prices: Quote and convert assets (e.g., USDT to BTC) inside your dashboard balance.
- ⛓️ Smart Contract Bridge: Programmatic access to Burn & Mint wrapping (e.g., BTC to wBTC on Solana).
- TypeScript First: Full type definitions for all requests and responses.
📦 Installation
npm install crytom-sdk
# or
yarn add crytom-sdk🛠️ Getting Started
Initialize the client with your Secret Key. Use an sk_test_ key for Sandbox and sk_live_ for production.
const { Crytom } = require('crytom-sdk');
const crytom = new Crytom({
secretKey: 'sk_test_51P...' // Found in your Crytom Dashboard
});1. Create a Wallet for a Customer
Perfect for credit-system apps where each user needs a personal deposit address.
async function setupUserWallet(userId) {
try {
const wallet = await crytom.wallets.create({
customer_id: userId,
currency: 'USDT',
network: 'BSC',
label: 'Main Deposit Wallet'
});
console.log(`Deposit Address: ${wallet.data.deposit_address}`);
} catch (error) {
console.error('Wallet creation failed:', error.message);
}
}2. Create a Checkout Session
Generate a URL to redirect your customers for payment.
const session = await crytom.checkout.createSession({
amount: 25.00,
currency: 'USD',
product_name: 'Premium Subscription',
success_url: 'https://yoursite.com/success',
cancel_url: 'https://yoursite.com/cart',
customer_id: 'user_123' // reconcile automatically
});
// Redirect the user
console.log(session.data.checkout_url);3. Smart Contract Bridge (Burn & Mint)
Bridge assets between chains programmatically.
const bridge = await crytom.smartContract.mint({
from_asset: 'BTC',
from_chain: 'Bitcoin',
to_chain: 'Solana',
destination_address: 'DYw8...',
amount: 0.05
});
console.log(`Lock TX: ${bridge.data.lock_tx_hash}`);
console.log(`Mint TX: ${bridge.data.mint_tx_hash}`);📖 API Reference
crytom.wallets—create,list,retrieve,deposit,withdraw,aggregatedBalance,lookup,supportedcrytom.payouts—create,mass,verify,retrieve,list,estimateFee,minAmountcrytom.prices—estimate,convert,listConversionscrytom.checkout—createSession,retrieveSession,verifySessioncrytom.invoices—create,retrievecrytom.payments—list,retrieve,minAmountcrytom.smartContract—listRoutes,mint,retrieveStatus
🔒 Security Note
- Never expose your
Secret Keyon the client-side (frontend). This SDK is intended for backend use only (Node.js). - All requests are automatically signed via HMAC-SHA256 to prevent tampering and replay attacks.
📄 License
MIT © Crytom
