Skip to content

Commit

Permalink
Add transaction pretty printing to the example
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Sep 1, 2021
1 parent bf6835c commit e52ad22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,15 @@ package main
import (
"context"
"fmt"
"os"
"time"

"github.com/davecgh/go-spew/spew"
"github.com/gagliardetto/solana-go"
"github.com/gagliardetto/solana-go/programs/system"
"github.com/gagliardetto/solana-go/rpc"
"github.com/gagliardetto/solana-go/rpc/jsonrpc"
"github.com/gagliardetto/solana-go/text"
)

func main() {
Expand Down Expand Up @@ -253,6 +255,8 @@ func main() {
panic(fmt.Errorf("unable to sign transaction: %w", err))
}
spew.Dump(tx)
// Pretty print the transaction:
tx.EncodeTree(text.NewTreeEncoder(os.Stdout, "Transfer SOL"))

sig, err := client.SendTransactionWithOpts(
context.TODO(),
Expand Down

0 comments on commit e52ad22

Please sign in to comment.