Skip to content

feat: Support getting ScriptRef from TransactionOutput interface #1051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ledger/alonzo/alonzo.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ func (o AlonzoTransactionOutput) Address() common.Address {
return o.OutputAddress
}

func (o AlonzoTransactionOutput) GetScriptRef() *cbor.LazyValue {
return nil
}

func (o AlonzoTransactionOutput) Amount() uint64 {
return o.OutputAmount.Amount
}
Expand Down
10 changes: 10 additions & 0 deletions ledger/babbage/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,16 @@ func (o BabbageTransactionOutput) Address() common.Address {
return o.OutputAddress
}

func (o BabbageTransactionOutput) GetScriptRef() *cbor.LazyValue {
if o.ScriptRef == nil {
return nil
}
if lazyVal, ok := o.ScriptRef.Content.(*cbor.LazyValue); ok {
return lazyVal
}
return nil
}

func (o BabbageTransactionOutput) Amount() uint64 {
return o.OutputAmount.Amount
}
Expand Down
4 changes: 4 additions & 0 deletions ledger/byron/byron.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ func (o ByronTransactionOutput) Address() common.Address {
return o.OutputAddress
}

func (o ByronTransactionOutput) GetScriptRef() *cbor.LazyValue {
return nil
}

func (o ByronTransactionOutput) Amount() uint64 {
return o.OutputAmount
}
Expand Down
1 change: 1 addition & 0 deletions ledger/common/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type TransactionOutput interface {
DatumHash() *Blake2b256
Cbor() []byte
Utxorpc() (*utxorpc.TxOutput, error)
GetScriptRef() *cbor.LazyValue
}

type TransactionWitnessSet interface {
Expand Down
4 changes: 4 additions & 0 deletions ledger/mary/mary.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,10 @@ func (o MaryTransactionOutput) Address() common.Address {
return o.OutputAddress
}

func (txo MaryTransactionOutput) GetScriptRef() *cbor.LazyValue {
return nil
}

func (o MaryTransactionOutput) Amount() uint64 {
return o.OutputAmount.Amount
}
Expand Down
4 changes: 4 additions & 0 deletions ledger/shelley/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ func (o ShelleyTransactionOutput) Address() common.Address {
return o.OutputAddress
}

func (o ShelleyTransactionOutput) GetScriptRef() *cbor.LazyValue {
return nil
}

func (o ShelleyTransactionOutput) Amount() uint64 {
return o.OutputAmount
}
Expand Down