eteu-technologies / near-api-go

Go library to interact with NEAR Protocol via RPC API (https://docs.near.org/docs/api/rpc)
MIT License
16 stars 13 forks source link

Implement ReceiptView's Receipt parsing #14

Open rqzrqh opened 2 years ago

rqzrqh commented 2 years ago

type ReceiptView struct { PredecessorID types.AccountID json:"predecessor_id" ReceiverID types.AccountID json:"receiver_id" ReceiptID hash.CryptoHash json:"receipt_id" Receipt json.RawMessage json:"receipt" // TODO: needs a type! }

Now the type of the Receipt field is RawMessage, I have to parse it by gjson. Of course the better way is use a Receipt Struct. In nearcore the receipt is a Enum Type, it seems a bit hard to unmarshal it.

mikroskeem commented 2 years ago

Enum parsing is not going to be very pretty, see e.g Action struct. I'll see during this week, but PRs are accepted in the meantime.