feat(gui): Change Monero node while running (#502)

* feat(gui): Change daemon during runtime

* feat(swap-controller): Add `monero-seed` RPC command

* nitpicks

* amend changelog
This commit is contained in:
Mohan 2025-08-11 10:34:40 +02:00 committed by GitHub
parent 6861f38f16
commit 7e6138570f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 213 additions and 17 deletions

View file

@ -44,6 +44,7 @@ import {
SetRestoreHeightArgs,
SetRestoreHeightResponse,
GetRestoreHeightResponse,
MoneroNodeConfig,
} from "models/tauriModel";
import {
rpcSetBalance,
@ -641,3 +642,33 @@ export async function saveFilesInDialog(files: Record<string, string>) {
export async function dfxAuthenticate(): Promise<DfxAuthenticateResponse> {
return await invokeNoArgs<DfxAuthenticateResponse>("dfx_authenticate");
}
export async function changeMoneroNode(
nodeConfig: MoneroNodeConfig,
): Promise<void> {
await invoke<{ node_config: MoneroNodeConfig }, void>("change_monero_node", {
node_config: nodeConfig,
});
}
// Helper function to create MoneroNodeConfig from current settings
export async function getCurrentMoneroNodeConfig(): Promise<MoneroNodeConfig> {
const network = getNetwork();
const useMoneroRpcPool = store.getState().settings.useMoneroRpcPool;
const moneroNodeUrl =
store.getState().settings.nodes[network][Blockchain.Monero][0] ?? null;
const moneroNodeConfig =
useMoneroRpcPool ||
moneroNodeUrl == null ||
!(await getMoneroNodeStatus(moneroNodeUrl, network))
? { type: "Pool" as const }
: {
type: "SingleNode" as const,
content: {
url: moneroNodeUrl,
},
};
return moneroNodeConfig;
}