LogoLogo
Cryptum.ioGitHub
  • 🌐Cryptum
    • What is Cryptum
    • DeFi Market
    • Ecosystem
      • Bitcoin
      • Ethereum
      • Polygon
      • Avalanche C-Chain
      • BNB Chain
      • Cardano
      • Celo
      • Hathor
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
      • Hyperledger Besu
  • 👝Products
    • Dashboard Analytics
    • Tokenization
    • Crypto Checkout
      • Overview
      • Getting started
      • Checkout Dashboard
        • Creating your Store
        • Customer Checkout screens
        • Analytics
        • Managing Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
      • Checkout API
        • Authentication
        • Store
        • Orders
          • Handling Orders
    • Wallets
    • DeFi-as-a-Service
    • On & Off Ramp (soon)
    • E-commerce Plugins
      • Wordpress NFT Plugin
        • How to install NFT Plugin
        • Connect your Credentials to NFT Plugin
      • Wordpress Checkout Plugin
        • How to install Checkout Plugin
        • Connect your Credentials to Checkout Plugin
      • Plugins Guides
        • Creating your Store
        • Manage your Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
        • Monitoring Store (Analytics)
  • 💻Community Edition
    • Overview
    • Architecture
    • Start for free
    • Getting started
    • Dashboard guide
      • 🔑Creating a Project (API Key)
      • 🛠️Start building!
      • 📊Monitoring your Project
      • 📈Monitoring Requests
    • SDK guides
      • Get test currencies
      • Chainlink
        • 📈Price Feeds
        • ⚙️Automation
        • 🎲VRF
        • 🛤️CCIP
        • 🛤️CCIP
        • Project Examples
          • Lottery
          • Send Message CCIP
      • Wallets
      • Balances
      • Prices
      • Tokens
        • EVM Tokens (ERC-20)
        • Solana Tokens (SPL)
        • Cardano Tokens
        • Stellar Tokens
        • XRP Tokens
        • Hathor Tokens
      • NFTs
        • EVM NFTs (Ethereum, Polygon and others)
        • NFTs on Solana
        • NFTs on Hathor Network
      • Queries
        • Wallet information
        • Get transaction by hash
        • Get block information
        • Get transaction receipt by hash
        • Get fees information
        • Get NFT data
        • Get NFT balance
        • Get UTXOs (Unspent transaction outputs)
      • Uniswap
      • Staking
      • Smart Contracts
        • Deploy custom Smart Contracts
        • Loot Box
    • Features and credits
      • Avalanche C Chain
      • Bitcoin
      • BNB Chain
      • Cardano
      • Celo
      • Ethereum
      • Hathor
      • Polygon
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
    • API guides
      • API Cryptum
      • API Connector
  • 📃GLOSSARY
    • Blockchain terms
    • Cryptum terms
Powered by GitBook
On this page
  • Transfer tokens
  • Transfer token with UTXOs
  1. Community Edition
  2. SDK guides
  3. Tokens

Cardano Tokens

Instantiate Cryptum SDK first:

const sdk = new CryptumSdk({
  environment: 'testnet',
  apiKey: 'YOUR-API-KEY',
})

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:

const { hash } = await sdk.token.transfer({
  protocol: 'CARDANO',
  wallet,
  outputs: [
    { address: 'address1', amount: '1' },
    { address: 'address2', amount: '2', token: { asset: '546...a3e', policy: 'f3eb9...5f4a1', amount: '1' } },
    { address: 'address3', amount: '1.5', token: { asset: 'a9e...698', policy: 'c43a...1743f', amount: '10' } },
  ],
})

Transfer token with UTXOs

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.

// transfer ADA and tokens from 1 input to 3 output addresses
const transaction = await sdk.transaction.createCardanoTransferTransactionFromUTXO({
  inputs: [
    {
      txHash: 'bcc91e0...aec1f28066821',
      index: 0,
      privateKey: '9c34271d8...636667e265d0a',
    },
  ],
  outputs: [
    { address: 'address1', amount: '1' },
    { address: 'address2', amount: '2', token: { asset: '546...a3e', policy: 'f3eb9...5f4a1', amount: '1' } },
    { address: 'address3', amount: '1.5', token: { asset: 'a9e...698', policy: 'c43a...1743f', amount: '10' } },
  ],
})

const { hash } = await sdk.transaction.sendTransaction(transaction)
PreviousSolana Tokens (SPL)NextStellar Tokens

Last updated 2 years ago

💻