update to haveno-ts 0.0.20

This commit is contained in:
woodser 2023-12-11 10:54:34 -05:00
parent 1cd1ecfe6b
commit 74b248096c
13 changed files with 10381 additions and 10549 deletions

11
.project Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>haveno-ui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

View File

@ -5,7 +5,7 @@
### Prerequisites
1. Node 16.x
2. yarn 1.x
2. yarn 1.x (npm install --global yarn)
3. Run user1-daemon-local and envoy proxy by following [these instructions](https://github.com/haveno-dex/haveno-ts#run-tests)
### Install dependencies

View File

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

View File

@ -21,7 +21,7 @@ export enum QueryKeys {
MoneroConnection = "Haveno.MoneroConnection",
MoneroConnections = "Haveno.MoneroConnections",
MoneroNodeIsRunning = "Haveno.MoneroNodeIsRunning",
MoneroNodeSettings = "Haveno.MoneroNodeSettings",
MoneroNodeSettings = "Haveno.XmrNodeSettings",
PaymentAccounts = "Haveno.PaymentAccounts",
Prices = "Haveno.Prices",
PrimaryAddress = "Haveno.PrimaryAddress",

View File

@ -45,12 +45,8 @@ const transformData = (offers: Array<OfferInfo>) => {
...offer,
amount: HavenoUtils.atomicUnitsToXmr(offer.amount),
minAmount: HavenoUtils.atomicUnitsToXmr(offer.minAmount),
buyerSecurityDeposit: HavenoUtils.atomicUnitsToXmr(
offer.buyerSecurityDeposit
),
sellerSecurityDeposit: HavenoUtils.atomicUnitsToXmr(
offer.sellerSecurityDeposit
),
buyerSecurityDeposit: offer.buyerSecurityDepositPct,
sellerSecurityDeposit: offer.sellerSecurityDepositPct,
makerFee: HavenoUtils.atomicUnitsToXmr(offer.makerFee),
price: parseFloat(offer.price),
volume: parseFloat(offer.volume),

View File

@ -15,13 +15,13 @@
// =============================================================================
import { useQuery } from "react-query";
import type { MoneroNodeSettings } from "haveno-ts";
import type { XmrNodeSettings } from "haveno-ts";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function useMoneroNodeSettings() {
const client = useHavenoClient();
return useQuery<MoneroNodeSettings | undefined, Error>(
return useQuery<XmrNodeSettings | undefined, Error>(
QueryKeys.MoneroNodeSettings,
async () => client.getMoneroNodeSettings()
);

View File

@ -15,13 +15,13 @@
// =============================================================================
import { useQuery } from "react-query";
import type { OfferInfo } from "haveno-ts";
import type { OfferDirection, OfferInfo } from "haveno-ts";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
interface MyOfferesQuery {
assetCode: string;
direction?: "buy" | "sell";
direction?: OfferDirection;
}
export function useMarketsOffers(query: MyOfferesQuery) {

View File

@ -17,7 +17,7 @@
import { hideNotification, showNotification } from "@mantine/notifications";
import { useMutation } from "react-query";
import { useNavigate } from "react-router-dom";
import { MoneroNodeSettings } from "haveno-ts";
import { XmrNodeSettings } from "haveno-ts";
import { useHavenoClient } from "./useHavenoClient";
import { Notifications } from "@constants/notifications";
import { deleteSession } from "@utils/session";
@ -58,7 +58,7 @@ export function useRestoreBackup() {
await client.stopMoneroNode();
}
try {
await client.startMoneroNode(new MoneroNodeSettings());
await client.startMoneroNode(new XmrNodeSettings());
} catch (ex) {
console.log(ex);
throw new Error("Failed to start the monero node");

View File

@ -15,7 +15,7 @@
// =============================================================================
import { useMutation, useQueryClient } from "react-query";
import { MoneroNodeSettings } from "haveno-ts";
import { XmrNodeSettings } from "haveno-ts";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
import { useSaveRemoteNode } from "@hooks/storage/useSaveRemoteNode";
@ -33,7 +33,7 @@ export function useSaveLocalMoneroNode() {
return useMutation<void, Error, Variables>(
async (data: Variables) => {
const nodeSettings = new MoneroNodeSettings();
const nodeSettings = new XmrNodeSettings();
nodeSettings.setBlockchainPath(data.blockchainPath);
nodeSettings.setStartupFlagsList(data.startupFlags);
nodeSettings.setBootstrapUrl(data.bootstrapUrl);

View File

@ -15,12 +15,13 @@
// =============================================================================
import { useMutation, useQueryClient } from "react-query";
import type { OfferDirection } from "haveno-ts";
import { showNotification } from "@mantine/notifications";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
interface SetOfferVariables {
direction: string;
direction: OfferDirection;
amount: bigint;
assetCode: string;
paymentAccountId: string;

View File

@ -15,7 +15,7 @@
// =============================================================================
import { useMutation, useQueryClient } from "react-query";
import type { MoneroNodeSettings } from "haveno-ts";
import type { XmrNodeSettings } from "haveno-ts";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
@ -23,8 +23,8 @@ export function useStartMoneroNode() {
const queryClient = useQueryClient();
const client = useHavenoClient();
return useMutation<void, Error, MoneroNodeSettings>(
async (data: MoneroNodeSettings) => client.startMoneroNode(data),
return useMutation<void, Error, XmrNodeSettings>(
async (data: XmrNodeSettings) => client.startMoneroNode(data),
{
onSuccess: () => {
queryClient.invalidateQueries(QueryKeys.MoneroNodeIsRunning);

View File

@ -14,16 +14,16 @@
// limitations under the License.
// =============================================================================
import type { MoneroNodeSettings } from "haveno-ts";
import type { XmrNodeSettings } from "haveno-ts";
import type { LocalSettingsFormValues } from "./_types";
/**
* Transformes the settings request values to form.
* @param {MoneroNodeSettings.AsObject} nodeSettings
* @param {XmrNodeSettings.AsObject} nodeSettings
* @returns {LocalSettingsFormValues}
*/
export function transformSettingsRequestToForm(
nodeSettings: MoneroNodeSettings.AsObject
nodeSettings: XmrNodeSettings.AsObject
): LocalSettingsFormValues {
return {
blockchainLocation: nodeSettings?.blockchainPath || "",

20874
yarn.lock

File diff suppressed because it is too large Load Diff