lib.rs
entrypoint which exposes the main modules
constants.rs
includes our PROGRAM_ID
client.rs
Include a WorldClient struct with rpclient field and have new and send_ixs fns implemented. for creating a connection to the rpc and sending ixs
instructions.rs
This file include the ix enum with the arguments we needed with borsh implementations and helper fns for creating the ixs for em.
#[derive(BorshDeserialize, BorshSerialize)]
pub enum WorldIxs {
CreateWorld { name: String },
WriteToWorld { data: Vec<u8> },
}
pda.rs
includes helper fn for getting the world pda
account.rs
#[derive(BorshSerialize, BorshDeserialize, Debug)]
pub struct WorldAccount {
pub owner: Pubkey,
pub name: String,
pub data: Vec<u8>,
}
when reading the world pda we will use try from slice from this struct
*let* world = WorldAccount::try_from_slice(&data)?;