Compare commits
5 Commits
66c93dcc00
...
c0ee0a5df1
| Author | SHA1 | Date | |
|---|---|---|---|
| c0ee0a5df1 | |||
| ad1e488c3f | |||
| 7b42b0df58 | |||
| 8b643cbb4a | |||
| 57ea476e13 |
@ -78,7 +78,7 @@ ipcMain.handle('wallet:checkKeystore', async () => {
|
||||
fs.statSync(path.join(walletDir, a)).mtime.getTime()
|
||||
)[0]
|
||||
|
||||
if (!newestFile?.length) return { exists: false, filePath: null }
|
||||
if (!newestFile) return { exists: false, filePath: null }
|
||||
|
||||
const resolvedPath = path.join(walletDir, newestFile)
|
||||
let minBlockHeight: number | null = null
|
||||
@ -88,10 +88,11 @@ ipcMain.handle('wallet:checkKeystore', async () => {
|
||||
const data = JSON.parse(json)
|
||||
const height = data?.minBlockHeight
|
||||
|
||||
if (Number.isFinite(height)) minBlockHeight = height
|
||||
if (typeof height === 'number' && Number.isFinite(height)) {
|
||||
minBlockHeight = height
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Unable to read minBlockHeight from keystore:', error)
|
||||
return { exists: true, filePath: resolvedPath }
|
||||
}
|
||||
|
||||
return { exists: true, filePath: resolvedPath, minBlockHeight }
|
||||
@ -136,7 +137,9 @@ ipcMain.handle(
|
||||
}
|
||||
)
|
||||
|
||||
ipcMain.handle('wallet:getMinBlockHeight', async (_event, filePath: string | null) => {
|
||||
ipcMain.handle(
|
||||
'wallet:getMinBlockHeight',
|
||||
async (_event, filePath: string | null) => {
|
||||
if (!filePath) {
|
||||
return { success: false, error: 'No keystore file path provided.', minBlockHeight: null }
|
||||
}
|
||||
@ -154,7 +157,7 @@ ipcMain.handle('wallet:getMinBlockHeight', async (_event, filePath: string | nul
|
||||
const walletJson = JSON.parse(fileContents)
|
||||
const height = walletJson?.minBlockHeight
|
||||
|
||||
if (Number.isFinite(height)) {
|
||||
if (typeof height === 'number' && Number.isFinite(height)) {
|
||||
return { success: true, minBlockHeight: height }
|
||||
}
|
||||
|
||||
@ -163,7 +166,8 @@ ipcMain.handle('wallet:getMinBlockHeight', async (_event, filePath: string | nul
|
||||
console.error('Error reading min block height:', error)
|
||||
return { success: false, error: String(error), minBlockHeight: null }
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
ipcMain.handle('wallet:generateKeysFromSeed', async (_event, seedPhrase: string[]) => {
|
||||
try {
|
||||
@ -184,6 +188,7 @@ ipcMain.handle('wallet:buildTransaction', async (_event, args) => {
|
||||
import.meta.env.VITE_APP_API,
|
||||
spendingKeyHex,
|
||||
inputAdditionRecords,
|
||||
// pass minBlockHeight from args if provided, default 0
|
||||
typeof args?.minBlockHeight === 'number' && Number.isFinite(args.minBlockHeight)
|
||||
? args.minBlockHeight
|
||||
: 0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user