mirror of
https://github.com/haveno-dex/haveno-ui.git
synced 2024-10-01 07:35:39 -04:00
update to haveno-ts v0.0.10
This commit is contained in:
parent
fcd209fd3a
commit
1cd1ecfe6b
14
README.md
14
README.md
@ -5,8 +5,8 @@
|
|||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
1. Node 16.x
|
1. Node 16.x
|
||||||
1. yarn 1.x
|
2. yarn 1.x
|
||||||
1. Haveno daemon and envoy proxy
|
3. Run user1-daemon-local and envoy proxy by following [these instructions](https://github.com/haveno-dex/haveno-ts#run-tests)
|
||||||
|
|
||||||
### Install dependencies
|
### Install dependencies
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ yarn watch
|
|||||||
### Tests
|
### Tests
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
yarn tests
|
yarn test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Storybook
|
### Storybook
|
||||||
@ -35,3 +35,11 @@ yarn tests
|
|||||||
```sh
|
```sh
|
||||||
yarn storybook
|
yarn storybook
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### App Data Folder
|
||||||
|
|
||||||
|
The UI's data folder can be cleared to reset the UI state, located at:
|
||||||
|
|
||||||
|
- Mac: ~/Library/Application Support/haveno-ui/
|
||||||
|
- Linux: ~/.local/share/haveno-ui/
|
||||||
|
- Windows: ~\AppData\Roaming\haveno-ui\
|
@ -95,7 +95,7 @@
|
|||||||
"dayjs": "^1.11.0",
|
"dayjs": "^1.11.0",
|
||||||
"electron-store": "^8.0.1",
|
"electron-store": "^8.0.1",
|
||||||
"electron-updater": "4.6.5",
|
"electron-updater": "4.6.5",
|
||||||
"haveno-ts": "0.0.6",
|
"haveno-ts": "0.0.10",
|
||||||
"joi": "^17.6.0",
|
"joi": "^17.6.0",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
@ -27,7 +27,7 @@ export const transformToMarketsOffers = (
|
|||||||
amountCurrency: offer.baseCurrencyCode,
|
amountCurrency: offer.baseCurrencyCode,
|
||||||
costCurrency: offer.baseCurrencyCode,
|
costCurrency: offer.baseCurrencyCode,
|
||||||
paymentMethod: offer.paymentMethodShortName,
|
paymentMethod: offer.paymentMethodShortName,
|
||||||
cost: offer.txFee,
|
cost: offer.makerFee,
|
||||||
priceComparison: 0.1,
|
priceComparison: 0.1,
|
||||||
accountAge: 1,
|
accountAge: 1,
|
||||||
accountTrades: 1,
|
accountTrades: 1,
|
||||||
|
@ -29,13 +29,13 @@ describe("organisms::MyWalletMoneroBalance", () => {
|
|||||||
{
|
{
|
||||||
timestamp: 1653593643913,
|
timestamp: 1653593643913,
|
||||||
height: "1.334423",
|
height: "1.334423",
|
||||||
fee: "3.33",
|
fee: "33300000",
|
||||||
isConfirmed: true,
|
isConfirmed: true,
|
||||||
isLocked: false,
|
isLocked: false,
|
||||||
hash: "HASHADDRESS",
|
hash: "HASHADDRESS",
|
||||||
incomingTransfersList: [
|
incomingTransfersList: [
|
||||||
{
|
{
|
||||||
amount: "10000",
|
amount: "10000000000000000",
|
||||||
accountIndex: 1,
|
accountIndex: 1,
|
||||||
subaddressIndex: 1,
|
subaddressIndex: 1,
|
||||||
address: "INCOMINGADDRESS",
|
address: "INCOMINGADDRESS",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import { isEmpty } from "lodash";
|
import { isEmpty } from "lodash";
|
||||||
import type { XmrTx } from "haveno-ts";
|
import type { XmrTx } from "haveno-ts";
|
||||||
|
import { HavenoUtils } from "haveno-ts";
|
||||||
import { WalletTransactionType } from "@molecules/WalletTransactions/_types";
|
import { WalletTransactionType } from "@molecules/WalletTransactions/_types";
|
||||||
import type { TWalletTransaction } from "@molecules/WalletTransactions/_types";
|
import type { TWalletTransaction } from "@molecules/WalletTransactions/_types";
|
||||||
|
|
||||||
@ -30,12 +31,15 @@ const transfromXmrTx = (xmrTx: XmrTx.AsObject): TWalletTransaction => ({
|
|||||||
? WalletTransactionType.Sent
|
? WalletTransactionType.Sent
|
||||||
: WalletTransactionType.Received,
|
: WalletTransactionType.Received,
|
||||||
|
|
||||||
fee: parseFloat(xmrTx.fee),
|
fee: HavenoUtils.atomicUnitsToXmr(xmrTx.fee),
|
||||||
height: xmrTx.height,
|
height: xmrTx.height,
|
||||||
|
|
||||||
|
// TODO: this skips incoming transfers of tx which has both incoming and outgoing transfer
|
||||||
amount: !isEmpty(xmrTx.outgoingTransfer)
|
amount: !isEmpty(xmrTx.outgoingTransfer)
|
||||||
? parseFloat(xmrTx.outgoingTransfer?.amount || "")
|
? HavenoUtils.atomicUnitsToXmr(xmrTx.outgoingTransfer?.amount || "0")
|
||||||
: parseFloat(xmrTx.incomingTransfersList[0]?.amount),
|
: HavenoUtils.atomicUnitsToXmr(
|
||||||
|
xmrTx.incomingTransfersList[0]?.amount || "0"
|
||||||
|
),
|
||||||
|
|
||||||
amountCurrency: "XMR",
|
amountCurrency: "XMR",
|
||||||
transactionId: xmrTx.hash,
|
transactionId: xmrTx.hash,
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
|
import { HavenoUtils } from "haveno-ts";
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { QueryKeys } from "@constants/query-keys";
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
@ -37,10 +38,16 @@ export function useBalances() {
|
|||||||
const balances = xmrBalances.toObject();
|
const balances = xmrBalances.toObject();
|
||||||
|
|
||||||
const balance = parseFloat(balances.balance);
|
const balance = parseFloat(balances.balance);
|
||||||
const unlockedBalance = parseFloat(balances.unlockedBalance);
|
const unlockedBalance = HavenoUtils.atomicUnitsToXmr(
|
||||||
const lockedBalance = parseFloat(balances.lockedBalance);
|
balances.availableBalance
|
||||||
const reservedOfferBalance = parseFloat(balances.reservedOfferBalance);
|
);
|
||||||
const reservedTradeBalance = parseFloat(balances.reservedTradeBalance);
|
const lockedBalance = HavenoUtils.atomicUnitsToXmr(balances.pendingBalance);
|
||||||
|
const reservedOfferBalance = HavenoUtils.atomicUnitsToXmr(
|
||||||
|
balances.reservedOfferBalance
|
||||||
|
);
|
||||||
|
const reservedTradeBalance = HavenoUtils.atomicUnitsToXmr(
|
||||||
|
balances.reservedTradeBalance
|
||||||
|
);
|
||||||
|
|
||||||
const availableBalance = unlockedBalance;
|
const availableBalance = unlockedBalance;
|
||||||
const reservedBalance = reservedOfferBalance + reservedTradeBalance;
|
const reservedBalance = reservedOfferBalance + reservedTradeBalance;
|
||||||
|
@ -24,7 +24,7 @@ export function useIsMoneroNodeRunning() {
|
|||||||
QueryKeys.MoneroNodeIsRunning,
|
QueryKeys.MoneroNodeIsRunning,
|
||||||
async () => {
|
async () => {
|
||||||
try {
|
try {
|
||||||
const value = await client.isMoneroNodeRunning();
|
const value = await client.isMoneroNodeOnline();
|
||||||
return value;
|
return value;
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import type { OfferInfo } from "haveno-ts";
|
import type { OfferInfo } from "haveno-ts";
|
||||||
|
import { HavenoUtils } from "haveno-ts";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { QueryKeys } from "@constants/query-keys";
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
|
|
||||||
@ -42,6 +43,15 @@ const transformData = (offers: Array<OfferInfo>) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...offer,
|
...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),
|
price: parseFloat(offer.price),
|
||||||
volume: parseFloat(offer.volume),
|
volume: parseFloat(offer.volume),
|
||||||
minVolume: parseFloat(offer.minVolume),
|
minVolume: parseFloat(offer.minVolume),
|
||||||
@ -70,8 +80,6 @@ export interface MarketOfferData {
|
|||||||
date: number;
|
date: number;
|
||||||
state: string;
|
state: string;
|
||||||
sellerSecurityDeposit: number;
|
sellerSecurityDeposit: number;
|
||||||
offerFeePaymentTxId: string;
|
|
||||||
txFee: number;
|
|
||||||
makerFee: number;
|
makerFee: number;
|
||||||
isActivated: boolean;
|
isActivated: boolean;
|
||||||
isMyOffer: boolean;
|
isMyOffer: boolean;
|
||||||
|
@ -54,7 +54,7 @@ export function useRestoreBackup() {
|
|||||||
deleteSession();
|
deleteSession();
|
||||||
navigate(ROUTES.Login);
|
navigate(ROUTES.Login);
|
||||||
|
|
||||||
if (await client.isMoneroNodeRunning()) {
|
if (await client.isMoneroNodeOnline()) {
|
||||||
await client.stopMoneroNode();
|
await client.stopMoneroNode();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -38,7 +38,7 @@ export function useSaveLocalMoneroNode() {
|
|||||||
nodeSettings.setStartupFlagsList(data.startupFlags);
|
nodeSettings.setStartupFlagsList(data.startupFlags);
|
||||||
nodeSettings.setBootstrapUrl(data.bootstrapUrl);
|
nodeSettings.setBootstrapUrl(data.bootstrapUrl);
|
||||||
|
|
||||||
if (await client.isMoneroNodeRunning()) {
|
if (await client.isMoneroNodeOnline()) {
|
||||||
// stop the node if it's running
|
// stop the node if it's running
|
||||||
await client.stopMoneroNode();
|
await client.stopMoneroNode();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user