-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix: update wallet_app tutorial #431
Merged
ptisserand
merged 14 commits into
focustree:main
from
ptisserand:fix/wallet_app_tutorial
Jan 8, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dabeeb3
docs: add step about Android minimun SDK version required by `wallet_…
ptisserand 5fde80b
feat(wallet_kit): add deploy account support
ptisserand cade09c
fix(wallet_kit): refresh accounts ETH balance when wallet is expanded
ptisserand 4ea2bb5
wallet_kit: fix analyze issue
ptisserand ea0202c
fix(wallet_kit): disable 'Send ETH' button when account is not deployed
ptisserand 767f472
docs: add missing Scaffold in mobile wallet tutorial
ptisserand 93bfd0d
fix(wallet_kit): use `TokenSymbol.name` instead of hardcoded string …
ptisserand 888075f
fix(wallet_kit): disable 'Deploy account' button if ETH account balan…
ptisserand f25838f
feat(wallet_kit): also refresh STRK balance when wallet is expanded
ptisserand 858d607
docs: add info for Android biometric support and devnet minting in mo…
ptisserand 3aa6048
fix(wallet_kit): check if account is deployed when wallet is expanded
ptisserand 4cb794f
fix(wallet_kit): ensure private key is not null before signer creation
ptisserand 2652f5f
wallet_kit: apply some code rabbit recommendation
ptisserand 6ebb7ee
docs: fix typo
ptisserand 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
39 changes: 39 additions & 0 deletions
39
packages/wallet_kit/lib/widgets/deploy_account_button.dart
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,39 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
import '../wallet_kit.dart'; | ||
|
||
class DeployAccountButton extends HookConsumerWidget { | ||
const DeployAccountButton({ | ||
super.key, | ||
}); | ||
|
||
// ignore: constant_identifier_names | ||
static const double MINIMUN_ETH_BALANCE = 0.00001; | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final selectedAccount = ref.watch( | ||
walletsProvider.select((value) => value.selectedAccount), | ||
); | ||
if (selectedAccount?.isDeployed == false) { | ||
final ethBalance = | ||
selectedAccount!.balances[TokenSymbol.ETH.name] ?? 0.00; | ||
final enoughBalance = ethBalance >= MINIMUN_ETH_BALANCE; | ||
return PrimaryButton( | ||
label: enoughBalance ? 'Deploy account' : 'Not enough ETH', | ||
onPressed: enoughBalance | ||
? () async { | ||
final secureStore = await ref | ||
.read(walletsProvider.notifier) | ||
.getSecureStoreForWallet(context: context); | ||
await ref.read(walletsProvider.notifier).deployAccount( | ||
secureStore: secureStore, | ||
account: selectedAccount, | ||
); | ||
} | ||
: null); | ||
} else { | ||
return const SizedBox.shrink(); | ||
} | ||
} | ||
} |
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.
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.
Remove hardcoded private key.
Good change to use dynamic chainId from WalletKit. However, there's a hardcoded private key (
0x1
) which should be removed from production code.The commented-out code suggests using PasswordStore - consider implementing this instead of the hardcoded value.