Skip to content

Commit

Permalink
added decode func to OrderBook
Browse files Browse the repository at this point in the history
  • Loading branch information
billettc committed Nov 11, 2020
1 parent adfd8f2 commit b8e0e98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions serum/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ type Orderbook struct {
Nodes []SlabNode `struc:""`
}

func (o *Orderbook) Decode(in []byte) error {
err := struc.Unpack(bytes.NewReader(in), o)
if err != nil {
return fmt.Errorf("order book: unpack: %w", err)
}
return nil
}

func (o *Orderbook) Items(descending bool, f func(node *SlabLeafNode) error) error {
if o.LeafCount == 0 {
return nil
Expand Down

0 comments on commit b8e0e98

Please sign in to comment.