Add String() method to Transaction type
This commit is contained in:
parent
965a81dfc1
commit
3db9225618
|
@ -18,6 +18,7 @@
|
||||||
package solana
|
package solana
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -351,6 +352,15 @@ func (tx *Transaction) EncodeTree(encoder *text.TreeEncoder) (int, error) {
|
||||||
return encoder.WriteString(encoder.Tree.String())
|
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) {
|
func (tx *Transaction) EncodeToTree(parent treeout.Branches) {
|
||||||
|
|
||||||
parent.ParentFunc(func(txTree treeout.Branches) {
|
parent.ParentFunc(func(txTree treeout.Branches) {
|
||||||
|
|
Loading…
Reference in New Issue