mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-22 20:01:06 -05:00
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:
parent
6861f38f16
commit
7e6138570f
11 changed files with 213 additions and 17 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue