Skip to content

Commit

Permalink
Store plutusv3 script references in newmchain
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewWestberg committed Sep 23, 2024
1 parent bbdf7ba commit a33dab0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions newm-chain-db/src/main/kotlin/io/newm/chain/util/DbKtx.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import io.newm.kogmios.protocols.model.MetadataMap
import io.newm.kogmios.protocols.model.MetadataString
import io.newm.kogmios.protocols.model.MetadataValue
import io.newm.kogmios.protocols.model.ScriptPlutusV2
import io.newm.kogmios.protocols.model.ScriptPlutusV3
import io.newm.kogmios.protocols.model.StakeCredentialRegistrationCertificate
import io.newm.kogmios.protocols.model.StakeDelegationCertificate
import io.newm.kogmios.protocols.model.UtxoOutput
Expand Down Expand Up @@ -176,8 +177,13 @@ fun List<UtxoOutput>.toCreatedUtxoList(
lovelace = utxoOutput.value.ada.ada.lovelace,
datumHash = datumHash,
datum = datum,
// we only care about plutus v2
scriptRef = (utxoOutput.script as? ScriptPlutusV2)?.cbor,
scriptRef = utxoOutput.script?.let { script ->
when (script) {
is ScriptPlutusV2 -> script.cbor
is ScriptPlutusV3 -> script.cbor
else -> null
}
},
nativeAssets =
utxoOutput.value.assets
?.map { asset ->
Expand Down

0 comments on commit a33dab0

Please sign in to comment.