@gardenfi/wallet-connectors 2.0.4-beta.7 → 2.0.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.
package/dist/index4.cjs CHANGED
@@ -1 +1 @@
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;
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"}},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}),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,i=c+l;return o.Ok({confirmed:c,unconfirmed:l,total:i})}catch(s){return o.Err("Error while fetching balance",s)}};exports.getBalance=u;
package/dist/index4.js CHANGED
@@ -1,28 +1,25 @@
1
- import { Err as l, Fetcher as i, Ok as h } from "@catalogfi/utils";
2
- const u = {
1
+ import { Err as l, Fetcher as p, Ok as u } from "@catalogfi/utils";
2
+ const h = {
3
3
  testnet: {
4
4
  Mempool: "https://mempool.space/testnet4"
5
5
  },
6
6
  mainnet: {
7
7
  Mempool: "https://mempool.space",
8
8
  Blockstream: "https://blockstream.info"
9
- },
10
- localnet: {
11
- Mempool: "http://localhost:30000"
12
9
  }
13
10
  }, d = async (s, m) => {
14
- const t = u[m];
11
+ const t = h[m];
15
12
  if (!t) return l("Invalid network");
16
- const n = "Blockstream" in t ? `${t.Blockstream}/api/address/${s}` : null, a = `${t.Mempool}/api/address/${s}`;
13
+ const n = "Blockstream" in t ? `${t.Blockstream}/api/address/${s}` : null, r = `${t.Mempool}/api/address/${s}`;
17
14
  try {
18
- const e = n ? [n, a] : [a], o = await i.getWithFallback(e, {
15
+ const e = n ? [n, r] : [r], o = await p.getWithFallback(e, {
19
16
  retryCount: 3,
20
17
  retryDelay: 1e3
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,
18
+ }), 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;
19
+ return u({
20
+ confirmed: a,
24
21
  unconfirmed: c,
25
- total: p
22
+ total: i
26
23
  });
27
24
  } catch (e) {
28
25
  return l("Error while fetching balance", e);
@@ -13,7 +13,7 @@ export declare class UnisatProvider implements IInjectedBitcoinProvider {
13
13
  connect(network?: Network): AsyncResult<Connect, string>;
14
14
  requestAccounts(): Promise<import('@catalogfi/utils').Result<string[], string>>;
15
15
  getAccounts(): Promise<import('@catalogfi/utils').Result<string[], string>>;
16
- getNetwork(): Promise<import('@catalogfi/utils').Result<Network.MAINNET | Network.TESTNET, string>>;
16
+ getNetwork(): Promise<import('@catalogfi/utils').Result<Network, string>>;
17
17
  switchNetwork(): AsyncResult<Network, string>;
18
18
  getBalance(): Promise<import('@catalogfi/utils').Result<{
19
19
  confirmed: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/wallet-connectors",
3
- "version": "2.0.4-beta.7",
3
+ "version": "2.0.4",
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.3",
41
+ "@gardenfi/utils": "2.1.3",
42
42
  "axios": "^1.7.9",
43
43
  "bitcoinjs-lib": "^7.0.0-rc.0",
44
44
  "react": "^18.3.1",