From 28e6a9ec472842dfc4b246404fe21eba7029ec14 Mon Sep 17 00:00:00 2001 From: CharlVS <77973576+CharlVS@users.noreply.github.com> Date: Wed, 25 Mar 2026 23:33:41 +0100 Subject: [PATCH 1/2] fix(wallet): coordinate activation through shared sdk path Force-refresh app activation checks before enabling assets, route activation through the shared SDK coordinator, and roll the sdk submodule to the TRX market-data and activation fixes. --- lib/bloc/coins_bloc/coins_repo.dart | 29 +++++++++++++---------------- sdk | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/bloc/coins_bloc/coins_repo.dart b/lib/bloc/coins_bloc/coins_repo.dart index 8981ac4b6a..504381b769 100644 --- a/lib/bloc/coins_bloc/coins_repo.dart +++ b/lib/bloc/coins_bloc/coins_repo.dart @@ -471,10 +471,12 @@ class CoinsRepo { for (final asset in assets) { final coin = _assetToCoinWithoutAddress(asset); try { - // Check if asset is already activated to avoid SDK exception. - // The SDK throws an exception when trying to activate an already-activated - // asset, so we need this manual check to prevent unnecessary retries. - final isAlreadyActivated = await isAssetActivated(asset.id); + // Force-refresh activation state here to avoid racing on stale cache + // reads before attempting a coordinated activation. + final isAlreadyActivated = await isAssetActivated( + asset.id, + forceRefresh: true, + ); if (isAlreadyActivated) { _log.info( @@ -488,12 +490,9 @@ class CoinsRepo { // Use retry with exponential backoff for activation await retry( () async { - final progress = await _kdfSdk.assets.activateAsset(asset).last; - if (!progress.isSuccess) { - throw Exception( - progress.errorMessage ?? - 'Activation failed for ${asset.id.id}', - ); + final didActivate = await _kdfSdk.ensureAssetActivated(asset); + if (!didActivate) { + throw Exception('Activation failed for ${asset.id.id}'); } }, maxAttempts: maxRetryAttempts, @@ -591,12 +590,10 @@ class CoinsRepo { _addAssetsToWalletMetdata(assets); Future _addAssetsToWalletMetdata(Iterable assets) async { - final parentIds = {}; - for (final assetId in assets) { - if (assetId.parentId != null) { - parentIds.add(assetId.parentId!.id); - } - } + final parentIds = assets + .where((assetId) => assetId.parentId != null) + .map((assetId) => assetId.parentId!.id) + .toSet(); if (assets.isNotEmpty || parentIds.isNotEmpty) { final allIdsToAdd = {...assets.map((e) => e.id), ...parentIds}; diff --git a/sdk b/sdk index 39dd1fc605..79ff3f8da3 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 39dd1fc605ddfa009ab1c15ebb631a3be6bde36d +Subproject commit 79ff3f8da37e52508f74a8f8b337d4bc58113a59 From d7a7473ed6399825e05ff627d84c156cb9dd836f Mon Sep 17 00:00:00 2001 From: CharlVS <77973576+CharlVS@users.noreply.github.com> Date: Wed, 25 Mar 2026 23:35:56 +0100 Subject: [PATCH 2/2] chore(sdk): roll submodule to merged TRX activation fix Update the app to track the merged SDK dev commit that restores TRX market data and coordinates activation deduplication. --- sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk b/sdk index 79ff3f8da3..877bb57fe7 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 79ff3f8da37e52508f74a8f8b337d4bc58113a59 +Subproject commit 877bb57fe7ca3e528e60eab2688062dc1d631ade