Skip to content

Commit

Permalink
fix: 🐛 Fix CoinPriceProvider : Return 0 when ucid doesn't exist for…
Browse files Browse the repository at this point in the history
… a token
  • Loading branch information
redDwarf03 committed Sep 11, 2024
1 parent 6e551e8 commit 21c66ab
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changelog
=========
#### Version 1.3.1
* Fix bug: `CoinPriceProvider` : Return 0 when ucid doesn't exist for a token
* Fix typo: fix method `startTimer` instead of `starTimer` in `CoinPriceNotifier`

#### Version 1.3.0
* BREAKING CHANGES: `TransactionUtil` - Add `apiService` param for each method
* BREAKING CHANGES: Changing the way you load providers: `UcidsTokensProviders` & `CoinPriceProviders`
Expand Down
28 changes: 16 additions & 12 deletions lib/src/application/coin_price.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,23 @@ Future<double> _coinPrice(
required String address,
String? network,
}) async {
final coinPrice = ref.watch(
CoinPriceProviders.coinPrices,
);
final ucid = await ref.watch(
UcidsTokensProviders.ucid(
address: address.toUpperCase(),
network: network,
).future,
);
try {
final coinPrice = ref.watch(
CoinPriceProviders.coinPrices,
);
final ucid = await ref.watch(
UcidsTokensProviders.ucid(
address: address.toUpperCase(),
network: network,
).future,
);

return ref
.read(_coinPriceRepositoryProvider)
.getPriceFromUcid(ucid, coinPrice);
return ref
.read(_coinPriceRepositoryProvider)
.getPriceFromUcid(ucid, coinPrice);
} catch (e) {
return 0;
}
}

abstract class CoinPriceProviders {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: archethic_dapp_framework_flutter
description: An internal framework for archethic flutter development
homepage: https://github.com/archethic-foundation/archethic-dapp-framework-flutter

version: 1.3.0
version: 1.3.1

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down

0 comments on commit 21c66ab

Please sign in to comment.