This Solana program facilitates the transfer of SOL (native currency, measured in lamports) and SPL (Solana Program Library) tokens. It provides two separate methods: one for transferring SOL (lamports) and another for SPL tokens.
- Lamport Transfer: Send SOL from one account to another.
- SPL Token Transfer: Move SPL tokens between associated token accounts.
Transfers SOL from a signer's account to a recipient's account.
ctx: Context<TransferLamports>: A context that includes the signing accounts necessary for the lamport transfer.amount: u64: The number of lamports to be transferred.
Handles the transfer of SPL tokens from one account to another.
ctx: Context<TransferSpl>: The context that holds the required accounts for the SPL token transfer.amount: u64: The quantity of tokens to transfer.
from: The sender's account, which must be a signer.to: The recipient's account where lamports will be deposited.system_program: Reference to the System Program.
from: The authority account initiating the transfer, must sign the transaction.from_ata: The sender's SPL token account.to_ata: The receiver's SPL token account.token_program: Reference to the Token Program.
- Install the required tools, including the Anchor CLI and Solana CLI.
- Clone this repository and navigate to its root directory.
- Deploy the smart contract to the Solana blockchain:
anchor build
anchor deploy