Skip to content

Add example for using EsploraClient with timeout configuration #260

@ChidiChuks

Description

@ChidiChuks

Feature Request

An example showing how to configure and use EsploraClient with custom timeout settings would be helpful for developers using BDK with unreliable or slow network connections.

Why?

Currently, the documentation does not illustrate how to:

  • Set custom request timeouts when using EsploraClient
  • Handle timeout-related errors gracefully

What’s Expected?

Please add a simple example (in the examples/ directory) demonstrating:

  • Instantiating EsploraClient with a custom ureq::Agent
  • Setting timeout durations (connect/read/write)
  • Making a sample call (e.g., get_height or get_tx) with the client

Example Reference

The relevant code might look like:

let agent = ureq::AgentBuilder::new()
    .timeout_connect(Duration::from_secs(10))
    .timeout_read(Duration::from_secs(30))
    .timeout_write(Duration::from_secs(30))
    .build();

let esplora_client = EsploraClient::from_agent("https://blockstream.info/api", agent);

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions