
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
spark-node-express
Advanced tools
basic express server consuming the @buildonspark/spark-sdk and @buildonspark/issuer-sdk
Welcome to the Spark Hackathon!
Contained is a simple express server example written in plain javascript that calls most of our exposed sdk functions.
To get started:
yarn
yarn dev
or if you'd like you can copy this directory as a starting template for your own project and use a different package manager like npm:
npm install
npm run dev
To init your wallet, make a call to either
or
Your mnemonic should then get saved to your local machine and you can explore our sdks from there.
If your server crashes, remember to init your wallet again.
To spin up a new wallet, delete the saved mnemonic files.
You can find more documentation for our sdks at https://docs.spark.info
As an IssuerSparkWallet extends the functionality of a SparkWallet, IssuerSparkWallets have access to all the methods available in a SparkWallet.
Returns the raw wallet instance.
GET /spark-wallet/wallet
GET /issuer-wallet/wallet
Initialize a new wallet or recovers an existing one.
POST /spark-wallet/wallet/init
POST /issuer-wallet/wallet/init
Request Body:
{
"mnemonicOrSeed": Optional[string]
}
If no mnemonic is provided, generates a new one and saves it.
Returns the wallet's identity public key.
GET /spark-wallet/wallet/identity-public-key
GET /issuer-wallet/wallet/identity-public-key
Returns the wallet's Spark address.
GET /spark-wallet/wallet/spark-address
GET /issuer-wallet/wallet/spark-address
Returns the current wallet balance, including token balances.
GET /spark-wallet/wallet/balance
GET /issuer-wallet/wallet/balance
Returns a list of transfers.
GET /spark-wallet/wallet/transfers?limit=20&offset=0
GET /issuer-wallet/wallet/transfers?limit=20&offset=0
Query Parameters:
limit (optional): Number of transfers to return (default: 20)offset (optional): Offset for pagination (default: 0)Returns a list of pending transfers.
GET /spark-wallet/wallet/pending-transfers
GET /issuer-wallet/wallet/pending-transfers
Claim all pending transfers.
POST /spark-wallet/wallet/claim-transfers
POST /issuer-wallet/wallet/claim-transfers
Send a Spark transfer to another address.
POST /spark-wallet/spark/send-transfer
POST /issuer-wallet/spark/send-transfer
Request Body:
{
"receiverSparkAddress": string,
"amountSats": number
}
Generate a new Lightning Network invoice.
POST /spark-wallet/lightning/create-invoice
POST /issuer-wallet/lightning/create-invoice
Request Body:
{
"amountSats": number,
"memo": Optional[string],
"expirySeconds": Optional[number]
}
Pay a Lightning Network invoice.
POST /spark-wallet/lightning/pay-invoice
POST /issuer-wallet/lightning/pay-invoice
Request Body:
{
"invoice": string
}
Generate a Bitcoin deposit address associated with the current wallet.
GET /spark-wallet/bitcoin/deposit-address
GET /issuer-wallet/bitcoin/deposit-address
Claim a Bitcoin deposit.
POST /spark-wallet/bitcoin/claim-deposit
POST /issuer-wallet/bitcoin/claim-deposit
Request Body:
{
"txid": string
}
Withdraw funds to a Bitcoin address.
POST /spark-wallet/bitcoin/withdraw
POST /issuer-wallet/bitcoin/withdraw
Request Body:
{
"onchainAddress": string,
"targetAmountSats": number
}
Transfer tokens to another address.
POST /spark-wallet/tokens/transfer
POST /issuer-wallet/tokens/transfer
Request Body:
{
"tokenPublicKey": string,
"tokenAmount": number,
"receiverSparkAddress": string
}
Withdraw tokens.
POST /spark-wallet/tokens/withdraw
POST /issuer-wallet/tokens/withdraw
Request Body:
{
"tokenPublicKey": string,
"receiverPublicKey": string,
"leafIds": string[]
}
These endpoints are exclusively available for issuer wallets (/issuer-wallet/...).
Returns the issuer's token balance.
GET /issuer-wallet/token-balance
Returns information about the token's public key.
GET /issuer-wallet/token-public-key-info
Mint new tokens.
POST /issuer-wallet/spark/mint-tokens
Request Body:
{
"tokenAmount": string // Amount to mint (will be converted to BigInt)
}
Burn existing tokens.
POST /issuer-wallet/spark/burn-tokens
Request Body:
{
"tokenAmount": "string" // Amount to burn (will be converted to BigInt)
}
Freeze tokens for a specific owner.
POST /issuer-wallet/spark/freeze-tokens
Request Body:
{
"ownerPublicKey": string
}
Unfreeze tokens for a specific owner.
POST /issuer-wallet/spark/unfreeze-tokens
Request Body:
{
"ownerPublicKey": string
}
Announce a new token on Layer 1.
POST /issuer-wallet/on-chain/announce-token
Request Body:
{
"tokenName": string,
"tokenTicker": string,
"decimals": number,
"maxSupply": number,
"isFreezable": boolean,
"feeRateSatsPerVb": number
}
Mint tokens on Layer 1.
POST /issuer-wallet/on-chain/mint-tokens
Request Body:
{
"tokenAmount": number
}
Transfer tokens on Layer 1.
POST /issuer-wallet/on-chain/transfer-tokens
Request Body:
{
"tokenAmount": number,
"receiverPublicKey": string
}
The API can be configured for either:
REGTEST (Development/Testing)MAINNET (Production)FAQs
basic express server consuming the @buildonspark/spark-sdk and @buildonspark/issuer-sdk
The npm package spark-node-express receives a total of 10 weekly downloads. As such, spark-node-express popularity was classified as not popular.
We found that spark-node-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.