Skip to content

Commit 58bc927

Browse files
committed
feat(ledger): Added GetScriptRef() support across eras to expose ScriptRef in TransactionOutput
Signed-off-by: Akhil Repala <[email protected]>
1 parent b275c23 commit 58bc927

File tree

6 files changed

+27
-0
lines changed

6 files changed

+27
-0
lines changed

ledger/alonzo/alonzo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ func (o AlonzoTransactionOutput) Address() common.Address {
324324
return o.OutputAddress
325325
}
326326

327+
func (o AlonzoTransactionOutput) GetScriptRef() *cbor.LazyValue {
328+
return nil
329+
}
330+
327331
func (o AlonzoTransactionOutput) Amount() uint64 {
328332
return o.OutputAmount.Amount
329333
}

ledger/babbage/babbage.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,16 @@ func (o BabbageTransactionOutput) Address() common.Address {
486486
return o.OutputAddress
487487
}
488488

489+
func (o BabbageTransactionOutput) GetScriptRef() *cbor.LazyValue {
490+
if o.ScriptRef == nil {
491+
return nil
492+
}
493+
if lazyVal, ok := o.ScriptRef.Content.(*cbor.LazyValue); ok {
494+
return lazyVal
495+
}
496+
return nil
497+
}
498+
489499
func (o BabbageTransactionOutput) Amount() uint64 {
490500
return o.OutputAmount.Amount
491501
}

ledger/byron/byron.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ func (o ByronTransactionOutput) Address() common.Address {
414414
return o.OutputAddress
415415
}
416416

417+
func (o ByronTransactionOutput) GetScriptRef() *cbor.LazyValue {
418+
return nil
419+
}
420+
417421
func (o ByronTransactionOutput) Amount() uint64 {
418422
return o.OutputAmount
419423
}

ledger/common/tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ type TransactionOutput interface {
7171
DatumHash() *Blake2b256
7272
Cbor() []byte
7373
Utxorpc() (*utxorpc.TxOutput, error)
74+
GetScriptRef() *cbor.LazyValue
7475
}
7576

7677
type TransactionWitnessSet interface {

ledger/mary/mary.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ func (o MaryTransactionOutput) Address() common.Address {
446446
return o.OutputAddress
447447
}
448448

449+
func (txo MaryTransactionOutput) GetScriptRef() *cbor.LazyValue {
450+
return nil
451+
}
452+
449453
func (o MaryTransactionOutput) Amount() uint64 {
450454
return o.OutputAmount.Amount
451455
}

ledger/shelley/shelley.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ func (o ShelleyTransactionOutput) Address() common.Address {
388388
return o.OutputAddress
389389
}
390390

391+
func (o ShelleyTransactionOutput) GetScriptRef() *cbor.LazyValue {
392+
return nil
393+
}
394+
391395
func (o ShelleyTransactionOutput) Amount() uint64 {
392396
return o.OutputAmount
393397
}

0 commit comments

Comments
 (0)