Skip to content

exotic-markets-labs/typhoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

51 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Typhoon

Solana Sealevel Framework

Build Status Read the book License

๐Ÿ—’๏ธ Note

  • Typhoon is in active development, so all APIs are subject to change.
  • This code is unaudited. Use at your own risk.

๐Ÿ“š Installation

To get started with Typhoon, add it to your Rust project using Cargo:

cargo add typhoon

๐Ÿš€ Getting Started

Hereโ€™s a quick example to show how Typhoon simplifies Solana program development:

use typhoon::prelude::*;

program_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");

#[context]
pub struct InitContext {
    pub payer: Signer,
    #[constraint(
        init,
        payer = payer,
        space = Counter::SPACE
    )]
    pub counter: Mut<Account<Counter>>,
    pub system: Program<System>,
}

#[context]
pub struct IncrementContext {
    pub counter: Mut<Account<Counter>>,
}

handlers! {
    initialize,
    increment
}

pub fn initialize(_: InitContext) -> Result<(), ProgramError> {
    Ok(())
}

pub fn increment(ctx: IncrementContext) -> Result<(), ProgramError> {
    ctx.counter.mut_data()?.count += 1;

    Ok(())
}

#[account]
pub struct Counter {
    pub count: u64,
}

impl Counter {
    const SPACE: usize = std::mem::size_of::<Counter>();
}

๐Ÿ“ฆ Examples

Explore the examples directory for templates and use-case scenarios to kickstart your project.

๐Ÿ“œ License

Typhoon is licensed under Apache 2.0.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Typhoon by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Releases

No releases published

Languages