Skip to main content

light_sdk_types/
lib.rs

1//! # light-sdk-types
2//!
3//! Core types for the Light Protocol SDK.
4//!
5//! | Type | Description |
6//! |------|-------------|
7//! | [`RentSponsor`] | PDA to sponsor rent-exemption of Solana accounts using the Light Token Program |
8//! | [`CpiAccounts`](cpi_accounts::CpiAccounts) | Container for CPI system and tree accounts |
9//! | [`CpiSigner`] | Program ID, signer, and bump for CPI invocation |
10//! | [`address`] | Address derivation functions (v1 and v2) |
11//! | [`constants`] | Protocol program IDs and discriminators |
12
13#![cfg_attr(not(feature = "std"), no_std)]
14
15#[cfg(feature = "alloc")]
16extern crate alloc;
17
18pub mod address;
19pub mod constants;
20pub mod cpi_accounts;
21pub mod cpi_context_write;
22pub mod error;
23pub mod instruction;
24#[cfg(feature = "std")]
25pub mod pack_accounts;
26
27#[cfg(all(feature = "alloc", feature = "v2"))]
28pub mod interface;
29
30// Re-exports
31#[cfg(feature = "anchor")]
32pub use anchor_lang::{AnchorDeserialize, AnchorSerialize};
33#[cfg(not(feature = "anchor"))]
34pub use borsh::{BorshDeserialize as AnchorDeserialize, BorshSerialize as AnchorSerialize};
35pub use constants::*;
36pub use light_account_checks::{self, discriminator::Discriminator as LightDiscriminator};
37pub use light_compressed_account::CpiSigner;
38
39#[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorSerialize, AnchorDeserialize)]
40pub struct RentSponsor {
41    pub program_id: [u8; 32],
42    pub rent_sponsor: [u8; 32],
43    pub bump: u8,
44}