⛏️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 NEST® SDK, you must have it installed.

You can install NEST® SDK using either npm or yarn. Use the following commands to install NEST® SDK:

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 NEST® SDK:

// 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.

Last updated