pub struct FeeForwarderService<P>{ /* private fields */ }Expand description
Service for building FeeForwarder transactions
Implementations§
Source§impl<P> FeeForwarderService<P>
impl<P> FeeForwarderService<P>
Sourcepub fn new(fee_forwarder_address: String, provider: Arc<P>) -> Self
pub fn new(fee_forwarder_address: String, provider: Arc<P>) -> Self
Create a new FeeForwarderService
§Arguments
fee_forwarder_address- The deployed FeeForwarder contract addressprovider- Stellar provider for network queries
Sourcepub fn build_user_auth_entry_standalone(
fee_forwarder_address: &str,
params: &FeeForwarderParams,
requires_target_auth: bool,
) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
pub fn build_user_auth_entry_standalone( fee_forwarder_address: &str, params: &FeeForwarderParams, requires_target_auth: bool, ) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
Build a user authorization entry without requiring a FeeForwarderService instance
This static method is useful when you don’t have an Arc<P> provider
but still need to build authorization entries for the FeeForwarder.
Sourcepub fn build_relayer_auth_entry_standalone(
fee_forwarder_address: &str,
params: &FeeForwarderParams,
) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
pub fn build_relayer_auth_entry_standalone( fee_forwarder_address: &str, params: &FeeForwarderParams, ) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
Build a relayer authorization entry without requiring a FeeForwarderService instance
The FeeForwarder contract requires the relayer to authorize receiving the fee payment.
This creates an auth entry for the relayer’s authorization of the forward call.
§Arguments
fee_forwarder_address- The FeeForwarder contract addressparams- FeeForwarder transaction parameters
§Returns
A SorobanAuthorizationEntry for the relayer (with empty signature for simulation)
Sourcepub fn fee_forwarder_address(&self) -> &str
pub fn fee_forwarder_address(&self) -> &str
Get the FeeForwarder contract address
Sourcepub fn build_forward_args_for_invoke_contract_args(
fee_forwarder_address: &str,
params: &FeeForwarderParams,
) -> Result<ScVec, FeeForwarderError>
pub fn build_forward_args_for_invoke_contract_args( fee_forwarder_address: &str, params: &FeeForwarderParams, ) -> Result<ScVec, FeeForwarderError>
Public wrapper for building forward args (for serializing InvokeContractArgs)
Sourcepub fn parse_contract_address_public(
address: &str,
) -> Result<ScAddress, FeeForwarderError>
pub fn parse_contract_address_public( address: &str, ) -> Result<ScAddress, FeeForwarderError>
Public wrapper for parsing a contract address
Sourcepub async fn get_expiration_ledger(
&self,
validity_seconds: u64,
) -> Result<u32, FeeForwarderError>
pub async fn get_expiration_ledger( &self, validity_seconds: u64, ) -> Result<u32, FeeForwarderError>
Sourcepub fn build_user_auth_entry(
&self,
params: &FeeForwarderParams,
requires_target_auth: bool,
) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
pub fn build_user_auth_entry( &self, params: &FeeForwarderParams, requires_target_auth: bool, ) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
Build the user authorization entry for FeeForwarder.forward()
This creates the authorization structure that the user needs to sign. The authorization includes sub-invocations for:
- fee_token.approve(user, fee_forwarder, max_fee_amount, expiration_ledger)
- target_contract.target_fn(target_args) (if requires_target_auth is true)
§Arguments
params- FeeForwarder transaction parametersrequires_target_auth- Whether the target contract call requires user authorization
§Returns
A SorobanAuthorizationEntry that the user needs to sign
Sourcepub fn serialize_auth_entry(
auth: &SorobanAuthorizationEntry,
) -> Result<String, FeeForwarderError>
pub fn serialize_auth_entry( auth: &SorobanAuthorizationEntry, ) -> Result<String, FeeForwarderError>
Serialize an authorization entry to base64 XDR
Sourcepub fn deserialize_auth_entry(
xdr: &str,
) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
pub fn deserialize_auth_entry( xdr: &str, ) -> Result<SorobanAuthorizationEntry, FeeForwarderError>
Deserialize an authorization entry from base64 XDR
Sourcepub fn build_invoke_operation(
&self,
params: &FeeForwarderParams,
auth_entries: Vec<SorobanAuthorizationEntry>,
) -> Result<Operation, FeeForwarderError>
pub fn build_invoke_operation( &self, params: &FeeForwarderParams, auth_entries: Vec<SorobanAuthorizationEntry>, ) -> Result<Operation, FeeForwarderError>
Build the InvokeHostFunction operation for FeeForwarder.forward()
This creates the operation that will be included in the transaction. The authorization entries should include both user and relayer signatures.
§Arguments
params- FeeForwarder transaction parametersauth_entries- Signed authorization entries (user + relayer)
Sourcepub fn build_invoke_operation_standalone(
fee_forwarder_address: &str,
params: &FeeForwarderParams,
auth_entries: Vec<SorobanAuthorizationEntry>,
) -> Result<Operation, FeeForwarderError>
pub fn build_invoke_operation_standalone( fee_forwarder_address: &str, params: &FeeForwarderParams, auth_entries: Vec<SorobanAuthorizationEntry>, ) -> Result<Operation, FeeForwarderError>
Build the InvokeHostFunction operation without requiring a service instance.
This static method is useful when you don’t have an Arc<P> provider
but still need to build InvokeHostFunction operations for the FeeForwarder.
Auto Trait Implementations§
impl<P> Freeze for FeeForwarderService<P>
impl<P> RefUnwindSafe for FeeForwarderService<P>where
P: RefUnwindSafe,
impl<P> Send for FeeForwarderService<P>
impl<P> Sync for FeeForwarderService<P>
impl<P> Unpin for FeeForwarderService<P>
impl<P> UnwindSafe for FeeForwarderService<P>where
P: RefUnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more