rust-esplora-client icon indicating copy to clipboard operation
rust-esplora-client copied to clipboard

refactor(api, blocking, async)!: make library generic over any HTTP client

Open oleonardolima opened this issue 5 months ago • 4 comments

fixes #97

Description

It refactors the library, introducing and adding new structures/enums for Esplora API: TransactionApi, AddressesApi, BlocksApi, and FeeEstimateApi.

Introduce and exposes new trait Client with minimal HTTP behaviors: request, send, send_async, and deserialize_{decodable|json|str} methods.

Any HTTP client can now implement either the send or send_async method, use it's inner HTTP client structure for dispatching and handling the request/response, then use the common already implemented methods for deserializing the response.

Notes to the reviewers

I still think it's not there yet, the ergonomics and usage can be improved, but I'd like to see if anyone has any comments or suggestions on the approach.

Changelog notice

TBD

Checklists

All Submissions:

  • [x] I've signed all my commits
  • [x] I followed the contribution guidelines
  • [x] I ran cargo fmt and cargo clippy before committing

New Features:

  • [x] I've added tests for the new feature
  • [ ] I've added docs for the new feature

Bugfixes:

  • [ ] This pull request breaks the existing API
  • [ ] I've added tests to reproduce the issue which are now passing
  • [ ] I'm linking the issue being fixed by this PR

oleonardolima avatar Sep 15 '24 01:09 oleonardolima