Skip to content

Add bitreq#1608

Open
lescuer97 wants to merge 20 commits intocashubtc:mainfrom
lescuer97:add_bitreq
Open

Add bitreq#1608
lescuer97 wants to merge 20 commits intocashubtc:mainfrom
lescuer97:add_bitreq

Conversation

@lescuer97
Copy link
Contributor

Description

use bitreq for the non wasm targets and use reqwest for wasm. in the http client crate.


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

@github-project-automation github-project-automation bot moved this to Backlog in CDK Feb 7, 2026
@ye0man ye0man moved this from Backlog to In progress in CDK Feb 10, 2026
@lescuer97 lescuer97 marked this pull request as ready for review February 19, 2026 14:27
@thesimplekid thesimplekid requested a review from crodas February 19, 2026 14:28
@crodas
Copy link
Collaborator

crodas commented Feb 19, 2026

@lescuer97 almost there, I think we should remove reqwuest all together and use this bits for wasm, using the native "fetch" function provided by the browser and bitreq for everything else

@thesimplekid
Copy link
Collaborator

@lescuer97 almost there, I think we should remove reqwuest all together and use this bits for wasm, using the native "fetch" function provided by the browser and bitreq for everything else

I don't think we should remove reqwest all together. Can't we make use of a trait and then implement that trait for both bitreq and reqwest, it should only have a couple fns. We can then feature flag these implementations. Many projects already use reqwest so use reqwest within cdk would not be adding any deps and in fact using bitreq would. This would also make it easier for us to switch between the two as bitreq is still new we could encounter issues.

@lescuer97
Copy link
Contributor Author

@lescuer97 almost there, I think we should remove reqwuest all together and use this bits for wasm, using the native "fetch" function provided by the browser and bitreq for everything else

I don't think we should remove reqwest all together. Can't we make use of a trait and then implement that trait for both bitreq and reqwest, it should only have a couple fns. We can then feature flag these implementations. Many projects already use reqwest so use reqwest within cdk would not be adding any deps and in fact using bitreq would. This would also make it easier for us to switch between the two as bitreq is still new we could encounter issues.

projects already using reqwest is true. I had not think about it

@crodas
Copy link
Collaborator

crodas commented Feb 24, 2026

The reqwest feature needs to be added to the cdk and perhaps the mintd crates as well, since the http crate is not injected or cannot be provided externally.

@thesimplekid
Copy link
Collaborator

mintd we can just make the choice we don't need to give a feature.

@thesimplekid
Copy link
Collaborator

Even if we do not provide the feature externally, I still think it makes sense to do as a trait. Since we know we will have at least 2 impls even if we drop reqwest wasm and native.

@lescuer97
Copy link
Contributor Author

okey, just to clear thing up. I will then keep this code but add back the features for bitreq and reqwest.

and reimplement the trait for reqwest.

does this sound correct?

@crodas
Copy link
Collaborator

crodas commented Feb 24, 2026

I can help if you want, but I also believe the trait is a good idea and it should live in cdk-common perhaps.

@thesimplekid
Copy link
Collaborator

I just remembered we actually have 3 at minimum due to Tor. We already have a trait there maybe we can just move it and consolidate?

@lescuer97
Copy link
Contributor Author

@thesimplekid @crodas just to be clear on what to do next. I should keep the trait that already exists in the http package, then use that trait for the tor implementation also. possibly moving that code into the http crate.

plus go back to use features. so users can decide to use either the reqwest or bitreq trait.

@thesimplekid
Copy link
Collaborator

We want to move the transport Trait to the http crate. Tor, bitreq and reqwest should all implement this each behind a feature in the http crate. The MintConnector should stay roughly the same in cdk where it takes the Transport trait.

lescuer97 and others added 10 commits March 20, 2026 19:58
Remove the reqwest dependency from cdk-http-client and replace it with a native
WASM fetch backend using wasm_bindgen + web_sys. The bitreq backend remains for
native targets but is no longer behind a feature flag — it is always compiled
on non-WASM via target_arch cfg.

- Add wasm_backend.rs: WasmRequestBuilder, HttpClient, and HttpClientBuilder
  using js_fetch + web_sys::Request
- Move HttpClient and HttpClientBuilder into their respective backend files to
  eliminate cfg gates on shared types
- Remove reqwest_backend.rs and the reqwest/bitreq feature flags
- Use cfg(target_arch = "wasm32") / cfg(not(...)) instead of features
- Remove reqwest from workspace dependencies
- Update cdk, cdk-common, cdk-prometheus Cargo.toml references
move and implemented the transport crate in the http crate
c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants