pub struct RelayClient { /* private fields */ }Implementations§
Source§impl RelayClient
impl RelayClient
Sourcepub fn new(
private_key: impl Into<String>,
config: Option<BuilderConfig>,
) -> Result<Self, RelayError>
pub fn new( private_key: impl Into<String>, config: Option<BuilderConfig>, ) -> Result<Self, RelayError>
Create a new Relay client with authentication
Sourcepub fn builder() -> Result<RelayClientBuilder, RelayError>
pub fn builder() -> Result<RelayClientBuilder, RelayError>
Create a new Relay client builder
Sourcepub fn default_builder() -> Result<RelayClientBuilder, RelayError>
pub fn default_builder() -> Result<RelayClientBuilder, RelayError>
Create a new Relay client builder pulling settings from environment
Sourcepub fn from_account(account: BuilderAccount) -> Result<Self, RelayError>
pub fn from_account(account: BuilderAccount) -> Result<Self, RelayError>
Create a new Relay client from a BuilderAccount
pub fn address(&self) -> Option<Address>
Sourcepub async fn ping(&self) -> Result<Duration, RelayError>
pub async fn ping(&self) -> Result<Duration, RelayError>
Measure the round-trip time (RTT) to the Relay API.
Makes a GET request to the API base URL and returns the latency.
§Example
use polyoxide_relay::RelayClient;
let client = RelayClient::builder()?.build()?;
let latency = client.ping().await?;
println!("API latency: {}ms", latency.as_millis());pub async fn get_nonce(&self, address: Address) -> Result<u64, RelayError>
pub async fn get_transaction( &self, transaction_id: &str, ) -> Result<TransactionStatusResponse, RelayError>
pub async fn get_deployed( &self, safe_address: Address, ) -> Result<bool, RelayError>
pub fn get_expected_safe(&self) -> Result<Address, RelayError>
pub fn get_expected_proxy_wallet(&self) -> Result<Address, RelayError>
Sourcepub async fn get_relay_payload(
&self,
address: Address,
) -> Result<(Address, u64), RelayError>
pub async fn get_relay_payload( &self, address: Address, ) -> Result<(Address, u64), RelayError>
Get relay payload for PROXY wallets (returns relay address and nonce)
pub async fn execute( &self, transactions: Vec<SafeTransaction>, metadata: Option<String>, ) -> Result<RelayerTransactionResponse, RelayError>
pub async fn execute_with_gas( &self, transactions: Vec<SafeTransaction>, metadata: Option<String>, gas_limit: Option<u64>, ) -> Result<RelayerTransactionResponse, RelayError>
Sourcepub async fn estimate_redemption_gas(
&self,
condition_id: [u8; 32],
index_sets: Vec<U256>,
) -> Result<u64, RelayError>
pub async fn estimate_redemption_gas( &self, condition_id: [u8; 32], index_sets: Vec<U256>, ) -> Result<u64, RelayError>
Estimate gas required for a redemption transaction.
Returns the estimated gas limit with relayer overhead and safety buffer included. Uses the default RPC URL configured for the current chain.
§Arguments
condition_id- The condition ID to redeemindex_sets- The index sets to redeem
§Example
use polyoxide_relay::{RelayClient, BuilderAccount, BuilderConfig, WalletType};
use alloy::primitives::{U256, hex};
let builder_config = BuilderConfig::new(
"key".to_string(),
"secret".to_string(),
None,
);
let account = BuilderAccount::new("0x...", Some(builder_config))?;
let client = RelayClient::builder()?
.with_account(account)
.wallet_type(WalletType::Proxy)
.build()?;
let condition_id = [0u8; 32];
let index_sets = vec![U256::from(1)];
let estimated_gas = client
.estimate_redemption_gas(condition_id, index_sets)
.await?;
println!("Estimated gas: {}", estimated_gas);pub async fn submit_gasless_redemption( &self, condition_id: [u8; 32], index_sets: Vec<U256>, ) -> Result<RelayerTransactionResponse, RelayError>
pub async fn submit_gasless_redemption_with_gas_estimation( &self, condition_id: [u8; 32], index_sets: Vec<U256>, estimate_gas: bool, ) -> Result<RelayerTransactionResponse, RelayError>
Trait Implementations§
Source§impl Clone for RelayClient
impl Clone for RelayClient
Source§fn clone(&self) -> RelayClient
fn clone(&self) -> RelayClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RelayClient
impl !RefUnwindSafe for RelayClient
impl Send for RelayClient
impl Sync for RelayClient
impl Unpin for RelayClient
impl UnsafeUnpin for RelayClient
impl !UnwindSafe for RelayClient
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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