Add String() method to Transaction type
This commit is contained in:
parent
965a81dfc1
commit
3db9225618
|
@ -18,6 +18,7 @@
|
|||
package solana
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
@ -351,6 +352,15 @@ func (tx *Transaction) EncodeTree(encoder *text.TreeEncoder) (int, error) {
|
|||
return encoder.WriteString(encoder.Tree.String())
|
||||
}
|
||||
|
||||
func (tx *Transaction) String() string {
|
||||
buf := new(bytes.Buffer)
|
||||
_, err := tx.EncodeTree(text.NewTreeEncoder(buf, text.Bold("")))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (tx *Transaction) EncodeToTree(parent treeout.Branches) {
|
||||
|
||||
parent.ParentFunc(func(txTree treeout.Branches) {
|
||||
|
|
Loading…
Reference in New Issue