feat(staking): prepare for Polkadot 2.0 nomination pools on Asset Hub

- ChainExt.kt: Handle nomination-pools without local backing type (Polkadot 2.0)
- Add hasLocalNominationPoolsBacking() helper function
- Default to RELAYCHAIN when no local backing type exists
- StakingDashboardUpdateSystem: Improved error logging
- StakingDashboardViewModel: Show toast when item is syncing
- Update chains.json: relay chain only has relaychain staking
This commit is contained in:
2026-02-09 08:47:53 +03:00
parent 6f8a8b9511
commit 66879ae3c1
5 changed files with 114 additions and 47 deletions
+1 -3
View File
@@ -299,9 +299,6 @@
<string name="account_migration_accepted_url" translatable="false">%s://polkadot/migration-accepted?key=%s</string>
<string name="account_ledger_import_start_step_3_highlighted">access Bluetooth</string>
<string name="branch_io_link_host" translatable="false">pezkuwi-wallet.app.link</string>
<string name="branch_io_link_host_alternate" translatable="false">pezkuwi-wallet-alternate.app.link</string>
<string name="ledger_verify_addresses_message_both_buttons">Press both buttons on your %s to approve the addresses</string>
<string name="ledger_verify_addresses_message_confirm_button">Press confirm button on your %s to approve the addresses</string>
@@ -1438,6 +1435,7 @@
<string name="staking_dashboard_more_options">More staking options</string>
<string name="staking_dashboard_no_stake_header">Stake and earn rewards</string>
<string name="staking_dashboard_browser_stake_header">Staking via Pezkuwi DApp browser</string>
<string name="staking_dashboard_syncing">Loading staking info…</string>
<string name="common_waiting">Waiting</string>
<string name="common_per_year">/ year</string>
@@ -90,8 +90,8 @@ class RealStakingDashboardUpdateSystem(
sharedRequestsBuilder.subscribe(accountScope)
chainUpdates.mergeIfMultiple()
}.catch {
Log.d("StakingDashboardUpdateSystem", "Failed to sync staking dashboard status for ${stakingChain.name}")
}.catch { e ->
Log.e("StakingDashboardUpdateSystem", "Failed to sync staking dashboard status for ${stakingChain.name}", e)
}
}
@@ -2,6 +2,24 @@ package io.novafoundation.nova.feature_staking_impl.domain.nominationPools
import io.novafoundation.nova.runtime.multiNetwork.chain.model.Chain
/**
* Finds the staking type that backs nomination pools.
*
* In Polkadot 1.0: Both relaychain and nomination-pools exist on the same chain
* In Polkadot 2.0: nomination-pools may exist on Asset Hub without local backing type
* (backing is via XCM from relay chain)
*
* @return The backing staking type, or RELAYCHAIN as default for Polkadot 2.0 compatibility
*/
fun Chain.Asset.findStakingTypeBackingNominationPools(): Chain.Asset.StakingType {
return staking.first { it != Chain.Asset.StakingType.NOMINATION_POOLS }
return staking.firstOrNull { it != Chain.Asset.StakingType.NOMINATION_POOLS }
?: Chain.Asset.StakingType.RELAYCHAIN // Polkadot 2.0: default to RELAYCHAIN for Asset Hub
}
/**
* Checks if this asset has nomination pools backed by a local staking type.
* Returns false for Polkadot 2.0 Asset Hub where backing is cross-chain.
*/
fun Chain.Asset.hasLocalNominationPoolsBacking(): Boolean {
return staking.any { it != Chain.Asset.StakingType.NOMINATION_POOLS }
}
@@ -102,7 +102,13 @@ class StakingDashboardViewModel(
fun onNoStakeItemClicked(index: Int) = launch {
val withoutStakeItems = stakingDashboardFlow.firstLoaded().withoutStake
val withoutStakeItem = withoutStakeItems.getOrNull(index) ?: return@launch
val noStakeItemState = withoutStakeItem.stakingState as? NoStake ?: return@launch
val noStakeItemState = withoutStakeItem.stakingState as? NoStake
if (noStakeItemState == null) {
// Item is still syncing (NotYetResolved state)
showToast(resourceManager.getString(R.string.staking_dashboard_syncing))
return@launch
}
val stakingTypes = noStakeItemState.flowType.allStakingTypes
val chain = withoutStakeItem.chain
+85 -40
View File
@@ -2,7 +2,7 @@
{
"chainId": "bb4a61ab0c4b8c12f5eab71d0c86c482e03a275ecdafee678dea712474d33d75",
"name": "Pezkuwi",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/master/icons/chains/Pezkuwi.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/HEZ.png",
"addressPrefix": 42,
"options": [
"crowdloans",
@@ -43,11 +43,10 @@
"name": "Hezkurd",
"priceId": "hezkurd",
"staking": [
"relaychain",
"nomination-pools"
"relaychain"
],
"type": "native",
"icon": "https://pezkuwichain.io/tokens/HEZ.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/HEZ.png",
"buyProviders": {},
"sellProviders": {},
"typeExtras": null
@@ -62,15 +61,14 @@
{
"chainId": "96eb58af1bb7288115b5e4ff1590422533e749293f231974536dc6672417d06f",
"name": "Zagros Testnet",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/master/icons/chains/Pezkuwi.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/HEZ.png",
"addressPrefix": 42,
"options": [
"testnet",
"fullSyncByDefault"
"testnet"
],
"nodes": [
{
"url": "wss://testnet-rpc.pezkuwichain.io",
"url": "wss://zagros-rpc.pezkuwichain.io",
"name": "Zagros Node"
}
],
@@ -85,7 +83,7 @@
"relaychain"
],
"type": "native",
"icon": "https://pezkuwichain.io/tokens/HEZ.png"
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/HEZ.png"
}
],
"additional": {
@@ -98,7 +96,7 @@
"chainId": "00d0e1d0581c3cd5c5768652d52f4520184018b44f56a2ae1e0dc9d65c00c948",
"parentId": "bb4a61ab0c4b8c12f5eab71d0c86c482e03a275ecdafee678dea712474d33d75",
"name": "Pezkuwi Asset Hub",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/master/icons/chains/PezkuwiAssetHub.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/PEZ.png",
"addressPrefix": 42,
"options": [
"swap-hub",
@@ -130,9 +128,11 @@
"precision": 12,
"name": "Hezkurd",
"priceId": "hezkurd",
"staking": null,
"staking": [
"nomination-pools"
],
"type": "native",
"icon": "https://pezkuwichain.io/tokens/HEZ.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/HEZ.png",
"buyProviders": {},
"sellProviders": {},
"typeExtras": null
@@ -145,7 +145,7 @@
"priceId": "pezkuwi",
"staking": null,
"type": "statemine",
"icon": "https://pezkuwichain.io/tokens/PEZ.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/PEZ.png",
"buyProviders": {},
"sellProviders": {},
"typeExtras": {
@@ -160,12 +160,57 @@
"priceId": "tether",
"staking": null,
"type": "statemine",
"icon": "https://pezkuwichain.io/tokens/wUSDT.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"buyProviders": {},
"sellProviders": {},
"typeExtras": {
"assetId": "1000"
}
},
{
"assetId": 1001,
"symbol": "DOT",
"precision": 10,
"name": "Polkadot",
"priceId": "polkadot",
"staking": null,
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/DOT.svg",
"buyProviders": {},
"sellProviders": {},
"typeExtras": {
"assetId": "1001"
}
},
{
"assetId": 1002,
"symbol": "ETH",
"precision": 18,
"name": "Ethereum",
"priceId": "ethereum",
"staking": null,
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/ETH.svg",
"buyProviders": {},
"sellProviders": {},
"typeExtras": {
"assetId": "1002"
}
},
{
"assetId": 1003,
"symbol": "BTC",
"precision": 8,
"name": "Bitcoin",
"priceId": "bitcoin",
"staking": null,
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/WBTC.svg",
"buyProviders": {},
"sellProviders": {},
"typeExtras": {
"assetId": "1003"
}
}
],
"additional": {
@@ -179,7 +224,7 @@
"chainId": "58269e9c184f721e0309332d90cafc410df1519a5dc27a5fd9b3bf5fd2d129f8",
"parentId": "bb4a61ab0c4b8c12f5eab71d0c86c482e03a275ecdafee678dea712474d33d75",
"name": "Pezkuwi People",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/master/icons/chains/PezkuwiPeople.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/chains/PezkuwiPeople.png",
"addressPrefix": 42,
"options": [
"proxy",
@@ -211,7 +256,7 @@
"priceId": "hezkurd",
"staking": null,
"type": "native",
"icon": "https://pezkuwichain.io/tokens/HEZ.png",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/HEZ.png",
"buyProviders": {},
"sellProviders": {},
"typeExtras": null
@@ -560,7 +605,7 @@
"precision": 6,
"priceId": "tether",
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "1984"
}
@@ -943,7 +988,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x050700",
"currencyIdType": "acala_primitives.currency.CurrencyId",
@@ -1234,7 +1279,7 @@
"precision": 6,
"type": "statemine",
"priceId": "tether",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "311091173110107856861649819128533077277"
}
@@ -1645,7 +1690,7 @@
"precision": 6,
"priceId": "tether",
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "311091173110107856861649819128533077277"
}
@@ -2005,7 +2050,7 @@
"precision": 6,
"type": "statemine",
"priceId": "tether",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "4294969280"
}
@@ -2183,7 +2228,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0800",
"currencyIdType": "bifrost_primitives.currency.CurrencyId",
@@ -2381,7 +2426,7 @@
"precision": 6,
"type": "orml",
"priceId": "tether",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0e000000",
"currencyIdType": "u32",
@@ -2610,7 +2655,7 @@
"precision": 6,
"priceId": "tether",
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "102"
}
@@ -3048,7 +3093,7 @@
"precision": 6,
"priceId": "tether",
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "14"
}
@@ -3437,7 +3482,7 @@
"precision": 6,
"type": "orml",
"priceId": "tether",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x050c00",
"currencyIdType": "acala_primitives.currency.CurrencyId",
@@ -3638,7 +3683,7 @@
"precision": 6,
"type": "statemine",
"priceId": "tether",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "4294969280"
}
@@ -3888,7 +3933,7 @@
"precision": 6,
"priceId": "tether",
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "102"
}
@@ -4010,7 +4055,7 @@
"precision": 6,
"priceId": "tether",
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "1984"
}
@@ -4391,7 +4436,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0103000000",
"currencyIdType": "interbtc_primitives.CurrencyId",
@@ -4483,7 +4528,7 @@
"symbol": "qUSDT",
"precision": 6,
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0203000000",
"currencyIdType": "interbtc_primitives.CurrencyId",
@@ -4566,7 +4611,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x82000000000000000000000000000000",
"currencyIdType": "u128",
@@ -4996,7 +5041,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0a000000",
"currencyIdType": "u32",
@@ -5631,7 +5676,7 @@
"symbol": "USDT",
"precision": 6,
"priceId": "tether",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"type": "orml",
"typeExtras": {
"currencyIdScale": "0x0102000000",
@@ -5696,7 +5741,7 @@
"assetId": 12,
"symbol": "qUSDT",
"precision": 6,
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"type": "orml",
"typeExtras": {
"currencyIdScale": "0x0203000000",
@@ -6101,7 +6146,7 @@
"precision": 12,
"priceId": "tether",
"type": "statemine",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"assetId": "3496813586714279103986568049643838918"
}
@@ -6322,7 +6367,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0802",
"currencyIdType": "bifrost_primitives.currency.CurrencyId",
@@ -6902,7 +6947,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0101",
"currencyIdType": "spacewalk_primitives.CurrencyId",
@@ -7269,7 +7314,7 @@
"precision": 6,
"priceId": "tether",
"type": "orml",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"typeExtras": {
"currencyIdScale": "0x0101",
"currencyIdType": "spacewalk_primitives.CurrencyId",
@@ -8556,7 +8601,7 @@
"symbol": "USDT",
"precision": 6,
"priceId": "tether",
"icon": "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/tokens/white/USDT.svg",
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/main/icons/tokens/wUSDT.png",
"type": "statemine",
"typeExtras": {
"assetId": "1984",