@ecency/wallets 1.4.5 → 1.4.6
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/browser/index.d.ts +4 -0
- package/dist/browser/index.js +23 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +23 -4
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +23 -4
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -641,10 +641,12 @@ function getHiveAssetGeneralInfoQueryOptions(username) {
|
|
|
641
641
|
const accountData = getQueryClient().getQueryData(
|
|
642
642
|
getAccountFullQueryOptions(username).queryKey
|
|
643
643
|
);
|
|
644
|
+
const marketTicker = await CONFIG.hiveClient.call("condenser_api", "get_ticker", []).catch(() => void 0);
|
|
645
|
+
const marketPrice = Number.parseFloat(marketTicker?.latest ?? "");
|
|
644
646
|
return {
|
|
645
647
|
name: "HIVE",
|
|
646
648
|
title: "Hive",
|
|
647
|
-
price: dynamicProps ? dynamicProps.base / dynamicProps.quote : 0,
|
|
649
|
+
price: Number.isFinite(marketPrice) ? marketPrice : dynamicProps ? dynamicProps.base / dynamicProps.quote : 0,
|
|
648
650
|
accountBalance: accountData ? parseAsset(accountData.balance).amount : 0
|
|
649
651
|
};
|
|
650
652
|
}
|
|
@@ -691,10 +693,13 @@ function getHivePowerAssetGeneralInfoQueryOptions(username) {
|
|
|
691
693
|
accountBalance: 0
|
|
692
694
|
};
|
|
693
695
|
}
|
|
696
|
+
const marketTicker = await CONFIG.hiveClient.call("condenser_api", "get_ticker", []).catch(() => void 0);
|
|
697
|
+
const marketPrice = Number.parseFloat(marketTicker?.latest ?? "");
|
|
698
|
+
const price = Number.isFinite(marketPrice) ? marketPrice : dynamicProps.base / dynamicProps.quote;
|
|
694
699
|
return {
|
|
695
700
|
name: "HP",
|
|
696
701
|
title: "Hive Power",
|
|
697
|
-
price
|
|
702
|
+
price,
|
|
698
703
|
accountBalance: +vestsToHp(
|
|
699
704
|
parseAsset(accountData.vesting_shares).amount,
|
|
700
705
|
// parseAsset(accountData.delegated_vesting_shares).amount +
|
|
@@ -739,18 +744,30 @@ function getHbdAssetGeneralInfoQueryOptions(username) {
|
|
|
739
744
|
const dynamicProps = getQueryClient().getQueryData(
|
|
740
745
|
getDynamicPropsQueryOptions().queryKey
|
|
741
746
|
);
|
|
747
|
+
let price = 1;
|
|
748
|
+
try {
|
|
749
|
+
const response = await fetch(
|
|
750
|
+
"https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=usd"
|
|
751
|
+
);
|
|
752
|
+
const data = await response.json();
|
|
753
|
+
const marketPrice = data.hive_dollar?.usd;
|
|
754
|
+
if (typeof marketPrice === "number" && Number.isFinite(marketPrice)) {
|
|
755
|
+
price = marketPrice;
|
|
756
|
+
}
|
|
757
|
+
} catch {
|
|
758
|
+
}
|
|
742
759
|
if (!accountData) {
|
|
743
760
|
return {
|
|
744
761
|
name: "HBD",
|
|
745
762
|
title: "Hive-based dollar",
|
|
746
|
-
price
|
|
763
|
+
price,
|
|
747
764
|
accountBalance: 0
|
|
748
765
|
};
|
|
749
766
|
}
|
|
750
767
|
return {
|
|
751
768
|
name: "HBD",
|
|
752
769
|
title: "Hive-based dollar",
|
|
753
|
-
price
|
|
770
|
+
price,
|
|
754
771
|
accountBalance: parseAsset(accountData.hbd_balance).amount + parseAsset(accountData?.savings_hbd_balance).amount,
|
|
755
772
|
apr: ((dynamicProps?.hbdInterestRate ?? 0) / 100).toFixed(3),
|
|
756
773
|
parts: [
|
|
@@ -1499,6 +1516,7 @@ function getSpkAssetGeneralInfoQueryOptions(username) {
|
|
|
1499
1516
|
if (!wallet || !market) {
|
|
1500
1517
|
return {
|
|
1501
1518
|
name: "SPK",
|
|
1519
|
+
layer: "SPK",
|
|
1502
1520
|
title: "SPK Network",
|
|
1503
1521
|
price: 1,
|
|
1504
1522
|
accountBalance: 0
|
|
@@ -1523,6 +1541,7 @@ function getSpkAssetGeneralInfoQueryOptions(username) {
|
|
|
1523
1541
|
);
|
|
1524
1542
|
return {
|
|
1525
1543
|
name: "SPK",
|
|
1544
|
+
layer: "SPK",
|
|
1526
1545
|
title: "SPK Network",
|
|
1527
1546
|
price: price / accountBalance,
|
|
1528
1547
|
accountBalance
|