-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from valory-xyz/josh/xdai-requirement
feat: state persistence
- Loading branch information
Showing
27 changed files
with
2,177 additions
and
1,921 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// set schema to validate store data | ||
const schema = { | ||
isInitialFunded: { | ||
type: 'boolean', | ||
default: false, | ||
}, | ||
}; | ||
|
||
const setupStoreIpc = async (ipcChannel, mainWindow) => { | ||
const Store = (await import('electron-store')).default; | ||
|
||
/** @type import Store from 'electron-store' */ | ||
const store = new Store({ | ||
schema, | ||
}); | ||
|
||
store.onDidAnyChange((data) => { | ||
if (mainWindow?.webContents) | ||
mainWindow.webContents.send('store-changed', data); | ||
}); | ||
|
||
// exposed to electron browser window | ||
ipcChannel.handle('store', () => store.store); | ||
ipcChannel.handle('store-get', (_, key) => store.get(key)); | ||
ipcChannel.handle('store-set', (_, key, value) => store.set(key, value)); | ||
ipcChannel.handle('store-delete', (_, key) => store.delete(key)); | ||
}; | ||
|
||
module.exports = { setupStoreIpc }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export * from './copyToClipboard'; | ||
export * from './isDev'; | ||
export * from './numberFormatters'; | ||
export * from './setTrayIcon'; | ||
export * from './truncate'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.