Instantiate Cryptum SDK first:
const sdk = new CryptumSdk({
environment: 'testnet',
apiKey: 'YOUR-API-KEY',
})
Solana tokens follow the SPL Token standard alongside the Metaplex NFT protocol.
opts.protocol
(string)(required) - blockchain protocol must beSOLANA
.opts.wallet
(Wallet)(required) - wallet to sign the transaction with.opts.name
(string)(required) - token name.opts.symbol
(string)(required) - token symbol.opts.amount
(string)(required) - token amount to be first minted.opts.fixedSupply
(boolean)(required) - whether future minting will be restricted or not.opts.decimals
(number)(required) - amount of decimal units for this token.
This function returns hash of the token created.
const { hash } = await sdk.token.create({
protocol: 'SOLANA',
wallet,
symbol: 'TEST',
name: 'TEST',
amount: '1000000',
fixedSupply: false,
decimals: 9,
})
Mint an additional amount of an existing token.
opts.protocol
(string)(required) - blockchain protocol must beSOLANA
.opts.wallet
(Wallet)(required) - wallet to sign the transaction with.opts.token
(string)(required) - address of the token that will be minted.opts.amount
(string)(required) - token amount to be minted.opts.destination
(string)(required) - destination address.
This function returns the hash of the minting transaction.
const { hash } = await sdk.token.mint({
wallet,
protocol: 'SOLANA',
token,
amount: '20.42',
destination: 'DohbPo7UFV6phQ9DJF...psM2uwLQxEj94hmj2ohr',
})
opts.protocol
(string)(required) - blockchain protocol must beSOLANA
.opts.wallet
(Wallet)(required) - wallet to sign the transaction with.opts.token
(string)(required) - address of the token that will be burned.opts.amount
(string)(required) - token amount to be burned.
This function returns the hash of the burning transaction.
const { hash } = await sdk.token.burn({
protocol: 'SOLANA',
wallet,
token: 'EzqZ...qnCNd',
amount: '100.34',
})