Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gui): Upgrade to MUI v5 #28

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[toolchain]
channel = "1.80" # also update this in the readme, changelog, and github actions
# also update this in the readme, changelog, and github actions
channel = "1.79"
components = ["clippy"]
targets = ["armv7-unknown-linux-gnueabihf"]
3 changes: 1 addition & 2 deletions src-gui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri + React + Typescript</title>
<title>UnstoppableSwap</title>
</head>

<body>
Expand Down
13 changes: 8 additions & 5 deletions src-gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"tauri": "tauri"
},
"dependencies": {
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.61",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5.16.7",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5.16.7",
"@mui/styles": "^5.16.7",
"@reduxjs/toolkit": "^2.2.6",
"@tauri-apps/api": "2.0.0-rc.1",
"humanize-duration": "^3.32.1",
Expand All @@ -21,7 +24,7 @@
"notistack": "^3.0.1",
"pino": "^9.2.0",
"pino-pretty": "^11.2.1",
"react": "^18.2.0",
"react": "^18.3.1",
"react-dom": "^18.2.0",
"react-qr-code": "^2.0.15",
"react-redux": "^9.1.2",
Expand All @@ -35,7 +38,7 @@
"@types/humanize-duration": "^3.27.4",
"@types/lodash": "^4.17.6",
"@types/node": "^20.14.10",
"@types/react": "^18.2.15",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.2.7",
"@types/semver": "^7.5.8",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
Empty file added src-gui/public/.gitignore
Empty file.
6 changes: 0 additions & 6 deletions src-gui/public/tauri.svg

This file was deleted.

1 change: 0 additions & 1 deletion src-gui/public/vite.svg

This file was deleted.

239 changes: 134 additions & 105 deletions src-gui/src/models/tauriModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,165 +21,194 @@ export type PunishTimelock = number;
export type Amount = number;

export interface BuyXmrArgs {
seller: string;
bitcoin_change_address: string;
monero_receive_address: string;
seller: string;
bitcoin_change_address: string;
monero_receive_address: string;
}

export interface ResumeArgs {
swap_id: string;
swap_id: string;
}

export interface CancelAndRefundArgs {
swap_id: string;
swap_id: string;
}

export interface MoneroRecoveryArgs {
swap_id: string;
swap_id: string;
}

export interface WithdrawBtcArgs {
amount?: number;
address: string;
amount?: number;
address: string;
}

export interface BalanceArgs {
force_refresh: boolean;
force_refresh: boolean;
}

export interface ListSellersArgs {
rendezvous_point: string;
rendezvous_point: string;
}

export interface StartDaemonArgs {
server_address: string;
server_address: string;
}

export interface GetSwapInfoArgs {
swap_id: string;
swap_id: string;
}

export interface ResumeSwapResponse {
result: string;
result: string;
}

export interface BalanceResponse {
balance: number;
balance: number;
}

/** Represents a quote for buying XMR. */
export interface BidQuote {
/** The price at which the maker is willing to buy at. */
price: number;
/**
* The minimum quantity the maker is willing to buy.
* #[typeshare(serialized_as = "number")]
*/
min_quantity: number;
/** The maximum quantity the maker is willing to buy. */
max_quantity: number;
/** The price at which the maker is willing to buy at. */
price: number;
/**
* The minimum quantity the maker is willing to buy.
* #[typeshare(serialized_as = "number")]
*/
min_quantity: number;
/** The maximum quantity the maker is willing to buy. */
max_quantity: number;
}

export interface BuyXmrResponse {
swap_id: string;
quote: BidQuote;
swap_id: string;
quote: BidQuote;
}

export interface GetHistoryEntry {
swap_id: string;
state: string;
swap_id: string;
state: string;
}

export interface GetHistoryResponse {
swaps: GetHistoryEntry[];
swaps: GetHistoryEntry[];
}

export interface Seller {
peer_id: string;
addresses: string[];
}

export type ExpiredTimelocks =
| { type: "None", content: {
blocks_left: number;
}}
| { type: "Cancel", content: {
blocks_left: number;
}}
| { type: "Punish", content?: undefined };
peer_id: string;
addresses: string[];
}

export type ExpiredTimelocks =
| {
type: "None";
content: {
blocks_left: number;
};
}
| {
type: "Cancel";
content: {
blocks_left: number;
};
}
| { type: "Punish"; content?: undefined };

