Skip to content
Merged
Show file tree
Hide file tree
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 Sep 29, 2025
2a1e3bc
chore: Update configuration scripts and dependencies to include 'base…
Blazebrain Sep 29, 2025
2b3f8cf
chore: Update pubspec.yaml, adjust SDK constraints, and add new depen…
Blazebrain Sep 29, 2025
474a1bd
feat: Add support for base wallet type and cryptocurrency in related …
Blazebrain Sep 29, 2025
70cbf27
feat: Implement BaseWallet and DefaultBaseTokens classes for managing…
Blazebrain Sep 29, 2025
f748878
feat: Add BaseTransactionHistory and BaseTransactionInfo classes for …
Blazebrain Sep 29, 2025
de5cc09
feat: Implement BaseClient, BaseWalletService, and BaseMnemonicIsInco…
Blazebrain Sep 30, 2025
fe429e5
feat: Setup base proxy for main package and adjust token class name
Blazebrain Sep 30, 2025
bdcf801
feat: Setup initial base node configuration
Blazebrain Sep 30, 2025
b52a5ad
feat: Integrate support for base wallet type across various functions…
Blazebrain Sep 30, 2025
3982db4
feat: Add base support to exchange and outputs
Blazebrain Sep 30, 2025
e37128a
feat: Add base wallet type integration to wallet creation and node ma…
Blazebrain Sep 30, 2025
78e4264
feat: Add base support to transaction details and transaction list item
Blazebrain Sep 30, 2025
62e8226
feat: Implement BaseURI class and add base support across wallet crea…
Blazebrain Sep 30, 2025
592c992
feat: Add support for BaseScan preference in settings store
Blazebrain Oct 1, 2025
f5e9e0b
feat: Integrate Base support into various workflows and documentation
Blazebrain Oct 1, 2025
5fe3dac
feat: Addingbase config to windows and secret key support
Blazebrain Oct 1, 2025
253770d
feat: Add base support to settings and address handling
Blazebrain Oct 1, 2025
cdf558c
chore: Move walletTypeToCurrency to another file and adjust across co…
Blazebrain Oct 1, 2025
37bbd29
feat: Add 'basescan_history' string localization
Blazebrain Oct 1, 2025
3239aaa
feat: Remove Cryptocurrency.base, it doesn't have a base currency
Blazebrain Oct 1, 2025
d865194
feat: Set eth as native currency
Blazebrain Oct 1, 2025
461731c
feat: Enhance Base support across various sending, exchange, transact…
Blazebrain Oct 1, 2025
4ef6a90
feat: Integrate Base wallet support in advanced privacy settings and …
Blazebrain Oct 1, 2025
237750d
feat: Add Base wallet support with icon and integration across provid…
Blazebrain Oct 1, 2025
1f63d3d
feat: Update currency handling to use baseEth for Base wallet integra…
Blazebrain Oct 1, 2025
5c9e609
fix: Update default token symbol to ETH in Base wallet transaction model
Blazebrain Oct 2, 2025
2bc4ff3
refactor: Change default currency references from BASE to ETH across …
Blazebrain Oct 2, 2025
0f78478
feat: Introduce normalizedIconPath for CryptoCurrency to standardize …
Blazebrain Oct 2, 2025
58e7bae
fix: Include baseEth as a native token in EVMChainClient for currency…
Blazebrain Oct 2, 2025
4c58d9d
chore: Update base_icon.png
Blazebrain Oct 2, 2025
3f53b59
feat: Add more nodes to base_node_list.yml
Blazebrain Oct 3, 2025
a0eb1e4
refactor: Update wallet icon retrieval to use normalizedIconPath
Blazebrain Oct 3, 2025
1808151
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
Blazebrain Oct 3, 2025
b5f0af3
chore: Remove unused cases and cleanup impl.
Blazebrain Oct 3, 2025
181deff
feat: Add base proxy generation to configure
Blazebrain Oct 3, 2025
23d45e2
refactor: Update base proxy and generation code in configure.dart
Blazebrain Oct 3, 2025
3399f1e
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
Blazebrain Oct 8, 2025
413f99d
feat: Add missing wallet and mono images
Blazebrain Oct 8, 2025
53a9cff
fix: Wrong image path for pr and add missing base qr image
Blazebrain Oct 8, 2025
abb8fd7
feat: Enhance EVMTransactionErrorFeesHandler to parse new insufficien…
Blazebrain Oct 8, 2025
0d7bbc4
feat: Add gas price safety buffer for Base chain transactions to impr…
Blazebrain Oct 8, 2025
cb52925
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
OmarHatem28 Oct 10, 2025
92fffb2
Update model_generator.sh [skip ci]
OmarHatem28 Oct 10, 2025
5f8b011
Update assets/base_node_list.yml [skip ci]
OmarHatem28 Oct 10, 2025
623b268
Update cw_base/lib/default_base_erc20_tokens.dart [skip ci]
OmarHatem28 Oct 10, 2025
4af4604
Review fixes
OmarHatem28 Oct 10, 2025
8a33f1d
fixes
OmarHatem28 Oct 11, 2025
4d4991e
Merge branch 'main' into CW-1182-Add-Base-Wallet
OmarHatem28 Oct 11, 2025
e4ef054
Merge branch 'main' into CW-1182-Add-Base-Wallet
OmarHatem28 Oct 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/automated_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ jobs:
echo "const litecoinTestWalletSeeds = '${{ secrets.LITECOIN_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const bitcoinCashTestWalletSeeds = '${{ secrets.BITCOIN_CASH_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const polygonTestWalletSeeds = '${{ secrets.POLYGON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const baseTestWalletSeeds = '${{ secrets.BASE_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const solanaTestWalletSeeds = '${{ secrets.SOLANA_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const solanaTestWalletSeeds2 = '${{ secrets.SOLANA_TEST_WALLET_SEEDS2 }}';" >> lib/.secrets.g.dart
echo "const tronTestWalletSeeds = '${{ secrets.TRON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
Expand All @@ -176,6 +177,7 @@ jobs:
echo "const litecoinTestWalletReceiveAddress = '${{ secrets.LITECOIN_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const bitcoinCashTestWalletReceiveAddress = '${{ secrets.BITCOIN_CASH_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const polygonTestWalletReceiveAddress = '${{ secrets.POLYGON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const baseTestWalletReceiveAddress = '${{ secrets.BASE_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const solanaTestWalletReceiveAddress = '${{ secrets.SOLANA_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const tronTestWalletReceiveAddress = '${{ secrets.TRON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const nanoTestWalletReceiveAddress = '${{ secrets.NANO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/no_restricted_imports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
"cw_mweb"
"cw_nano"
"cw_polygon"
"cw_base"
"cw_solana"
"cw_tron"
"cw_wownero"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr_test_build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ jobs:
echo "const litecoinTestWalletSeeds = '${{ secrets.LITECOIN_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const bitcoinCashTestWalletSeeds = '${{ secrets.BITCOIN_CASH_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const polygonTestWalletSeeds = '${{ secrets.POLYGON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const baseTestWalletSeeds = '${{ secrets.BASE_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const solanaTestWalletSeeds = '${{ secrets.SOLANA_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const tronTestWalletSeeds = '${{ secrets.TRON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const nanoTestWalletSeeds = '${{ secrets.NANO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
Expand All @@ -168,6 +169,7 @@ jobs:
echo "const litecoinTestWalletReceiveAddress = '${{ secrets.LITECOIN_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const bitcoinCashTestWalletReceiveAddress = '${{ secrets.BITCOIN_CASH_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const polygonTestWalletReceiveAddress = '${{ secrets.POLYGON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const baseTestWalletReceiveAddress = '${{ secrets.BASE_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const solanaTestWalletReceiveAddress = '${{ secrets.SOLANA_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const tronTestWalletReceiveAddress = '${{ secrets.TRON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const nanoTestWalletReceiveAddress = '${{ secrets.NANO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr_test_build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
echo "const litecoinTestWalletSeeds = '${{ secrets.LITECOIN_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const bitcoinCashTestWalletSeeds = '${{ secrets.BITCOIN_CASH_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const polygonTestWalletSeeds = '${{ secrets.POLYGON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const baseTestWalletSeeds = '${{ secrets.BASE_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const solanaTestWalletSeeds = '${{ secrets.SOLANA_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const tronTestWalletSeeds = '${{ secrets.TRON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
echo "const nanoTestWalletSeeds = '${{ secrets.NANO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
Expand All @@ -162,6 +163,7 @@ jobs:
echo "const litecoinTestWalletReceiveAddress = '${{ secrets.LITECOIN_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const bitcoinCashTestWalletReceiveAddress = '${{ secrets.BITCOIN_CASH_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const polygonTestWalletReceiveAddress = '${{ secrets.POLYGON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const baseTestWalletReceiveAddress = '${{ secrets.BASE_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const solanaTestWalletReceiveAddress = '${{ secrets.SOLANA_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const tronTestWalletReceiveAddress = '${{ secrets.TRON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
echo "const nanoTestWalletReceiveAddress = '${{ secrets.NANO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Cake Wallet includes support for several cryptocurrencies, including:
* Litecoin (LTC)
* Bitcoin Cash (BCH)
* Polygon (POL)
* Base (BASE)
* Solana (SOL)
* Tron (TRX)
* Nano (XNO)
Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ analyzer:
lib/tron/cw_tron.dart,
lib/wownero/cw_wownero.dart,
lib/zano/cw_zano.dart,
lib/base/cw_base.dart,
]
language:
strict-casts: true
Expand Down
3 changes: 3 additions & 0 deletions android/app/src/main/AndroidManifestBase.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
<data android:scheme="dogecoin" />
<data android:scheme="dogecoin-wallet" />
<data android:scheme="dogecoin_wallet" />
<data android:scheme="base" />
<data android:scheme="base-wallet" />
<data android:scheme="base_wallet" />
</intent-filter>
<!-- nano-gpt link scheme -->
<intent-filter android:autoVerify="true">
Expand Down
15 changes: 15 additions & 0 deletions assets/base_node_list.yml
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
5 changes: 5 additions & 0 deletions assets/images/base_chain_QR.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/images/base_chain_mono.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/base_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions cakewallet.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
set cw_win_app_config=--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --dogecoin
set cw_win_app_config=--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --dogecoin --base
set cw_root=%cd%
set cw_archive_name=Cake Wallet.zip
set cw_archive_path=%cw_root%\%cw_archive_name%
Expand All @@ -24,7 +24,7 @@ IF NOT EXIST "%secrets_file_path%" (
) ELSE (echo === Using previously/already generated secrets file: %secrets_file_path% ===)

