monaco-grpc-sdk 0.6.3-develop.fcde00c

Typed Rust gRPC client SDK for the Monaco Exchange API — generated from Protocol Buffer definitions
Documentation

monaco-grpc-sdk

Typed Rust gRPC client SDK for the Monaco Exchange API, generated from Protocol Buffer definitions.

Usage

Plaintext (development / localhost)

[dependencies]
monaco-grpc-sdk = "0.6"
tonic = { version = "0.14", features = ["transport"] }
tokio = { version = "1", features = ["full"] }
use monaco_grpc_sdk::monaco::api::orders::orders_service_client::OrdersServiceClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut client = OrdersServiceClient::connect("http://localhost:9090").await?;
    // ...
    Ok(())
}

TLS (production / HTTPS endpoints)

The transport feature alone does not enable TLS. To connect to https:// endpoints, enable a TLS backend in tonic and a roots provider:

[dependencies]
monaco-grpc-sdk = "0.6"
tonic = { version = "0.14", features = ["transport", "tls-ring", "tls-webpki-roots"] }
tokio = { version = "1", features = ["full"] }
use monaco_grpc_sdk::monaco::api::orders::orders_service_client::OrdersServiceClient;
use tonic::transport::{Channel, ClientTlsConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let channel = Channel::from_static("https://grpc.monaco.exchange")
        .tls_config(ClientTlsConfig::new().with_webpki_roots())?
        .connect()
        .await?;
    let mut client = OrdersServiceClient::new(channel);
    // ...
    Ok(())
}

Regenerating

After proto changes, run from the repo root:

make sdk-gen

This requires a valid BUF_TOKEN environment variable with access to buf.build/monaco-sdk/api.