# transferToken

## Description

The `transferToken` function transfers a specified amount of a token from one address to another using the private key associated with the sender's wallet and returns a transaction signature.

## Parameter

The function does not take any parameters.

## Response

| Name         | Type   | Description                                |
| ------------ | ------ | ------------------------------------------ |
| `publicKey`  | string | The generated public key in Base58 format  |
| `privateKey` | string | The generated private key in Base58 format |

## Example Request and Response

### Prerequisites

Before making requests with Volary SDK, you must have it installed.

You can install Volary SDK using either **`npm`** or **`yarn`**. Use the following commands to install Volary SDK:

<br>

```sh
npm install @nest25/solana-lib
OR
yarn add @nest25/solana-lib
```

### Request

Here is an example of how to make a `transferToken` request using the Volary SDK:

<br>

```javascript
// import Nest SDK
import { Solana } from '@nest25/solana-lib';

// create a new instance of the SDK
const Sol = new Solana();

async function main() {
  // transfer token to another wallet
  let receipt = await Sol.transferToken(
    '2VckPpaPxNuzQrwzFf6NPFNh8dB9qGzoGBEJi9QRFNrGhPWYvPuUcBnDJbVwHEgkPUtwvoTxdKpjLh3wzUEGXQ3A',
    50,
    '3R9zwizFGE7seURD2H8MuAigmCRgRLj7zh8HZaXqU7fE',
  );
  console.log(receipt);
}

main();
```

### Response

```
5vyVarLuPLYscZB9svFXLFruLbhV18TsZ2eccqdawYaM2rz82QENVj2iryZkbE4P4w97SgUcNDuaamtMFWUSHTrT
```

## Use Cases

* **Crypto Wallets:** The function can be used by crypto wallets to generate new key pairs for their users.
* **Online Marketplaces:** The function can be used by online marketplaces to facilitate payments using Solana.
* **Cryptocurrency Exchanges:** The function can be used by cryptocurrency exchanges to generate new key pairs for their users to use on Solana.


---

# 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.volary.io/sdks-guide/blockchain-sdks/solana-sdk/transfertoken.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.
