omnisat / lasereyes

React Hooks for Bitcoin Ordinals
https://www.lasereyes.build/
MIT License
11 stars 4 forks source link

Error Fetching BTC Balance on Testnet #38

Closed JoE11-y closed 1 week ago

JoE11-y commented 2 weeks ago

Issue: Error Fetching BTC Balance on Testnet

Description:

When connected to the Bitcoin testnet, I'm encountering the following error:

Error: Failed to fetch BTC balance

This error occurs because the service is attempting to retrieve address information from https://blockchain.info using the URL:

https://blockchain.info/q/addressbalance/<testnetaddress>

However, this endpoint does not support testnet addresses, leading to the failure.

Steps to Reproduce:

  1. Switch LaserEyesProvider Config to the Bitcoin testnet.
  2. Connect your wallet any of this XVERSE, OYL, MAGIC_EDEN, OKX, LEATHER, PHANTOM
  3. Observe the error message.

Expected Behavior: The service should use a testnet-compatible block explorer or API to fetch the balance for testnet addresses.

Actual Behavior: The service incorrectly tries to fetch the balance using Blockchain.info, which only supports mainnet addresses.

Possible Solutions:

Environment:

JoE11-y commented 2 weeks ago

Anychance this gets looked at @hathbanger @0xBunzy.

hathbanger commented 1 week ago

@JoE11-y sounds like a plan. We'll need to shift around our utxo type to best suit their response but other then that should be p chill. Also would like to get segwit and fractal fully supported as well.

hathbanger commented 1 week ago

@JoE11-y looks like blockcypher requires an api key, blockstream's looking p nice tho.

hathbanger commented 1 week ago

so which testnet should we support @JoE11-y? i'm leaning towards 4 over 3 as 3's otw to being deprecated. i think we lean into mempool.space's api which has 3,4,segwit and then there are fractal based mempool.spaces out there we can hook into, keeping the utxo type the same across the board.

JoE11-y commented 1 week ago

Yeah @hathbanger that's true testnet4 will be the way to go. Exactly so mempool.space will be perfect then.

JoE11-y commented 1 week ago

I actually did make a PR earlier maybe you could also take a look at it @hathbanger.

hathbanger commented 1 week ago

@JoE11-y i saw it after the fact 😫 i saw the issue you raised on my phone and i didn't dig any further to see the pr. sorry bro. never again.

JoE11-y commented 1 week ago

Haha it's all cool brother. Glad to have helped. 💪💪💪 😁