pub struct NetworkClient { /* private fields */ }Expand description
A client for interacting with the network.
Implementations§
Source§impl NetworkClient
impl NetworkClient
Sourcepub fn new(
signer: NetworkSigner,
rpc_url: impl Into<String>,
network_mode: NetworkMode,
) -> Self
pub fn new( signer: NetworkSigner, rpc_url: impl Into<String>, network_mode: NetworkMode, ) -> Self
Creates a new NetworkClient with the given signer, rpc url, and network mode.
Sourcepub fn get_explorer_url(&self) -> &'static str
pub fn get_explorer_url(&self) -> &'static str
Get the explorer URL for the current network mode.
Sourcepub async fn get_balance(&self) -> Result<U256>
pub async fn get_balance(&self) -> Result<U256>
Sourcepub fn get_vk_hash(vk: &SP1VerifyingKey) -> Result<B256>
pub fn get_vk_hash(vk: &SP1VerifyingKey) -> Result<B256>
Get the verifying key hash from a verifying key.
§Details
The verifying key hash is used to identify a program.
Sourcepub async fn register_program(
&self,
vk: &SP1VerifyingKey,
elf: &[u8],
) -> Result<B256>
pub async fn register_program( &self, vk: &SP1VerifyingKey, elf: &[u8], ) -> Result<B256>
Registers a program with the network if it is not already registered.
Sourcepub async fn get_program(
&self,
vk_hash: B256,
) -> Result<Option<GetProgramResponse>>
pub async fn get_program( &self, vk_hash: B256, ) -> Result<Option<GetProgramResponse>>
Sourcepub async fn create_program(
&self,
vk_hash: B256,
vk: &SP1VerifyingKey,
elf: &[u8],
) -> Result<CreateProgramResponse>
pub async fn create_program( &self, vk_hash: B256, vk: &SP1VerifyingKey, elf: &[u8], ) -> Result<CreateProgramResponse>
Creates a new program on the network.
Sourcepub async fn get_proof_request_params(
&self,
mode: ProofMode,
) -> Result<GetProofRequestParamsResponse>
pub async fn get_proof_request_params( &self, mode: ProofMode, ) -> Result<GetProofRequestParamsResponse>
Gets the proof request parameters from the network. This is only available in Mainnet (auction) mode.
Sourcepub async fn get_filtered_proof_requests(
&self,
version: Option<String>,
fulfillment_status: Option<i32>,
execution_status: Option<i32>,
minimum_deadline: Option<u64>,
vk_hash: Option<Vec<u8>>,
requester: Option<Vec<u8>>,
fulfiller: Option<Vec<u8>>,
from: Option<u64>,
to: Option<u64>,
limit: Option<u32>,
page: Option<u32>,
mode: Option<i32>,
not_bid_by: Option<Vec<u8>>,
execute_fail_cause: Option<i32>,
settlement_status: Option<i32>,
error: Option<i32>,
) -> Result<GetFilteredProofRequestsResponse>
pub async fn get_filtered_proof_requests( &self, version: Option<String>, fulfillment_status: Option<i32>, execution_status: Option<i32>, minimum_deadline: Option<u64>, vk_hash: Option<Vec<u8>>, requester: Option<Vec<u8>>, fulfiller: Option<Vec<u8>>, from: Option<u64>, to: Option<u64>, limit: Option<u32>, page: Option<u32>, mode: Option<i32>, not_bid_by: Option<Vec<u8>>, execute_fail_cause: Option<i32>, settlement_status: Option<i32>, error: Option<i32>, ) -> Result<GetFilteredProofRequestsResponse>
Get all the proof requests that meet the filter criteria.
Sourcepub async fn get_proof_request_status<P: DeserializeOwned>(
&self,
request_id: B256,
timeout: Option<Duration>,
) -> Result<(GetProofRequestStatusResponse, Option<P>)>
pub async fn get_proof_request_status<P: DeserializeOwned>( &self, request_id: B256, timeout: Option<Duration>, ) -> Result<(GetProofRequestStatusResponse, Option<P>)>
Sourcepub async fn get_proof_request_details(
&self,
request_id: B256,
timeout: Option<Duration>,
) -> Result<GetProofRequestDetailsResponse>
pub async fn get_proof_request_details( &self, request_id: B256, timeout: Option<Duration>, ) -> Result<GetProofRequestDetailsResponse>
Get the details of a given proof request.
Sourcepub async fn request_proof(
&self,
vk_hash: B256,
stdin: &SP1Stdin,
mode: ProofMode,
version: &str,
strategy: FulfillmentStrategy,
timeout_secs: u64,
cycle_limit: u64,
gas_limit: u64,
min_auction_period: u64,
whitelist: Option<Vec<Address>>,
auctioneer: Address,
executor: Address,
verifier: Address,
treasury: Address,
public_values_hash: Option<Vec<u8>>,
base_fee: u64,
max_price_per_pgu: u64,
domain: Vec<u8>,
private_stdin: bool,
) -> Result<RequestProofResponse>
pub async fn request_proof( &self, vk_hash: B256, stdin: &SP1Stdin, mode: ProofMode, version: &str, strategy: FulfillmentStrategy, timeout_secs: u64, cycle_limit: u64, gas_limit: u64, min_auction_period: u64, whitelist: Option<Vec<Address>>, auctioneer: Address, executor: Address, verifier: Address, treasury: Address, public_values_hash: Option<Vec<u8>>, base_fee: u64, max_price_per_pgu: u64, domain: Vec<u8>, private_stdin: bool, ) -> Result<RequestProofResponse>
Creates a proof request with the given verifying key hash and stdin.
§Details
vk_hash: The verifying key hash of the program to prove. Used to identify the program.stdin: The standard input to provide to the program.mode: TheProofModeto use.version: The version of the SP1 circuits to use.strategy: TheFulfillmentStrategyto use.timeout_secs: The timeout for the proof request in seconds.cycle_limit: The cycle limit for the proof request.gas_limit: The gas limit for the proof request.min_auction_period: The minimum auction period for the proof request in seconds.whitelist: The auction whitelist for the proof request.auctioneer: The auctioneer for the proof request.executor: The executor for the proof request.verifier: The verifier for the proof request.treasury: The treasury for the proof request.public_values_hash: The hash of the public values to use for the proof.base_fee: The base fee to use for the proof request.max_price_per_pgu: The maximum price per PGU to use for the proof request.domain: The domain bytes to use for the proof request.
Sourcepub async fn cancel_request(
&self,
request_id: B256,
) -> Result<CancelRequestResponse>
pub async fn cancel_request( &self, request_id: B256, ) -> Result<CancelRequestResponse>
Cancel a proof request. This is only available in Mainnet (auction) mode.
Trait Implementations§
Source§impl Clone for NetworkClient
impl Clone for NetworkClient
Source§fn clone(&self) -> NetworkClient
fn clone(&self) -> NetworkClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 NetworkClient
impl !RefUnwindSafe for NetworkClient
impl Send for NetworkClient
impl Sync for NetworkClient
impl Unpin for NetworkClient
impl UnsafeUnpin for NetworkClient
impl !UnwindSafe for NetworkClient
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<F, EF, E> ExtensionOperand<F, EF> for E
impl<F, EF, E> ExtensionOperand<F, EF> for E
fn to_operand(self) -> ExtOperand<F, EF>
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<Challenger, A> FromChallenger<Challenger, A> for Challengerwhere
Challenger: Clone,
impl<Challenger, A> FromChallenger<Challenger, A> for Challengerwhere
Challenger: Clone,
fn from_challenger(challenger: &Challenger, _backend: &A) -> Challenger
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.