Skip to content

Commit

Permalink
Merge pull request #33 from projectNEWM/amw/STUD-207
Browse files Browse the repository at this point in the history
STUD-207: Ensure we capture all assets in OutputUtxoValue
  • Loading branch information
AndrewWestberg authored Mar 29, 2024
2 parents a82c3ff + 80bed99 commit b611cda
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ktlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
java-version: '21'
- run: |
curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.2.1/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/
- name: run ktlint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
java-version: '21'
- name: run tests
run: ./gradlew test -PisGithubActions
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (!project.hasProperty("isGithubActions")) {
}

group = "io.newm"
version = "2.1.0-SNAPSHOT"
version = "2.2.0-SNAPSHOT"

java.sourceCompatibility = JavaVersion.VERSION_21
java.targetCompatibility = JavaVersion.VERSION_21
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Versions {
const val COMMONS_LOGGING = "1.3.0"
const val COMMONS_LOGGING = "1.3.1"
const val COMMONS_NUMBERS = "1.1"
const val COROUTINES = "1.8.0"
const val GOOGLE_TRUTH = "1.4.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ object UtxoOutputValueSerializer : KSerializer<UtxoOutputValue> {
val adaMap = elements["ada"] ?: throw IllegalStateException("ada value not found in UtxoOutputValue")
val lovelace = adaMap["lovelace"] ?: throw IllegalStateException("lovelace value not found in UtxoOutputValue")
val assets =
elements.entries.filterNot { it.key == "ada" }.map {
Asset(
policyId = it.key,
name = it.value.keys.first(),
quantity = it.value.values.first()
)
elements.entries.filterNot { it.key == "ada" }.flatMap { policy ->
val policyId = policy.key
policy.value.map {
Asset(
policyId = policyId,
name = it.key,
quantity = it.value
)
}
}
return UtxoOutputValue(
ada = Ada(Lovelace(lovelace)),
Expand Down

0 comments on commit b611cda

Please sign in to comment.