Skip to content

Commit

Permalink
MarshalWithEncoder method always of value
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Apr 4, 2022
1 parent e6a5806 commit 6706f74
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (mx *Message) MarshalBinary() ([]byte, error) {
return buf, nil
}

func (mx *Message) MarshalWithEncoder(encoder *bin.Encoder) error {
func (mx Message) MarshalWithEncoder(encoder *bin.Encoder) error {
out, err := mx.MarshalBinary()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion programs/associated-token-account/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (inst *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) error {
return inst.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionImplDef)
}

func (inst *Instruction) MarshalWithEncoder(encoder *bin.Encoder) error {
func (inst Instruction) MarshalWithEncoder(encoder *bin.Encoder) error {
return encoder.Encode(inst.Impl)
}

Expand Down
2 changes: 1 addition & 1 deletion programs/serum/instruction.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (i *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) {
return i.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionDefVariant)
}

func (i *Instruction) MarshalWithEncoder(encoder *bin.Encoder) error {
func (i Instruction) MarshalWithEncoder(encoder *bin.Encoder) error {
err := encoder.WriteUint8(i.Version)
if err != nil {
return fmt.Errorf("unable to write instruction version: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions programs/serum/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (q *RequestQueue) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) {
}

// TODO: fill up later
func (q *RequestQueue) MarshalWithEncoder(encoder *bin.Encoder) error {
func (q RequestQueue) MarshalWithEncoder(encoder *bin.Encoder) error {
return nil
}

Expand Down Expand Up @@ -241,7 +241,7 @@ func (q *EventQueue) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) {
}

// TODO: fill up later
func (q *EventQueue) MarshalWithEncoder(encoder *bin.Encoder) error {
func (q EventQueue) MarshalWithEncoder(encoder *bin.Encoder) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion programs/serum/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (s *Slab) UnmarshalWithDecoder(decoder *bin.Decoder) error {
return s.BaseVariant.UnmarshalBinaryVariant(decoder, SlabFactoryImplDef)
}

func (s *Slab) MarshalWithEncoder(encoder *bin.Encoder) error {
func (s Slab) MarshalWithEncoder(encoder *bin.Encoder) error {
err := encoder.WriteUint32(s.TypeID.Uint32(), binary.LittleEndian)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion programs/system/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error
return inst.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionImplDef)
}

func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error {
func (inst Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error {
err := encoder.WriteUint32(inst.TypeID.Uint32(), binary.LittleEndian)
if err != nil {
return fmt.Errorf("unable to write variant type: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion programs/token/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error
return inst.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionImplDef)
}

func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error {
func (inst Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error {
err := encoder.WriteUint8(inst.TypeID.Uint8())
if err != nil {
return fmt.Errorf("unable to write variant type: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion programs/tokenregistry/instruction.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (i *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) {
return i.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionDefVariant)
}

func (i *Instruction) MarshalWithEncoder(encoder *bin.Encoder) error {
func (i Instruction) MarshalWithEncoder(encoder *bin.Encoder) error {
err := encoder.WriteUint32(i.TypeID.Uint32(), binary.LittleEndian)
if err != nil {
return fmt.Errorf("unable to write variant type: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (tx *Transaction) MarshalBinary() ([]byte, error) {
return output, nil
}

func (tx *Transaction) MarshalWithEncoder(encoder *bin.Encoder) error {
func (tx Transaction) MarshalWithEncoder(encoder *bin.Encoder) error {
out, err := tx.MarshalBinary()
if err != nil {
return err
Expand Down

0 comments on commit 6706f74

Please sign in to comment.