interveil_sdk/intent/
builder.rs1use crate::intent::intent::Intent;
2use crate::intent::payload::IntentPayload;
3use crate::types::{Chain, Nonce};
4use std::time::{SystemTime, UNIX_EPOCH};
5
6impl Intent {
7 pub fn transfer_sol(to: String, lamports: u64) -> Self {
10 Self {
11 version: 1,
12 chain: Chain::Solana,
13 nonce: current_timestamp_millis(),
14 payload: IntentPayload::TransferSol { to, lamports },
15 }
16 }
17}
18
19fn current_timestamp_millis() -> Nonce {
23 SystemTime::now()
24 .duration_since(UNIX_EPOCH)
25 .expect("system clock before UNIX epoch")
26 .as_millis() as u64
27}