Skip to content

Commit 928a938

Browse files
authored
fix: add missing UnmarshalCBOR for types using cbor.DecodeStoreCbor (#957)
Signed-off-by: Aurora Gaffney <[email protected]>
1 parent a873303 commit 928a938

File tree

7 files changed

+36
-0
lines changed

7 files changed

+36
-0
lines changed

ledger/allegra/allegra.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ type AllegraTransaction struct {
170170
TxMetadata *cbor.LazyValue
171171
}
172172

173+
func (t *AllegraTransaction) UnmarshalCBOR(data []byte) error {
174+
return t.UnmarshalCbor(data, t)
175+
}
176+
173177
func (AllegraTransaction) Type() int {
174178
return TxTypeAllegra
175179
}

ledger/alonzo/alonzo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ type AlonzoTransaction struct {
362362
TxMetadata *cbor.LazyValue
363363
}
364364

365+
func (t *AlonzoTransaction) UnmarshalCBOR(data []byte) error {
366+
return t.UnmarshalCbor(data, t)
367+
}
368+
365369
func (AlonzoTransaction) Type() int {
366370
return TxTypeAlonzo
367371
}

ledger/babbage/babbage.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ type BabbageTransaction struct {
515515
TxMetadata *cbor.LazyValue
516516
}
517517

518+
func (t *BabbageTransaction) UnmarshalCBOR(data []byte) error {
519+
return t.UnmarshalCbor(data, t)
520+
}
521+
518522
func (BabbageTransaction) Type() int {
519523
return TxTypeBabbage
520524
}

ledger/common/credentials.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ type StakeCredential struct {
3434
Credential []byte
3535
}
3636

37+
func (c *StakeCredential) UnmarshalCBOR(data []byte) error {
38+
return c.UnmarshalCbor(data, c)
39+
}
40+
3741
func (c *StakeCredential) Hash() Blake2b224 {
3842
hash, err := blake2b.New(28, nil)
3943
if err != nil {

ledger/conway/conway.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ type ConwayTransaction struct {
317317
TxMetadata *cbor.LazyValue
318318
}
319319

320+
func (t *ConwayTransaction) UnmarshalCBOR(data []byte) error {
321+
return t.UnmarshalCbor(data, t)
322+
}
323+
320324
func (ConwayTransaction) Type() int {
321325
return TxTypeConway
322326
}

ledger/mary/mary.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ type MaryTransaction struct {
181181
TxMetadata *cbor.LazyValue
182182
}
183183

184+
func (t *MaryTransaction) UnmarshalCBOR(data []byte) error {
185+
return t.UnmarshalCbor(data, t)
186+
}
187+
184188
func (MaryTransaction) Type() int {
185189
return TxTypeMary
186190
}
@@ -336,6 +340,10 @@ type MaryTransactionOutput struct {
336340
OutputAmount MaryTransactionOutputValue
337341
}
338342

343+
func (o *MaryTransactionOutput) UnmarshalCBOR(data []byte) error {
344+
return o.UnmarshalCbor(data, o)
345+
}
346+
339347
func (o MaryTransactionOutput) MarshalJSON() ([]byte, error) {
340348
tmpObj := struct {
341349
Address common.Address `json:"address"`

ledger/shelley/shelley.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,10 @@ type ShelleyTransactionOutput struct {
444444
OutputAmount uint64 `json:"amount"`
445445
}
446446

447+
func (o *ShelleyTransactionOutput) UnmarshalCBOR(data []byte) error {
448+
return o.UnmarshalCbor(data, o)
449+
}
450+
447451
func (o ShelleyTransactionOutput) Address() common.Address {
448452
return o.OutputAddress
449453
}
@@ -527,6 +531,10 @@ type ShelleyTransaction struct {
527531
TxMetadata *cbor.LazyValue
528532
}
529533

534+
func (t *ShelleyTransaction) UnmarshalCBOR(data []byte) error {
535+
return t.UnmarshalCbor(data, t)
536+
}
537+
530538
func (ShelleyTransaction) Type() int {
531539
return TxTypeShelley
532540
}

0 commit comments

Comments
 (0)