#[repr(packed)]
pub struct FunctionAccountData {
Show 28 fields pub is_scheduled: u8, pub is_triggered: u8, pub permissions: u32, pub status: FunctionStatus, pub name: [u8; 64], pub metadata: [u8; 256], pub created_at: i64, pub updated_at: i64, pub container_registry: [u8; 64], pub container: [u8; 64], pub version: [u8; 32], pub authority: Pubkey, pub escrow: Pubkey, pub address_lookup_table: Pubkey, pub attestation_queue: Pubkey, pub queue_idx: u32, pub schedule: [u8; 64], pub last_execution_timestamp: i64, pub next_allowed_timestamp: i64, pub trigger_count: u64, pub permission_expiration: i64, pub num_requests: u64, pub requests_disabled: bool, pub requests_require_authorization: bool, pub requests_default_slots_until_expiration: u64, pub requests_fee: u64, pub mr_enclaves: [[u8; 32]; 32], pub _ebuf: [u8; 1024],
}

Fields§

§is_scheduled: u8

Whether the function is invoked on a schedule or by request

§is_triggered: u8

Whether the function has been manually triggered with the function_trigger instruction

§permissions: u32

The function permissions granted by the attestation_queue.authority

§status: FunctionStatus§name: [u8; 64]

The name of the function for easier identification.

§metadata: [u8; 256]

The metadata of the function for easier identification.

§created_at: i64

The unix timestamp when the function was created.

§updated_at: i64

The unix timestamp when the function config (container, registry, version, or schedule) was changed.

§container_registry: [u8; 64]

The off-chain registry to fetch the function container from.

§container: [u8; 64]

The identifier of the container in the given container_registry.

§version: [u8; 32]

The version tag of the container to pull.

§authority: Pubkey

The authority of the function which is authorized to make account changes.

§escrow: Pubkey

The wrapped SOL escrow of the function to pay for scheduled requests.

§address_lookup_table: Pubkey

The address_lookup_table of the function used to increase the number of accounts we can fit into a function result.

§attestation_queue: Pubkey

The address of the AttestationQueueAccountData that will be processing function requests and verifying the function measurements.

§queue_idx: u32

An incrementer used to rotate through an AttestationQueue’s verifiers.

§schedule: [u8; 64]

The cron schedule to run the function on.

§last_execution_timestamp: i64

The unix timestamp when the function was last run.

§next_allowed_timestamp: i64

The unix timestamp when the function is allowed to run next.

§trigger_count: u64

The number of times to trigger the function upon the next invocation.

§permission_expiration: i64

UNUSED. The unix timestamp when the current permissions expire.

§num_requests: u64

Number of requests created for this function. Used to prevent closing when there are live requests.

§requests_disabled: bool

Whether custom requests have been disabled for this function.

§requests_require_authorization: bool

Whether new requests need to be authorized by the FunctionAccount authority before being initialized. Useful if you want to use CPIs to control request account creation.

§requests_default_slots_until_expiration: u64

The number of slots after a request has been verified before allowing a non-authority account to close the account. Useful if you want to submit multiple txns in your custom function and need the account to be kept alive for multiple slots.

§requests_fee: u64

The lamports paid to the FunctionAccount escrow on each successful update request.

§mr_enclaves: [[u8; 32]; 32]

An array of permitted mr_enclave measurements for the function.

§_ebuf: [u8; 1024]

Reserved.

Implementations§

source§

impl FunctionAccountData

source

pub fn size() -> usize

source

pub fn new<'info>( function_account_info: &'info AccountInfo<'info> ) -> Result<Ref<'info, FunctionAccountData>>

Returns the deserialized Switchboard Function account

Arguments
  • function_account_info - A Solana AccountInfo referencing an existing Switchboard FunctionAccount
Examples
use switchboard_solana::FunctionAccountData;

let function_account = FunctionAccountData::new(function_account_info)?;
source

pub fn new_from_bytes(data: &[u8]) -> Result<&FunctionAccountData>

Returns the deserialized Switchboard Function account

Arguments
  • data - A Solana AccountInfo’s data buffer
Examples
use switchboard_solana::FunctionAccountData;

let function_account = FunctionAccountData::new(function_account_info.try_borrow_data()?)?;
source

pub fn get_enclave_pda(fn_key: &Pubkey) -> Pubkey

source

pub fn get_escrow_key(fn_key: &Pubkey) -> Pubkey

source

pub fn validate_enclave<'a>( function_account_info: &AccountInfo<'a>, enclave_account_info: &AccountInfo<'a>, signer: &AccountInfo<'a> ) -> Result<bool>

Validate that the provided accounts correspond to the expected function accounts

Arguments
  • function_account_info - Solana AccountInfo for a FunctionAccountData
  • enclave_account_info - Solana AccountInfo for a EnclaveAccountData
  • signer - Solana AccountInfo for a signer
source

pub fn is_empty_schedule(&self) -> bool

source

pub fn get_container(&self) -> String

source

pub fn get_version(&self) -> String

source

pub fn get_name(&self) -> String

source

pub fn is_valid_enclave(&self, mr_enclave: &[u8; 32]) -> bool

source

pub fn get_schedule(&self) -> Option<Schedule>

Available on non-target_os="solana" only.
source

pub fn get_last_execution_datetime(&self) -> DateTime<Utc>

Available on non-target_os="solana" only.
source

pub fn get_next_execution_datetime(&self) -> DateTime<Utc>

Available on non-target_os="solana" only.
source

pub fn should_execute(&self, now: DateTime<Utc>) -> bool

Available on non-target_os="solana" only.
source

pub async fn fetch(client: &RpcClient, pubkey: Pubkey) -> Result<Self, Error>

Available on non-target_os="solana" only.

Trait Implementations§

source§

impl Clone for FunctionAccountData

source§

fn clone(&self) -> FunctionAccountData

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for FunctionAccountData

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Discriminator for FunctionAccountData

source§

const DISCRIMINATOR: [u8; 8] = _

§

fn discriminator() -> [u8; 8]

source§

impl Owner for FunctionAccountData

source§

impl PartialEq<FunctionAccountData> for FunctionAccountData

source§

fn eq(&self, other: &FunctionAccountData) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Zeroable for FunctionAccountData

source§

fn zeroed() -> Self

source§

impl Copy for FunctionAccountData

source§

impl Pod for FunctionAccountData

source§

impl StructuralPartialEq for FunctionAccountData

source§

impl ZeroCopy for FunctionAccountData

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> NoUninit for Twhere T: Pod,