⛏️sendSOL

Description

The sendSOL function enables the transfer of SOL tokens between two wallets on the Solana blockchain.

Parameter

NameTypeDescription

fromWalletSecretKey

string

The secret key of the wallet sending SOL

toWalletAddress

string

The public address of the wallet receiving SOL

amount

number

The amount of SOL to be transferred

Response

NameTypeDescription

signature

string

The transaction signature returned by the blockchain

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 sendSOL 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() {
 // send SOL to an address
  let receipt = await Sol.sendSOL(
    '3Q6Wn4hggUWuiD3iEjGaMYurKBywTXiWWjxp1yGCQvFvWPmZ4dff8SXuUEknfLRzqXfobSB46k9rbmDzjrDE3ZqK',
    'HyAEtjw6d4qEf7ew7LUN8UV7Hes3wXk9yBL6kG9yCpfP',
    '1',
  )
  console.log({receipt});
}

main();

Response

{
   SUYgr3ZrqUKaTD5vJok2AzzfKg2mkP8ZXzUDH1PH55uKKHxwUrA8w23SKxm7AgV8yyTrTHQ8BNhcbhqx15z7NMH
}

Use Cases

  • Sending payments: The function can be used to send SOL payments from one wallet to another, enabling users to pay for goods and services on Solana-based platforms.

  • Exchanges: The function can be used by cryptocurrency exchanges to facilitate the buying and selling of SOL.

  • Wallets: The function can be integrated into Solana-based wallets to allow users to send and receive SOL tokens.

Last updated