This commit is contained in:
Slavomir 2021-08-09 16:18:05 +02:00
parent 3af5c3d17a
commit 9a0d5212b1
2 changed files with 14 additions and 18 deletions

View File

@ -46,7 +46,7 @@ func (inst *Transfer) EncodeToTree(parent treeout.Branches) {
instructionBranch.Child("Params").ParentFunc(func(paramsBranch treeout.Branches) {
paramsBranch.Child(Sf(CC(Shakespeare("Lamports"), ": %v"), Lime(S(inst.Lamports))))
})
instructionBranch.Child("Accounts:").ParentFunc(func(accountsBranch treeout.Branches) {
instructionBranch.Child("Accounts").ParentFunc(func(accountsBranch treeout.Branches) {
accountsBranch.Child(Sf(CC(Shakespeare("Funding account"), ": %s"), text.ColorizeBG(inst.AccountMetaSlice[0].PublicKey.String())))
accountsBranch.Child(Sf(CC(Shakespeare("Recipient account"), ": %s"), text.ColorizeBG(inst.AccountMetaSlice[1].PublicKey.String())))
})

View File

@ -59,8 +59,7 @@ type Message struct {
Instructions []CompiledInstruction `json:"instructions"`
}
func (mx *Message) EncodeToTree(parent treeout.Branches) {
parent.ParentFunc(func(txTree treeout.Branches) {
func (mx *Message) EncodeToTree(txTree treeout.Branches) {
txTree.Child(text.Sf("RecentBlockhash: %s", mx.RecentBlockhash))
txTree.Child("AccountKeys[]").ParentFunc(func(accountKeysBranch treeout.Branches) {
@ -72,15 +71,12 @@ func (mx *Message) EncodeToTree(parent treeout.Branches) {
txTree.Child("Header").ParentFunc(func(message treeout.Branches) {
mx.Header.EncodeToTree(message)
})
})
}
func (header *MessageHeader) EncodeToTree(parent treeout.Branches) {
parent.ParentFunc(func(mxBranch treeout.Branches) {
func (header *MessageHeader) EncodeToTree(mxBranch treeout.Branches) {
mxBranch.Child(text.Sf("NumRequiredSignatures: %v", header.NumRequiredSignatures))
mxBranch.Child(text.Sf("NumReadonlySignedAccounts: %v", header.NumReadonlySignedAccounts))
mxBranch.Child(text.Sf("NumReadonlyUnsignedAccounts: %v", header.NumReadonlyUnsignedAccounts))
})
}
func (mx *Message) MarshalBinary() ([]byte, error) {