Rust
Use full service RPC for fetching latest blockhash. Nozomi only supports sendTransaction.
use solana_client::rpc_client::RpcClient;
use solana_sdk::{message::Instruction, pubkey, pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction};
const NOZOMI_ENDPOINT: &str = "https://nozomi.temporal.xyz/?c=<YOUR_API_KEY>";
const NOZOMI_TIP: Pubkey = pubkey!("TEMPaMeCRFAS9EKF53Jd6KpHxgL47uWLcpFArU1Fanq");
const MIN_TIP_AMOUNT: u64 = 1_000_000;
const SOLANA_RPC_ENDPOINT: &str = "https://api.mainnet-beta.solana.com";
fn send_nozomi_txn(ixns: &mut Vec<Instruction>, signer: &Keypair, nozomi_rpc_client: &RpcClient, solana_rpc_client: &RpcClient) {
let tip_ix = solana_system_interface::instruction::transfer(&signer.pubkey(), &NOZOMI_TIP, MIN_TIP_AMOUNT);
ixns.push(tip_ix);
let blockhash = solana_rpc_client.get_latest_blockhash().unwrap();
let tx = Transaction::new_signed_with_payer(ixns, Some(&signer.pubkey()), &[signer], blockhash);
nozomi_rpc_client.send_transaction(&tx).unwrap();
}
fn build_ixns() -> Vec<Instruction> {
// your instruction building logic here..
vec![]
}
fn main() {
let nozomi_rpc_client = RpcClient::new(NOZOMI_ENDPOINT.to_string());
let solana_rpc_client = RpcClient::new(SOLANA_RPC_ENDPOINT.to_string());
let keypair = Keypair::new();
let mut ixns = build_ixns();
send_nozomi_txn(&mut ixns, &keypair, &nozomi_rpc_client, &solana_rpc_client);
}Last updated

