hashgraph / hedera-block-node

New Block Node services
Apache License 2.0
2 stars 0 forks source link

Adjust Helidon interfaces to translate to PBJ types #74

Closed a-saksena closed 2 weeks ago

a-saksena commented 1 month ago

AS A BN Dev I WANT TO Translate ProtoC objects received from Helidon to PBJ objects. SO THAT I can use PBJ objects in my business logic.

Tech Note:

  1. Serialize the ProtoC object to bytes and then deserialize to PBJ.
  2. @jsync-swirlds to give examples.
  3. PBJ is new for the team.
  4. Compilation needs to happen first (ref to other story)
a-saksena commented 1 month ago

Not necessary if Richard finishes his PBJ task first.

jsync-swirlds commented 1 month ago

Best example for conversion is the (now removed) PbjConverter class Services used. The interfaces for PBJ have changed a bit since then (for instance, Bytes can wrap a byte array directly), but it's a decent starting point. Here are a couple links within the last version of the file that convert from protoc to PBJ cleanly. From ProtoC to PBJ Transaction and key conversion SchedulableTransactionBody

From PBJ to ProtoC