@gardenfi/wallet-connectors 2.0.7 → 2.0.8-beta.1
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"}},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}),
|
|
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,25 +1,28 @@
|
|
|
1
|
-
import { Err as l, Fetcher as
|
|
2
|
-
const
|
|
1
|
+
import { Err as l, Fetcher as i, Ok as h } from "@catalogfi/utils";
|
|
2
|
+
const u = {
|
|
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"
|
|
9
12
|
}
|
|
10
13
|
}, d = async (s, m) => {
|
|
11
|
-
const t =
|
|
14
|
+
const t = u[m];
|
|
12
15
|
if (!t) return l("Invalid network");
|
|
13
|
-
const n = "Blockstream" in t ? `${t.Blockstream}/api/address/${s}` : null,
|
|
16
|
+
const n = "Blockstream" in t ? `${t.Blockstream}/api/address/${s}` : null, a = `${t.Mempool}/api/address/${s}`;
|
|
14
17
|
try {
|
|
15
|
-
const e = n ? [n,
|
|
18
|
+
const e = n ? [n, a] : [a], o = await i.getWithFallback(e, {
|
|
16
19
|
retryCount: 3,
|
|
17
20
|
retryDelay: 1e3
|
|
18
|
-
}),
|
|
19
|
-
return
|
|
20
|
-
confirmed:
|
|
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,
|
|
21
24
|
unconfirmed: c,
|
|
22
|
-
total:
|
|
25
|
+
total: p
|
|
23
26
|
});
|
|
24
27
|
} catch (e) {
|
|
25
28
|
return l("Error while fetching balance", e);
|
|
@@ -13,7 +13,7 @@ export declare class KeplrProvider 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, string>>;
|
|
16
|
+
getNetwork(): Promise<import('@catalogfi/utils').Result<Network.MAINNET | Network.TESTNET, string>>;
|
|
17
17
|
switchNetwork(): AsyncResult<Network, string>;
|
|
18
18
|
getBalance(): Promise<import('@catalogfi/utils').Result<{
|
|
19
19
|
confirmed: number;
|
|
@@ -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, string>>;
|
|
16
|
+
getNetwork(): Promise<import('@catalogfi/utils').Result<Network.MAINNET | Network.TESTNET, string>>;
|
|
17
17
|
switchNetwork(): AsyncResult<Network, string>;
|
|
18
18
|
getBalance(): Promise<import('@catalogfi/utils').Result<{
|
|
19
19
|
confirmed: number;
|
|
@@ -15,7 +15,7 @@ export declare class XverseProvider implements IInjectedBitcoinProvider {
|
|
|
15
15
|
requestAccounts: () => AsyncResult<string[], string>;
|
|
16
16
|
getAccounts: () => AsyncResult<string[], string>;
|
|
17
17
|
sendBitcoin: (toAddress: string, satoshis: number) => AsyncResult<string, string>;
|
|
18
|
-
getNetwork(): Promise<import('@catalogfi/utils').Result<Network, string>>;
|
|
18
|
+
getNetwork(): Promise<import('@catalogfi/utils').Result<Network.MAINNET | Network.TESTNET, string>>;
|
|
19
19
|
switchNetwork(): AsyncResult<Network, string>;
|
|
20
20
|
/**
|
|
21
21
|
* not available in XVerse wallet
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gardenfi/wallet-connectors",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8-beta.1",
|
|
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",
|
|
41
|
+
"@gardenfi/utils": "2.1.3-beta.7",
|
|
42
42
|
"axios": "^1.7.9",
|
|
43
43
|
"bitcoinjs-lib": "^6.1.7",
|
|
44
44
|
"react": "^18.3.1",
|