@gardenfi/wallet-connectors 2.0.8-beta.12 → 2.0.8-beta.2

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.
package/dist/index4.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@catalogfi/utils"),p=require("@gardenfi/utils"),u={testnet:{Mempool:"https://mempool.space/testnet4"},mainnet:{Mempool:"https://mempool.space",Blockstream:"https://blockstream.info"},localnet:{Mempool:p.API.localnet.bitcoin}},d=async(n,i)=>{const t=u[i];if(!t)return o.Err("Invalid network");const r="Blockstream"in t?`${t.Blockstream}/api/address/${n}`:null,a=`${t.Mempool}/api/address/${n}`;try{const s=r?[r,a]:[a],e=await o.Fetcher.getWithFallback(s,{retryCount:3,retryDelay:1e3}),c=e.chain_stats.funded_txo_sum-e.chain_stats.spent_txo_sum,l=e.mempool_stats.funded_txo_sum-e.mempool_stats.spent_txo_sum,m=c+l;return o.Ok({confirmed:c,unconfirmed:l,total:m})}catch(s){return o.Err("Error while fetching balance",s)}};exports.getBalance=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@catalogfi/utils"),p={testnet:{Mempool:"https://mempool.space/testnet4"},mainnet:{Mempool:"https://mempool.space",Blockstream:"https://blockstream.info"},localnet:{Mempool:"http://localhost:30000"}},u=async(n,m)=>{const t=p[m];if(!t)return o.Err("Invalid network");const r="Blockstream"in t?`${t.Blockstream}/api/address/${n}`:null,a=`${t.Mempool}/api/address/${n}`;try{const s=r?[r,a]:[a],e=await o.Fetcher.getWithFallback(s,{retryCount:3,retryDelay:1e3}),l=e.chain_stats.funded_txo_sum-e.chain_stats.spent_txo_sum,c=e.mempool_stats.funded_txo_sum-e.mempool_stats.spent_txo_sum,i=l+c;return o.Ok({confirmed:l,unconfirmed:c,total:i})}catch(s){return o.Err("Error while fetching balance",s)}};exports.getBalance=u;
package/dist/index4.js CHANGED
@@ -1,6 +1,5 @@
1
- import { Err as l, Fetcher as p, Ok as u } from "@catalogfi/utils";
2
- import { API as h } from "@gardenfi/utils";
3
- const _ = {
1
+ import { Err as l, Fetcher as i, Ok as h } from "@catalogfi/utils";
2
+ const u = {
4
3
  testnet: {
5
4
  Mempool: "https://mempool.space/testnet4"
6
5
  },
@@ -9,26 +8,26 @@ const _ = {
9
8
  Blockstream: "https://blockstream.info"
10
9
  },
11
10
  localnet: {
12
- Mempool: h.localnet.bitcoin
11
+ Mempool: "http://localhost:30000"
13
12
  }
14
- }, k = async (s, m) => {
15
- const t = _[m];
13
+ }, d = async (s, m) => {
14
+ const t = u[m];
16
15
  if (!t) return l("Invalid network");
17
- const n = "Blockstream" in t ? `${t.Blockstream}/api/address/${s}` : null, r = `${t.Mempool}/api/address/${s}`;
16
+ const n = "Blockstream" in t ? `${t.Blockstream}/api/address/${s}` : null, a = `${t.Mempool}/api/address/${s}`;
18
17
  try {
19
- const e = n ? [n, r] : [r], o = await p.getWithFallback(e, {
18
+ const e = n ? [n, a] : [a], o = await i.getWithFallback(e, {
20
19
  retryCount: 3,
21
20
  retryDelay: 1e3
22
- }), a = o.chain_stats.funded_txo_sum - o.chain_stats.spent_txo_sum, c = o.mempool_stats.funded_txo_sum - o.mempool_stats.spent_txo_sum, i = a + c;
23
- return u({
24
- confirmed: a,
21
+ }), r = o.chain_stats.funded_txo_sum - o.chain_stats.spent_txo_sum, c = o.mempool_stats.funded_txo_sum - o.mempool_stats.spent_txo_sum, p = r + c;
22
+ return h({
23
+ confirmed: r,
25
24
  unconfirmed: c,
26
- total: i
25
+ total: p
27
26
  });
28
27
  } catch (e) {
29
28
  return l("Error while fetching balance", e);
30
29
  }
31
30
  };
32
31
  export {
33
- k as getBalance
32
+ d as getBalance
34
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/wallet-connectors",
3
- "version": "2.0.8-beta.12",
3
+ "version": "2.0.8-beta.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@catalogfi/utils": "^0.1.11",
40
40
  "@catalogfi/wallets": "^0.2.54",
41
- "@gardenfi/utils": "2.1.3-beta.18",
41
+ "@gardenfi/utils": "2.1.3-beta.8",
42
42
  "axios": "^1.7.9",
43
43
  "bitcoinjs-lib": "^6.1.7",
44
44
  "react": "^18.3.1",