API Reference
Complete API reference for the Spark Token Issuance SDK
IssuerSparkWallet
The IssuerSparkWallet
class extends SparkWallet
(all the functions of SparkWallet
are available) and provides functions for token issuance and management on the Spark network.
Token Management Methods
announceTokenL1()
Announces a new token on Bitcoin L1.
Parameters:
tokenName
: Name of the token (eg: SparkCoin)tokenTicker
: Token ticker (eg: SPARKC)decimals
: The precision the token supports (eg: 8 for BTC)maxSupply
: The maximum supply for this tokenisFreezable
: Whether or not the Issuer can freeze this tokenfeeRateSatsPerVb
: (Default: 2) Transaction fee per virtual byte
Returns: Transaction ID as string
getBalance()
Gets the current balance of tokens.
Returns: Object containing:
balance
: Current balance in satoshistokenBalances
: Map of token balances by token public key
mintTokens()
Mints new tokens.
Parameters:
tokenAmount
: The amount to mint (eg: 1000n)
Returns: Transaction ID as string
transferTokens()
Transfers tokens to another Spark Address.
Parameters:
tokenPublicKey
: Public key of the token to transfertokenAmount
: Amount of tokens to transferreceiverSparkAddress
: Recipient’s Spark AddressselectedOutputs
: (Optional) Specific outputs to use for transfer
Returns: Transaction ID as string
burnTokens()
Burns existing tokens.
Parameters:
tokenAmount
: The amount to burn (eg: 1000n)
Returns: Transaction ID as string
freezeTokens()
Freezes issuer’s tokens for a specific wallet.
Parameters:
sparkAddress
: The Spark Address to freeze.
unfreezeTokens()
Unfreezes issuer’s tokens for a specific wallet.
Parameters:
sparkAddress
: The Spark Address to unfreeze.
Token Information Methods
getIssuerTokenBalance()
Gets the token balance of the wallet.
Parameters:
sparkAddress
: (Optional) Spark Address of the wallet to get the balance of. If no address is provided, the function will return the token balance of the issuer wallet.
getIssuerTokenInfo()
Gets the details about the token.
getIssuerTokenInfo()
or getIdentityPublicKey()
For frequent retrieval of the token public key, we recommend using
getIdentityPublicKey()
since it does not involve a network call.Token Activity Methods
getIssuerTokenActivity()
Gets the activity for the token associated with this issuer wallet.
Parameters:
pageSize
: (Optional, default: 100) Number of transactions per pagecursor
: (Optional) Pagination cursor to pass inoperationTypes
: (Optional) Which operation types to return (ISSUER_ANNOUNCE
,ISSUER_MINT
,USER_TRANSFER
,ISSUER_BURN
,ISSUER_FREEZE
,ISSUER_UNFREEZE
)beforeTimestamp
: (Optional) Return transactions before this dateafterTimestamp
: (Optional) Return transactions after this date
Returns: List of token transactions with pagination info
getIssuerTokenDistribution()
Gets the token distribution information for the token associated with this issuer wallet.
This feature is currently under development and will be available in a future release of Spark.
Returns:
totalCirculatingSupply
: Total circulating supply of the tokentotalIssued
: Total issued tokenstotalBurned
: Total tokens burnednumHoldingAddress
: Number of addresses holding the tokennumConfirmedTransactions
: Number of confirmed transactions