@zubari/sdk 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3969,6 +3969,61 @@ var WalletManager = class _WalletManager {
3969
3969
  } catch (error) {
3970
3970
  console.warn(`Failed to fetch ${chain} balance:`, error);
3971
3971
  }
3972
+ } else if (chain === "bitcoin") {
3973
+ const baseUrl = this.config.network === "mainnet" ? "https://blockstream.info/api" : "https://blockstream.info/testnet/api";
3974
+ try {
3975
+ const response = await fetch(`${baseUrl}/address/${address}`, {
3976
+ headers: { "Accept": "application/json" }
3977
+ });
3978
+ if (response.ok) {
3979
+ const data = await response.json();
3980
+ const chainFunded = data.chain_stats?.funded_txo_sum || 0;
3981
+ const chainSpent = data.chain_stats?.spent_txo_sum || 0;
3982
+ const mempoolFunded = data.mempool_stats?.funded_txo_sum || 0;
3983
+ const mempoolSpent = data.mempool_stats?.spent_txo_sum || 0;
3984
+ const satoshis = chainFunded - chainSpent + (mempoolFunded - mempoolSpent);
3985
+ balance = (satoshis / 1e8).toFixed(8);
3986
+ }
3987
+ } catch (error) {
3988
+ console.warn(`Failed to fetch ${chain} balance:`, error);
3989
+ }
3990
+ } else if (chain === "solana") {
3991
+ const rpcUrl = this.config.network === "mainnet" ? "https://api.mainnet-beta.solana.com" : "https://api.devnet.solana.com";
3992
+ try {
3993
+ const response = await fetch(rpcUrl, {
3994
+ method: "POST",
3995
+ headers: { "Content-Type": "application/json" },
3996
+ body: JSON.stringify({
3997
+ jsonrpc: "2.0",
3998
+ id: 1,
3999
+ method: "getBalance",
4000
+ params: [address]
4001
+ })
4002
+ });
4003
+ if (response.ok) {
4004
+ const data = await response.json();
4005
+ if (data.result?.value !== void 0) {
4006
+ balance = (data.result.value / 1e9).toFixed(9);
4007
+ }
4008
+ }
4009
+ } catch (error) {
4010
+ console.warn(`Failed to fetch ${chain} balance:`, error);
4011
+ }
4012
+ } else if (chain === "tron") {
4013
+ const baseUrl = this.config.network === "mainnet" ? "https://api.trongrid.io" : "https://api.shasta.trongrid.io";
4014
+ try {
4015
+ const response = await fetch(`${baseUrl}/v1/accounts/${address}`, {
4016
+ headers: { "Accept": "application/json" }
4017
+ });
4018
+ if (response.ok) {
4019
+ const data = await response.json();
4020
+ if (data.data?.[0]?.balance !== void 0) {
4021
+ balance = (data.data[0].balance / 1e6).toFixed(6);
4022
+ }
4023
+ }
4024
+ } catch (error) {
4025
+ console.warn(`Failed to fetch ${chain} balance:`, error);
4026
+ }
3972
4027
  }
3973
4028
  return {
3974
4029
  chain,