Skip to content

Commit

Permalink
Added version information in MarshalWithEncoder, UnmarshalWithDecoder…
Browse files Browse the repository at this point in the history
… methods of GetTransactionResult (#275)

* Fix: UnmarshalWithDecoder method reciever type in GetParsedTransactionResult

* Added version information in MarshalWithEncoder, UnmarshalWithDecoder methods of GetTransactionResult
  • Loading branch information
newmanifold authored Jan 16, 2025
1 parent 39e2b98 commit 3a9b156
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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
}

0 comments on commit 3a9b156

Please sign in to comment.