File tree Expand file tree Collapse file tree
newm-server/src/main/kotlin/io/newm/server/features/minting/repo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,6 @@ class MintingRepositoryImpl(
105105 Pair (collabUser.walletAddress!! , amount)
106106 }
107107 log.info { " Royalty splits for songId: ${song.id} - $streamTokenSplits " }
108- val paymentKey = cardanoRepository.getKey(song.paymentKeyId!! )
109108
110109 // Convert release.mintPaymentType String to PaymentType enum
111110 val paymentTypeEnum = PaymentType .valueOf(release.mintPaymentType ? : PaymentType .ADA .name)
@@ -122,8 +121,10 @@ class MintingRepositoryImpl(
122121 val newmTokenName =
123122 if (isMainnet) CardanoRepository .NEWM_TOKEN_NAME else CardanoRepository .NEWM_TOKEN_NAME_PREPROD
124123
124+ var paymentKey: Key ? = null
125125 val paymentUtxo = when (paymentTypeEnum) {
126126 PaymentType .NEWM -> {
127+ paymentKey = cardanoRepository.getKey(song.paymentKeyId!! )
127128 requireNotNull(
128129 cardanoRepository.queryLiveUtxos(paymentKey.address).firstOrNull { utxo ->
129130 utxo.nativeAssetsCount == 1 &&
@@ -140,7 +141,7 @@ class MintingRepositoryImpl(
140141
141142 else -> {
142143 // Handles PaymentType.ADA and legacy cases (where release.mintPaymentType might be null)
143-
144+ paymentKey = cardanoRepository.getKey(song.paymentKeyId !! )
144145 val costToUse = if (release.mintPaymentType != null && paymentTypeEnum == PaymentType .ADA ) {
145146 mintCost // This is release.mintCost, which would be ADA amount
146147 } else {
You can’t perform that action at this time.
0 commit comments