# Cardano Tokens

Instantiate Cryptum SDK first:

```javascript
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:

```javascript
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.

```javascript
// 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)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cryptum.io/english/community-edition/sdk-guides/tokens/cardano-tokens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
