-
Notifications
You must be signed in to change notification settings - Fork 32
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
docs: Add wallet app tutorial #421
Conversation
To view this pull requests documentation preview, visit the following URL: docs.page/focustree/starknet.dart~421 Documentation is deployed and generated using docs.page. |
WalkthroughThis pull request introduces a comprehensive tutorial for building a mobile wallet application using Flutter and Starknet. Key updates include enhanced installation steps, the addition of environment variable management, and modifications to the main application structure. Notably, Kotlin and dependency versions are updated, and files related to project metadata are removed. The tutorial culminates in the creation of a Changes
Possibly related PRs
Suggested reviewers
Poem
Warning Rate limit exceeded@lesnitsky has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 8 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
docs/examples/mobile-wallet.mdx (2)
3-3
: Fix grammatical and formatting issuesSeveral minor issues in the tutorial text:
- Line 3: Add a comma after "In this tutorial"
- Line 44: Add "the" before "flutter_dotenv package"
- Line 79: "setup" should be "set up" (verb form)
- Line 99: Add a comma after "Finally"
Also applies to: 44-44, 79-79, 99-99
🧰 Tools
🪛 LanguageTool
[typographical] ~3-~3: It appears that a comma is missing.
Context: ...d a mobile wallet for Starknet In this tutorial we will build a mobile wallet app. ## ...(DURING_THAT_TIME_COMMA)
25-30
: Add security note about environment variablesConsider adding a security note about not committing the .env file and providing a .env.example template instead.
Add this section after the .env file example:
> Note: Never commit your .env file to version control. Create a .env.example file with placeholder values instead.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (2)
examples/wallet_app/devnet/poetry.lock
is excluded by!**/*.lock
examples/wallet_app/ios/Podfile.lock
is excluded by!**/*.lock
📒 Files selected for processing (7)
docs/examples/mobile-wallet.mdx
(2 hunks)examples/wallet_app/android/build.gradle
(1 hunks)examples/wallet_app/contracts
(0 hunks)examples/wallet_app/devnet/pyproject.toml
(0 hunks)examples/wallet_app/ios/Runner/AppDelegate.swift
(1 hunks)examples/wallet_app/lib/main.dart
(1 hunks)examples/wallet_app/pubspec.yaml
(2 hunks)
💤 Files with no reviewable changes (2)
- examples/wallet_app/contracts
- examples/wallet_app/devnet/pyproject.toml
🧰 Additional context used
🪛 LanguageTool
docs/examples/mobile-wallet.mdx
[typographical] ~3-~3: It appears that a comma is missing.
Context: ...d a mobile wallet for Starknet In this tutorial we will build a mobile wallet app. ## ...
(DURING_THAT_TIME_COMMA)
[uncategorized] ~44-~44: You might be missing the article “the” here.
Context: ...to load our environment variables using flutter_dotenv
package ```dart import ...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[grammar] ~79-~79: The word “setup” is a noun. The verb is spelled with a space.
Context: ...t Hive.initFlutter(); } ``` Let's also setup device orientation and system ui overla...
(NOUN_VERB_CONFUSION)
[typographical] ~99-~99: Consider adding a comma after ‘Finally’ for more clarity.
Context: ...Brightness: Brightness.dark, )); ``` Finally we can create an App widget and run our...
(RB_LY_COMMA)
🔇 Additional comments (5)
examples/wallet_app/ios/Runner/AppDelegate.swift (2)
4-4
: LGTM! Good modernization of the Swift entry point.
The change from @UIApplicationMain
to @main
follows modern Swift conventions. This is a safe update that maintains full compatibility while adopting the more concise syntax introduced in Swift 5.3.
Line range hint 5-13
: LGTM! Standard Flutter iOS integration.
The implementation follows Flutter's recommended pattern for iOS integration with proper plugin registration.
examples/wallet_app/pubspec.yaml (2)
47-48
:
Ensure .env file is properly gitignored
Since the .env file typically contains sensitive configuration, ensure it's added to .gitignore to prevent accidental commits of sensitive data.
✅ Verification successful
.env
file is properly secured in version control
The .gitignore
file already includes proper rules for environment files:
.env
- blocks the main env file.env.*
- blocks all env file variants- With explicit exceptions for example files (
.env.example
,.env.mainnet.example
, etc.)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if .env is properly gitignored
if ! grep -q "^\.env$" .gitignore; then
echo "Warning: .env is not in .gitignore"
fi
Length of output: 30
Script:
#!/bin/bash
# Let's first check if .gitignore exists and show its contents
if [ -f .gitignore ]; then
echo "Content of .gitignore:"
cat .gitignore
else
echo ".gitignore file not found"
fi
# Also check if .env file exists in the repository
echo -e "\nChecking for .env files:"
fd -H ".env$"
Length of output: 720
21-21
: Verify impact of major flutter_lints version update
The update from flutter_lints 2.0.0 to 5.0.0 is a major version jump that might introduce breaking changes in linting rules.
✅ Verification successful
Review flutter_lints version update in wallet_app
The analysis shows that the wallet_app and several other packages use the default flutter_lints configuration without any custom rule overrides. Since flutter_lints follows semantic versioning and maintains a stable set of recommended rules, the update from 2.0.0 to 5.0.0 should be safe as it primarily introduces new lint rules rather than breaking existing ones.
- The
analysis_options.yaml
in wallet_app uses the default include without modifications - Other packages using flutter_lints also use the default configuration
- No custom rules are enabled that could be impacted by the version change
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any existing lint configurations that might need updates
fd -e yaml "analysis_options"
Length of output: 331
Script:
#!/bin/bash
# Check the content of analysis_options.yaml files to see their linting configurations
for file in $(fd -e yaml "analysis_options"); do
echo "=== $file ==="
cat "$file"
echo -e "\n"
done
Length of output: 6450
examples/wallet_app/lib/main.dart (1)
31-37
: Consider platform-specific UI configurations
The system UI configuration might need adjustments for different platforms (iOS vs Android).
@@ -1,5 +1,5 @@ | |||
buildscript { | |||
ext.kotlin_version = '1.7.10' | |||
ext.kotlin_version = '2.0.21' |
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.
💡 Codebase verification
Kotlin 2.0.21 is incompatible with Android Gradle Plugin 7.3.0
The verification confirms that the Android Gradle Plugin version 7.3.0 is being used in the project. Kotlin 2.0.x is not compatible with this AGP version, as it requires a more recent version of the Android Gradle Plugin. Additionally, other examples in the codebase are using Kotlin 1.7.10, which indicates this is the established version across the project.
Recommendations:
- Either downgrade Kotlin to 1.9.x (preferably 1.9.22) for compatibility with AGP 7.3.0
- Or upgrade both AGP and Kotlin versions together following the official compatibility matrix
🔗 Analysis chain
Consider using a more stable Kotlin version for the tutorial
The update to Kotlin 2.0.21 introduces potential risks:
- Kotlin 2.0 is a very recent major release that might have compatibility issues with existing Android tooling
- For a tutorial, using such a new version might cause problems for users following along
Consider using the latest stable 1.x version (e.g., 1.9.22) which is more widely tested with Android tooling.
Let's verify the compatibility with Android Gradle Plugin:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check Kotlin versions recommended for Android Gradle Plugin 7.3.0
# Search for any Kotlin version recommendations in the Android documentation
rg --type md "Kotlin.*version.*7\.3\.0"
# Look for any version constraints in build files
rg "kotlin.*version.*7\.3\.0"
Length of output: 73
Script:
#!/bin/bash
# Let's check the current Android Gradle Plugin version and other dependencies
# Check build.gradle files for Android Gradle Plugin version
rg "com\.android\.tools\.build:gradle" -A 2
# Check other Kotlin-related dependencies
rg "org\.jetbrains\.kotlin" -A 2
# Look for any other build configuration that might give context
rg "compileSdk|minSdk|targetSdk|buildToolsVersion"
Length of output: 4246
await WalletKit().init( | ||
accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] as String, | ||
rpc: dotenv.env['RPC'] as String, | ||
); |
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.
Add validation for environment variables
Direct casting of environment variables to String without validation could lead to runtime errors if variables are missing.
Consider adding validation:
await WalletKit().init(
- accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] as String,
- rpc: dotenv.env['RPC'] as String,
+ accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] ??
+ throw Exception('ACCOUNT_CLASS_HASH environment variable is required'),
+ rpc: dotenv.env['RPC'] ??
+ throw Exception('RPC environment variable is required'),
);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
await WalletKit().init( | |
accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] as String, | |
rpc: dotenv.env['RPC'] as String, | |
); | |
await WalletKit().init( | |
accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] ?? | |
throw Exception('ACCOUNT_CLASS_HASH environment variable is required'), | |
rpc: dotenv.env['RPC'] ?? | |
throw Exception('RPC environment variable is required'), | |
); |
WalletKit().init( | ||
accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] as String, | ||
rpc: dotenv.env['RPC'] as String, | ||
); |
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.
Add await to WalletKit initialization
The WalletKit initialization in the tutorial is missing the await
keyword, unlike the actual implementation in main.dart.
- WalletKit().init(
+ await WalletKit().init(
accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] as String,
rpc: dotenv.env['RPC'] as String,
);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
WalletKit().init( | |
accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] as String, | |
rpc: dotenv.env['RPC'] as String, | |
); | |
await WalletKit().init( | |
accountClassHash: dotenv.env['ACCOUNT_CLASS_HASH'] as String, | |
rpc: dotenv.env['RPC'] as String, | |
); |
Summary by CodeRabbit
New Features
.env
file.WalletApp
widget and aHomeScreen
.Bug Fixes
Chores
Documentation
.gitignore
to track the.env
file for version control.