Cardano Tokens
Instantiate Cryptum SDK first:
Transfer tokens
sdk.token.transfer(opts)
you can transfer ADA or any other native Cardano token.
opts.wallet
(Wallet)(required) - wallet to sign the transaction with.opts.outputs
(array of Output)(required) - outputs to transfer to.opts.outputs[].address
(string)(required) - address to transfer to.opts.outputs[].amount
(string)(required) - amount of ADA to transfer.opts.outputs[].token
(object)(optional) - optional token information (for tokens only).opts.outputs[].token.policy
(string) - PolicyID of the token you want to send.opts.outputs[].token.asset
(string) - Asset name (in hex) of the token you want to send.opts.outputs[].token.amount
(string) - Amount of tokens you want to send.
This function returns the transaction hash.
Example:
Transfer token with UTXOs
sdk.transaction.createCardanoTransferTransactionFromUTXO(opts)
sdk.transaction.createCardanoTransferTransactionFromUTXO(opts)
opts.inputs
(array of Input) - array of inputs to be used in the transaction.opts.inputs[].txHash
(string) - transaction hash of the UTXO.opts.inputs[].index
(number) - index of the UTXO output.opts.inputs[].privateKey
(string) - spending private key to sign the transaction with.
opts.outputs
(array of Output)(required) - outputs to transfer to.opts.outputs[].address
(string) - address to transfer to.opts.outputs[].amount
(string) - amount of ADA to transfer.opts.outputs[].token
(object) - optional token information (for token transactions only).opts.outputs[].token.policy
(string) - PolicyID of the token you want to send.opts.outputs[].token.asset
(string) - Asset name (in hex) of the token you want to send.opts.outputs[].token.amount
(string) - Amount of tokens you want to send.
Last updated