Skip to content
Closed
Changes from all commits
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
34 changes: 28 additions & 6 deletions ledger/babbage/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,16 +528,38 @@ func (o BabbageTransactionOutput) ToPlutusData() data.PlutusData {
assetDataMap.Pairs...,
)
}
var datumOptionPd data.PlutusData
switch {
case o.DatumOption == nil:
datumOptionPd = data.NewConstr(0)
case o.DatumOption.hash != nil:
datumOptionPd = data.NewConstr(
1,
data.NewByteString(o.DatumOption.hash.Bytes()),
)
case o.DatumOption.data != nil:
datumOptionPd = data.NewConstr(
2,
o.DatumOption.data.Data,
)
}
var scriptRefPd data.PlutusData
if o.TxOutScriptRef == nil {
scriptRefPd = data.NewConstr(1)
} else {
scriptRefPd = data.NewConstr(
0,
data.NewByteString(
o.TxOutScriptRef.Script.Hash().Bytes(),
),
)
}
tmpData := data.NewConstr(
0,
o.OutputAddress.ToPlutusData(),
data.NewMap(valueData),
// Empty datum option
// TODO: implement this
data.NewConstr(0),
// Empty script ref
// TODO: implement this
data.NewConstr(1),
datumOptionPd,
scriptRefPd,
)
return tmpData
}
Expand Down
Loading