Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client-sdk: Add PrettyPrint to StakeThresholds #2066

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
kostko marked this conversation as resolved.
Show resolved Hide resolved
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
}
Loading