Skip to content

Commit

Permalink
client-sdk: Add PrettyPrint to StakeThresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Nov 19, 2024
1 parent 8444b42 commit ab78595
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client-sdk/go/modules/rofl/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package rofl

import (
"context"
"fmt"
"io"

"github.com/oasisprotocol/curve25519-voi/primitives/x25519"

beacon "github.com/oasisprotocol/oasis-core/go/beacon/api"
Expand Down Expand Up @@ -141,3 +145,16 @@ type Event struct {
type StakeThresholds struct {
AppCreate *types.BaseUnits `json:"app_create"`
}

// PrettyPrint writes a pretty-printed representation of the stake thresholds to the given writer.
func (st *StakeThresholds) PrettyPrint(ctx context.Context, prefix string, w io.Writer) {
fmt.Fprintf(w, "%sStake thresholds:\n", prefix)
fmt.Fprintf(w, "%s App create: ", prefix)
st.AppCreate.PrettyPrint(ctx, "", w)
fmt.Fprint(w, "\n")
}

// PrettyType returns a representation of the type that can be used for pretty printing.
func (st *StakeThresholds) PrettyType() (interface{}, error) {
return st, nil
}

0 comments on commit ab78595

Please sign in to comment.