fix(tauri, gui): Allow Tauri command to be called with empty arguments

- Allow Tauri command to be called with empty arguments
- Add struct for GetSwapInfosAllArgs
This commit is contained in:
binarybaron 2024-08-27 18:53:58 +02:00 committed by binarybaron
parent de1f77bf80
commit ca25e0454f
5 changed files with 185 additions and 1239 deletions

View file

@ -26,47 +26,6 @@ export interface BuyXmrArgs {
monero_receive_address: string;
}
export interface ResumeArgs {
swap_id: string;
}
export interface CancelAndRefundArgs {
swap_id: string;
}
export interface MoneroRecoveryArgs {
swap_id: string;
}
export interface WithdrawBtcArgs {
amount?: number;
address: string;
}
export interface BalanceArgs {
force_refresh: boolean;
}
export interface ListSellersArgs {
rendezvous_point: string;
}
export interface StartDaemonArgs {
server_address: string;
}
export interface GetSwapInfoArgs {
swap_id: string;
}
export interface ResumeSwapResponse {
result: string;
}
export interface BalanceResponse {
balance: number;
}
/** Represents a quote for buying XMR. */
export interface BidQuote {
/** The price at which the maker is willing to buy at. */
@ -85,13 +44,42 @@ export interface BuyXmrResponse {
quote: BidQuote;
}
export interface GetHistoryEntry {
export interface ResumeSwapArgs {
swap_id: string;
state: string;
}
export interface GetHistoryResponse {
swaps: GetHistoryEntry[];
export interface ResumeSwapResponse {
result: string;
}
export interface CancelAndRefundArgs {
swap_id: string;
}
export interface MoneroRecoveryArgs {
swap_id: string;
}
export interface WithdrawBtcArgs {
amount?: number;
address: string;
}
export interface WithdrawBtcResponse {
amount: number;
txid: string;
}
export interface ListSellersArgs {
rendezvous_point: string;
}
export interface StartDaemonArgs {
server_address: string;
}
export interface GetSwapInfoArgs {
swap_id: string;
}
export interface Seller {
@ -126,11 +114,122 @@ export interface GetSwapInfoResponse {
timelock?: ExpiredTimelocks;
}
export interface BalanceArgs {
force_refresh: boolean;
}
export interface BalanceResponse {
balance: number;
}
export interface GetHistoryArgs {
}
export interface GetHistoryEntry {
swap_id: string;
state: string;
}
export interface GetHistoryResponse {
swaps: GetHistoryEntry[];
}
export interface SuspendCurrentSwapResponse {
swap_id: string;
}
export interface BuyXmrArgs {
seller: string;
bitcoin_change_address: string;
monero_receive_address: string;
}
export interface BuyXmrResponse {
swap_id: string;
quote: BidQuote;
}
export interface ResumeSwapArgs {
swap_id: string;
}
export interface ResumeSwapResponse {
result: string;
}
export interface CancelAndRefundArgs {
swap_id: string;
}
export interface MoneroRecoveryArgs {
swap_id: string;
}
export interface WithdrawBtcArgs {
amount?: number;
address: string;
}
export interface WithdrawBtcResponse {
amount: number;
txid: string;
}
export interface ListSellersArgs {
rendezvous_point: string;
}
export interface StartDaemonArgs {
server_address: string;
}
export interface GetSwapInfoArgs {
swap_id: string;
}
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;
}
export interface BalanceArgs {
force_refresh: boolean;
}
export interface BalanceResponse {
balance: number;
}
export interface GetHistoryArgs {
}
export interface GetHistoryEntry {
swap_id: string;
state: string;
}
export interface GetHistoryResponse {
swaps: GetHistoryEntry[];
}
export interface Seller {
peer_id: string;
addresses: string[];
}
export interface SuspendCurrentSwapResponse {
swap_id: string;
}

View file

@ -34,7 +34,7 @@ async function invoke<ARGS, RESPONSE>(
}
async function invokeNoArgs<RESPONSE>(command: string): Promise<RESPONSE> {
return invokeUnsafe(command, {}) as Promise<RESPONSE>;
return invokeUnsafe(command) as Promise<RESPONSE>;
}
export async function checkBitcoinBalance() {