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:
Mohan 2025-07-02 14:01:56 +02:00 committed by GitHub
parent b8982b5ac2
commit 7606982de3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 22465 additions and 171 deletions

View file

@ -17,6 +17,8 @@ import {
GetSwapInfoArgs,
ExportBitcoinWalletResponse,
CheckMoneroNodeArgs,
CheckSeedArgs,
CheckSeedResponse,
CheckMoneroNodeResponse,
TauriSettings,
CheckElectrumNodeArgs,
@ -304,10 +306,16 @@ export async function initializeContext() {
logger.info("Initializing context with settings", tauriSettings);
await invokeUnsafe<void>("initialize_context", {
settings: tauriSettings,
testnet,
});
try {
await invokeUnsafe<void>("initialize_context", {
settings: tauriSettings,
testnet,
});
} catch (error) {
throw new Error("Couldn't initialize context: " + error);
}
logger.info("Initialized context");
}
export async function getWalletDescriptor() {
@ -395,7 +403,7 @@ export async function getDataDir(): Promise<string> {
export async function resolveApproval(
requestId: string,
accept: boolean,
accept: object,
): Promise<void> {
await invoke<ResolveApprovalArgs, ResolveApprovalResponse>(
"resolve_approval_request",
@ -403,6 +411,16 @@ export async function resolveApproval(
);
}
export async function checkSeed(seed: string): Promise<boolean> {
const response = await invoke<CheckSeedArgs, CheckSeedResponse>(
"check_seed",
{
seed,
},
);
return response.available;
}
export async function saveLogFiles(
zipFileName: string,
content: Record<string, string>,