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(any(feature = "alloc", not(feature = "std")))]
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;
24pub mod lca;
25#[cfg(feature = "std")]
26pub mod pack_accounts;
27
28#[cfg(feature = "alloc")]
29pub mod types;
30
31// Re-exports
32#[cfg(feature = "anchor")]
33pub use anchor_lang::{AnchorDeserialize, AnchorSerialize};
34#[cfg(not(feature = "anchor"))]
35pub use borsh::{BorshDeserialize as AnchorDeserialize, BorshSerialize as AnchorSerialize};
36pub use constants::*;
37pub use light_account_checks::{self, discriminator::Discriminator as LightDiscriminator};
38pub use crate::lca::CpiSigner;
39
40#[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorSerialize, AnchorDeserialize)]
41pub struct RentSponsor {
42    pub program_id: [u8; 32],
43    pub rent_sponsor: [u8; 32],
44    pub bump: u8,
45}