Struct orao_solana_vrf::FulfillBuilder
source · pub struct FulfillBuilder { /* private fields */ }
sdk
only.Expand description
crate::Fulfill
/crate::FulfillV2
instruction builder.
Note:
- prioritization fees here are handled automatically based on the recent
prioritization fees — use
FulfillBuilder::with_compute_unit_price
to opt-out. - this builder is added for convenience — use
FulfillBuilder::into_raw_instruction
to get the raw instruction, or build it yourself (see theFulfillBuilder::into_raw_instruction
source)
§Notes on account version:
This builder will analyze the randomness account version to properly choose the correct
fulfill instruction, i.e. instruction::Fulfill
will be called for [Randomness
],
and instruction::FulfillV2
will be called for [RandomnessV2
]
Implementations§
source§impl FulfillBuilder
impl FulfillBuilder
sourcepub fn with_compute_unit_price(self, compute_unit_price: u64) -> Self
pub fn with_compute_unit_price(self, compute_unit_price: u64) -> Self
Defines a prioritization fee in micro-lamports (applied per compute unit).
Adds ComputeBudgetInstruction::SetComputeUnitPrice
to the request builder.
- if not specified, then median fee of the last 150 confirmed slots is used (this is by default)
- if zero, then compute unit price is not applied at all.
sourcepub fn with_compute_unit_price_multiplier(self, multiplier: f64) -> Self
pub fn with_compute_unit_price_multiplier(self, multiplier: f64) -> Self
Defines a multiplier that is applied to a median compute unit price.
This is only applied if no compute_unit_price specified, i.e. if compute unit price is measured as a median fee of the last 150 confirmed slots.
- if not specified, then no multiplier is applied (this is by default)
- if specified, then applied as follows:
compute_unit_price = median * multiplier
sourcepub fn with_compute_unit_limit(self, compute_unit_limit: u32) -> Self
pub fn with_compute_unit_limit(self, compute_unit_limit: u32) -> Self
Defines a specific compute unit limit that the transaction is allowed to consume.
Adds ComputeBudgetInstruction::SetComputeUnitLimit
to the request builder.
- if not specified, then compute unit limit is not applied at all (this is by default)
- if specified, then applied as is
sourcepub fn into_raw_instruction(
self,
id: Pubkey,
payer: Pubkey,
client: Pubkey,
version: RandomnessAccountVersion,
fulfill_authority: &Keypair,
) -> [Instruction; 2]
pub fn into_raw_instruction( self, id: Pubkey, payer: Pubkey, client: Pubkey, version: RandomnessAccountVersion, fulfill_authority: &Keypair, ) -> [Instruction; 2]
Builds the raw crate::Fulfill
or crate::FulfillV2
instruction based on this builder.
This is a low-level function, consider using FulfillBuilder::build
.
id
— the VRF program id (usually thecrate::id
)payer
— transaction fee payer that will sign the tx.fulfill_authority
— is the authorized fulfill authority present in the effective configuration (seecrate::get_network_state
).ed25519_dalek::Keypair
is required because it is required by theed25519_instruction::new_ed25519_instruction
.
Note that this function returns a pair of instructions and the order matters —
in the transaction the first instruction (the ed25519
instruction) must go
right before the second instruction (the Fulfill
instruction). It is also
possible to put multiple fulfills into the same tx — instructions must go
in the following order:
- ed25519_1
- Fulfill_1
- ed25519_2
- Fulfill_2
- …
Also note that you must give the proper RandomnessAccountVersion
(see RandomnessAccountVersion::resolve
).
Compute Budget Program configuration is ignored.
sourcepub async fn build<'a, C: Deref<Target = impl Signer> + Clone>(
self,
orao_vrf: &'a Program<C>,
fulfill_authority: &Keypair,
) -> Result<RequestBuilder<'a, C>, ClientError>
pub async fn build<'a, C: Deref<Target = impl Signer> + Clone>( self, orao_vrf: &'a Program<C>, fulfill_authority: &Keypair, ) -> Result<RequestBuilder<'a, C>, ClientError>
Builds the request.
Note that this function returns an anchor_client::RequestBuilder
instance,
so feel free to put more instructions into the request.
Trait Implementations§
source§impl Debug for FulfillBuilder
impl Debug for FulfillBuilder
source§impl Default for FulfillBuilder
impl Default for FulfillBuilder
source§fn default() -> FulfillBuilder
fn default() -> FulfillBuilder
Auto Trait Implementations§
impl Freeze for FulfillBuilder
impl RefUnwindSafe for FulfillBuilder
impl Send for FulfillBuilder
impl Sync for FulfillBuilder
impl Unpin for FulfillBuilder
impl UnwindSafe for FulfillBuilder
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more