-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: created config base env file #244
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c4158b7
created base env file
Zfinix 590fb12
minor lint fixes
Zfinix 26005aa
Merge branch 'main' into feat/add-config-file
Zfinix 359fd1e
Merge branch 'main' into feat/add-config-file
Zfinix 12c4e88
Merge remote-tracking branch 'origin' into feat/add-config-file
Zfinix b1a46d6
refactor baseEnv to appConfig
Zfinix 8f1908c
Merge branch 'main' into feat/add-config-file
Zfinix 61ab763
Merge remote-tracking branch 'origin' into feat/add-config-file
Zfinix c8959e7
Merge branch 'feat/add-config-file' of https://github.com/tendermint/…
Zfinix a3c623f
fix lint problems
Zfinix b0b5ea9
updated the docs
Zfinix e932a5a
Merge branch 'main' into feat/add-config-file
Zfinix d396963
updated lcdurl
Zfinix 093bb9c
Merge branch 'main' into feat/add-config-file
Zfinix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,32 +1,46 @@ | ||
## Setup and run Flutter app | ||
|
||
- [Setup Flutter based on your operating system](https://flutter.dev/docs/get-started/install) | ||
|
||
- Make sure you follow all the steps above and have an all-green output of `flutter doctor` command. | ||
|
||
- [Install and run Anroid Studio once](https://developer.android.com/studio/install) | ||
|
||
- (For iOS) Install XCode from AppStore | ||
|
||
- You can use Android Studio, [IntelliJ Idea](https://www.jetbrains.com/idea/download), | ||
or [VSCode](https://code.visualstudio.com/download) for Flutter development | ||
|
||
- Install Flutter plugin in your chosen IDE | ||
|
||
- Clone this repository using `git clone https://github.com/tendermint/flutter.git` | ||
|
||
- To run it on your `localhost` environment, you will just have to run `main.dart` file in your project. That can be | ||
done directly by clicking on the play button in your IDE, or by running `flutter run` from the root of your project. | ||
This will run the app on any device or simulator connected to your system | ||
|
||
- If you're running the app on real device instead of emulator/simulator or want to taget a specific blockchain run on a | ||
remote machine, make sure to specify proper urls and ports when running the app. Here is an example for running the | ||
app on cosmos hub testnet: | ||
remote machine, make sure to specify proper urls and ports when running the app. | ||
|
||
- Edit and update your environment variables in the [`app_config.dart`](https://github.com/tendermint/flutter/blob/main/starport_template/app_config.dart) | ||
|
||
- Run the `starport_template` app using `fvm flutter run` or `make run-dev` commands: | ||
|
||
``` | ||
flutter run --dart-define=LCD_URL=https://api.testnet.cosmos.network --dart-define=LCD_PORT=443 --dart-define=GRPC_URL=https://grpc.testnet.cosmos.network --dart-define=GRPC_PORT=443 | ||
``` | ||
|
||
## Using template from Starport's scaffolded chain | ||
|
||
- Clone the [Starport](https://github.com/tendermint/starport) repository from `develop` branch | ||
|
||
- Make sure to install [GoLang](https://go.dev/dl/) for your platform | ||
|
||
- Run `make install` in Starport's root directory | ||
|
||
- Run `starport scaffold chain github.com/cosmonaut/mars` to create a new chain | ||
|
||
- Run `cd mars` | ||
|
||
- Run `starport scaffold flutter` to create a new Flutter app (this clones the `starport_template` repository - the | ||
current repo) and puts in under `flutter` subdirectory | ||
|
||
- Run `starport generate dart` to generate dart files from proto files to be used by the template to interact with the | ||
blockchain |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:alan/alan.dart'; | ||
import 'package:grpc/grpc.dart'; | ||
|
||
class AppConfig { | ||
AppConfig({ | ||
this.lcdUrl = 'http://10.0.2.2', | ||
this.grpcUrl = 'http://localhost', | ||
this.lcdPort = '1317', | ||
this.grpcPort = '9090', | ||
this.prefixAddress = 'cosmos', | ||
}); | ||
|
||
/// Configure the LCD Url | ||
final String lcdUrl; | ||
|
||
/// Configure the GRPC Url | ||
final String grpcUrl; | ||
|
||
/// Configure the LCD Port | ||
final String lcdPort; | ||
|
||
/// Configure the GRPC Port | ||
final String grpcPort; | ||
|
||
/// Configure the address prefix | ||
final String prefixAddress; | ||
|
||
/// Configure the base api url | ||
String get baseApiUrl => '$lcdUrl:$lcdPort'; | ||
|
||
/// Network information of the Cosmos-based network. | ||
NetworkInfo get networkInfo => NetworkInfo( | ||
bech32Hrp: prefixAddress, | ||
lcdInfo: LCDInfo( | ||
host: lcdUrl, | ||
port: int.parse(lcdPort), | ||
), | ||
grpcInfo: GRPCInfo( | ||
host: grpcUrl, | ||
port: int.parse(grpcPort), | ||
credentials: | ||
int.parse(grpcPort) == 443 ? const ChannelCredentials.secure() : const ChannelCredentials.insecure(), | ||
), | ||
); | ||
|
||
AppConfig copyWith({ | ||
String? lcdUrl, | ||
String? grpcUrl, | ||
String? lcdPort, | ||
String? grpcPort, | ||
String? prefixAddress, | ||
}) { | ||
return AppConfig( | ||
lcdUrl: lcdUrl ?? this.lcdUrl, | ||
grpcUrl: grpcUrl ?? this.grpcUrl, | ||
lcdPort: lcdPort ?? this.lcdPort, | ||
grpcPort: grpcPort ?? this.grpcPort, | ||
prefixAddress: prefixAddress ?? this.prefixAddress, | ||
); | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10.0.2.2
- localhost for android emulatorslhttp://localhost
- ios simulatoryou'll have to stick with only 1 version, I suggest going with
http://localhost
for both LCD and grpcThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay