Skip to content

Commit

Permalink
Merge pull request #39 from archethic-foundation/38-create-a-provider…
Browse files Browse the repository at this point in the history
…-to-get-deftokensrepositoryimpla

Create a provider to getDefTokensRepository
  • Loading branch information
redDwarf03 authored Nov 8, 2024
2 parents 27290ac + aea11ea commit f206543
Show file tree
Hide file tree
Showing 24 changed files with 377 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:intl/intl.dart' as intl;
import 'localizations-ae-dapp-framework_en.dart';
import 'localizations-ae-dapp-framework_fr.dart';

// ignore_for_file: type=lint

/// Callers can lookup localized strings with an instance of AppLocalizations
/// returned by `AppLocalizations.of(context)`.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'localizations-ae-dapp-framework.dart';

// ignore_for_file: type=lint

/// The translations for English (`en`).
class AppLocalizationsEn extends AppLocalizations {
AppLocalizationsEn([String locale = 'en']) : super(locale);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flutter-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: '3.22.2'
flutter-version: '3.24.4'

- name: Install dependencies
run: flutter pub get
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.22.3"
flutter-version: "3.24.4"
- name: Install dependencies
run: flutter pub get
- name: Publish
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
flutter 3.22.3-stable
flutter 3.24.4-stable
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 3.2.3

* Add `defTokensRepository` provider

# 3.2.2

* Use MediaQuery.sizeOf(context) instead of MediaQuery.of(context).size
Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ analyzer:
- lib/src/l10n/*
- "**/*.freezed.dart"
- "**/*.g.dart"
plugins:
- custom_lint

language:
strict-casts: true
Expand Down
3 changes: 2 additions & 1 deletion lib/src/application/ae_token.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart'
as aedappfm;
import 'package:archethic_dapp_framework_flutter/src/domain/models/ae_token.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'ae_token.g.dart';

@riverpod
Future<double> _estimateTokenInFiat(
_EstimateTokenInFiatRef ref,
Ref ref,
AEToken token,
) async {
if (token.symbol == 'UCO') {
Expand Down
6 changes: 4 additions & 2 deletions lib/src/application/ae_token.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/src/application/api_service.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:archethic_dapp_framework_flutter/src/domain/models/environment.dart';
import 'package:archethic_lib_dart/archethic_lib_dart.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'api_service.g.dart';

@riverpod
ApiService apiService(
ApiServiceRef ref,
Ref ref,
Environment environment,
) =>
ApiService(environment.endpoint);
6 changes: 4 additions & 2 deletions lib/src/application/api_service.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions lib/src/application/coin_price.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import 'dart:async';

import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

Expand Down Expand Up @@ -42,13 +43,13 @@ class _CoinPricesNotifier extends _$CoinPricesNotifier {

@riverpod
CoinPriceRepositoryImpl _coinPriceRepository(
_CoinPriceRepositoryRef ref,
Ref ref,
) =>
CoinPriceRepositoryImpl();

@riverpod
Future<double> _coinPrice(
_CoinPriceRef ref, {
Ref ref, {
required String address,
Environment? environment,
}) async {
Expand Down
12 changes: 8 additions & 4 deletions lib/src/application/coin_price.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions lib/src/application/def_tokens.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:archethic_dapp_framework_flutter/src/domain/models/ae_token.dart';
import 'package:archethic_dapp_framework_flutter/src/domain/models/environment.dart';
import 'package:archethic_dapp_framework_flutter/src/infrastructure/def_tokens.repository.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'def_tokens.g.dart';

@riverpod
DefTokensRepositoryImpl defTokensRepositoryImpl(
Ref ref,
) =>
DefTokensRepositoryImpl();

@riverpod
Future<AEToken?> getDefToken(
Ref ref,
Environment environment,
String address,
) async {
return ref
.watch(defTokensRepositoryImplProvider)
.getDefToken(environment, address);
}
Loading

0 comments on commit f206543

Please sign in to comment.