Remove hard-coded record types #132
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user