• Transfers SOL from one wallet to another on the Solana blockchain.

    Parameters

    • endpoint: string

      The Solana network endpoint to connect to.

    • fromWalletKey: number[]

      The secret key of the sender's wallet as an array of numbers.

    • toAddressPubkey: string

      The public key of the recipient's wallet.

    • transferAmountLamport: number

      The amount of lamports to transfer.

    Returns Promise<boolean>

    • A promise that resolves to true upon successful transaction.

    Throws

    • Throws an error if the transaction fails.

    Example

    const run = async () => {
    const endpoint = 'https://api.mainnet-beta.solana.com';
    const fromWalletSecretKey = [/* Your Secret Key Array Elements */];
    const toWalletAddress = 'RecipientPublicKeyHere';
    const transferAmount = 1000000; // Amount in lamports

    try {
    const result = await solanaTransfer(endpoint, fromWalletSecretKey, toWalletAddress, transferAmount);
    console.log('Transaction successful:', result);
    } catch (error) {
    console.error('Transaction failed:', error);
    }
    }

    run();

Generated using TypeDoc