mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-20 10:55:37 -05:00
feat: Recover from / write down seed (#439)
* vendor: seed crate from monero-serai * refactor: make approval type generic over respone from frontend * progress * Raphaels Progress * feat(gui): seed import flow skeleton * fix(gui): Seed import in the development version * fix(gui): specify the imported seed type * remove initializeHandle, make tauri handle non optional in state, dont allow closing seed dialog * feat(gui): check if seed is valid dynamically * fix(gui): refine the dynamic seed validation * push * progress * progress * Fix pending trimeout --------- Co-authored-by: Maksim Kirillov <artist@eduroam-141-23-183-184.wlan.tu-berlin.de> Co-authored-by: Maksim Kirillov <artist@eduroam-141-23-189-144.wlan.tu-berlin.de> Co-authored-by: Maksim Kirillov <maksim.kirillov@staticlabs.de>
This commit is contained in:
parent
b8982b5ac2
commit
7606982de3
39 changed files with 22465 additions and 171 deletions
|
|
@ -253,27 +253,38 @@ export function isGetSwapInfoResponseWithTimelock(
|
|||
return response.timelock !== null;
|
||||
}
|
||||
|
||||
export type PendingApprovalRequest = Extract<
|
||||
ApprovalRequest,
|
||||
{ state: "Pending" }
|
||||
>;
|
||||
export type PendingApprovalRequest = ApprovalRequest & {
|
||||
content: Extract<ApprovalRequest["request_status"], { state: "Pending" }>;
|
||||
};
|
||||
|
||||
export type PendingLockBitcoinApprovalRequest = PendingApprovalRequest & {
|
||||
content: {
|
||||
details: { type: "LockBitcoin" };
|
||||
};
|
||||
export type PendingLockBitcoinApprovalRequest = ApprovalRequest & {
|
||||
request: Extract<ApprovalRequest["request"], { type: "LockBitcoin" }>;
|
||||
content: Extract<ApprovalRequest["request_status"], { state: "Pending" }>;
|
||||
};
|
||||
|
||||
export type PendingSeedSelectionApprovalRequest = ApprovalRequest & {
|
||||
type: "SeedSelection";
|
||||
content: Extract<ApprovalRequest["request_status"], { state: "Pending" }>;
|
||||
};
|
||||
|
||||
export function isPendingLockBitcoinApprovalEvent(
|
||||
event: ApprovalRequest,
|
||||
): event is PendingLockBitcoinApprovalRequest {
|
||||
// Check if the request is pending
|
||||
if (event.state !== "Pending") {
|
||||
return false;
|
||||
}
|
||||
// Check if the request is a LockBitcoin request and is pending
|
||||
return (
|
||||
event.request.type === "LockBitcoin" &&
|
||||
event.request_status.state === "Pending"
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the request is a LockBitcoin request
|
||||
return event.content.details.type === "LockBitcoin";
|
||||
export function isPendingSeedSelectionApprovalEvent(
|
||||
event: ApprovalRequest,
|
||||
): event is PendingSeedSelectionApprovalRequest {
|
||||
// Check if the request is a SeedSelection request and is pending
|
||||
return (
|
||||
event.request.type === "SeedSelection" &&
|
||||
event.request_status.state === "Pending"
|
||||
);
|
||||
}
|
||||
|
||||
export function isPendingBackgroundProcess(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue