Remove hard-coded record types #132

Merged
ashwin merged 17 commits from deep-stack/laconicd-deprecated:ng-rm-record-types into main 2024-01-15 04:20:39 +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