Graphql schema for DAG-JSON objects #1

Merged
ashwin merged 13 commits from ng-gql-ipld into ng-rm-record-types 2024-01-11 09:46:41 +00:00
2 changed files with 4 additions and 6 deletions
Showing only changes of commit 4f8fda7c9c - Show all commits

View File

@ -269,7 +269,7 @@ func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord
// ProcessSetRecord creates a record.
func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.ReadableRecord, error) {
payload := msg.Payload.ToReadablePayload()
record := types.ReadableRecord{Attributes: payload.Record, BondID: msg.BondId}
record := types.ReadableRecord{Attributes: payload.RecordAttributes, BondID: msg.BondId}
// Check signatures.
resourceSignBytes, _ := record.GetSignBytes()

View File

@ -41,7 +41,7 @@ type ReadableRecord struct {
// Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.
func (payloadObj *ReadablePayload) ToPayload() Payload {
// Note: record directly contains the attributes here
attributes := helpers.MarshalMapToJSONBytes(payloadObj.Record)
attributes := payloadObj.RecordAttributes
payload := Payload{
Record: &Record{
Deleted: false,
@ -66,8 +66,6 @@ func (payload Payload) ToReadablePayload() ReadablePayload {
// ToRecordObj converts Record to RecordObj.
// Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.
func (r *ReadableRecord) ToRecordObj() (Record, error) {
attributes := helpers.MarshalMapToJSONBytes(r.Attributes)
var resourceObj Record
resourceObj.Id = r.ID
@ -82,8 +80,8 @@ func (r *ReadableRecord) ToRecordObj() (Record, error) {
}
// ToReadableRecord converts Record to a serializable object
func (r *Record) ToReadableRecord() RecordEncodable {
var resourceObj RecordEncodable
func (r *Record) ToReadableRecord() ReadableRecord {
var resourceObj ReadableRecord
resourceObj.ID = r.Id
resourceObj.BondID = r.BondId