This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
100 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import 'package:http/http.dart' as http; | ||
|
||
/// Service for performing HTTP requests. | ||
/// | ||
/// The service is intended to take care of retry logic, cookie management, etc. | ||
class HttpService { | ||
const HttpService(); | ||
|
||
/// Performs an HTTP request asynchronously. | ||
Future<http.Response> get(Uri url) async { | ||
// TODO: Implement retry logic. | ||
return http.get(url); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,40 @@ | ||
import 'package:concordium_wallet/state/config.dart'; | ||
import 'package:concordium_wallet/services/wallet_proxy/service.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
/// Name of a network. | ||
class NetworkName { | ||
final String name; | ||
|
||
const NetworkName(this.name); | ||
|
||
/// Standard name of the testnet network. | ||
static const NetworkName testnet = NetworkName('testnet'); | ||
/// Standard name of the mainnet network. | ||
static const NetworkName mainnet = NetworkName('mainnet'); | ||
} | ||
|
||
/// Configuration of all services of a specific network. | ||
class Network { | ||
/// Name of the network. | ||
final NetworkName name; | ||
/// Configuration of the Wallet Proxy service belonging to the network. | ||
final WalletProxyConfig walletProxyConfig; | ||
|
||
const Network({required this.name, required this.walletProxyConfig}); | ||
} | ||
|
||
class SelectedNetwork extends ChangeNotifier { | ||
Network selected; | ||
/// State component acting as the source of truth for what network is currently active in the app. | ||
class ActiveNetwork extends ChangeNotifier { | ||
/// Currently active network. | ||
/// | ||
/// The network is guaranteed to be one of the "enabled" networks (as defined in [Config.availableNetworks]). | ||
Network active; | ||
|
||
SelectedNetwork(this.selected); | ||
ActiveNetwork(this.active); | ||
|
||
void setSelected(Network n) { | ||
selected = n; | ||
void setActive(Network n) { | ||
active = n; | ||
notifyListeners(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters