Skip to content

Commit 49a3363

Browse files
author
Tasos Bitsios
committed
Fix: participation key rendering from base64url to base64
1 parent 3270dc2 commit 49a3363

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

ui/modals/info/info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ func (m ViewModel) View() string {
9292
}
9393
account := style.Cyan.Render("Account: ") + m.Participation.Address
9494
id := style.Cyan.Render("Participation ID: ") + m.Participation.Id
95-
selection := style.Yellow.Render("Selection Key: ") + *utils.UrlEncodeBytesPtrOrNil(m.Participation.Key.SelectionParticipationKey[:])
96-
vote := style.Yellow.Render("Vote Key: ") + *utils.UrlEncodeBytesPtrOrNil(m.Participation.Key.VoteParticipationKey[:])
97-
stateProof := style.Yellow.Render("State Proof Key: ") + *utils.UrlEncodeBytesPtrOrNil(*m.Participation.Key.StateProofKey)
95+
selection := style.Yellow.Render("Selection Key: ") + *utils.Base64EncodeBytesPtrOrNil(m.Participation.Key.SelectionParticipationKey[:])
96+
vote := style.Yellow.Render("Vote Key: ") + *utils.Base64EncodeBytesPtrOrNil(m.Participation.Key.VoteParticipationKey[:])
97+
stateProof := style.Yellow.Render("State Proof Key: ") + *utils.Base64EncodeBytesPtrOrNil(*m.Participation.Key.StateProofKey)
9898
voteFirstValid := style.Purple("Vote First Valid: ") + utils.IntToStr(m.Participation.Key.VoteFirstValid)
9999
voteLastValid := style.Purple("Vote Last Valid: ") + utils.IntToStr(m.Participation.Key.VoteLastValid)
100100
voteKeyDilution := style.Purple("Vote Key Dilution: ") + utils.IntToStr(m.Participation.Key.VoteKeyDilution)

ui/utils/utils.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import (
77

88
func toPtr[T any](constVar T) *T { return &constVar }
99

10+
func Base64EncodeBytesPtrOrNil(b []byte) *string {
11+
if b == nil || len(b) == 0 || isZeros(b) {
12+
return nil
13+
}
14+
return toPtr(base64.StdEncoding.EncodeToString(b))
15+
}
16+
1017
func UrlEncodeBytesPtrOrNil(b []byte) *string {
1118
if b == nil || len(b) == 0 || isZeros(b) {
1219
return nil

0 commit comments

Comments
 (0)