Skip to content

Commit

Permalink
update to haveno-ts 0.0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Dec 11, 2023
1 parent 1cd1ecf commit 74b2480
Show file tree
Hide file tree
Showing 13 changed files with 11,983 additions and 12,151 deletions.
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/src/constants/query-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 2 additions & 6 deletions packages/renderer/src/hooks/haveno/useMarketsOffers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/hooks/haveno/useMoneroNodeSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/hooks/haveno/useMyOffers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/hooks/haveno/useRestoreBackup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/hooks/haveno/useSaveLocalMoneroNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion packages/renderer/src/hooks/haveno/useSetOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions packages/renderer/src/hooks/haveno/useStartMoneroNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
// =============================================================================

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

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);
Expand Down
6 changes: 3 additions & 3 deletions packages/renderer/src/pages/Account/Settings/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || "",
Expand Down
Loading

0 comments on commit 74b2480

Please sign in to comment.