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 (use0n
for unlimited supply)isFreezable
: Whether or not the Issuer can freeze this token
announceTokenL1()
(Deprecated)
Deprecated Method:
announceTokenL1()
is being phased out in favor of createToken()
for Spark Native Tokens. While this method still works and existing L1-announced tokens continue to function normally, we recommend using createToken()
for all new token launches. This method will be removed in a future SDK release.Potential loss of L1 funds
Announcing multiple times on L1 from the same wallet will cause a loss of L1 funds.
Only the first announcement by a wallet confirmed on chain will be recognized as valid.Check the
reference transaction: link
Announcing multiple times on L1 from the same wallet will cause a loss of L1 funds.
Only the first announcement by a wallet confirmed on chain will be recognized as valid.Check the
OP_RETURN
for the LRC20
prefix in the returned L1 txid to verify announcement on chain.reference transaction: link
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
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.Tip: As an issuer, to get your token public key, you can call
For frequent retrieval of the token public key, we recommend using
getIssuerTokenMetadata()
or getIdentityPublicKey()
For frequent retrieval of the token public key, we recommend using
getIdentityPublicKey()
since it does not involve a network call.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.