export interface GetSwapInfoResponse {
swap_id: string;
seller: Seller;
completed: boolean;
start_date: string;
state_name: string;
xmr_amount: number;
btc_amount: number;
tx_lock_id: string;
tx_cancel_fee: number;
tx_refund_fee: number;
tx_lock_fee: number;
btc_refund_address: string;
cancel_timelock: CancelTimelock;
punish_timelock: PunishTimelock;
timelock?: ExpiredTimelocks;
swap_id: string;
seller: Seller;
completed: boolean;
start_date: string;
state_name: string;
xmr_amount: number;
btc_amount: number;
tx_lock_id: string;
tx_cancel_fee: number;
tx_refund_fee: number;
tx_lock_fee: number;
btc_refund_address: string;
cancel_timelock: CancelTimelock;
punish_timelock: PunishTimelock;
timelock?: ExpiredTimelocks;
}

export interface WithdrawBtcResponse {
amount: number;
txid: string;
amount: number;
txid: string;
}

export interface SuspendCurrentSwapResponse {
swap_id: string;
}

export type TauriSwapProgressEvent =
| { type: "Initiated", content?: undefined }
| { type: "ReceivedQuote", content: BidQuote }
| { type: "WaitingForBtcDeposit", content: {
deposit_address: string;
max_giveable: number;
min_deposit_until_swap_will_start: number;
max_deposit_until_maximum_amount_is_reached: number;
min_bitcoin_lock_tx_fee: number;
quote: BidQuote;
}}
| { type: "Started", content: {
btc_lock_amount: number;
btc_tx_lock_fee: number;
}}
| { type: "BtcLockTxInMempool", content: {
btc_lock_txid: string;
btc_lock_confirmations: number;
}}
| { type: "XmrLockTxInMempool", content: {
xmr_lock_txid: string;
xmr_lock_tx_confirmations: number;
}}
| { type: "XmrLocked", content?: undefined }
| { type: "BtcRedeemed", content?: undefined }
| { type: "XmrRedeemInMempool", content: {
xmr_redeem_txid: string;
xmr_redeem_address: string;
}}
| { type: "BtcCancelled", content: {
btc_cancel_txid: string;
}}
| { type: "BtcRefunded", content: {
btc_refund_txid: string;
}}
| { type: "BtcPunished", content?: undefined }
| { type: "AttemptingCooperativeRedeem", content?: undefined }
| { type: "CooperativeRedeemAccepted", content?: undefined }
| { type: "CooperativeRedeemRejected", content: {
reason: string;
}}
| { type: "Released", content?: undefined };
swap_id: string;
}

export type TauriSwapProgressEvent =
| { type: "Initiated"; content?: undefined }
| { type: "ReceivedQuote"; content: BidQuote }
| {
type: "WaitingForBtcDeposit";
content: {
deposit_address: string;
max_giveable: number;
min_deposit_until_swap_will_start: number;
max_deposit_until_maximum_amount_is_reached: number;
min_bitcoin_lock_tx_fee: number;
quote: BidQuote;
};
}
| {
type: "Started";
content: {
btc_lock_amount: number;
btc_tx_lock_fee: number;
};
}
| {
type: "BtcLockTxInMempool";
content: {
btc_lock_txid: string;
btc_lock_confirmations: number;
};
}
| {
type: "XmrLockTxInMempool";
content: {
xmr_lock_txid: string;
xmr_lock_tx_confirmations: number;
};
}
| { type: "XmrLocked"; content?: undefined }
| { type: "BtcRedeemed"; content?: undefined }
| {
type: "XmrRedeemInMempool";
content: {
xmr_redeem_txid: string;
xmr_redeem_address: string;
};
}
| {
type: "BtcCancelled";
content: {
btc_cancel_txid: string;
};
}
| {
type: "BtcRefunded";
content: {
btc_refund_txid: string;
};
}
| { type: "BtcPunished"; content?: undefined }
| { type: "AttemptingCooperativeRedeem"; content?: undefined }
| { type: "CooperativeRedeemAccepted"; content?: undefined }
| {
type: "CooperativeRedeemRejected";
content: {
reason: string;
};
}
| { type: "Released"; content?: undefined };

export interface TauriSwapProgressEventWrapper {
swap_id: string;
event: TauriSwapProgressEvent;
swap_id: string;
event: TauriSwapProgressEvent;
}

Loading
Loading