@spirobel/monero-wallet-api 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,6 +61,11 @@ export type ScanSettingsOpened = {
|
|
|
61
61
|
* @throws Will throw if file writing fails (e.g., permissions, disk space).
|
|
62
62
|
*/
|
|
63
63
|
export declare function writeScanSettings(scan_settings: ScanSettings, settingsStorePath?: string): Promise<number>;
|
|
64
|
+
export type WriteScanSettingsFileParams = {
|
|
65
|
+
settingsStorePath?: string;
|
|
66
|
+
writeCallback: (settings: ScanSettings) => void | Promise<void>;
|
|
67
|
+
};
|
|
68
|
+
export declare function writeScanSettingsFileDefaultLocation(params: WriteScanSettingsFileParams): Promise<void>;
|
|
64
69
|
export declare function writeStartHeightToScanSettings(start_height: number | null, settingsStorePath?: string): Promise<number>;
|
|
65
70
|
export declare function writeDaemonHeightAsStartHeightToScanSettings(node_url: string, settingsStorePath?: string): Promise<number>;
|
|
66
71
|
export declare function cullTooLargeScanHeight(node_url: string, settingsStorePath?: string): Promise<number>;
|
|
@@ -26,6 +26,20 @@ export const SCAN_SETTINGS_STORE_NAME_DEFAULT = "ScanSettings.json";
|
|
|
26
26
|
export async function writeScanSettings(scan_settings, settingsStorePath = SCAN_SETTINGS_STORE_NAME_DEFAULT) {
|
|
27
27
|
return await atomicWrite(settingsStorePath, JSON.stringify(scan_settings, null, 2));
|
|
28
28
|
}
|
|
29
|
+
export async function writeScanSettingsFileDefaultLocation(params) {
|
|
30
|
+
let settings = await openScanSettingsFile(params.settingsStorePath);
|
|
31
|
+
if (!settings) {
|
|
32
|
+
// Create empty ScanSettings object with default values
|
|
33
|
+
settings = {
|
|
34
|
+
node_url: LOCAL_NODE_DEFAULT_URL,
|
|
35
|
+
wallets: [],
|
|
36
|
+
start_height: null,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
await params.writeCallback(settings);
|
|
40
|
+
// write to settings file
|
|
41
|
+
await writeScanSettings(settings, params.settingsStorePath);
|
|
42
|
+
}
|
|
29
43
|
export async function writeStartHeightToScanSettings(start_height, settingsStorePath = SCAN_SETTINGS_STORE_NAME_DEFAULT) {
|
|
30
44
|
const scanSettings = (await openScanSettingsFile(settingsStorePath)) || {
|
|
31
45
|
node_url: "",
|