pub struct SuiClientBuilder { /* private fields */ }client only.Expand description
A Sui client builder for connecting to the Sui network
By default the maximum concurrent requests is set to 256 and
the request timeout is set to 60 seconds. These can be adjusted using the
max_concurrent_requests function, and the request_timeout function.
If you use the WebSocket, consider setting the ws_ping_interval field to a
value of your choice to prevent the inactive WS subscription being
disconnected due to proxy timeout.
§Examples
use sui_jsonrpc::client::SuiClientBuilder;
#[tokio::main]
async fn main() -> Result<(), color_eyre::eyre::Error> {
let sui = SuiClientBuilder::default()
.build("http://127.0.0.1:9000")
.await?;
println!("Sui local network version: {:?}", sui.api_version());
Ok(())
}Implementations§
Source§impl SuiClientBuilder
impl SuiClientBuilder
Sourcepub const fn request_timeout(self, request_timeout: Duration) -> Self
pub const fn request_timeout(self, request_timeout: Duration) -> Self
Set the request timeout to the specified duration
Sourcepub fn ws_url(self, url: impl AsRef<str>) -> Self
👎Deprecated: JSON-RPC subscriptions have been deprecated since at least mainnet-v1.28.3. See https://github.com/MystenLabs/sui/releases/tag/mainnet-v1.28.3
pub fn ws_url(self, url: impl AsRef<str>) -> Self
Set the WebSocket URL for the Sui network
Sourcepub const fn ws_ping_interval(self, duration: Duration) -> Self
👎Deprecated: JSON-RPC subscriptions have been deprecated since at least mainnet-v1.28.3. See https://github.com/MystenLabs/sui/releases/tag/mainnet-v1.28.3
pub const fn ws_ping_interval(self, duration: Duration) -> Self
Set the WebSocket ping interval
Sourcepub fn basic_auth(
self,
username: impl AsRef<str>,
password: impl AsRef<str>,
) -> Self
pub fn basic_auth( self, username: impl AsRef<str>, password: impl AsRef<str>, ) -> Self
Set the basic auth credentials for the HTTP client
Sourcepub async fn build_localnet(self) -> SuiClientResult<SuiClient>
pub async fn build_localnet(self) -> SuiClientResult<SuiClient>
Returns a SuiClient object that is ready to interact with the local
development network (by default it expects the Sui network to be
up and running at 127.0.0.1:9000).
Sourcepub async fn build_devnet(self) -> SuiClientResult<SuiClient>
pub async fn build_devnet(self) -> SuiClientResult<SuiClient>
Returns a SuiClient object that is ready to interact with the Sui devnet.
Sourcepub async fn build_testnet(self) -> SuiClientResult<SuiClient>
pub async fn build_testnet(self) -> SuiClientResult<SuiClient>
Returns a SuiClient object that is ready to interact with the Sui testnet.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SuiClientBuilder
impl RefUnwindSafe for SuiClientBuilder
impl Send for SuiClientBuilder
impl Sync for SuiClientBuilder
impl Unpin for SuiClientBuilder
impl UnwindSafe for SuiClientBuilder
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
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