From 4f8fda7c9c257ecc501d7aeaf63dac5ddce80d34 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 26 Oct 2023 08:46:57 -0500 Subject: [PATCH] type rename --- x/registry/keeper/keeper.go | 2 +- x/registry/types/types.go | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index 7b531b35..a47ce572 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -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() diff --git a/x/registry/types/types.go b/x/registry/types/types.go index 745dca47..b14a69f0 100644 --- a/x/registry/types/types.go +++ b/x/registry/types/types.go @@ -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