2021-12-24 12:52:08 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
const bitcoinOutputPath = 'lib/bitcoin/bitcoin.dart';
|
|
|
|
const moneroOutputPath = 'lib/monero/monero.dart';
|
2022-03-30 15:57:04 +00:00
|
|
|
const havenOutputPath = 'lib/haven/haven.dart';
|
2023-08-04 17:01:49 +00:00
|
|
|
const ethereumOutputPath = 'lib/ethereum/ethereum.dart';
|
2023-10-12 22:50:16 +00:00
|
|
|
const bitcoinCashOutputPath = 'lib/bitcoin_cash/bitcoin_cash.dart';
|
2023-10-05 01:09:07 +00:00
|
|
|
const nanoOutputPath = 'lib/nano/nano.dart';
|
2023-12-02 02:26:43 +00:00
|
|
|
const polygonOutputPath = 'lib/polygon/polygon.dart';
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
const solanaOutputPath = 'lib/solana/solana.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
const walletTypesPath = 'lib/wallet_types.g.dart';
|
|
|
|
const pubspecDefaultPath = 'pubspec_default.yaml';
|
|
|
|
const pubspecOutputPath = 'pubspec.yaml';
|
|
|
|
|
|
|
|
Future<void> main(List<String> args) async {
|
|
|
|
const prefix = '--';
|
|
|
|
final hasBitcoin = args.contains('${prefix}bitcoin');
|
|
|
|
final hasMonero = args.contains('${prefix}monero');
|
2022-03-30 15:57:04 +00:00
|
|
|
final hasHaven = args.contains('${prefix}haven');
|
2023-08-04 17:01:49 +00:00
|
|
|
final hasEthereum = args.contains('${prefix}ethereum');
|
2023-10-12 22:50:16 +00:00
|
|
|
final hasBitcoinCash = args.contains('${prefix}bitcoinCash');
|
2023-10-05 01:09:07 +00:00
|
|
|
final hasNano = args.contains('${prefix}nano');
|
|
|
|
final hasBanano = args.contains('${prefix}banano');
|
2023-12-02 02:26:43 +00:00
|
|
|
final hasPolygon = args.contains('${prefix}polygon');
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
final hasSolana = args.contains('${prefix}solana');
|
2023-10-05 01:09:07 +00:00
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
await generateBitcoin(hasBitcoin);
|
|
|
|
await generateMonero(hasMonero);
|
2022-04-07 10:51:06 +00:00
|
|
|
await generateHaven(hasHaven);
|
2023-08-04 17:01:49 +00:00
|
|
|
await generateEthereum(hasEthereum);
|
2023-10-12 22:50:16 +00:00
|
|
|
await generateBitcoinCash(hasBitcoinCash);
|
2023-10-05 01:09:07 +00:00
|
|
|
await generateNano(hasNano);
|
2023-12-02 02:26:43 +00:00
|
|
|
await generatePolygon(hasPolygon);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
await generateSolana(hasSolana);
|
2023-10-05 01:09:07 +00:00
|
|
|
// await generateBanano(hasEthereum);
|
|
|
|
|
2023-09-21 14:16:27 +00:00
|
|
|
await generatePubspec(
|
2023-10-05 01:09:07 +00:00
|
|
|
hasMonero: hasMonero,
|
|
|
|
hasBitcoin: hasBitcoin,
|
|
|
|
hasHaven: hasHaven,
|
|
|
|
hasEthereum: hasEthereum,
|
|
|
|
hasNano: hasNano,
|
|
|
|
hasBanano: hasBanano,
|
2023-10-12 22:50:16 +00:00
|
|
|
hasBitcoinCash: hasBitcoinCash,
|
2023-12-02 02:26:43 +00:00
|
|
|
hasPolygon: hasPolygon,
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
hasSolana: hasSolana,
|
2023-10-05 01:09:07 +00:00
|
|
|
);
|
2023-09-21 14:16:27 +00:00
|
|
|
await generateWalletTypes(
|
2023-10-05 01:09:07 +00:00
|
|
|
hasMonero: hasMonero,
|
|
|
|
hasBitcoin: hasBitcoin,
|
|
|
|
hasHaven: hasHaven,
|
|
|
|
hasEthereum: hasEthereum,
|
|
|
|
hasNano: hasNano,
|
|
|
|
hasBanano: hasBanano,
|
2023-10-12 22:50:16 +00:00
|
|
|
hasBitcoinCash: hasBitcoinCash,
|
2023-12-02 02:26:43 +00:00
|
|
|
hasPolygon: hasPolygon,
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
hasSolana: hasSolana,
|
2023-10-05 01:09:07 +00:00
|
|
|
);
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> generateBitcoin(bool hasImplementation) async {
|
|
|
|
final outputFile = File(bitcoinOutputPath);
|
|
|
|
const bitcoinCommonHeaders = """
|
2024-03-04 17:32:10 +00:00
|
|
|
import 'package:cw_core/receive_page_option.dart';
|
2023-10-16 13:44:20 +00:00
|
|
|
import 'package:cw_core/unspent_transaction_output.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cw_core/unspent_coins_info.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
2024-01-23 05:15:24 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2024-03-04 17:32:10 +00:00
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:bitcoin_base/bitcoin_base.dart';""";
|
2021-12-24 12:52:08 +00:00
|
|
|
const bitcoinCWHeaders = """
|
Btc address types (#1263)
* inital migration changes
* feat: rest of changes
* minor fix [skip ci]
* fix: P2wshAddress & wallet address index
* fix: address review comments
* fix: address type restore
* feat: add testnet
* Fix review comments
Remove bitcoin_base from cw_core
* Fix address not matching selected type on start
* remove un-necessary parameter [skip ci]
* Remove bitcoin specific code from main lib
Fix possible runtime exception from list wrong access
* Minor fix
* fix: fixes for Testnet
* fix: bitcoin receive option dependency breaks monerocom
* Fix issues when building Monero.com
* feat: Transaction Builder changes
* fix: discover addresses, testnet restoring, duplicate unspent coins, and taproot address vs schnorr sig tweak
* fix: remove print
* feat: improve error when failed broadcast response
* feat: create fish shell env script
* fix: unmodifiable maps
* fix: build
* fix: build
* fix: computed observable side effect bug
* feat: add nix script for android build_all
* fix: wrong keypairs used for signing
* fix: wrong addresses when using fromScriptPubKey scripts
* fix(actual commit): testnet tx expanded + wrong addresses when using fromScriptPubKey scripts (update bitcoin_base deps)
* fix: self-send [skip ci]
* fix: p2wsh
* fix: testnet fees
* New versions
* Update macos build number
Minor UI fix
* fix: use new bitcoin_base ref, fix tx list wrong hex value & refactor hidden vs hd use
- if always use sideHd for isHidden, it is easier to simplify the functions instead of passing both which can be error prone
- (ps: now this could probably be changed, for example from isHidden to isChange since with address list we now see "hidden" addresses)
* Fix if condition to handle litecoin case
* fix: self-send, change address was always making direction incoming
* refactor: improve estimation function, add more inputs if balance missing
* fix: new bitcoin_base update, fixes script issues
* Update evm chain wallet service arguments
* Fix translation [skip ci]
* Fix translation [skip ci]
* Update strings_fr.arb [skip ci]
* fix: async isChange function not being awaited, refactor to reduce looping into a single place
* fix: _address vs address, missing p2sh
* fix: minor mistake in storing p2sh page type [skip ci]
* refactor: use already matched addresses property
* feat: improved perfomance for fetching transaction histories
* feat: continue perfomance change, improve address discovery only to last address by type with history
* fix: make sure transaction list is sorted by date
* refactor: isTestnet only for bitcoin
* fix: walletInfo type null case
* fix: deprecated p2pk
* refactor: make condition more readable
* refactor: remove unnecessary Str variant
* refactor: make condition more readable
* fix: infinite loop possible
* Revert removing isTestnet from other wallets [skip ci]
* refactor: rename addresses when matched by receive type
* Make the beta build [skip ci]
Remove app_env.fish
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-02-23 16:13:30 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_receive_page_option.dart';
|
2022-01-12 13:38:53 +00:00
|
|
|
import 'package:cw_bitcoin/electrum_wallet.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_unspent.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_mnemonic.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_wallet_service.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_wallet_creation_credentials.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_amount_format.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
|
|
|
|
import 'package:cw_bitcoin/litecoin_wallet_service.dart';
|
2024-01-23 05:15:24 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
""";
|
|
|
|
const bitcoinCwPart = "part 'cw_bitcoin.dart';";
|
|
|
|
const bitcoinContent = """
|
2024-01-23 05:15:24 +00:00
|
|
|
|
|
|
|
class ElectrumSubAddress {
|
|
|
|
ElectrumSubAddress({
|
|
|
|
required this.id,
|
|
|
|
required this.name,
|
|
|
|
required this.address,
|
|
|
|
required this.txCount,
|
|
|
|
required this.balance,
|
|
|
|
required this.isChange});
|
|
|
|
final int id;
|
|
|
|
final String name;
|
|
|
|
final String address;
|
|
|
|
final int txCount;
|
|
|
|
final int balance;
|
|
|
|
final bool isChange;
|
|
|
|
}
|
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
abstract class Bitcoin {
|
|
|
|
TransactionPriority getMediumTransactionPriority();
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
WalletCredentials createBitcoinRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password});
|
|
|
|
WalletCredentials createBitcoinRestoreWalletFromWIFCredentials({required String name, required String password, required String wif, WalletInfo? walletInfo});
|
|
|
|
WalletCredentials createBitcoinNewWalletCredentials({required String name, WalletInfo? walletInfo});
|
2021-12-24 12:52:08 +00:00
|
|
|
List<String> getWordList();
|
|
|
|
Map<String, String> getWalletKeys(Object wallet);
|
|
|
|
List<TransactionPriority> getTransactionPriorities();
|
2022-01-12 16:13:16 +00:00
|
|
|
List<TransactionPriority> getLitecoinTransactionPriorities();
|
2023-10-12 22:50:16 +00:00
|
|
|
TransactionPriority deserializeBitcoinTransactionPriority(int raw);
|
|
|
|
TransactionPriority deserializeLitecoinTransactionPriority(int raw);
|
2021-12-24 12:52:08 +00:00
|
|
|
int getFeeRate(Object wallet, TransactionPriority priority);
|
2024-01-23 05:15:24 +00:00
|
|
|
Future<void> generateNewAddress(Object wallet, String label);
|
|
|
|
Future<void> updateAddress(Object wallet,String address, String label);
|
2022-10-12 17:09:57 +00:00
|
|
|
Object createBitcoinTransactionCredentials(List<Output> outputs, {required TransactionPriority priority, int? feeRate});
|
|
|
|
Object createBitcoinTransactionCredentialsRaw(List<OutputInfo> outputs, {TransactionPriority? priority, required int feeRate});
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
List<String> getAddresses(Object wallet);
|
|
|
|
String getAddress(Object wallet);
|
2024-02-27 14:40:56 +00:00
|
|
|
List<BitcoinSilentPaymentAddressRecord> getSilentAddresses(Object wallet);
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2024-01-23 05:15:24 +00:00
|
|
|
List<ElectrumSubAddress> getSubAddresses(Object wallet);
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
String formatterBitcoinAmountToString({required int amount});
|
|
|
|
double formatterBitcoinAmountToDouble({required int amount});
|
2021-12-24 12:52:08 +00:00
|
|
|
int formatterStringDoubleToBitcoinAmount(String amount);
|
2022-10-28 22:09:27 +00:00
|
|
|
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate);
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2023-10-16 13:44:20 +00:00
|
|
|
List<Unspent> getUnspents(Object wallet);
|
2024-01-30 17:57:47 +00:00
|
|
|
Future<void> updateUnspents(Object wallet);
|
2021-12-24 12:52:08 +00:00
|
|
|
WalletService createBitcoinWalletService(Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
|
|
|
|
WalletService createLitecoinWalletService(Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
|
2022-11-03 23:13:13 +00:00
|
|
|
TransactionPriority getBitcoinTransactionPriorityMedium();
|
|
|
|
TransactionPriority getLitecoinTransactionPriorityMedium();
|
|
|
|
TransactionPriority getBitcoinTransactionPrioritySlow();
|
|
|
|
TransactionPriority getLitecoinTransactionPrioritySlow();
|
Btc address types (#1263)
* inital migration changes
* feat: rest of changes
* minor fix [skip ci]
* fix: P2wshAddress & wallet address index
* fix: address review comments
* fix: address type restore
* feat: add testnet
* Fix review comments
Remove bitcoin_base from cw_core
* Fix address not matching selected type on start
* remove un-necessary parameter [skip ci]
* Remove bitcoin specific code from main lib
Fix possible runtime exception from list wrong access
* Minor fix
* fix: fixes for Testnet
* fix: bitcoin receive option dependency breaks monerocom
* Fix issues when building Monero.com
* feat: Transaction Builder changes
* fix: discover addresses, testnet restoring, duplicate unspent coins, and taproot address vs schnorr sig tweak
* fix: remove print
* feat: improve error when failed broadcast response
* feat: create fish shell env script
* fix: unmodifiable maps
* fix: build
* fix: build
* fix: computed observable side effect bug
* feat: add nix script for android build_all
* fix: wrong keypairs used for signing
* fix: wrong addresses when using fromScriptPubKey scripts
* fix(actual commit): testnet tx expanded + wrong addresses when using fromScriptPubKey scripts (update bitcoin_base deps)
* fix: self-send [skip ci]
* fix: p2wsh
* fix: testnet fees
* New versions
* Update macos build number
Minor UI fix
* fix: use new bitcoin_base ref, fix tx list wrong hex value & refactor hidden vs hd use
- if always use sideHd for isHidden, it is easier to simplify the functions instead of passing both which can be error prone
- (ps: now this could probably be changed, for example from isHidden to isChange since with address list we now see "hidden" addresses)
* Fix if condition to handle litecoin case
* fix: self-send, change address was always making direction incoming
* refactor: improve estimation function, add more inputs if balance missing
* fix: new bitcoin_base update, fixes script issues
* Update evm chain wallet service arguments
* Fix translation [skip ci]
* Fix translation [skip ci]
* Update strings_fr.arb [skip ci]
* fix: async isChange function not being awaited, refactor to reduce looping into a single place
* fix: _address vs address, missing p2sh
* fix: minor mistake in storing p2sh page type [skip ci]
* refactor: use already matched addresses property
* feat: improved perfomance for fetching transaction histories
* feat: continue perfomance change, improve address discovery only to last address by type with history
* fix: make sure transaction list is sorted by date
* refactor: isTestnet only for bitcoin
* fix: walletInfo type null case
* fix: deprecated p2pk
* refactor: make condition more readable
* refactor: remove unnecessary Str variant
* refactor: make condition more readable
* fix: infinite loop possible
* Revert removing isTestnet from other wallets [skip ci]
* refactor: rename addresses when matched by receive type
* Make the beta build [skip ci]
Remove app_env.fish
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-02-23 16:13:30 +00:00
|
|
|
|
|
|
|
Future<void> setAddressType(Object wallet, dynamic option);
|
|
|
|
BitcoinReceivePageOption getSelectedAddressType(Object wallet);
|
2024-03-04 17:32:10 +00:00
|
|
|
BitcoinAddressType getBitcoinAddressType(ReceivePageOption option);
|
2024-02-26 18:33:31 +00:00
|
|
|
bool hasSelectedSilentPayments(Object wallet);
|
Btc address types (#1263)
* inital migration changes
* feat: rest of changes
* minor fix [skip ci]
* fix: P2wshAddress & wallet address index
* fix: address review comments
* fix: address type restore
* feat: add testnet
* Fix review comments
Remove bitcoin_base from cw_core
* Fix address not matching selected type on start
* remove un-necessary parameter [skip ci]
* Remove bitcoin specific code from main lib
Fix possible runtime exception from list wrong access
* Minor fix
* fix: fixes for Testnet
* fix: bitcoin receive option dependency breaks monerocom
* Fix issues when building Monero.com
* feat: Transaction Builder changes
* fix: discover addresses, testnet restoring, duplicate unspent coins, and taproot address vs schnorr sig tweak
* fix: remove print
* feat: improve error when failed broadcast response
* feat: create fish shell env script
* fix: unmodifiable maps
* fix: build
* fix: build
* fix: computed observable side effect bug
* feat: add nix script for android build_all
* fix: wrong keypairs used for signing
* fix: wrong addresses when using fromScriptPubKey scripts
* fix(actual commit): testnet tx expanded + wrong addresses when using fromScriptPubKey scripts (update bitcoin_base deps)
* fix: self-send [skip ci]
* fix: p2wsh
* fix: testnet fees
* New versions
* Update macos build number
Minor UI fix
* fix: use new bitcoin_base ref, fix tx list wrong hex value & refactor hidden vs hd use
- if always use sideHd for isHidden, it is easier to simplify the functions instead of passing both which can be error prone
- (ps: now this could probably be changed, for example from isHidden to isChange since with address list we now see "hidden" addresses)
* Fix if condition to handle litecoin case
* fix: self-send, change address was always making direction incoming
* refactor: improve estimation function, add more inputs if balance missing
* fix: new bitcoin_base update, fixes script issues
* Update evm chain wallet service arguments
* Fix translation [skip ci]
* Fix translation [skip ci]
* Update strings_fr.arb [skip ci]
* fix: async isChange function not being awaited, refactor to reduce looping into a single place
* fix: _address vs address, missing p2sh
* fix: minor mistake in storing p2sh page type [skip ci]
* refactor: use already matched addresses property
* feat: improved perfomance for fetching transaction histories
* feat: continue perfomance change, improve address discovery only to last address by type with history
* fix: make sure transaction list is sorted by date
* refactor: isTestnet only for bitcoin
* fix: walletInfo type null case
* fix: deprecated p2pk
* refactor: make condition more readable
* refactor: remove unnecessary Str variant
* refactor: make condition more readable
* fix: infinite loop possible
* Revert removing isTestnet from other wallets [skip ci]
* refactor: rename addresses when matched by receive type
* Make the beta build [skip ci]
Remove app_env.fish
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-02-23 16:13:30 +00:00
|
|
|
List<BitcoinReceivePageOption> getBitcoinReceivePageOptions();
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
const bitcoinEmptyDefinition = 'Bitcoin? bitcoin;\n';
|
|
|
|
const bitcoinCWDefinition = 'Bitcoin? bitcoin = CWBitcoin();\n';
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2023-09-21 14:16:27 +00:00
|
|
|
final output = '$bitcoinCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$bitcoinCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$bitcoinCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? bitcoinCWDefinition : bitcoinEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
bitcoinContent;
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> generateMonero(bool hasImplementation) async {
|
|
|
|
final outputFile = File(moneroOutputPath);
|
|
|
|
const moneroCommonHeaders = """
|
2023-10-12 22:50:16 +00:00
|
|
|
import 'package:cw_core/unspent_transaction_output.dart';
|
2023-08-24 13:54:05 +00:00
|
|
|
import 'package:cw_core/unspent_coins_info.dart';
|
|
|
|
import 'package:cw_monero/monero_unspent.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
|
|
|
import 'package:cw_core/transaction_history.dart';
|
|
|
|
import 'package:cw_core/transaction_info.dart';
|
|
|
|
import 'package:cw_core/balance.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
2023-11-25 00:37:12 +00:00
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:polyseed/polyseed.dart';""";
|
2021-12-24 12:52:08 +00:00
|
|
|
const moneroCWHeaders = """
|
2022-03-30 15:57:04 +00:00
|
|
|
import 'package:cw_core/get_height_by_date.dart';
|
|
|
|
import 'package:cw_core/monero_amount_format.dart';
|
|
|
|
import 'package:cw_core/monero_transaction_priority.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_monero/monero_wallet_service.dart';
|
|
|
|
import 'package:cw_monero/monero_wallet.dart';
|
|
|
|
import 'package:cw_monero/monero_transaction_info.dart';
|
|
|
|
import 'package:cw_monero/monero_transaction_creation_credentials.dart';
|
2022-03-30 15:57:04 +00:00
|
|
|
import 'package:cw_core/account.dart' as monero_account;
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_monero/api/wallet.dart' as monero_wallet_api;
|
|
|
|
import 'package:cw_monero/mnemonics/english.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/chinese_simplified.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/dutch.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/german.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/japanese.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/russian.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/spanish.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/portuguese.dart';
|
2022-01-19 14:25:58 +00:00
|
|
|
import 'package:cw_monero/mnemonics/french.dart';
|
|
|
|
import 'package:cw_monero/mnemonics/italian.dart';
|
2022-07-28 17:03:16 +00:00
|
|
|
import 'package:cw_monero/pending_monero_transaction.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
""";
|
|
|
|
const moneroCwPart = "part 'cw_monero.dart';";
|
|
|
|
const moneroContent = """
|
|
|
|
class Account {
|
2023-05-05 12:58:41 +00:00
|
|
|
Account({required this.id, required this.label, this.balance});
|
2021-12-24 12:52:08 +00:00
|
|
|
final int id;
|
|
|
|
final String label;
|
2023-05-05 12:58:41 +00:00
|
|
|
final String? balance;
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class Subaddress {
|
2022-10-12 17:09:57 +00:00
|
|
|
Subaddress({
|
|
|
|
required this.id,
|
|
|
|
required this.label,
|
|
|
|
required this.address});
|
2021-12-24 12:52:08 +00:00
|
|
|
final int id;
|
|
|
|
final String label;
|
|
|
|
final String address;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MoneroBalance extends Balance {
|
2022-10-12 17:09:57 +00:00
|
|
|
MoneroBalance({required this.fullBalance, required this.unlockedBalance})
|
|
|
|
: formattedFullBalance = monero!.formatterMoneroAmountToString(amount: fullBalance),
|
2021-12-24 12:52:08 +00:00
|
|
|
formattedUnlockedBalance =
|
2022-10-12 17:09:57 +00:00
|
|
|
monero!.formatterMoneroAmountToString(amount: unlockedBalance),
|
2021-12-24 12:52:08 +00:00
|
|
|
super(unlockedBalance, fullBalance);
|
|
|
|
|
|
|
|
MoneroBalance.fromString(
|
2022-10-12 17:09:57 +00:00
|
|
|
{required this.formattedFullBalance,
|
|
|
|
required this.formattedUnlockedBalance})
|
|
|
|
: fullBalance = monero!.formatterMoneroParseAmount(amount: formattedFullBalance),
|
|
|
|
unlockedBalance = monero!.formatterMoneroParseAmount(amount: formattedUnlockedBalance),
|
|
|
|
super(monero!.formatterMoneroParseAmount(amount: formattedUnlockedBalance),
|
|
|
|
monero!.formatterMoneroParseAmount(amount: formattedFullBalance));
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
final int fullBalance;
|
|
|
|
final int unlockedBalance;
|
|
|
|
final String formattedFullBalance;
|
|
|
|
final String formattedUnlockedBalance;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String get formattedAvailableBalance => formattedUnlockedBalance;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String get formattedAdditionalBalance => formattedFullBalance;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class MoneroWalletDetails {
|
|
|
|
@observable
|
2022-10-12 17:09:57 +00:00
|
|
|
late Account account;
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
@observable
|
2022-10-12 17:09:57 +00:00
|
|
|
late MoneroBalance balance;
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class Monero {
|
|
|
|
MoneroAccountList getAccountList(Object wallet);
|
|
|
|
|
|
|
|
MoneroSubaddressList getSubaddressList(Object wallet);
|
|
|
|
|
|
|
|
TransactionHistoryBase getTransactionHistory(Object wallet);
|
|
|
|
|
|
|
|
MoneroWalletDetails getMoneroWalletDetails(Object wallet);
|
|
|
|
|
2022-01-31 12:08:38 +00:00
|
|
|
String getTransactionAddress(Object wallet, int accountIndex, int addressIndex);
|
|
|
|
|
2022-04-12 15:38:47 +00:00
|
|
|
String getSubaddressLabel(Object wallet, int accountIndex, int addressIndex);
|
|
|
|
|
2023-11-02 15:52:47 +00:00
|
|
|
int getHeightByDate({required DateTime date});
|
2021-12-24 12:52:08 +00:00
|
|
|
TransactionPriority getDefaultTransactionPriority();
|
2022-11-03 23:13:13 +00:00
|
|
|
TransactionPriority getMoneroTransactionPrioritySlow();
|
|
|
|
TransactionPriority getMoneroTransactionPriorityAutomatic();
|
2022-10-12 17:09:57 +00:00
|
|
|
TransactionPriority deserializeMoneroTransactionPriority({required int raw});
|
2021-12-24 12:52:08 +00:00
|
|
|
List<TransactionPriority> getTransactionPriorities();
|
|
|
|
List<String> getMoneroWordList(String language);
|
2023-08-24 13:54:05 +00:00
|
|
|
|
|
|
|
List<Unspent> getUnspents(Object wallet);
|
2024-01-30 17:57:47 +00:00
|
|
|
Future<void> updateUnspents(Object wallet);
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
WalletCredentials createMoneroRestoreWalletFromKeysCredentials({
|
2022-10-12 17:09:57 +00:00
|
|
|
required String name,
|
|
|
|
required String spendKey,
|
|
|
|
required String viewKey,
|
|
|
|
required String address,
|
|
|
|
required String password,
|
|
|
|
required String language,
|
|
|
|
required int height});
|
|
|
|
WalletCredentials createMoneroRestoreWalletFromSeedCredentials({required String name, required String password, required int height, required String mnemonic});
|
2023-11-25 00:37:12 +00:00
|
|
|
WalletCredentials createMoneroNewWalletCredentials({required String name, required String language, required bool isPolyseed, String password});
|
2021-12-24 12:52:08 +00:00
|
|
|
Map<String, String> getKeys(Object wallet);
|
2022-10-12 17:09:57 +00:00
|
|
|
Object createMoneroTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority});
|
|
|
|
Object createMoneroTransactionCreationCredentialsRaw({required List<OutputInfo> outputs, required TransactionPriority priority});
|
|
|
|
String formatterMoneroAmountToString({required int amount});
|
|
|
|
double formatterMoneroAmountToDouble({required int amount});
|
|
|
|
int formatterMoneroParseAmount({required String amount});
|
2021-12-24 12:52:08 +00:00
|
|
|
Account getCurrentAccount(Object wallet);
|
2023-05-05 12:58:41 +00:00
|
|
|
void setCurrentAccount(Object wallet, int id, String label, String? balance);
|
2021-12-24 12:52:08 +00:00
|
|
|
void onStartup();
|
|
|
|
int getTransactionInfoAccountId(TransactionInfo tx);
|
2023-08-24 13:54:05 +00:00
|
|
|
WalletService createMoneroWalletService(Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
|
2022-07-28 17:03:16 +00:00
|
|
|
Map<String, String> pendingTransactionInfo(Object transaction);
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class MoneroSubaddressList {
|
|
|
|
ObservableList<Subaddress> get subaddresses;
|
2022-10-12 17:09:57 +00:00
|
|
|
void update(Object wallet, {required int accountIndex});
|
|
|
|
void refresh(Object wallet, {required int accountIndex});
|
2021-12-24 12:52:08 +00:00
|
|
|
List<Subaddress> getAll(Object wallet);
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> addSubaddress(Object wallet, {required int accountIndex, required String label});
|
2021-12-24 12:52:08 +00:00
|
|
|
Future<void> setLabelSubaddress(Object wallet,
|
2022-10-12 17:09:57 +00:00
|
|
|
{required int accountIndex, required int addressIndex, required String label});
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class MoneroAccountList {
|
|
|
|
ObservableList<Account> get accounts;
|
|
|
|
void update(Object wallet);
|
|
|
|
void refresh(Object wallet);
|
|
|
|
List<Account> getAll(Object wallet);
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> addAccount(Object wallet, {required String label});
|
|
|
|
Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
const moneroEmptyDefinition = 'Monero? monero;\n';
|
|
|
|
const moneroCWDefinition = 'Monero? monero = CWMonero();\n';
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2023-09-21 14:16:27 +00:00
|
|
|
final output = '$moneroCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$moneroCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$moneroCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? moneroCWDefinition : moneroEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
moneroContent;
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
Future<void> generateHaven(bool hasImplementation) async {
|
2022-04-07 11:19:10 +00:00
|
|
|
final outputFile = File(havenOutputPath);
|
2022-03-30 15:57:04 +00:00
|
|
|
const havenCommonHeaders = """
|
|
|
|
import 'package:mobx/mobx.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
|
|
|
import 'package:cw_core/transaction_history.dart';
|
|
|
|
import 'package:cw_core/transaction_info.dart';
|
|
|
|
import 'package:cw_core/balance.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
2022-04-07 11:19:10 +00:00
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';""";
|
2022-03-30 15:57:04 +00:00
|
|
|
const havenCWHeaders = """
|
|
|
|
import 'package:cw_core/get_height_by_date.dart';
|
|
|
|
import 'package:cw_core/monero_amount_format.dart';
|
|
|
|
import 'package:cw_core/monero_transaction_priority.dart';
|
|
|
|
import 'package:cw_haven/haven_wallet_service.dart';
|
|
|
|
import 'package:cw_haven/haven_wallet.dart';
|
|
|
|
import 'package:cw_haven/haven_transaction_info.dart';
|
|
|
|
import 'package:cw_haven/haven_transaction_history.dart';
|
|
|
|
import 'package:cw_core/account.dart' as monero_account;
|
|
|
|
import 'package:cw_haven/api/wallet.dart' as monero_wallet_api;
|
|
|
|
import 'package:cw_haven/mnemonics/english.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/chinese_simplified.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/dutch.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/german.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/japanese.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/russian.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/spanish.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/portuguese.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/french.dart';
|
|
|
|
import 'package:cw_haven/mnemonics/italian.dart';
|
|
|
|
import 'package:cw_haven/haven_transaction_creation_credentials.dart';
|
2022-04-07 11:19:10 +00:00
|
|
|
import 'package:cw_haven/api/balance_list.dart';
|
2022-03-30 15:57:04 +00:00
|
|
|
""";
|
|
|
|
const havenCwPart = "part 'cw_haven.dart';";
|
|
|
|
const havenContent = """
|
|
|
|
class Account {
|
2022-10-12 17:09:57 +00:00
|
|
|
Account({required this.id, required this.label});
|
2022-03-30 15:57:04 +00:00
|
|
|
final int id;
|
|
|
|
final String label;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Subaddress {
|
2022-10-12 17:09:57 +00:00
|
|
|
Subaddress({
|
|
|
|
required this.id,
|
|
|
|
required this.label,
|
|
|
|
required this.address});
|
2022-03-30 15:57:04 +00:00
|
|
|
final int id;
|
|
|
|
final String label;
|
|
|
|
final String address;
|
|
|
|
}
|
|
|
|
|
|
|
|
class HavenBalance extends Balance {
|
2022-10-12 17:09:57 +00:00
|
|
|
HavenBalance({required this.fullBalance, required this.unlockedBalance})
|
|
|
|
: formattedFullBalance = haven!.formatterMoneroAmountToString(amount: fullBalance),
|
2022-03-30 15:57:04 +00:00
|
|
|
formattedUnlockedBalance =
|
2022-10-12 17:09:57 +00:00
|
|
|
haven!.formatterMoneroAmountToString(amount: unlockedBalance),
|
2022-03-30 15:57:04 +00:00
|
|
|
super(unlockedBalance, fullBalance);
|
|
|
|
|
|
|
|
HavenBalance.fromString(
|
2022-10-12 17:09:57 +00:00
|
|
|
{required this.formattedFullBalance,
|
|
|
|
required this.formattedUnlockedBalance})
|
|
|
|
: fullBalance = haven!.formatterMoneroParseAmount(amount: formattedFullBalance),
|
|
|
|
unlockedBalance = haven!.formatterMoneroParseAmount(amount: formattedUnlockedBalance),
|
|
|
|
super(haven!.formatterMoneroParseAmount(amount: formattedUnlockedBalance),
|
|
|
|
haven!.formatterMoneroParseAmount(amount: formattedFullBalance));
|
2022-03-30 15:57:04 +00:00
|
|
|
|
|
|
|
final int fullBalance;
|
|
|
|
final int unlockedBalance;
|
|
|
|
final String formattedFullBalance;
|
|
|
|
final String formattedUnlockedBalance;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String get formattedAvailableBalance => formattedUnlockedBalance;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String get formattedAdditionalBalance => formattedFullBalance;
|
|
|
|
}
|
|
|
|
|
2022-04-07 11:19:10 +00:00
|
|
|
class AssetRate {
|
2022-10-12 17:09:57 +00:00
|
|
|
AssetRate(this.asset, this.rate);
|
|
|
|
|
2022-04-07 11:19:10 +00:00
|
|
|
final String asset;
|
|
|
|
final int rate;
|
|
|
|
}
|
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
abstract class HavenWalletDetails {
|
2024-01-17 23:38:36 +00:00
|
|
|
// FIX-ME: it's abstract class
|
2022-03-30 15:57:04 +00:00
|
|
|
@observable
|
2022-10-12 17:09:57 +00:00
|
|
|
late Account account;
|
2024-01-17 23:38:36 +00:00
|
|
|
// FIX-ME: it's abstract class
|
2022-03-30 15:57:04 +00:00
|
|
|
@observable
|
2022-10-12 17:09:57 +00:00
|
|
|
late HavenBalance balance;
|
2022-03-30 15:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class Haven {
|
|
|
|
HavenAccountList getAccountList(Object wallet);
|
|
|
|
|
|
|
|
MoneroSubaddressList getSubaddressList(Object wallet);
|
|
|
|
|
|
|
|
TransactionHistoryBase getTransactionHistory(Object wallet);
|
|
|
|
|
|
|
|
HavenWalletDetails getMoneroWalletDetails(Object wallet);
|
|
|
|
|
|
|
|
String getTransactionAddress(Object wallet, int accountIndex, int addressIndex);
|
|
|
|
|
2023-03-15 15:30:06 +00:00
|
|
|
int getHeightByDate({required DateTime date});
|
|
|
|
Future<int> getCurrentHeight();
|
2022-03-30 15:57:04 +00:00
|
|
|
TransactionPriority getDefaultTransactionPriority();
|
2022-10-12 17:09:57 +00:00
|
|
|
TransactionPriority deserializeMoneroTransactionPriority({required int raw});
|
2022-03-30 15:57:04 +00:00
|
|
|
List<TransactionPriority> getTransactionPriorities();
|
|
|
|
List<String> getMoneroWordList(String language);
|
|
|
|
|
|
|
|
WalletCredentials createHavenRestoreWalletFromKeysCredentials({
|
2022-10-12 17:09:57 +00:00
|
|
|
required String name,
|
|
|
|
required String spendKey,
|
|
|
|
required String viewKey,
|
|
|
|
required String address,
|
|
|
|
required String password,
|
|
|
|
required String language,
|
|
|
|
required int height});
|
|
|
|
WalletCredentials createHavenRestoreWalletFromSeedCredentials({required String name, required String password, required int height, required String mnemonic});
|
|
|
|
WalletCredentials createHavenNewWalletCredentials({required String name, required String language, String password});
|
2022-03-30 15:57:04 +00:00
|
|
|
Map<String, String> getKeys(Object wallet);
|
2022-10-12 17:09:57 +00:00
|
|
|
Object createHavenTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority, required String assetType});
|
|
|
|
String formatterMoneroAmountToString({required int amount});
|
|
|
|
double formatterMoneroAmountToDouble({required int amount});
|
|
|
|
int formatterMoneroParseAmount({required String amount});
|
2022-03-30 15:57:04 +00:00
|
|
|
Account getCurrentAccount(Object wallet);
|
|
|
|
void setCurrentAccount(Object wallet, int id, String label);
|
|
|
|
void onStartup();
|
|
|
|
int getTransactionInfoAccountId(TransactionInfo tx);
|
|
|
|
WalletService createHavenWalletService(Box<WalletInfo> walletInfoSource);
|
2022-04-07 11:19:10 +00:00
|
|
|
CryptoCurrency assetOfTransaction(TransactionInfo tx);
|
|
|
|
List<AssetRate> getAssetRate();
|
2022-03-30 15:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class MoneroSubaddressList {
|
|
|
|
ObservableList<Subaddress> get subaddresses;
|
2022-10-12 17:09:57 +00:00
|
|
|
void update(Object wallet, {required int accountIndex});
|
|
|
|
void refresh(Object wallet, {required int accountIndex});
|
2022-03-30 15:57:04 +00:00
|
|
|
List<Subaddress> getAll(Object wallet);
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> addSubaddress(Object wallet, {required int accountIndex, required String label});
|
2022-03-30 15:57:04 +00:00
|
|
|
Future<void> setLabelSubaddress(Object wallet,
|
2022-10-12 17:09:57 +00:00
|
|
|
{required int accountIndex, required int addressIndex, required String label});
|
2022-03-30 15:57:04 +00:00
|
|
|
}
|
2022-10-14 15:23:24 +00:00
|
|
|
|
|
|
|
abstract class HavenAccountList {
|
|
|
|
ObservableList<Account> get accounts;
|
|
|
|
void update(Object wallet);
|
|
|
|
void refresh(Object wallet);
|
|
|
|
List<Account> getAll(Object wallet);
|
|
|
|
Future<void> addAccount(Object wallet, {required String label});
|
|
|
|
Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
|
|
|
}
|
2022-03-30 15:57:04 +00:00
|
|
|
""";
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
const havenEmptyDefinition = 'Haven? haven;\n';
|
|
|
|
const havenCWDefinition = 'Haven? haven = CWHaven();\n';
|
2022-03-30 15:57:04 +00:00
|
|
|
|
2023-09-21 14:16:27 +00:00
|
|
|
final output = '$havenCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$havenCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$havenCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? havenCWDefinition : havenEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
havenContent;
|
2022-03-30 15:57:04 +00:00
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
Future<void> generateEthereum(bool hasImplementation) async {
|
|
|
|
final outputFile = File(ethereumOutputPath);
|
|
|
|
const ethereumCommonHeaders = """
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
|
|
import 'package:cw_core/erc20_token.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cw_core/transaction_info.dart';
|
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
|
|
|
import 'package:cw_core/wallet_base.dart';
|
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
2024-02-11 00:04:46 +00:00
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:web3dart/web3dart.dart';
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
|
2023-08-07 11:43:04 +00:00
|
|
|
""";
|
|
|
|
const ethereumCWHeaders = """
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
import 'package:cw_evm/evm_chain_formatter.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_mnemonics.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_transaction_credentials.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_transaction_info.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_transaction_priority.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_wallet_creation_credentials.dart';
|
|
|
|
|
|
|
|
import 'package:cw_ethereum/ethereum_client.dart';
|
2023-08-04 17:01:49 +00:00
|
|
|
import 'package:cw_ethereum/ethereum_wallet.dart';
|
|
|
|
import 'package:cw_ethereum/ethereum_wallet_service.dart';
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
|
|
|
|
import 'package:eth_sig_util/util/utils.dart';
|
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
""";
|
|
|
|
const ethereumCwPart = "part 'cw_ethereum.dart';";
|
|
|
|
const ethereumContent = """
|
|
|
|
abstract class Ethereum {
|
|
|
|
List<String> getEthereumWordList(String language);
|
|
|
|
WalletService createEthereumWalletService(Box<WalletInfo> walletInfoSource);
|
|
|
|
WalletCredentials createEthereumNewWalletCredentials({required String name, WalletInfo? walletInfo});
|
|
|
|
WalletCredentials createEthereumRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password});
|
2023-08-23 12:33:20 +00:00
|
|
|
WalletCredentials createEthereumRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
|
2023-08-04 17:01:49 +00:00
|
|
|
String getAddress(WalletBase wallet);
|
2023-10-03 14:56:10 +00:00
|
|
|
String getPrivateKey(WalletBase wallet);
|
|
|
|
String getPublicKey(WalletBase wallet);
|
2023-08-04 17:01:49 +00:00
|
|
|
TransactionPriority getDefaultTransactionPriority();
|
2023-10-12 22:50:16 +00:00
|
|
|
TransactionPriority getEthereumTransactionPrioritySlow();
|
2023-08-04 17:01:49 +00:00
|
|
|
List<TransactionPriority> getTransactionPriorities();
|
|
|
|
TransactionPriority deserializeEthereumTransactionPriority(int raw);
|
|
|
|
|
|
|
|
Object createEthereumTransactionCredentials(
|
|
|
|
List<Output> outputs, {
|
|
|
|
required TransactionPriority priority,
|
|
|
|
required CryptoCurrency currency,
|
|
|
|
int? feeRate,
|
|
|
|
});
|
|
|
|
|
|
|
|
Object createEthereumTransactionCredentialsRaw(
|
|
|
|
List<OutputInfo> outputs, {
|
|
|
|
TransactionPriority? priority,
|
|
|
|
required CryptoCurrency currency,
|
|
|
|
required int feeRate,
|
|
|
|
});
|
|
|
|
|
|
|
|
int formatterEthereumParseAmount(String amount);
|
|
|
|
double formatterEthereumAmountToDouble({TransactionInfo? transaction, BigInt? amount, int exponent = 18});
|
|
|
|
List<Erc20Token> getERC20Currencies(WalletBase wallet);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
Future<void> addErc20Token(WalletBase wallet, CryptoCurrency token);
|
|
|
|
Future<void> deleteErc20Token(WalletBase wallet, CryptoCurrency token);
|
2023-08-04 17:01:49 +00:00
|
|
|
Future<Erc20Token?> getErc20Token(WalletBase wallet, String contractAddress);
|
|
|
|
|
|
|
|
CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction);
|
|
|
|
void updateEtherscanUsageState(WalletBase wallet, bool isEnabled);
|
2023-10-03 17:07:05 +00:00
|
|
|
Web3Client? getWeb3Client(WalletBase wallet);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
String getTokenAddress(CryptoCurrency asset);
|
2023-08-04 17:01:49 +00:00
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
|
|
|
const ethereumEmptyDefinition = 'Ethereum? ethereum;\n';
|
|
|
|
const ethereumCWDefinition = 'Ethereum? ethereum = CWEthereum();\n';
|
|
|
|
|
2023-09-21 14:16:27 +00:00
|
|
|
final output = '$ethereumCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$ethereumCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$ethereumCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? ethereumCWDefinition : ethereumEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
ethereumContent;
|
2023-08-04 17:01:49 +00:00
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
2023-12-02 02:26:43 +00:00
|
|
|
Future<void> generatePolygon(bool hasImplementation) async {
|
|
|
|
final outputFile = File(polygonOutputPath);
|
|
|
|
const polygonCommonHeaders = """
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
|
|
import 'package:cw_core/erc20_token.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cw_core/transaction_info.dart';
|
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
|
|
|
import 'package:cw_core/wallet_base.dart';
|
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
2024-02-11 00:04:46 +00:00
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:web3dart/web3dart.dart';
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
|
2023-12-02 02:26:43 +00:00
|
|
|
""";
|
|
|
|
const polygonCWHeaders = """
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
import 'package:cw_evm/evm_chain_formatter.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_mnemonics.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_transaction_info.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_transaction_priority.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_transaction_credentials.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_wallet_creation_credentials.dart';
|
|
|
|
|
|
|
|
import 'package:cw_polygon/polygon_client.dart';
|
2023-12-02 02:26:43 +00:00
|
|
|
import 'package:cw_polygon/polygon_wallet.dart';
|
|
|
|
import 'package:cw_polygon/polygon_wallet_service.dart';
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
|
|
|
|
import 'package:eth_sig_util/util/utils.dart';
|
|
|
|
|
2023-12-02 02:26:43 +00:00
|
|
|
""";
|
|
|
|
const polygonCwPart = "part 'cw_polygon.dart';";
|
|
|
|
const polygonContent = """
|
|
|
|
abstract class Polygon {
|
|
|
|
List<String> getPolygonWordList(String language);
|
|
|
|
WalletService createPolygonWalletService(Box<WalletInfo> walletInfoSource);
|
|
|
|
WalletCredentials createPolygonNewWalletCredentials({required String name, WalletInfo? walletInfo});
|
|
|
|
WalletCredentials createPolygonRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password});
|
|
|
|
WalletCredentials createPolygonRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
|
|
|
|
String getAddress(WalletBase wallet);
|
|
|
|
String getPrivateKey(WalletBase wallet);
|
|
|
|
String getPublicKey(WalletBase wallet);
|
|
|
|
TransactionPriority getDefaultTransactionPriority();
|
|
|
|
TransactionPriority getPolygonTransactionPrioritySlow();
|
|
|
|
List<TransactionPriority> getTransactionPriorities();
|
|
|
|
TransactionPriority deserializePolygonTransactionPriority(int raw);
|
|
|
|
|
|
|
|
Object createPolygonTransactionCredentials(
|
|
|
|
List<Output> outputs, {
|
|
|
|
required TransactionPriority priority,
|
|
|
|
required CryptoCurrency currency,
|
|
|
|
int? feeRate,
|
|
|
|
});
|
|
|
|
|
|
|
|
Object createPolygonTransactionCredentialsRaw(
|
|
|
|
List<OutputInfo> outputs, {
|
|
|
|
TransactionPriority? priority,
|
|
|
|
required CryptoCurrency currency,
|
|
|
|
required int feeRate,
|
|
|
|
});
|
|
|
|
|
|
|
|
int formatterPolygonParseAmount(String amount);
|
|
|
|
double formatterPolygonAmountToDouble({TransactionInfo? transaction, BigInt? amount, int exponent = 18});
|
|
|
|
List<Erc20Token> getERC20Currencies(WalletBase wallet);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
Future<void> addErc20Token(WalletBase wallet, CryptoCurrency token);
|
|
|
|
Future<void> deleteErc20Token(WalletBase wallet, CryptoCurrency token);
|
2023-12-02 02:26:43 +00:00
|
|
|
Future<Erc20Token?> getErc20Token(WalletBase wallet, String contractAddress);
|
|
|
|
|
|
|
|
CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction);
|
|
|
|
void updatePolygonScanUsageState(WalletBase wallet, bool isEnabled);
|
|
|
|
Web3Client? getWeb3Client(WalletBase wallet);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
String getTokenAddress(CryptoCurrency asset);
|
2023-12-02 02:26:43 +00:00
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
|
|
|
const polygonEmptyDefinition = 'Polygon? polygon;\n';
|
|
|
|
const polygonCWDefinition = 'Polygon? polygon = CWPolygon();\n';
|
|
|
|
|
|
|
|
final output = '$polygonCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$polygonCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$polygonCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? polygonCWDefinition : polygonEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
polygonContent;
|
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
Future<void> generateBitcoinCash(bool hasImplementation) async {
|
|
|
|
final outputFile = File(bitcoinCashOutputPath);
|
|
|
|
const bitcoinCashCommonHeaders = """
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
2023-10-16 13:44:20 +00:00
|
|
|
import 'package:cw_core/unspent_transaction_output.dart';
|
2023-10-12 22:50:16 +00:00
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
|
|
|
import 'package:cw_core/unspent_coins_info.dart';
|
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
""";
|
|
|
|
const bitcoinCashCWHeaders = """
|
|
|
|
import 'package:cw_bitcoin_cash/cw_bitcoin_cash.dart';
|
2023-10-16 13:44:20 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
|
2023-10-12 22:50:16 +00:00
|
|
|
""";
|
|
|
|
const bitcoinCashCwPart = "part 'cw_bitcoin_cash.dart';";
|
|
|
|
const bitcoinCashContent = """
|
|
|
|
abstract class BitcoinCash {
|
|
|
|
String getCashAddrFormat(String address);
|
|
|
|
|
|
|
|
WalletService createBitcoinCashWalletService(
|
|
|
|
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
|
|
|
|
|
|
|
|
WalletCredentials createBitcoinCashNewWalletCredentials(
|
|
|
|
{required String name, WalletInfo? walletInfo});
|
|
|
|
|
|
|
|
WalletCredentials createBitcoinCashRestoreWalletFromSeedCredentials(
|
|
|
|
{required String name, required String mnemonic, required String password});
|
|
|
|
|
|
|
|
TransactionPriority deserializeBitcoinCashTransactionPriority(int raw);
|
|
|
|
|
|
|
|
TransactionPriority getDefaultTransactionPriority();
|
|
|
|
|
|
|
|
List<TransactionPriority> getTransactionPriorities();
|
|
|
|
|
|
|
|
TransactionPriority getBitcoinCashTransactionPrioritySlow();
|
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
|
|
|
const bitcoinCashEmptyDefinition = 'BitcoinCash? bitcoinCash;\n';
|
|
|
|
const bitcoinCashCWDefinition = 'BitcoinCash? bitcoinCash = CWBitcoinCash();\n';
|
|
|
|
|
|
|
|
final output = '$bitcoinCashCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$bitcoinCashCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$bitcoinCashCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? bitcoinCashCWDefinition : bitcoinCashEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
bitcoinCashContent;
|
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
Future<void> generateNano(bool hasImplementation) async {
|
|
|
|
final outputFile = File(nanoOutputPath);
|
|
|
|
const nanoCommonHeaders = """
|
|
|
|
import 'package:cw_core/cake_hive.dart';
|
|
|
|
import 'package:cw_core/nano_account.dart';
|
|
|
|
import 'package:cw_core/account.dart';
|
|
|
|
import 'package:cw_core/node.dart';
|
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/transaction_info.dart';
|
|
|
|
import 'package:cw_core/transaction_history.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cw_core/nano_account_info_response.dart';
|
|
|
|
import 'package:mobx/mobx.dart';
|
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
""";
|
|
|
|
const nanoCWHeaders = """
|
|
|
|
import 'package:cw_nano/nano_client.dart';
|
|
|
|
import 'package:cw_nano/nano_mnemonic.dart';
|
|
|
|
import 'package:cw_nano/nano_wallet.dart';
|
|
|
|
import 'package:cw_nano/nano_wallet_service.dart';
|
|
|
|
import 'package:cw_nano/nano_transaction_info.dart';
|
|
|
|
import 'package:cw_nano/nano_transaction_credentials.dart';
|
|
|
|
import 'package:cw_nano/nano_wallet_creation_credentials.dart';
|
|
|
|
// needed for nano_util:
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:convert/convert.dart';
|
|
|
|
import "package:ed25519_hd_key/ed25519_hd_key.dart";
|
|
|
|
import 'package:libcrypto/libcrypto.dart';
|
|
|
|
import 'package:nanodart/nanodart.dart' as ND;
|
2024-01-11 23:00:41 +00:00
|
|
|
import 'package:nanoutil/nanoutil.dart';
|
2023-10-05 01:09:07 +00:00
|
|
|
""";
|
|
|
|
const nanoCwPart = "part 'cw_nano.dart';";
|
|
|
|
const nanoContent = """
|
|
|
|
abstract class Nano {
|
|
|
|
NanoAccountList getAccountList(Object wallet);
|
|
|
|
|
|
|
|
Account getCurrentAccount(Object wallet);
|
|
|
|
|
|
|
|
void setCurrentAccount(Object wallet, int id, String label, String? balance);
|
|
|
|
|
|
|
|
WalletService createNanoWalletService(Box<WalletInfo> walletInfoSource);
|
|
|
|
|
|
|
|
WalletCredentials createNanoNewWalletCredentials({
|
|
|
|
required String name,
|
|
|
|
String password,
|
|
|
|
});
|
|
|
|
|
|
|
|
WalletCredentials createNanoRestoreWalletFromSeedCredentials({
|
|
|
|
required String name,
|
|
|
|
required String password,
|
|
|
|
required String mnemonic,
|
|
|
|
DerivationType? derivationType,
|
|
|
|
});
|
|
|
|
|
|
|
|
WalletCredentials createNanoRestoreWalletFromKeysCredentials({
|
|
|
|
required String name,
|
|
|
|
required String password,
|
|
|
|
required String seedKey,
|
|
|
|
DerivationType? derivationType,
|
|
|
|
});
|
|
|
|
|
|
|
|
List<String> getNanoWordList(String language);
|
|
|
|
Map<String, String> getKeys(Object wallet);
|
|
|
|
Object createNanoTransactionCredentials(List<Output> outputs);
|
|
|
|
Future<void> changeRep(Object wallet, String address);
|
2024-01-11 23:00:41 +00:00
|
|
|
Future<bool> updateTransactions(Object wallet);
|
2023-10-05 01:09:07 +00:00
|
|
|
BigInt getTransactionAmountRaw(TransactionInfo transactionInfo);
|
2023-10-09 15:18:59 +00:00
|
|
|
String getRepresentative(Object wallet);
|
2023-10-05 01:09:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class NanoAccountList {
|
|
|
|
ObservableList<NanoAccount> get accounts;
|
|
|
|
void update(Object wallet);
|
|
|
|
void refresh(Object wallet);
|
|
|
|
Future<List<NanoAccount>> getAll(Object wallet);
|
|
|
|
Future<void> addAccount(Object wallet, {required String label});
|
|
|
|
Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class NanoUtil {
|
|
|
|
bool isValidBip39Seed(String seed);
|
|
|
|
static const int maxDecimalDigits = 6; // Max digits after decimal
|
|
|
|
BigInt rawPerNano = BigInt.parse("1000000000000000000000000000000");
|
|
|
|
BigInt rawPerNyano = BigInt.parse("1000000000000000000000000");
|
|
|
|
BigInt rawPerBanano = BigInt.parse("100000000000000000000000000000");
|
|
|
|
BigInt rawPerXMR = BigInt.parse("1000000000000");
|
|
|
|
BigInt convertXMRtoNano = BigInt.parse("1000000000000000000");
|
|
|
|
String getRawAsUsableString(String? raw, BigInt rawPerCur);
|
|
|
|
String getRawAccuracy(String? raw, BigInt rawPerCur);
|
|
|
|
String getAmountAsRaw(String amount, BigInt rawPerCur);
|
|
|
|
|
|
|
|
// derivationInfo:
|
|
|
|
Future<AccountInfoResponse?> getInfoFromSeedOrMnemonic(
|
|
|
|
DerivationType derivationType, {
|
|
|
|
String? seedKey,
|
|
|
|
String? mnemonic,
|
|
|
|
required Node node,
|
|
|
|
});
|
|
|
|
Future<List<DerivationType>> compareDerivationMethods({
|
|
|
|
String? mnemonic,
|
|
|
|
String? privateKey,
|
|
|
|
required Node node,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
2023-10-09 15:18:59 +00:00
|
|
|
const nanoEmptyDefinition = 'Nano? nano;\nNanoUtil? nanoUtil;\n';
|
2023-10-05 01:09:07 +00:00
|
|
|
const nanoCWDefinition = 'Nano? nano = CWNano();\nNanoUtil? nanoUtil = CWNanoUtil();\n';
|
|
|
|
|
|
|
|
final output = '$nanoCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$nanoCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$nanoCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? nanoCWDefinition : nanoEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
nanoContent;
|
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
Future<void> generateSolana(bool hasImplementation) async {
|
|
|
|
final outputFile = File(solanaOutputPath);
|
|
|
|
const solanaCommonHeaders = """
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cw_core/transaction_info.dart';
|
|
|
|
import 'package:cw_core/wallet_base.dart';
|
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/wallet_service.dart';
|
|
|
|
import 'package:hive/hive.dart';
|
2024-03-04 17:32:10 +00:00
|
|
|
import 'package:solana/solana.dart';
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
|
|
|
|
""";
|
|
|
|
const solanaCWHeaders = """
|
|
|
|
import 'package:cw_solana/spl_token.dart';
|
|
|
|
import 'package:cw_solana/solana_wallet.dart';
|
|
|
|
import 'package:cw_solana/solana_mnemonics.dart';
|
|
|
|
import 'package:cw_solana/solana_wallet_service.dart';
|
|
|
|
import 'package:cw_solana/solana_transaction_info.dart';
|
|
|
|
import 'package:cw_solana/solana_transaction_credentials.dart';
|
|
|
|
import 'package:cw_solana/solana_wallet_creation_credentials.dart';
|
|
|
|
""";
|
|
|
|
const solanaCwPart = "part 'cw_solana.dart';";
|
|
|
|
const solanaContent = """
|
|
|
|
abstract class Solana {
|
|
|
|
List<String> getSolanaWordList(String language);
|
|
|
|
WalletService createSolanaWalletService(Box<WalletInfo> walletInfoSource);
|
|
|
|
WalletCredentials createSolanaNewWalletCredentials(
|
|
|
|
{required String name, WalletInfo? walletInfo});
|
|
|
|
WalletCredentials createSolanaRestoreWalletFromSeedCredentials(
|
|
|
|
{required String name, required String mnemonic, required String password});
|
|
|
|
WalletCredentials createSolanaRestoreWalletFromPrivateKey(
|
|
|
|
{required String name, required String privateKey, required String password});
|
|
|
|
|
|
|
|
String getAddress(WalletBase wallet);
|
|
|
|
String getPrivateKey(WalletBase wallet);
|
|
|
|
String getPublicKey(WalletBase wallet);
|
|
|
|
Ed25519HDKeyPair? getWalletKeyPair(WalletBase wallet);
|
|
|
|
|
|
|
|
Object createSolanaTransactionCredentials(
|
|
|
|
List<Output> outputs, {
|
|
|
|
required CryptoCurrency currency,
|
|
|
|
});
|
|
|
|
|
|
|
|
Object createSolanaTransactionCredentialsRaw(
|
|
|
|
List<OutputInfo> outputs, {
|
|
|
|
required CryptoCurrency currency,
|
|
|
|
});
|
2024-03-04 17:32:10 +00:00
|
|
|
List<CryptoCurrency> getSPLTokenCurrencies(WalletBase wallet);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
Future<void> addSPLToken(WalletBase wallet, CryptoCurrency token);
|
|
|
|
Future<void> deleteSPLToken(WalletBase wallet, CryptoCurrency token);
|
2024-03-04 17:32:10 +00:00
|
|
|
Future<CryptoCurrency?> getSPLToken(WalletBase wallet, String contractAddress);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
|
|
|
|
CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction);
|
|
|
|
double getTransactionAmountRaw(TransactionInfo transactionInfo);
|
|
|
|
String getTokenAddress(CryptoCurrency asset);
|
|
|
|
List<int>? getValidationLength(CryptoCurrency type);
|
|
|
|
}
|
|
|
|
|
|
|
|
""";
|
|
|
|
|
|
|
|
const solanaEmptyDefinition = 'Solana? solana;\n';
|
|
|
|
const solanaCWDefinition = 'Solana? solana = CWSolana();\n';
|
|
|
|
|
|
|
|
final output = '$solanaCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$solanaCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$solanaCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? solanaCWDefinition : solanaEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
solanaContent;
|
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
Future<void> generatePubspec(
|
|
|
|
{required bool hasMonero,
|
|
|
|
required bool hasBitcoin,
|
|
|
|
required bool hasHaven,
|
|
|
|
required bool hasEthereum,
|
|
|
|
required bool hasNano,
|
|
|
|
required bool hasBanano,
|
2023-12-02 02:26:43 +00:00
|
|
|
required bool hasBitcoinCash,
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
required bool hasPolygon,
|
|
|
|
required bool hasSolana}) async {
|
2023-09-21 14:16:27 +00:00
|
|
|
const cwCore = """
|
2021-12-24 12:52:08 +00:00
|
|
|
cw_core:
|
|
|
|
path: ./cw_core
|
|
|
|
""";
|
|
|
|
const cwMonero = """
|
|
|
|
cw_monero:
|
|
|
|
path: ./cw_monero
|
|
|
|
""";
|
|
|
|
const cwBitcoin = """
|
|
|
|
cw_bitcoin:
|
|
|
|
path: ./cw_bitcoin
|
|
|
|
""";
|
2022-03-30 15:57:04 +00:00
|
|
|
const cwHaven = """
|
|
|
|
cw_haven:
|
|
|
|
path: ./cw_haven
|
|
|
|
""";
|
|
|
|
const cwSharedExternal = """
|
|
|
|
cw_shared_external:
|
|
|
|
path: ./cw_shared_external
|
|
|
|
""";
|
2023-08-04 17:01:49 +00:00
|
|
|
const cwEthereum = """
|
|
|
|
cw_ethereum:
|
|
|
|
path: ./cw_ethereum
|
|
|
|
""";
|
2023-10-12 22:50:16 +00:00
|
|
|
const cwBitcoinCash = """
|
|
|
|
cw_bitcoin_cash:
|
|
|
|
path: ./cw_bitcoin_cash
|
|
|
|
""";
|
2023-10-05 01:09:07 +00:00
|
|
|
const cwNano = """
|
|
|
|
cw_nano:
|
|
|
|
path: ./cw_nano
|
|
|
|
""";
|
|
|
|
const cwBanano = """
|
|
|
|
cw_banano:
|
|
|
|
path: ./cw_banano
|
|
|
|
""";
|
2023-12-02 02:26:43 +00:00
|
|
|
const cwPolygon = """
|
|
|
|
cw_polygon:
|
|
|
|
path: ./cw_polygon
|
|
|
|
""";
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
const cwSolana = """
|
|
|
|
cw_solana:
|
|
|
|
path: ./cw_solana
|
|
|
|
""";
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
const cwEVM = """
|
|
|
|
cw_evm:
|
|
|
|
path: ./cw_evm
|
|
|
|
""";
|
2022-01-11 09:35:08 +00:00
|
|
|
final inputFile = File(pubspecOutputPath);
|
2021-12-24 12:52:08 +00:00
|
|
|
final inputText = await inputFile.readAsString();
|
|
|
|
final inputLines = inputText.split('\n');
|
|
|
|
final dependenciesIndex = inputLines.indexWhere((line) => line.toLowerCase() == 'dependencies:');
|
|
|
|
var output = cwCore;
|
|
|
|
|
|
|
|
if (hasMonero) {
|
2022-03-30 15:57:04 +00:00
|
|
|
output += '\n$cwMonero\n$cwSharedExternal';
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (hasBitcoin) {
|
|
|
|
output += '\n$cwBitcoin';
|
|
|
|
}
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
if (hasEthereum) {
|
|
|
|
output += '\n$cwEthereum';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasNano) {
|
|
|
|
output += '\n$cwNano';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasBanano) {
|
|
|
|
output += '\n$cwBanano';
|
|
|
|
}
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
if (hasBitcoinCash) {
|
|
|
|
output += '\n$cwBitcoinCash';
|
|
|
|
}
|
|
|
|
|
2023-12-02 02:26:43 +00:00
|
|
|
if (hasPolygon) {
|
|
|
|
output += '\n$cwPolygon';
|
|
|
|
}
|
|
|
|
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
if (hasSolana) {
|
|
|
|
output += '\n$cwSolana';
|
|
|
|
}
|
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
if (hasHaven && !hasMonero) {
|
|
|
|
output += '\n$cwSharedExternal\n$cwHaven';
|
|
|
|
} else if (hasHaven) {
|
|
|
|
output += '\n$cwHaven';
|
|
|
|
}
|
|
|
|
|
CW-551-Refactor-EVM-Chains (#1256)
* feat: Create central package for EVM chains
* chore: Cleanup pubspec and add core evm dependencies
* feat: Replicated core evm chain files, time to start fixing the issues
* feat: Setup evm central package to handle all evm chains
* feat: Link up Polygon and Ethereum wallets to the centra evm package, fix bugs and issues, and optimze for better performance
* feat: Setup and adjust configs to reflect new evm configurations
* Remove unneeded file
* fix: Changes done while re-reviewing entire structure and refactor
* fix: Add evm chain wallet path to imports in configure file
* feat: Adjust implementation of parent class, remove unneeded files, remove windows, linux and mac directories, restructure the evm child classes
* fix: Make EVMChainWallet a central abstract class and adjust accordingly
* fix: Adjust transaction info, restructure EVMWalletChain to be an abstract, adjust external facing interfaces for polygon and ethereum, adjust configuration for ethereum and polygon in configure file
* fix: Testing issues
* fix: Add localization for nft tile and details page texts and add dashes for null responses
* fix: merge conflicts
* Minor fixes for building Monero.com
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-01-30 18:01:48 +00:00
|
|
|
if (hasEthereum || hasPolygon) {
|
|
|
|
output += '\n$cwEVM';
|
|
|
|
}
|
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
final outputLines = output.split('\n');
|
|
|
|
inputLines.insertAll(dependenciesIndex + 1, outputLines);
|
|
|
|
final outputContent = inputLines.join('\n');
|
|
|
|
final outputFile = File(pubspecOutputPath);
|
2023-09-21 14:16:27 +00:00
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(outputContent);
|
|
|
|
}
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
Future<void> generateWalletTypes(
|
|
|
|
{required bool hasMonero,
|
|
|
|
required bool hasBitcoin,
|
|
|
|
required bool hasHaven,
|
|
|
|
required bool hasEthereum,
|
|
|
|
required bool hasNano,
|
|
|
|
required bool hasBanano,
|
2023-12-02 02:26:43 +00:00
|
|
|
required bool hasBitcoinCash,
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
required bool hasPolygon,
|
|
|
|
required bool hasSolana}) async {
|
2021-12-24 12:52:08 +00:00
|
|
|
final walletTypesFile = File(walletTypesPath);
|
2023-09-21 14:16:27 +00:00
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
if (walletTypesFile.existsSync()) {
|
|
|
|
await walletTypesFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
const outputHeader = "import 'package:cw_core/wallet_type.dart';";
|
|
|
|
const outputDefinition = 'final availableWalletTypes = <WalletType>[';
|
|
|
|
var outputContent = outputHeader + '\n\n' + outputDefinition + '\n';
|
|
|
|
|
|
|
|
if (hasMonero) {
|
|
|
|
outputContent += '\tWalletType.monero,\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasBitcoin) {
|
2023-08-04 17:01:49 +00:00
|
|
|
outputContent += '\tWalletType.bitcoin,\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasEthereum) {
|
|
|
|
outputContent += '\tWalletType.ethereum,\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasBitcoin) {
|
|
|
|
outputContent += '\tWalletType.litecoin,\n';
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
if (hasBitcoinCash) {
|
|
|
|
outputContent += '\tWalletType.bitcoinCash,\n';
|
|
|
|
}
|
|
|
|
|
2023-12-02 02:26:43 +00:00
|
|
|
if (hasPolygon) {
|
|
|
|
outputContent += '\tWalletType.polygon,\n';
|
|
|
|
}
|
|
|
|
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
if (hasSolana) {
|
|
|
|
outputContent += '\tWalletType.solana,\n';
|
|
|
|
}
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
if (hasNano) {
|
|
|
|
outputContent += '\tWalletType.nano,\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasBanano) {
|
|
|
|
outputContent += '\tWalletType.banano,\n';
|
|
|
|
}
|
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
if (hasHaven) {
|
|
|
|
outputContent += '\tWalletType.haven,\n';
|
|
|
|
}
|
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
outputContent += '];\n';
|
|
|
|
await walletTypesFile.writeAsString(outputContent);
|
2023-08-24 13:54:05 +00:00
|
|
|
}
|