Documentation Index
Fetch the complete documentation index at: https://docs.spark.money/llms.txt
Use this file to discover all available pages before exploring further.
Your issuer wallet holds the keys that control your token. Create one to get started, or restore an existing wallet with your mnemonic.
Create a Wallet
import { IssuerSparkWallet } from "@buildonspark/issuer-sdk";
const { wallet, mnemonic } = await IssuerSparkWallet.initialize({
options: { network: "REGTEST" }
});
console.log("Backup this phrase:", mnemonic);
console.log("Your address:", await wallet.getSparkAddress());
Store the mnemonic securely. It’s the only way to recover your wallet.
Restore a Wallet
const { wallet } = await IssuerSparkWallet.initialize({
mnemonicOrSeed: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
options: { network: "MAINNET" }
});
Networks
| Network | Use |
|---|
REGTEST | Development and testing |
MAINNET | Production |
Start on REGTEST. When you’re ready for production, generate a fresh wallet on MAINNET.
Multiple Tokens
An issuer identity can create multiple tokens. Use getIssuerTokenIdentifiers() and getIssuerTokenBalances() to work with all of them.
If you want separate issuer identities (separate keys) from the same mnemonic, derive them with different account numbers:
const { wallet: tokenA } = await IssuerSparkWallet.initialize({
mnemonicOrSeed: "your mnemonic...",
accountNumber: 0,
options: { network: "REGTEST" }
});
const { wallet: tokenB } = await IssuerSparkWallet.initialize({
mnemonicOrSeed: "your mnemonic...",
accountNumber: 1,
options: { network: "REGTEST" }
});
Cleanup
Close connections when your app shuts down:
await wallet.cleanupConnections();