IssuerSparkWallet
TheIssuerSparkWallet 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
createToken()
Creates a new token directly on Spark using Spark Native Tokens (recommended).
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 token (use0nfor unlimited supply)isFreezable: Whether or not the Issuer can freeze this token
getBalance()
Gets the current balance of tokens.
balance: Current balance in satoshistokenBalances: Map of token balances by token public key with token information and Bech32m token identifier to display
mintTokens()
Mints new tokens.
tokenAmount: The amount to mint (eg: 1000n)
transferTokens()
Transfers tokens to another Spark Address.
tokenIdentifier: Bech32m token identifier (eg: btkn1…) of the token to transfertokenAmount: Amount of tokens to transferreceiverSparkAddress: Recipient’s Spark AddressselectedOutputs: (Optional) Specific outputs to use for transfer
batchTransferTokens()
Transfers tokens to multiple recipients in a single transaction.
tokenIdentifier: Bech32m token identifier (eg: btkn1…) of the token to transfertransfers: Array of transfer objects containing recipient addresses and amountsselectedOutputs: (Optional) Specific outputs to use for transfer
burnTokens()
Burns existing tokens.
tokenAmount: The amount to burn (eg: 1000n)
freezeTokens()
Freezes issuer’s tokens for a specific wallet.
sparkAddress: The Spark Address to freeze.
unfreezeTokens()
Unfreezes issuer’s tokens for a specific wallet.
sparkAddress: The Spark Address to unfreeze.
Token Information Methods
getIssuerTokenBalance()
Gets the token balance of the wallet.
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.
getIssuerTokenMetadata()
Gets the metadata about the token.
Breaking Change in v0.2.0: This method replaces the deprecated
getIssuerTokenInfo() method.getIssuerTokenIdentifier()
Gets the Bech32m token identifier for the issuer’s token.
New in v0.2.0: This method provides a convenient way to get your token identifier for use in transfer operations.
queryTokenTransactions()
Retrieves token transaction from the network with flexible filtering options.
Breaking Change in v0.2.0: The parameter structure for this method has been updated to be more flexible. Arguments are now passed as an object with optional filtering criteria.
ownerPublicKeys: (Optional) Array of owner public keys to filter byissuerPublicKeys: (Optional) Array of issuer public keys to filter bytokenTransactionHashes: (Optional) Array of token transaction hashes to filter bytokenIdentifiers: (Optional) Array of Bech32m token identifiers to filter byoutputIds: (Optional) Array of output IDs to filter by
Token Activity Methods
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.
totalCirculatingSupply: Total circulating supply of the tokentotalIssued: Total issued tokenstotalBurned: Total tokens burnednumHoldingAddress: Number of addresses holding the tokennumConfirmedTransactions: Number of confirmed transactions
SparkWallet
TheSparkWallet class provides core wallet functionality for interacting with the Spark network.