File tree Expand file tree Collapse file tree 9 files changed +62
-0
lines changed Expand file tree Collapse file tree 9 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ func (b *AllegraBlock) UnmarshalCBOR(cborData []byte) error {
60
60
return b .UnmarshalCbor (cborData , b )
61
61
}
62
62
63
+ func (AllegraBlock ) Type () int {
64
+ return BlockTypeAllegra
65
+ }
66
+
63
67
func (b * AllegraBlock ) Hash () string {
64
68
return b .Header .Hash ()
65
69
}
@@ -160,6 +164,10 @@ type AllegraTransaction struct {
160
164
TxMetadata * cbor.LazyValue
161
165
}
162
166
167
+ func (AllegraTransaction ) Type () int {
168
+ return TxTypeAllegra
169
+ }
170
+
163
171
func (t AllegraTransaction ) Hash () string {
164
172
return t .Body .Hash ()
165
173
}
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ func (b *AlonzoBlock) UnmarshalCBOR(cborData []byte) error {
63
63
return b .UnmarshalCbor (cborData , b )
64
64
}
65
65
66
+ func (AlonzoBlock ) Type () int {
67
+ return BlockTypeAlonzo
68
+ }
69
+
66
70
func (b * AlonzoBlock ) Hash () string {
67
71
return b .Header .Hash ()
68
72
}
@@ -317,6 +321,10 @@ type AlonzoTransaction struct {
317
321
TxMetadata * cbor.LazyValue
318
322
}
319
323
324
+ func (AlonzoTransaction ) Type () int {
325
+ return TxTypeAlonzo
326
+ }
327
+
320
328
func (t AlonzoTransaction ) Hash () string {
321
329
return t .Body .Hash ()
322
330
}
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ func (b *BabbageBlock) UnmarshalCBOR(cborData []byte) error {
64
64
return b .UnmarshalCbor (cborData , b )
65
65
}
66
66
67
+ func (BabbageBlock ) Type () int {
68
+ return BlockTypeBabbage
69
+ }
70
+
67
71
func (b * BabbageBlock ) Hash () string {
68
72
return b .Header .Hash ()
69
73
}
@@ -491,6 +495,10 @@ type BabbageTransaction struct {
491
495
TxMetadata * cbor.LazyValue
492
496
}
493
497
498
+ func (BabbageTransaction ) Type () int {
499
+ return TxTypeBabbage
500
+ }
501
+
494
502
func (t BabbageTransaction ) Hash () string {
495
503
return t .Body .Hash ()
496
504
}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
23
23
type Block interface {
24
24
BlockHeader
25
+ Type () int
25
26
Transactions () []Transaction
26
27
Utxorpc () * utxorpc.Block
27
28
}
Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ func (t *ByronTransaction) UnmarshalCBOR(data []byte) error {
151
151
return t .UnmarshalCbor (data , t )
152
152
}
153
153
154
+ func (ByronTransaction ) Type () int {
155
+ return TxTypeByron
156
+ }
157
+
154
158
func (t * ByronTransaction ) Hash () string {
155
159
if t .hash == "" {
156
160
tmpHash := common .Blake2b256Hash (t .Cbor ())
@@ -516,6 +520,10 @@ func (b *ByronMainBlock) UnmarshalCBOR(cborData []byte) error {
516
520
return b .UnmarshalCbor (cborData , b )
517
521
}
518
522
523
+ func (ByronMainBlock ) Type () int {
524
+ return BlockTypeByronMain
525
+ }
526
+
519
527
func (b * ByronMainBlock ) Hash () string {
520
528
return b .Header .Hash ()
521
529
}
@@ -566,6 +574,10 @@ func (b *ByronEpochBoundaryBlock) UnmarshalCBOR(cborData []byte) error {
566
574
return b .UnmarshalCbor (cborData , b )
567
575
}
568
576
577
+ func (ByronEpochBoundaryBlock ) Type () int {
578
+ return BlockTypeByronEbb
579
+ }
580
+
569
581
func (b * ByronEpochBoundaryBlock ) Hash () string {
570
582
return b .Header .Hash ()
571
583
}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
23
23
type Transaction interface {
24
24
TransactionBody
25
+ Type () int
25
26
Metadata () * cbor.LazyValue
26
27
IsValid () bool
27
28
Consumed () []TransactionInput
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ func (b *ConwayBlock) UnmarshalCBOR(cborData []byte) error {
63
63
return b .UnmarshalCbor (cborData , b )
64
64
}
65
65
66
+ func (ConwayBlock ) Type () int {
67
+ return BlockTypeConway
68
+ }
69
+
66
70
func (b * ConwayBlock ) Hash () string {
67
71
return b .Header .Hash ()
68
72
}
@@ -307,6 +311,10 @@ type ConwayTransaction struct {
307
311
TxMetadata * cbor.LazyValue
308
312
}
309
313
314
+ func (ConwayTransaction ) Type () int {
315
+ return TxTypeConway
316
+ }
317
+
310
318
func (t ConwayTransaction ) Hash () string {
311
319
return t .Body .Hash ()
312
320
}
Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ func (b *MaryBlock) UnmarshalCBOR(cborData []byte) error {
62
62
return b .UnmarshalCbor (cborData , b )
63
63
}
64
64
65
+ func (MaryBlock ) Type () int {
66
+ return BlockTypeMary
67
+ }
68
+
65
69
func (b * MaryBlock ) Hash () string {
66
70
return b .Header .Hash ()
67
71
}
@@ -172,6 +176,10 @@ type MaryTransaction struct {
172
176
TxMetadata * cbor.LazyValue
173
177
}
174
178
179
+ func (MaryTransaction ) Type () int {
180
+ return TxTypeMary
181
+ }
182
+
175
183
type MaryTransactionWitnessSet struct {
176
184
shelley.ShelleyTransactionWitnessSet
177
185
Script []interface {} `cbor:"4,keyasint,omitempty"`
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ func (b *ShelleyBlock) UnmarshalCBOR(cborData []byte) error {
59
59
return b .UnmarshalCbor (cborData , b )
60
60
}
61
61
62
+ func (ShelleyBlock ) Type () int {
63
+ return BlockTypeShelley
64
+ }
65
+
62
66
func (b * ShelleyBlock ) Hash () string {
63
67
return b .Header .Hash ()
64
68
}
@@ -436,6 +440,10 @@ type ShelleyTransaction struct {
436
440
TxMetadata * cbor.LazyValue
437
441
}
438
442
443
+ func (ShelleyTransaction ) Type () int {
444
+ return TxTypeShelley
445
+ }
446
+
439
447
func (t ShelleyTransaction ) Hash () string {
440
448
return t .Body .Hash ()
441
449
}
You can’t perform that action at this time.
0 commit comments