mirror of
https://github.com/haveno-dex/haveno-ui.git
synced 2025-02-02 10:35:18 -05:00
update to haveno-ts 0.0.20
This commit is contained in:
parent
1cd1ecfe6b
commit
74b248096c
11
.project
Normal file
11
.project
Normal 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>
|
@ -5,7 +5,7 @@
|
|||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
1. Node 16.x
|
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)
|
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
|
||||||
|
@ -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.10",
|
"haveno-ts": "0.0.20",
|
||||||
"joi": "^17.6.0",
|
"joi": "^17.6.0",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
@ -21,7 +21,7 @@ export enum QueryKeys {
|
|||||||
MoneroConnection = "Haveno.MoneroConnection",
|
MoneroConnection = "Haveno.MoneroConnection",
|
||||||
MoneroConnections = "Haveno.MoneroConnections",
|
MoneroConnections = "Haveno.MoneroConnections",
|
||||||
MoneroNodeIsRunning = "Haveno.MoneroNodeIsRunning",
|
MoneroNodeIsRunning = "Haveno.MoneroNodeIsRunning",
|
||||||
MoneroNodeSettings = "Haveno.MoneroNodeSettings",
|
MoneroNodeSettings = "Haveno.XmrNodeSettings",
|
||||||
PaymentAccounts = "Haveno.PaymentAccounts",
|
PaymentAccounts = "Haveno.PaymentAccounts",
|
||||||
Prices = "Haveno.Prices",
|
Prices = "Haveno.Prices",
|
||||||
PrimaryAddress = "Haveno.PrimaryAddress",
|
PrimaryAddress = "Haveno.PrimaryAddress",
|
||||||
|
@ -45,12 +45,8 @@ const transformData = (offers: Array<OfferInfo>) => {
|
|||||||
...offer,
|
...offer,
|
||||||
amount: HavenoUtils.atomicUnitsToXmr(offer.amount),
|
amount: HavenoUtils.atomicUnitsToXmr(offer.amount),
|
||||||
minAmount: HavenoUtils.atomicUnitsToXmr(offer.minAmount),
|
minAmount: HavenoUtils.atomicUnitsToXmr(offer.minAmount),
|
||||||
buyerSecurityDeposit: HavenoUtils.atomicUnitsToXmr(
|
buyerSecurityDeposit: offer.buyerSecurityDepositPct,
|
||||||
offer.buyerSecurityDeposit
|
sellerSecurityDeposit: offer.sellerSecurityDepositPct,
|
||||||
),
|
|
||||||
sellerSecurityDeposit: HavenoUtils.atomicUnitsToXmr(
|
|
||||||
offer.sellerSecurityDeposit
|
|
||||||
),
|
|
||||||
makerFee: HavenoUtils.atomicUnitsToXmr(offer.makerFee),
|
makerFee: HavenoUtils.atomicUnitsToXmr(offer.makerFee),
|
||||||
price: parseFloat(offer.price),
|
price: parseFloat(offer.price),
|
||||||
volume: parseFloat(offer.volume),
|
volume: parseFloat(offer.volume),
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import type { MoneroNodeSettings } from "haveno-ts";
|
import type { XmrNodeSettings } from "haveno-ts";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { QueryKeys } from "@constants/query-keys";
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
|
|
||||||
export function useMoneroNodeSettings() {
|
export function useMoneroNodeSettings() {
|
||||||
const client = useHavenoClient();
|
const client = useHavenoClient();
|
||||||
return useQuery<MoneroNodeSettings | undefined, Error>(
|
return useQuery<XmrNodeSettings | undefined, Error>(
|
||||||
QueryKeys.MoneroNodeSettings,
|
QueryKeys.MoneroNodeSettings,
|
||||||
async () => client.getMoneroNodeSettings()
|
async () => client.getMoneroNodeSettings()
|
||||||
);
|
);
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import type { OfferInfo } from "haveno-ts";
|
import type { OfferDirection, OfferInfo } from "haveno-ts";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { QueryKeys } from "@constants/query-keys";
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
|
|
||||||
interface MyOfferesQuery {
|
interface MyOfferesQuery {
|
||||||
assetCode: string;
|
assetCode: string;
|
||||||
direction?: "buy" | "sell";
|
direction?: OfferDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useMarketsOffers(query: MyOfferesQuery) {
|
export function useMarketsOffers(query: MyOfferesQuery) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import { hideNotification, showNotification } from "@mantine/notifications";
|
import { hideNotification, showNotification } from "@mantine/notifications";
|
||||||
import { useMutation } from "react-query";
|
import { useMutation } from "react-query";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { MoneroNodeSettings } from "haveno-ts";
|
import { XmrNodeSettings } from "haveno-ts";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { Notifications } from "@constants/notifications";
|
import { Notifications } from "@constants/notifications";
|
||||||
import { deleteSession } from "@utils/session";
|
import { deleteSession } from "@utils/session";
|
||||||
@ -58,7 +58,7 @@ export function useRestoreBackup() {
|
|||||||
await client.stopMoneroNode();
|
await client.stopMoneroNode();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await client.startMoneroNode(new MoneroNodeSettings());
|
await client.startMoneroNode(new XmrNodeSettings());
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log(ex);
|
console.log(ex);
|
||||||
throw new Error("Failed to start the monero node");
|
throw new Error("Failed to start the monero node");
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
import { useMutation, useQueryClient } from "react-query";
|
import { useMutation, useQueryClient } from "react-query";
|
||||||
import { MoneroNodeSettings } from "haveno-ts";
|
import { XmrNodeSettings } from "haveno-ts";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { QueryKeys } from "@constants/query-keys";
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
import { useSaveRemoteNode } from "@hooks/storage/useSaveRemoteNode";
|
import { useSaveRemoteNode } from "@hooks/storage/useSaveRemoteNode";
|
||||||
@ -33,7 +33,7 @@ export function useSaveLocalMoneroNode() {
|
|||||||
|
|
||||||
return useMutation<void, Error, Variables>(
|
return useMutation<void, Error, Variables>(
|
||||||
async (data: Variables) => {
|
async (data: Variables) => {
|
||||||
const nodeSettings = new MoneroNodeSettings();
|
const nodeSettings = new XmrNodeSettings();
|
||||||
nodeSettings.setBlockchainPath(data.blockchainPath);
|
nodeSettings.setBlockchainPath(data.blockchainPath);
|
||||||
nodeSettings.setStartupFlagsList(data.startupFlags);
|
nodeSettings.setStartupFlagsList(data.startupFlags);
|
||||||
nodeSettings.setBootstrapUrl(data.bootstrapUrl);
|
nodeSettings.setBootstrapUrl(data.bootstrapUrl);
|
||||||
|
@ -15,12 +15,13 @@
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
import { useMutation, useQueryClient } from "react-query";
|
import { useMutation, useQueryClient } from "react-query";
|
||||||
|
import type { OfferDirection } from "haveno-ts";
|
||||||
import { showNotification } from "@mantine/notifications";
|
import { showNotification } from "@mantine/notifications";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { QueryKeys } from "@constants/query-keys";
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
|
|
||||||
interface SetOfferVariables {
|
interface SetOfferVariables {
|
||||||
direction: string;
|
direction: OfferDirection;
|
||||||
amount: bigint;
|
amount: bigint;
|
||||||
assetCode: string;
|
assetCode: string;
|
||||||
paymentAccountId: string;
|
paymentAccountId: string;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
import { useMutation, useQueryClient } from "react-query";
|
import { useMutation, useQueryClient } from "react-query";
|
||||||
import type { MoneroNodeSettings } from "haveno-ts";
|
import type { XmrNodeSettings } from "haveno-ts";
|
||||||
import { useHavenoClient } from "./useHavenoClient";
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
import { QueryKeys } from "@constants/query-keys";
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ export function useStartMoneroNode() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const client = useHavenoClient();
|
const client = useHavenoClient();
|
||||||
|
|
||||||
return useMutation<void, Error, MoneroNodeSettings>(
|
return useMutation<void, Error, XmrNodeSettings>(
|
||||||
async (data: MoneroNodeSettings) => client.startMoneroNode(data),
|
async (data: XmrNodeSettings) => client.startMoneroNode(data),
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries(QueryKeys.MoneroNodeIsRunning);
|
queryClient.invalidateQueries(QueryKeys.MoneroNodeIsRunning);
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
import type { MoneroNodeSettings } from "haveno-ts";
|
import type { XmrNodeSettings } from "haveno-ts";
|
||||||
import type { LocalSettingsFormValues } from "./_types";
|
import type { LocalSettingsFormValues } from "./_types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transformes the settings request values to form.
|
* Transformes the settings request values to form.
|
||||||
* @param {MoneroNodeSettings.AsObject} nodeSettings
|
* @param {XmrNodeSettings.AsObject} nodeSettings
|
||||||
* @returns {LocalSettingsFormValues}
|
* @returns {LocalSettingsFormValues}
|
||||||
*/
|
*/
|
||||||
export function transformSettingsRequestToForm(
|
export function transformSettingsRequestToForm(
|
||||||
nodeSettings: MoneroNodeSettings.AsObject
|
nodeSettings: XmrNodeSettings.AsObject
|
||||||
): LocalSettingsFormValues {
|
): LocalSettingsFormValues {
|
||||||
return {
|
return {
|
||||||
blockchainLocation: nodeSettings?.blockchainPath || "",
|
blockchainLocation: nodeSettings?.blockchainPath || "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user