mirror of
https://github.com/haveno-dex/haveno-ui.git
synced 2025-06-19 11:54:20 -04:00
update to haveno-ts v0.0.10
This commit is contained in:
parent
fcd209fd3a
commit
1cd1ecfe6b
11 changed files with 10621 additions and 10450 deletions
|
@ -27,7 +27,7 @@ export const transformToMarketsOffers = (
|
|||
amountCurrency: offer.baseCurrencyCode,
|
||||
costCurrency: offer.baseCurrencyCode,
|
||||
paymentMethod: offer.paymentMethodShortName,
|
||||
cost: offer.txFee,
|
||||
cost: offer.makerFee,
|
||||
priceComparison: 0.1,
|
||||
accountAge: 1,
|
||||
accountTrades: 1,
|
||||
|
|
|
@ -29,13 +29,13 @@ describe("organisms::MyWalletMoneroBalance", () => {
|
|||
{
|
||||
timestamp: 1653593643913,
|
||||
height: "1.334423",
|
||||
fee: "3.33",
|
||||
fee: "33300000",
|
||||
isConfirmed: true,
|
||||
isLocked: false,
|
||||
hash: "HASHADDRESS",
|
||||
incomingTransfersList: [
|
||||
{
|
||||
amount: "10000",
|
||||
amount: "10000000000000000",
|
||||
accountIndex: 1,
|
||||
subaddressIndex: 1,
|
||||
address: "INCOMINGADDRESS",
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
import { isEmpty } from "lodash";
|
||||
import type { XmrTx } from "haveno-ts";
|
||||
import { HavenoUtils } from "haveno-ts";
|
||||
import { WalletTransactionType } from "@molecules/WalletTransactions/_types";
|
||||
import type { TWalletTransaction } from "@molecules/WalletTransactions/_types";
|
||||
|
||||
|
@ -30,12 +31,15 @@ const transfromXmrTx = (xmrTx: XmrTx.AsObject): TWalletTransaction => ({
|
|||
? WalletTransactionType.Sent
|
||||
: WalletTransactionType.Received,
|
||||
|
||||
fee: parseFloat(xmrTx.fee),
|
||||
fee: HavenoUtils.atomicUnitsToXmr(xmrTx.fee),
|
||||
height: xmrTx.height,
|
||||
|
||||
// TODO: this skips incoming transfers of tx which has both incoming and outgoing transfer
|
||||
amount: !isEmpty(xmrTx.outgoingTransfer)
|
||||
? parseFloat(xmrTx.outgoingTransfer?.amount || "")
|
||||
: parseFloat(xmrTx.incomingTransfersList[0]?.amount),
|
||||
? HavenoUtils.atomicUnitsToXmr(xmrTx.outgoingTransfer?.amount || "0")
|
||||
: HavenoUtils.atomicUnitsToXmr(
|
||||
xmrTx.incomingTransfersList[0]?.amount || "0"
|
||||
),
|
||||
|
||||
amountCurrency: "XMR",
|
||||
transactionId: xmrTx.hash,
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
import { HavenoUtils } from "haveno-ts";
|
||||
import { useQuery } from "react-query";
|
||||
import { useHavenoClient } from "./useHavenoClient";
|
||||
import { QueryKeys } from "@constants/query-keys";
|
||||
|
@ -37,10 +38,16 @@ export function useBalances() {
|
|||
const balances = xmrBalances.toObject();
|
||||
|
||||
const balance = parseFloat(balances.balance);
|
||||
const unlockedBalance = parseFloat(balances.unlockedBalance);
|
||||
const lockedBalance = parseFloat(balances.lockedBalance);
|
||||
const reservedOfferBalance = parseFloat(balances.reservedOfferBalance);
|
||||
const reservedTradeBalance = parseFloat(balances.reservedTradeBalance);
|
||||
const unlockedBalance = HavenoUtils.atomicUnitsToXmr(
|
||||
balances.availableBalance
|
||||
);
|
||||
const lockedBalance = HavenoUtils.atomicUnitsToXmr(balances.pendingBalance);
|
||||
const reservedOfferBalance = HavenoUtils.atomicUnitsToXmr(
|
||||
balances.reservedOfferBalance
|
||||
);
|
||||
const reservedTradeBalance = HavenoUtils.atomicUnitsToXmr(
|
||||
balances.reservedTradeBalance
|
||||
);
|
||||
|
||||
const availableBalance = unlockedBalance;
|
||||
const reservedBalance = reservedOfferBalance + reservedTradeBalance;
|
||||
|
|
|
@ -24,7 +24,7 @@ export function useIsMoneroNodeRunning() {
|
|||
QueryKeys.MoneroNodeIsRunning,
|
||||
async () => {
|
||||
try {
|
||||
const value = await client.isMoneroNodeRunning();
|
||||
const value = await client.isMoneroNodeOnline();
|
||||
return value;
|
||||
} catch {
|
||||
return false;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
import { useQuery } from "react-query";
|
||||
import type { OfferInfo } from "haveno-ts";
|
||||
import { HavenoUtils } from "haveno-ts";
|
||||
import { useHavenoClient } from "./useHavenoClient";
|
||||
import { QueryKeys } from "@constants/query-keys";
|
||||
|
||||
|
@ -42,6 +43,15 @@ const transformData = (offers: Array<OfferInfo>) => {
|
|||
|
||||
return {
|
||||
...offer,
|
||||
amount: HavenoUtils.atomicUnitsToXmr(offer.amount),
|
||||
minAmount: HavenoUtils.atomicUnitsToXmr(offer.minAmount),
|
||||
buyerSecurityDeposit: HavenoUtils.atomicUnitsToXmr(
|
||||
offer.buyerSecurityDeposit
|
||||
),
|
||||
sellerSecurityDeposit: HavenoUtils.atomicUnitsToXmr(
|
||||
offer.sellerSecurityDeposit
|
||||
),
|
||||
makerFee: HavenoUtils.atomicUnitsToXmr(offer.makerFee),
|
||||
price: parseFloat(offer.price),
|
||||
volume: parseFloat(offer.volume),
|
||||
minVolume: parseFloat(offer.minVolume),
|
||||
|
@ -70,8 +80,6 @@ export interface MarketOfferData {
|
|||
date: number;
|
||||
state: string;
|
||||
sellerSecurityDeposit: number;
|
||||
offerFeePaymentTxId: string;
|
||||
txFee: number;
|
||||
makerFee: number;
|
||||
isActivated: boolean;
|
||||
isMyOffer: boolean;
|
||||
|
|
|
@ -54,7 +54,7 @@ export function useRestoreBackup() {
|
|||
deleteSession();
|
||||
navigate(ROUTES.Login);
|
||||
|
||||
if (await client.isMoneroNodeRunning()) {
|
||||
if (await client.isMoneroNodeOnline()) {
|
||||
await client.stopMoneroNode();
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -38,7 +38,7 @@ export function useSaveLocalMoneroNode() {
|
|||
nodeSettings.setStartupFlagsList(data.startupFlags);
|
||||
nodeSettings.setBootstrapUrl(data.bootstrapUrl);
|
||||
|
||||
if (await client.isMoneroNodeRunning()) {
|
||||
if (await client.isMoneroNodeOnline()) {
|
||||
// stop the node if it's running
|
||||
await client.stopMoneroNode();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue