-
Notifications
You must be signed in to change notification settings - Fork 273
Add Base Wallet #2558
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
Merged
Merged
Add Base Wallet #2558
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
3ead923
chore: Create Base package template
Blazebrain 2a1e3bc
chore: Update configuration scripts and dependencies to include 'base…
Blazebrain 2b3f8cf
chore: Update pubspec.yaml, adjust SDK constraints, and add new depen…
Blazebrain 474a1bd
feat: Add support for base wallet type and cryptocurrency in related …
Blazebrain 70cbf27
feat: Implement BaseWallet and DefaultBaseTokens classes for managing…
Blazebrain f748878
feat: Add BaseTransactionHistory and BaseTransactionInfo classes for …
Blazebrain de5cc09
feat: Implement BaseClient, BaseWalletService, and BaseMnemonicIsInco…
Blazebrain fe429e5
feat: Setup base proxy for main package and adjust token class name
Blazebrain bdcf801
feat: Setup initial base node configuration
Blazebrain b52a5ad
feat: Integrate support for base wallet type across various functions…
Blazebrain 3982db4
feat: Add base support to exchange and outputs
Blazebrain e37128a
feat: Add base wallet type integration to wallet creation and node ma…
Blazebrain 78e4264
feat: Add base support to transaction details and transaction list item
Blazebrain 62e8226
feat: Implement BaseURI class and add base support across wallet crea…
Blazebrain 592c992
feat: Add support for BaseScan preference in settings store
Blazebrain f5e9e0b
feat: Integrate Base support into various workflows and documentation
Blazebrain 5fe3dac
feat: Addingbase config to windows and secret key support
Blazebrain 253770d
feat: Add base support to settings and address handling
Blazebrain cdf558c
chore: Move walletTypeToCurrency to another file and adjust across co…
Blazebrain 37bbd29
feat: Add 'basescan_history' string localization
Blazebrain 3239aaa
feat: Remove Cryptocurrency.base, it doesn't have a base currency
Blazebrain d865194
feat: Set eth as native currency
Blazebrain 461731c
feat: Enhance Base support across various sending, exchange, transact…
Blazebrain 4ef6a90
feat: Integrate Base wallet support in advanced privacy settings and …
Blazebrain 237750d
feat: Add Base wallet support with icon and integration across provid…
Blazebrain 1f63d3d
feat: Update currency handling to use baseEth for Base wallet integra…
Blazebrain 5c9e609
fix: Update default token symbol to ETH in Base wallet transaction model
Blazebrain 2bc4ff3
refactor: Change default currency references from BASE to ETH across …
Blazebrain 0f78478
feat: Introduce normalizedIconPath for CryptoCurrency to standardize …
Blazebrain 58e7bae
fix: Include baseEth as a native token in EVMChainClient for currency…
Blazebrain 4c58d9d
chore: Update base_icon.png
Blazebrain 3f53b59
feat: Add more nodes to base_node_list.yml
Blazebrain a0eb1e4
refactor: Update wallet icon retrieval to use normalizedIconPath
Blazebrain 1808151
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
Blazebrain b5f0af3
chore: Remove unused cases and cleanup impl.
Blazebrain 181deff
feat: Add base proxy generation to configure
Blazebrain 23d45e2
refactor: Update base proxy and generation code in configure.dart
Blazebrain 3399f1e
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
Blazebrain 413f99d
feat: Add missing wallet and mono images
Blazebrain 53a9cff
fix: Wrong image path for pr and add missing base qr image
Blazebrain abb8fd7
feat: Enhance EVMTransactionErrorFeesHandler to parse new insufficien…
Blazebrain 0d7bbc4
feat: Add gas price safety buffer for Base chain transactions to impr…
Blazebrain cb52925
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
OmarHatem28 92fffb2
Update model_generator.sh [skip ci]
OmarHatem28 5f8b011
Update assets/base_node_list.yml [skip ci]
OmarHatem28 623b268
Update cw_base/lib/default_base_erc20_tokens.dart [skip ci]
OmarHatem28 4af4604
Review fixes
OmarHatem28 8a33f1d
fixes
OmarHatem28 4d4991e
Merge branch 'main' into CW-1182-Add-Base-Wallet
OmarHatem28 e4ef054
Merge branch 'main' into CW-1182-Add-Base-Wallet
OmarHatem28 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ jobs: | |
| "cw_mweb" | ||
| "cw_nano" | ||
| "cw_polygon" | ||
| "cw_base" | ||
| "cw_solana" | ||
| "cw_tron" | ||
| "cw_wownero" | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -141,6 +141,7 @@ lib/wownero/wownero.dart | |
| lib/zano/zano.dart | ||
| lib/decred/decred.dart | ||
| lib/dogecoin/dogecoin.dart | ||
| lib/base/base.dart | ||
|
|
||
| ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] | ||
| ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
| - | ||
| uri: base.nownodes.io | ||
| is_default: true | ||
| useSSL: true | ||
| isEnabledForAutoSwitching: true | ||
| - | ||
| uri: base.llamarpc.com | ||
| useSSL: true | ||
| - | ||
| uri: base-rpc.publicnode.com | ||
| useSSL: true | ||
| isEnabledForAutoSwitching: true | ||
| - | ||
| uri: 1rpc.io/base | ||
| useSSL: true | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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,31 @@ | ||
| # Miscellaneous | ||
| *.class | ||
| *.log | ||
| *.pyc | ||
| *.swp | ||
| .DS_Store | ||
| .atom/ | ||
| .buildlog/ | ||
| .history | ||
| .svn/ | ||
| migrate_working_dir/ | ||
|
|
||
| # IntelliJ related | ||
| *.iml | ||
| *.ipr | ||
| *.iws | ||
| .idea/ | ||
|
|
||
| # The .vscode folder contains launch configuration and tasks you configure in | ||
| # VS Code which you may wish to be included in version control, so this line | ||
| # is commented out by default. | ||
| #.vscode/ | ||
|
|
||
| # Flutter/Dart/Pub related | ||
| # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
| /pubspec.lock | ||
| **/doc/api/ | ||
| .dart_tool/ | ||
| .flutter-plugins | ||
| .flutter-plugins-dependencies | ||
| build/ |
This file contains hidden or 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,10 @@ | ||
| # This file tracks properties of this Flutter project. | ||
| # Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
| # | ||
| # This file should be version controlled and should not be manually edited. | ||
|
|
||
| version: | ||
| revision: "fcf2c11572af6f390246c056bc905eca609533a0" | ||
| channel: "[user-branch]" | ||
|
|
||
| project_type: package |
This file contains hidden or 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,3 @@ | ||
| ## 0.0.1 | ||
|
|
||
| * TODO: Describe initial release. |
This file contains hidden or 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 @@ | ||
| TODO: Add your license here. |
This file contains hidden or 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 @@ | ||
| <!-- | ||
| This README describes the package. If you publish this package to pub.dev, | ||
| this README's contents appear on the landing page for your package. | ||
|
|
||
| For information about how to write a good package README, see the guide for | ||
| [writing package pages](https://dart.dev/tools/pub/writing-package-pages). | ||
|
|
||
| For general information about developing packages, see the Dart guide for | ||
| [creating packages](https://dart.dev/guides/libraries/create-packages) | ||
| and the Flutter guide for | ||
| [developing packages and plugins](https://flutter.dev/to/develop-packages). | ||
| --> | ||
|
|
||
| TODO: Put a short description of the package here that helps potential users | ||
| know whether this package might be useful for them. | ||
|
|
||
| ## Features | ||
|
|
||
| TODO: List what your package can do. Maybe include images, gifs, or videos. | ||
|
|
||
| ## Getting started | ||
|
|
||
| TODO: List prerequisites and provide or point to information on how to | ||
| start using the package. | ||
|
|
||
| ## Usage | ||
|
|
||
| TODO: Include short and useful examples for package users. Add longer examples | ||
| to `/example` folder. | ||
|
|
||
| ```dart | ||
| const like = 'sample'; | ||
| ``` | ||
|
|
||
| ## Additional information | ||
|
|
||
| TODO: Tell users more about the package: where to find more information, how to | ||
| contribute to the package, how to file issues, what response they can expect | ||
| from the package authors, and more. |
This file contains hidden or 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,4 @@ | ||
| include: package:flutter_lints/flutter.yaml | ||
|
|
||
| # Additional information about this file can be found at | ||
| # https://dart.dev/guides/language/analysis-options |
This file contains hidden or 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,103 @@ | ||
| import 'dart:convert'; | ||
|
|
||
| import 'package:cw_evm/evm_chain_client.dart'; | ||
| import 'package:cw_evm/.secrets.g.dart' as secrets; | ||
| import 'package:cw_evm/evm_chain_transaction_model.dart'; | ||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:web3dart/web3dart.dart'; | ||
|
|
||
| class BaseClient extends EVMChainClient { | ||
| @override | ||
| Transaction createTransaction({ | ||
| required EthereumAddress from, | ||
| required EthereumAddress to, | ||
| required EtherAmount amount, | ||
| EtherAmount? maxPriorityFeePerGas, | ||
| Uint8List? data, | ||
| int? maxGas, | ||
| EtherAmount? gasPrice, | ||
| EtherAmount? maxFeePerGas, | ||
| }) { | ||
| EtherAmount? finalGasPrice = gasPrice; | ||
|
|
||
| if (gasPrice == null && maxFeePerGas != null) { | ||
| // If we have EIP-1559 parameters but no legacy gasPrice, then use maxFeePerGas as gasPrice | ||
| finalGasPrice = maxFeePerGas; | ||
| } | ||
|
|
||
| return Transaction( | ||
| from: from, | ||
| to: to, | ||
| value: amount, | ||
| data: data, | ||
| maxGas: maxGas, | ||
| gasPrice: finalGasPrice, | ||
| // maxFeePerGas: maxFeePerGas, | ||
| // maxPriorityFeePerGas: maxPriorityFeePerGas, | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Uint8List prepareSignedTransactionForSending(Uint8List signedTransaction) => signedTransaction; | ||
|
|
||
| @override | ||
| int get chainId => 8453; | ||
|
|
||
| @override | ||
| Future<List<EVMChainTransactionModel>> fetchTransactions(String address, | ||
| {String? contractAddress}) async { | ||
| try { | ||
| final response = await client.get(Uri.https("api.etherscan.io", "/v2/api", { | ||
| "chainid": "$chainId", | ||
| "module": "account", | ||
| "action": contractAddress != null ? "tokentx" : "txlist", | ||
| if (contractAddress != null) "contractaddress": contractAddress, | ||
| "address": address, | ||
| "apikey": secrets.etherScanApiKey, | ||
| })); | ||
|
|
||
| final jsonResponse = json.decode(response.body) as Map<String, dynamic>; | ||
|
|
||
| if (response.statusCode >= 200 && response.statusCode < 300 && jsonResponse['status'] != 0) { | ||
| final res = (jsonResponse['result'] as List); | ||
|
|
||
| res.removeWhere((e) => e['value'] == '0'); | ||
|
|
||
| return res | ||
| .map( | ||
| (e) => EVMChainTransactionModel.fromJson(e as Map<String, dynamic>, 'ETH'), | ||
| ) | ||
| .toList(); | ||
| } | ||
|
|
||
| return []; | ||
| } catch (e) { | ||
| return []; | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| Future<List<EVMChainTransactionModel>> fetchInternalTransactions(String address) async { | ||
| try { | ||
| final response = await client.get(Uri.https("api.etherscan.io", "/v2/api", { | ||
| "chainid": "$chainId", | ||
| "module": "account", | ||
| "action": "txlistinternal", | ||
| "address": address, | ||
| "apikey": secrets.etherScanApiKey, | ||
| })); | ||
|
|
||
| final jsonResponse = json.decode(response.body) as Map<String, dynamic>; | ||
|
|
||
| if (response.statusCode >= 200 && response.statusCode < 300 && jsonResponse['status'] != 0) { | ||
| return (jsonResponse['result'] as List) | ||
| .map((e) => EVMChainTransactionModel.fromJson(e as Map<String, dynamic>, 'ETH')) | ||
| .toList(); | ||
| } | ||
|
|
||
| return []; | ||
| } catch (_) { | ||
| return []; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,5 @@ | ||
| class BaseMnemonicIsIncorrectException implements Exception { | ||
| @override | ||
| String toString() => | ||
| 'Base mnemonic has incorrect format. Mnemonic should contain 12 or 24 words separated by space.'; | ||
| } |
This file contains hidden or 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,20 @@ | ||
| import 'dart:core'; | ||
|
|
||
| import 'package:cw_evm/evm_chain_transaction_history.dart'; | ||
| import 'package:cw_evm/evm_chain_transaction_info.dart'; | ||
| import 'package:cw_base/base_transaction_info.dart'; | ||
|
|
||
| class BaseTransactionHistory extends EVMChainTransactionHistory { | ||
| BaseTransactionHistory({ | ||
| required super.walletInfo, | ||
| required super.password, | ||
| required super.encryptionFileUtils, | ||
| }); | ||
|
|
||
| @override | ||
| String getTransactionHistoryFileName() => 'base_transactions.json'; | ||
|
|
||
| @override | ||
| EVMChainTransactionInfo getTransactionInfo(Map<String, dynamic> val) => | ||
| BaseTransactionInfo.fromJson(val); | ||
| } |
This file contains hidden or 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,41 @@ | ||
| import 'package:cw_core/transaction_direction.dart'; | ||
| import 'package:cw_evm/evm_chain_transaction_info.dart'; | ||
|
|
||
| class BaseTransactionInfo extends EVMChainTransactionInfo { | ||
| BaseTransactionInfo({ | ||
| required super.id, | ||
| required super.height, | ||
| required super.ethAmount, | ||
| required super.ethFee, | ||
| required super.tokenSymbol, | ||
| required super.direction, | ||
| required super.isPending, | ||
| required super.date, | ||
| required super.confirmations, | ||
| required super.to, | ||
| required super.from, | ||
| super.contractAddress, | ||
| super.exponent, | ||
| }); | ||
|
|
||
| factory BaseTransactionInfo.fromJson(Map<String, dynamic> data) { | ||
| return BaseTransactionInfo( | ||
| id: data['id'] as String, | ||
| height: data['height'] as int, | ||
| ethAmount: BigInt.parse(data['amount']), | ||
| exponent: data['exponent'] as int, | ||
| ethFee: BigInt.parse(data['fee']), | ||
| direction: parseTransactionDirectionFromInt(data['direction'] as int), | ||
| date: DateTime.fromMillisecondsSinceEpoch(data['date'] as int), | ||
| isPending: data['isPending'] as bool, | ||
| confirmations: data['confirmations'] as int, | ||
| tokenSymbol: data['tokenSymbol'] as String, | ||
| to: data['to'], | ||
| from: data['from'], | ||
| contractAddress: data['contractAddress'], | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| String get feeCurrency => 'ETH'; | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.