superstream 0.3.3

Streaming payments on Solana
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use anchor_lang::prelude::*;
use anchor_spl::token::TokenAccount;

pub(crate) fn get_current_timestamp() -> Result<u64> {
    let clock = Clock::get()?;
    Ok(clock.unix_timestamp as u64)
}

pub(crate) fn is_token_account_rent_exempt<T: AccountSerialize + AccountDeserialize + Owner + Clone>(
    account: &Account<T>,
) -> Result<bool> {
    Ok(Rent::get()?.is_exempt(account.to_account_info().lamports(), TokenAccount::LEN))
}