Skip to main content
BETA
HomeIntegration BuilderAPI ReferenceGuides
View Mirror World on Github
Join the Discord server

Language:

transfer_spltoken

Transfers an SPL Token from the user's wallet to another wallet address.


_33
use mirrorworld_sdk_rust::{ transfer_spltoken };
_33
_33
fn main() {
_33
_33
// In this example, we shall transfer USDC 1000 SPL
_33
// to this wallet address: 2BrLoxPTkPLyLuD3sPitNKXQRA9y8zzZ9P6vYwMTtgBL
_33
_33
// See USDC in the Solana explorer: https://explorer.solana.com/address/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
_33
_33
_33
let recipient_public_key: &str = "2BrLoxPTkPLyLuD3sPitNKXQRA9y8zzZ9P6vYwMTtgBL";
_33
let amount: &str = "1000";
_33
let token_mint_address: &str = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
_33
let token_decimals: &str = "6";
_33
_33
let result: TransferSpltoken = transfer_spltoken(recipient, amount).await?;
_33
}
_33
_33
// Return Types
_33
// ============
_33
_33
#[derive(Debug, Serialize, Deserialize)]
_33
pub struct TransferSpltoken {
_33
pub tx_signature: String
_33
}
_33
_33
// Error response if any
_33
// =====================
_33
#[derive(Debug, Serialize, Deserialize)]
_33
pub struct Err {
_33
#[serde(rename = "InstructionError")]
_33
pub instruction_error: Option<String>,
_33
}

Edit this page on GitHub

Copyright © Mirror World, Inc. 2023
On this page

    Home

    Tutorials

    Guides

    API Reference