Skip to content

Commit

Permalink
handle dex mnemonic seedq display
Browse files Browse the repository at this point in the history
Signed-off-by: Philemon Ukane <[email protected]>
  • Loading branch information
ukane-philemon committed Sep 10, 2024
1 parent 2db84a9 commit 80e0a86
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions ui/page/settings/app_settings_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,17 +763,21 @@ func (pg *AppSettingsPage) showDEXSeedModal() {
}

func formatDEXSeedAsString(seed dex.Bytes) string {
chunkRegex := regexp.MustCompile(`.{1,32}`)
chunks := chunkRegex.FindAllString(seed.String(), -1)
if len(seed) == 128 { // 64 bytes, 128 hex character legacy seed
chunkRegex := regexp.MustCompile(`.{1,32}`)
chunks := chunkRegex.FindAllString(seed.String(), -1)

var seedChunks []string
subChunkRegex := regexp.MustCompile(`.{1,8}`)
for _, chunk := range chunks {
subChunks := subChunkRegex.FindAllString(chunk, -1)
seedChunks = append(seedChunks, strings.Join(subChunks, " "))
}

var seedChunks []string
subChunkRegex := regexp.MustCompile(`.{1,8}`)
for _, chunk := range chunks {
subChunks := subChunkRegex.FindAllString(chunk, -1)
seedChunks = append(seedChunks, strings.Join(subChunks, " "))
return strings.Join(seedChunks, "\n")
} else {
return seed.String()

Check failure on line 779 in ui/page/settings/app_settings_page.go

View workflow job for this annotation

GitHub Actions / Build

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)

Check warning on line 779 in ui/page/settings/app_settings_page.go

View workflow job for this annotation

GitHub Actions / Build

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
}

return strings.Join(seedChunks, "\n")
}

func ChangeNetworkType(load *load.Load, windowNav app.WindowNavigator, newNetType string) {
Expand Down

0 comments on commit 80e0a86

Please sign in to comment.