Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
RuneRogue committed Oct 27, 2024
1 parent 119162e commit 7f42aed
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ type ResourceBounds struct {
func (rb ResourceBounds) Bytes(resource Resource) []byte {
maxAmountBytes := make([]byte, 8) //nolint:mnd
binary.BigEndian.PutUint64(maxAmountBytes, rb.MaxAmount)
maxPriceBytes := make([]byte, 16) //nolint:mnd
binary.BigEndian.PutUint64(maxPriceBytes[0:8], rb.MaxPricePerUnit.High)
binary.BigEndian.PutUint64(maxPriceBytes[8:16], rb.MaxPricePerUnit.Low)
maxPriceBytes := MaxPriceToBytes(rb.MaxPricePerUnit)
return slices.Concat(
[]byte{0},
[]byte(resource.String()),
Expand All @@ -75,6 +73,13 @@ func (rb ResourceBounds) Bytes(resource Resource) []byte {
)
}

func MaxPriceToBytes(maxPrice *spec.Uint128) []byte {
maxPriceBytes := make([]byte, 16) //nolint:mnd
binary.BigEndian.PutUint64(maxPriceBytes[0:8], maxPrice.High)
binary.BigEndian.PutUint64(maxPriceBytes[8:16], maxPrice.Low)
return maxPriceBytes
}

type Event struct {
Data []*felt.Felt
From *felt.Felt
Expand Down

0 comments on commit 7f42aed

Please sign in to comment.