update to haveno-ts v0.0.10

This commit is contained in:
woodser 2023-05-22 16:44:40 -04:00
parent fcd209fd3a
commit 1cd1ecfe6b
11 changed files with 10621 additions and 10450 deletions

View File

@ -5,8 +5,8 @@
### Prerequisites
1. Node 16.x
1. yarn 1.x
1. Haveno daemon and envoy proxy
2. yarn 1.x
3. Run user1-daemon-local and envoy proxy by following [these instructions](https://github.com/haveno-dex/haveno-ts#run-tests)
### Install dependencies
@ -27,7 +27,7 @@ yarn watch
### Tests
```sh
yarn tests
yarn test
```
### Storybook
@ -35,3 +35,11 @@ yarn tests
```sh
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\

View File

@ -95,7 +95,7 @@
"dayjs": "^1.11.0",
"electron-store": "^8.0.1",
"electron-updater": "4.6.5",
"haveno-ts": "0.0.6",
"haveno-ts": "0.0.10",
"joi": "^17.6.0",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",

View File

@ -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,

View File

@ -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",

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -54,7 +54,7 @@ export function useRestoreBackup() {
deleteSession();
navigate(ROUTES.Login);
if (await client.isMoneroNodeRunning()) {
if (await client.isMoneroNodeOnline()) {
await client.stopMoneroNode();
}
try {

View File

@ -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();
}

21006
yarn.lock

File diff suppressed because it is too large Load Diff