echo === Generating mobx models ===
for /d %%i in (cw_core cw_monero cw_bitcoin cw_ethereum cw_evm cw_polygon cw_nano cw_bitcoin_cash cw_solana cw_tron .) do (
for /d %%i in (cw_core cw_monero cw_bitcoin cw_ethereum cw_evm cw_polygon cw_nano cw_bitcoin_cash cw_solana cw_tron cw_base.) do (
cd %%i
call flutter pub get > nul
call dart run build_runner build --delete-conflicting-outputs > nul
Expand Down
31 changes: 31 additions & 0 deletions cw_base/.gitignore
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/
10 changes: 10 additions & 0 deletions cw_base/.metadata
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
3 changes: 3 additions & 0 deletions cw_base/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions cw_base/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
39 changes: 39 additions & 0 deletions cw_base/README.md
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.
4 changes: 4 additions & 0 deletions cw_base/analysis_options.yaml
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
103 changes: 103 additions & 0 deletions cw_base/lib/base_client.dart
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 [];
}
}
}
5 changes: 5 additions & 0 deletions cw_base/lib/base_mnemonics_exception.dart
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.';
}
20 changes: 20 additions & 0 deletions cw_base/lib/base_transaction_history.dart
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);
}
41 changes: 41 additions & 0 deletions cw_base/lib/base_transaction_info.dart
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';
}
Loading
Loading