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

Added version information in MarshalWithEncoder, UnmarshalWithDecoder methods of GetTransactionResult #275

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion rpc/getParsedTransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (obj GetParsedTransactionResult) MarshalWithEncoder(encoder *bin.Encoder) (
return nil
}

func (obj GetParsedTransactionResult) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) {
func (obj *GetParsedTransactionResult) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) {
// Deserialize `Slot`:
obj.Slot, err = decoder.ReadUint64(bin.LE)
if err != nil {
Expand Down
20 changes: 20 additions & 0 deletions rpc/getTransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ func (obj GetTransactionResult) MarshalWithEncoder(encoder *bin.Encoder) (err er
}
}
}
{
buf, err := json.Marshal(obj.Version)
if err != nil {
return err
}
err = encoder.WriteBytes(buf, true)
if err != nil {
return err
}
}
return nil
}

Expand Down Expand Up @@ -283,5 +293,15 @@ func (obj *GetTransactionResult) UnmarshalWithDecoder(decoder *bin.Decoder) (err
}
}
}
{
buf, err := decoder.ReadByteSlice()
if err != nil {
return err
}
err = json.Unmarshal(buf, &obj.Version)
if err != nil {
return err
}
}
return nil
}
Loading