🔗sendEther

Description

The sendEther function sends a specified amount of Ether from the account associated with the provided private key to a specified address on a given blockchain network.

Parameters

Parameter
Type
Description

blockchain

string

Takes a string parameter specifying the name of the blockchain network (For eg. bsc, polygon, eth, ava, gnosis, moonbeam)

address

string

The receiving account address for the transfer of Ether

amount

string

The amount of Ether to be transferred

privateKey

string

The private key of the account to sign the transaction

Response

Property
Type
Description

Promise<Object>

object

Returns the transaction receipt object.

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/evm-chains-lib
OR
yarn add @nest25/evm-chains-lib

Request

Here is an example of how to make a sendEther request using the Nest SDK:

// import the Nest SDK
const { Wallet } = require('@nest25/evm-chains-lib');

// create a new wallet
const wallet = new Wallet();

// define the main function
const main = async () => {
    // send Ether
    let receipt = await wallet.sendEther(
        'klay',
        '0x3D5Cc05B5419CcD3c1bD510ab026C76F42D20871',
        '10',
        '3160dea9213bb3673b10a8c61103004e80a77046ea991778824f9d2b0a539835'
    )

    // print the receipt
    console.log({receipt);
};
// call the main function
main();

Response

{
  receipt: {
    type: 2,
    chainId: 1001,
    nonce: 247,
    maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
    maxFeePerGas: BigNumber { _hex: '0x0bdfd63e00', _isBigNumber: true },
    gasPrice: null,
    gasLimit: BigNumber { _hex: '0x5208', _isBigNumber: true },
    to: '0x3D5Cc05B5419CcD3c1bD510ab026C76F42D20871',
    value: BigNumber { _hex: '0x8ac7230489e80000', _isBigNumber: true },
    data: '0x',
    accessList: [],
    hash: '0xad169c8ebe54a152ae5c50b578b88ef3bd765d62a3161e594b0743636af338b4',
    v: 0,
    r: '0xb8b9e3326cb0df557cf6f24d8173edbf4fd4df535047ace869e22051bffedd0f',
    s: '0x194c5f94dd1cf2644f369b78f2498549fb026d1721692c7b2d340a4836e904be',
    from: '0xE668C72D4C67236A712Ce69A91C74358586f31ed',
    wait: [Function (anonymous)]
  }
}

Use Cases

  • Crypto Wallets: The function can be used by crypto wallets to send Ether from one wallet to another.

  • Online Marketplaces: The function can be used by online marketplaces to facilitate payments in Ether for goods and services.

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

Last updated