import pkg/protobuf_serialization import pkg/nitro import pkg/questionable import_proto3 "payments.proto" export PricingMessage export nitro type Pricing* = object address*: EthAddress asset*: EthAddress price*: UInt256 func init*(_: type PricingMessage, pricing: Pricing): PricingMessage = PricingMessage( address: @(pricing.address.toArray), asset: @(pricing.asset.toArray), price: @(pricing.price.toBytesBE) ) func parse(_: type EthAddress, bytes: seq[byte]): ?EthAddress = var address: array[20, byte] if bytes.len != address.len: return EthAddress.none for i in 0..