From d2a23d76fa99fa9f10763ea609de4546dd8e44b4 Mon Sep 17 00:00:00 2001 From: antonijzelinskij Date: Wed, 13 Nov 2024 08:10:13 +0100 Subject: [PATCH 1/4] Fixed amount update on balance list --- .../presentation/balance/common/BalanceListAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/common/BalanceListAdapter.kt b/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/common/BalanceListAdapter.kt index c6ab404aa6..9cac4ef514 100644 --- a/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/common/BalanceListAdapter.kt +++ b/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/common/BalanceListAdapter.kt @@ -87,7 +87,7 @@ class BalanceListAdapter( val item = getItem(position) as TokenAssetUi resolvePayload(holder, position, payloads) { when (it) { - AssetModel::amount -> holder.bindTotal(item.asset) + amountExtractor -> holder.bindTotal(item.asset) } } } From 20af2c65402d34654a192933f5a0a8c72e79423f Mon Sep 17 00:00:00 2001 From: antonijzelinskij Date: Mon, 18 Nov 2024 15:47:52 +0100 Subject: [PATCH 2/4] Fixed junctions binding --- .../multiLocation/MultiLocationEncoding.kt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt b/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt index f30fe143d7..b0ab580bb8 100644 --- a/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt +++ b/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt @@ -37,17 +37,22 @@ private fun bindInterior(instance: Any?): MultiLocation.Interior { return when (asDictEnum.name) { "Here" -> MultiLocation.Interior.Here - "X1" -> { - val junction = bindJunction(asDictEnum.value) - MultiLocation.Interior.Junctions(listOf(junction)) - } + else -> { - val junctions = bindList(asDictEnum.value, ::bindJunction) + val junctions = bindJunctions(asDictEnum.value) MultiLocation.Interior.Junctions(junctions) } } } +private fun bindJunctions(instance: Any?): List { + if (instance is List<*>) { + return bindList(instance, ::bindJunction) + } else { + return listOf(bindJunction(instance)) + } +} + private fun bindJunction(instance: Any?): Junction { val asDictEnum = instance.castToDictEnum() @@ -56,6 +61,7 @@ private fun bindJunction(instance: Any?): Junction { val keyBytes = bindByteArray(asDictEnum.value) Junction.GeneralKey(keyBytes.toHexString(withPrefix = true)) } + "PalletInstance" -> Junction.PalletInstance(bindNumber(asDictEnum.value)) "Parachain" -> Junction.ParachainId(bindNumber(asDictEnum.value)) "GeneralIndex" -> Junction.GeneralIndex(bindNumber(asDictEnum.value)) @@ -81,6 +87,7 @@ private fun bindGlobalConsensusJunction(instance: Any?): Junction { val genesis = bindByteArray(asDictEnum.value).toHexString(withPrefix = false) Junction.GlobalConsensus(chainId = genesis) } + "Polkadot" -> Junction.GlobalConsensus(chainId = Chain.Geneses.POLKADOT) "Kusama" -> Junction.GlobalConsensus(chainId = Chain.Geneses.KUSAMA) "Westend" -> Junction.GlobalConsensus(chainId = Chain.Geneses.WESTEND) From f2f25e5c9f890b2907a79764255f92251542a968 Mon Sep 17 00:00:00 2001 From: antonijzelinskij Date: Mon, 18 Nov 2024 18:10:02 +0100 Subject: [PATCH 3/4] Add comments for binding --- .../runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt b/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt index b0ab580bb8..630e3efccf 100644 --- a/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt +++ b/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt @@ -47,8 +47,10 @@ private fun bindInterior(instance: Any?): MultiLocation.Interior { private fun bindJunctions(instance: Any?): List { if (instance is List<*>) { + // For XCM V4 or Interior.X2 and higher return bindList(instance, ::bindJunction) } else { + // For XCM V3 and Interior.X1 return listOf(bindJunction(instance)) } } From f2cf9277ce778851b9b8b1f225c95e1af0dbcb76 Mon Sep 17 00:00:00 2001 From: antonijzelinskij Date: Mon, 18 Nov 2024 18:13:13 +0100 Subject: [PATCH 4/4] Bump version code --- build.gradle | 4 ++-- .../multiNetwork/multiLocation/MultiLocationEncoding.kt | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 470200fc98..e6d337163a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ buildscript { ext { // App version - versionName = '8.7.3' - versionCode = 157 + versionName = '9.0.1' + versionCode = 159 applicationId = "io.novafoundation.nova" releaseApplicationSuffix = "market" diff --git a/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt b/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt index 630e3efccf..873e45932a 100644 --- a/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt +++ b/runtime/src/main/java/io/novafoundation/nova/runtime/multiNetwork/multiLocation/MultiLocationEncoding.kt @@ -46,11 +46,10 @@ private fun bindInterior(instance: Any?): MultiLocation.Interior { } private fun bindJunctions(instance: Any?): List { + // Note that Interior.X1 is encoded differently in XCM v3 (a single junction) and V4 (single-element list) if (instance is List<*>) { - // For XCM V4 or Interior.X2 and higher return bindList(instance, ::bindJunction) } else { - // For XCM V3 and Interior.X1 return listOf(bindJunction(instance)) } }