Skip to main content

HopperSchemaPointer

Struct HopperSchemaPointer 

Source
#[repr(C)]
pub struct HopperSchemaPointer { pub schema_version: u16, pub pointer_flags: u16, pub manifest_hash: [u8; 32], pub idl_hash: [u8; 32], pub codama_hash: [u8; 32], pub uri_len: u16, pub uri: [u8; 192], }
Expand description

On-chain account that points to a Hopper program’s schema.

Stored at PDA ["hopper-schema", program_id]. Contains hashes of the manifest, IDL, and Codama projection, plus a URI to fetch the full manifest. See docs/ONCHAIN_SCHEMA_PUBLICATION.md.

§Wire layout (294 bytes payload + 16 bytes header = 310 bytes)

[0..16]    Hopper header (disc=255, ver=1)
[16..18]   schema_version   u16 LE
[18..20]   pointer_flags    u16 LE
[20..52]   manifest_hash    [u8; 32]
[52..84]   idl_hash         [u8; 32]
[84..116]  codama_hash      [u8; 32]
[116..118] uri_len          u16 LE
[118..310] uri              [u8; 192]

Fields§

§schema_version: u16

Schema format version (currently 1).

§pointer_flags: u16

Feature flags (HAS_MANIFEST, HAS_IDL, HAS_CODAMA, HAS_URI, …).

§manifest_hash: [u8; 32]

SHA-256 of the manifest JSON.

§idl_hash: [u8; 32]

SHA-256 of the IDL JSON.

§codama_hash: [u8; 32]

SHA-256 of the Codama projection JSON.

§uri_len: u16

Length of the URI string (0..192).

§uri: [u8; 192]

UTF-8 URI pointing to the manifest (padded with zeros).

Implementations§

Source§

impl HopperSchemaPointer

Source

pub const DISC: u8 = 255

Reserved discriminator for schema pointer accounts.

Source

pub const PAYLOAD_LEN: usize

Total payload size (excluding Hopper header).

Source

pub const ACCOUNT_LEN: usize

Total account size including Hopper header.

Source

pub const PDA_SEED: &'static [u8] = b"hopper-schema"

PDA seed prefix.

Source

pub const FLAG_HAS_MANIFEST: u16 = 0x0001

Source

pub const FLAG_HAS_IDL: u16 = 0x0002

Source

pub const FLAG_HAS_CODAMA: u16 = 0x0004

Source

pub const FLAG_HAS_URI: u16 = 0x0008

Source

pub const FLAG_URI_IS_IPFS: u16 = 0x0010

Source

pub const FLAG_URI_IS_ARWEAVE: u16 = 0x0020

Source

pub fn uri_str(&self) -> &str

Get the URI as a string slice.

Source

pub fn has_flag(&self, flag: u16) -> bool

Check if a specific flag is set.

Trait Implementations§

Source§

impl Clone for HopperSchemaPointer

Source§

fn clone(&self) -> HopperSchemaPointer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for HopperSchemaPointer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.