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';
|
2024-02-08 19:45:21 +00:00
|
|
|
const lightningOutputPath = 'lib/lightning/lightning.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';
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
const tronOutputPath = 'lib/tron/tron.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
const walletTypesPath = 'lib/wallet_types.g.dart';
|
2024-05-08 20:23:27 +00:00
|
|
|
const secureStoragePath = 'lib/core/secure_storage.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
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');
|
2024-02-08 19:45:21 +00:00
|
|
|
final hasLightning = args.contains('${prefix}lightning');
|
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');
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
final hasTron = args.contains('${prefix}tron');
|
2024-05-08 20:23:27 +00:00
|
|
|
final excludeFlutterSecureStorage = args.contains('${prefix}excludeFlutterSecureStorage');
|
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);
|
2024-02-08 19:45:21 +00:00
|
|
|
await generateLightning(hasLightning);
|
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);
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
await generateTron(hasTron);
|
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,
|
2024-05-08 20:23:27 +00:00
|
|
|
hasFlutterSecureStorage: !excludeFlutterSecureStorage,
|
2023-12-02 02:26:43 +00:00
|
|
|
hasPolygon: hasPolygon,
|
2024-02-08 19:45:21 +00:00
|
|
|
hasLightning: hasLightning,
|
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,
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
hasTron: hasTron,
|
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,
|
2024-02-13 18:13:17 +00:00
|
|
|
hasLightning: hasLightning,
|
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,
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
hasTron: hasTron,
|
2023-10-05 01:09:07 +00:00
|
|
|
);
|
2024-05-08 20:23:27 +00:00
|
|
|
await injectSecureStorage(!excludeFlutterSecureStorage);
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> generateBitcoin(bool hasImplementation) async {
|
|
|
|
final outputFile = File(bitcoinOutputPath);
|
|
|
|
const bitcoinCommonHeaders = """
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:cw_core/node.dart';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/hardware/hardware_account_data.dart';
|
2024-04-01 13:31:14 +00:00
|
|
|
import 'package:cw_core/pending_transaction.dart';
|
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';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_core/wallet_base.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';
|
2024-03-29 18:51:34 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2024-03-04 17:32:10 +00:00
|
|
|
import 'package:hive/hive.dart';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:ledger_flutter/ledger_flutter.dart';
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
import 'package:bitcoin_base/bitcoin_base.dart';
|
|
|
|
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as btc;
|
|
|
|
import 'package:bip32/bip32.dart' as bip32;
|
|
|
|
import 'package:bip39/bip39.dart' as bip39;
|
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
""";
|
2021-12-24 12:52:08 +00:00
|
|
|
const bitcoinCWHeaders = """
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
import 'package:cw_bitcoin/utils.dart';
|
|
|
|
import 'package:cw_bitcoin/litecoin_network.dart';
|
|
|
|
import 'package:cw_bitcoin/electrum_derivations.dart';
|
|
|
|
import 'package:cw_bitcoin/electrum.dart';
|
2024-04-01 13:31:14 +00:00
|
|
|
import 'package:cw_bitcoin/pending_bitcoin_transaction.dart';
|
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';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_wallet.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';
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
import 'package:cw_bitcoin/script_hash.dart';
|
2024-04-08 14:54:58 +00:00
|
|
|
import 'package:cw_bitcoin/pending_bitcoin_transaction.dart';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_hardware_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();
|
|
|
|
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
WalletCredentials createBitcoinRestoreWalletFromSeedCredentials({
|
|
|
|
required String name,
|
|
|
|
required String mnemonic,
|
|
|
|
required String password,
|
|
|
|
required DerivationType derivationType,
|
|
|
|
required String derivationPath,
|
|
|
|
String? passphrase,
|
|
|
|
});
|
2022-10-12 17:09:57 +00:00
|
|
|
WalletCredentials createBitcoinRestoreWalletFromWIFCredentials({required String name, required String password, required String wif, WalletInfo? walletInfo});
|
|
|
|
WalletCredentials createBitcoinNewWalletCredentials({required String name, WalletInfo? walletInfo});
|
2024-05-05 01:44:50 +00:00
|
|
|
WalletCredentials createBitcoinHardwareWalletCredentials({required String name, required HardwareAccountData accountData, 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-03-21 02:51:57 +00:00
|
|
|
Future<int> estimateFakeSendAllTxAmount(Object wallet, TransactionPriority priority);
|
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);
|
2024-04-08 14:54:58 +00:00
|
|
|
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate, {int? customRate});
|
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();
|
2024-04-08 14:54:58 +00:00
|
|
|
TransactionPriority getBitcoinTransactionPriorityCustom();
|
2022-11-03 23:13:13 +00:00
|
|
|
TransactionPriority getLitecoinTransactionPriorityMedium();
|
|
|
|
TransactionPriority getBitcoinTransactionPrioritySlow();
|
|
|
|
TransactionPriority getLitecoinTransactionPrioritySlow();
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
Future<List<DerivationType>> compareDerivationMethods(
|
|
|
|
{required String mnemonic, required Node node});
|
|
|
|
Future<List<DerivationInfo>> getDerivationsFromMnemonic(
|
|
|
|
{required String mnemonic, required Node node, String? passphrase});
|
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);
|
2024-03-04 17:32:10 +00:00
|
|
|
ReceivePageOption getSelectedAddressType(Object wallet);
|
|
|
|
List<ReceivePageOption> getBitcoinReceivePageOptions();
|
|
|
|
BitcoinAddressType getBitcoinAddressType(ReceivePageOption option);
|
2024-04-01 13:31:14 +00:00
|
|
|
bool hasTaprootInput(PendingTransaction pendingTransaction);
|
2024-04-08 14:54:58 +00:00
|
|
|
|
|
|
|
Future<PendingTransaction> replaceByFee(Object wallet, String transactionHash, String fee);
|
|
|
|
Future<bool> canReplaceByFee(Object wallet, String transactionHash);
|
|
|
|
Future<bool> isChangeSufficientForFee(Object wallet, String txId, String newFee);
|
|
|
|
int getFeeAmountForPriority(Object wallet, TransactionPriority priority, int inputsCount, int outputsCount, {int? size});
|
2024-04-26 16:18:26 +00:00
|
|
|
int getEstimatedFeeWithFeeRate(Object wallet, int feeRate, int? amount, {int? outputsCount, int? size});
|
2024-04-25 16:28:18 +00:00
|
|
|
int getMaxCustomFeeRate(Object wallet);
|
2024-05-05 01:44:50 +00:00
|
|
|
|
|
|
|
void setLedger(WalletBase wallet, Ledger ledger, LedgerDevice device);
|
|
|
|
Future<List<HardwareAccountData>> getHardwareWalletAccounts(LedgerViewModel ledgerVM, {int index = 0, int limit = 5});
|
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 = """
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
2023-08-04 17:01:49 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
|
|
import 'package:cw_core/erc20_token.dart';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_core/hardware/hardware_account_data.dart';
|
2023-08-04 17:01:49 +00:00
|
|
|
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';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:ledger_flutter/ledger_flutter.dart';
|
2024-02-11 00:04:46 +00:00
|
|
|
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';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_evm/evm_chain_hardware_wallet_service.dart';
|
|
|
|
import 'package:cw_evm/evm_ledger_credentials.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_wallet.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: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});
|
2024-05-05 01:44:50 +00:00
|
|
|
WalletCredentials createEthereumHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo});
|
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);
|
2024-05-05 01:44:50 +00:00
|
|
|
|
|
|
|
void setLedger(WalletBase wallet, Ledger ledger, LedgerDevice device);
|
|
|
|
Future<List<HardwareAccountData>> getHardwareWalletAccounts(LedgerViewModel ledgerVM, {int index = 0, int limit = 5});
|
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 = """
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
2023-12-02 02:26:43 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
|
|
import 'package:cw_core/erc20_token.dart';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_core/hardware/hardware_account_data.dart';
|
2023-12-02 02:26:43 +00:00
|
|
|
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';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:ledger_flutter/ledger_flutter.dart';
|
2024-02-11 00:04:46 +00:00
|
|
|
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';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_evm/evm_chain_transaction_credentials.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: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';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cw_evm/evm_chain_hardware_wallet_service.dart';
|
|
|
|
import 'package:cw_evm/evm_ledger_credentials.dart';
|
|
|
|
import 'package:cw_evm/evm_chain_wallet.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: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});
|
2024-05-05 01:44:50 +00:00
|
|
|
WalletCredentials createPolygonHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo});
|
2023-12-02 02:26:43 +00:00
|
|
|
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);
|
2024-05-05 01:44:50 +00:00
|
|
|
|
|
|
|
void setLedger(WalletBase wallet, Ledger ledger, LedgerDevice device);
|
|
|
|
Future<List<HardwareAccountData>> getHardwareWalletAccounts(LedgerViewModel ledgerVM, {int index = 0, int limit = 5});
|
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);
|
|
|
|
}
|
|
|
|
|
2024-02-08 19:45:21 +00:00
|
|
|
Future<void> generateLightning(bool hasImplementation) async {
|
|
|
|
final outputFile = File(lightningOutputPath);
|
|
|
|
const lightningCommonHeaders = """
|
2024-02-13 20:52:02 +00:00
|
|
|
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
2024-02-13 18:59:53 +00:00
|
|
|
import 'package:cw_core/unspent_transaction_output.dart';
|
2024-02-08 19:45:21 +00:00
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
2024-02-13 18:59:53 +00:00
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
|
|
|
import 'package:cw_core/output_info.dart';
|
|
|
|
import 'package:cw_core/unspent_coins_info.dart';
|
2024-02-08 19:45:21 +00:00
|
|
|
import 'package:cw_core/wallet_service.dart';
|
2024-03-05 17:51:20 +00:00
|
|
|
import 'package:cw_core/receive_page_option.dart';
|
|
|
|
import 'package:cw_core/crypto_amount_format.dart';
|
2024-02-13 18:59:53 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
2024-02-23 17:29:11 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2024-02-13 18:59:53 +00:00
|
|
|
import 'package:hive/hive.dart';
|
2024-02-13 21:04:13 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
2024-03-05 19:36:17 +00:00
|
|
|
import 'package:intl/intl.dart';
|
2024-02-08 19:45:21 +00:00
|
|
|
""";
|
|
|
|
const lightningCWHeaders = """
|
2024-02-13 18:32:24 +00:00
|
|
|
import 'package:cw_bitcoin/electrum_wallet.dart';
|
|
|
|
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_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_lightning/lightning_wallet_service.dart';
|
2024-03-05 19:36:17 +00:00
|
|
|
import 'package:cw_lightning/lightning_receive_page_option.dart';
|
2024-02-08 19:45:21 +00:00
|
|
|
""";
|
|
|
|
const lightningCwPart = "part 'cw_lightning.dart';";
|
|
|
|
const lightningContent = """
|
|
|
|
abstract class Lightning {
|
2024-02-13 18:30:24 +00:00
|
|
|
String formatterLightningAmountToString({required int amount});
|
|
|
|
double formatterLightningAmountToDouble({required int amount});
|
|
|
|
int formatterStringDoubleToLightningAmount(String amount);
|
|
|
|
WalletService createLightningWalletService(
|
|
|
|
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
|
2024-03-06 15:44:19 +00:00
|
|
|
List<ReceivePageOption> getLightningReceivePageOptions();
|
2024-03-05 17:51:20 +00:00
|
|
|
String satsToLightningString(int sats);
|
2024-03-06 15:44:19 +00:00
|
|
|
ReceivePageOption getOptionInvoice();
|
|
|
|
ReceivePageOption getOptionOnchain();
|
2024-03-05 17:51:20 +00:00
|
|
|
String bitcoinAmountToLightningString({required int amount});
|
|
|
|
int bitcoinAmountToLightningAmount({required int amount});
|
2024-03-06 19:21:24 +00:00
|
|
|
double bitcoinDoubleToLightningDouble({required double amount});
|
|
|
|
double lightningDoubleToBitcoinDouble({required double amount});
|
2024-02-08 19:45:21 +00:00
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
|
|
|
const lightningEmptyDefinition = 'Lightning? lightning;\n';
|
|
|
|
const lightningCWDefinition = 'Lightning? lightning = CWLightning();\n';
|
|
|
|
|
|
|
|
final output = '$lightningCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$lightningCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$lightningCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? lightningCWDefinition : lightningEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
lightningContent;
|
|
|
|
|
|
|
|
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';
|
2024-04-12 12:36:42 +00:00
|
|
|
import 'package:cw_core/n2_node.dart';
|
2023-10-05 01:09:07 +00:00
|
|
|
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,
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
required DerivationType derivationType,
|
2023-10-05 01:09:07 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
WalletCredentials createNanoRestoreWalletFromKeysCredentials({
|
|
|
|
required String name,
|
|
|
|
required String password,
|
|
|
|
required String seedKey,
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
required DerivationType derivationType,
|
2023-10-05 01:09:07 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2024-04-12 12:36:42 +00:00
|
|
|
Future<List<N2Node>> getN2Reps(Object wallet);
|
|
|
|
bool isRepOk(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,
|
|
|
|
});
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
Future<List<DerivationInfo>> getDerivationsFromMnemonic({
|
|
|
|
String? mnemonic,
|
|
|
|
String? seedKey,
|
|
|
|
required Node node,
|
|
|
|
});
|
2023-10-05 01:09:07 +00:00
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
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);
|
2024-03-29 18:55:29 +00:00
|
|
|
Future<void> addSPLToken(
|
|
|
|
WalletBase wallet,
|
|
|
|
CryptoCurrency token,
|
|
|
|
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
|
|
|
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);
|
2024-03-29 18:55:29 +00:00
|
|
|
double? getEstimateFees(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
|
|
|
}
|
|
|
|
|
|
|
|
""";
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
Future<void> generateTron(bool hasImplementation) async {
|
|
|
|
final outputFile = File(tronOutputPath);
|
|
|
|
const tronCommonHeaders = """
|
|
|
|
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';
|
|
|
|
|
|
|
|
""";
|
|
|
|
const tronCWHeaders = """
|
|
|
|
import 'package:cw_evm/evm_chain_mnemonics.dart';
|
|
|
|
import 'package:cw_tron/tron_transaction_credentials.dart';
|
|
|
|
import 'package:cw_tron/tron_transaction_info.dart';
|
|
|
|
import 'package:cw_tron/tron_wallet_creation_credentials.dart';
|
|
|
|
|
|
|
|
import 'package:cw_tron/tron_client.dart';
|
|
|
|
import 'package:cw_tron/tron_token.dart';
|
|
|
|
import 'package:cw_tron/tron_wallet.dart';
|
|
|
|
import 'package:cw_tron/tron_wallet_service.dart';
|
|
|
|
|
|
|
|
""";
|
|
|
|
const tronCwPart = "part 'cw_tron.dart';";
|
|
|
|
const tronContent = """
|
|
|
|
abstract class Tron {
|
|
|
|
List<String> getTronWordList(String language);
|
|
|
|
WalletService createTronWalletService(Box<WalletInfo> walletInfoSource);
|
|
|
|
WalletCredentials createTronNewWalletCredentials({required String name, WalletInfo? walletInfo});
|
|
|
|
WalletCredentials createTronRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password});
|
|
|
|
WalletCredentials createTronRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
|
|
|
|
String getAddress(WalletBase wallet);
|
|
|
|
|
|
|
|
Object createTronTransactionCredentials(
|
|
|
|
List<Output> outputs, {
|
|
|
|
required CryptoCurrency currency,
|
|
|
|
});
|
|
|
|
|
|
|
|
List<CryptoCurrency> getTronTokenCurrencies(WalletBase wallet);
|
|
|
|
Future<void> addTronToken(WalletBase wallet, CryptoCurrency token, String contractAddress);
|
|
|
|
Future<void> deleteTronToken(WalletBase wallet, CryptoCurrency token);
|
|
|
|
Future<CryptoCurrency?> getTronToken(WalletBase wallet, String contractAddress);
|
|
|
|
|
|
|
|
double getTransactionAmountRaw(TransactionInfo transactionInfo);
|
|
|
|
CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction);
|
|
|
|
String getTokenAddress(CryptoCurrency asset);
|
|
|
|
String getTronBase58Address(String hexAddress, WalletBase wallet);
|
|
|
|
|
|
|
|
String? getTronNativeEstimatedFee(WalletBase wallet);
|
|
|
|
String? getTronTRC20EstimatedFee(WalletBase wallet);
|
2024-05-08 14:26:57 +00:00
|
|
|
|
|
|
|
void updateTronGridUsageState(WalletBase wallet, bool isEnabled);
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
}
|
|
|
|
""";
|
|
|
|
|
|
|
|
const tronEmptyDefinition = 'Tron? tron;\n';
|
|
|
|
const tronCWDefinition = 'Tron? tron = CWTron();\n';
|
|
|
|
|
|
|
|
final output = '$tronCommonHeaders\n' +
|
|
|
|
(hasImplementation ? '$tronCWHeaders\n' : '\n') +
|
|
|
|
(hasImplementation ? '$tronCwPart\n\n' : '\n') +
|
|
|
|
(hasImplementation ? tronCWDefinition : tronEmptyDefinition) +
|
|
|
|
'\n' +
|
|
|
|
tronContent;
|
|
|
|
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|
|
|
|
|
2024-05-06 17:20:19 +00:00
|
|
|
Future<void> generatePubspec({
|
|
|
|
required bool hasMonero,
|
|
|
|
required bool hasBitcoin,
|
|
|
|
required bool hasHaven,
|
|
|
|
required bool hasEthereum,
|
|
|
|
required bool hasNano,
|
|
|
|
required bool hasBanano,
|
|
|
|
required bool hasBitcoinCash,
|
2024-05-10 16:10:03 +00:00
|
|
|
required bool hasFlutterSecureStorage,
|
2024-05-06 17:20:19 +00:00
|
|
|
required bool hasPolygon,
|
|
|
|
required bool hasSolana,
|
|
|
|
required bool hasTron,
|
|
|
|
required bool hasLightning,
|
|
|
|
}) 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
|
|
|
|
""";
|
2024-05-08 20:23:27 +00:00
|
|
|
const flutterSecureStorage = """
|
|
|
|
flutter_secure_storage:
|
|
|
|
git:
|
|
|
|
url: https://github.com/cake-tech/flutter_secure_storage.git
|
|
|
|
path: flutter_secure_storage
|
2024-05-09 13:00:26 +00:00
|
|
|
ref: cake-8.0.0
|
|
|
|
version: 8.0.0
|
2024-05-08 20:23:27 +00:00
|
|
|
""";
|
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
|
2024-05-06 17:20:19 +00:00
|
|
|
""";
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
const cwTron = """
|
|
|
|
cw_tron:
|
|
|
|
path: ./cw_tron
|
2024-05-06 17:20:19 +00:00
|
|
|
""";
|
2024-02-08 19:45:21 +00:00
|
|
|
const cwLightning = """
|
|
|
|
cw_lightning:
|
|
|
|
path: ./cw_lightning
|
2024-05-06 17:20:19 +00:00
|
|
|
""";
|
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');
|
2024-04-25 01:14:11 +00:00
|
|
|
final dependenciesIndex =
|
|
|
|
inputLines.indexWhere((line) => line.toLowerCase().contains('dependencies:'));
|
2021-12-24 12:52:08 +00:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
if (hasTron) {
|
|
|
|
output += '\n$cwTron';
|
|
|
|
}
|
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
if (hasHaven && !hasMonero) {
|
|
|
|
output += '\n$cwSharedExternal\n$cwHaven';
|
|
|
|
} else if (hasHaven) {
|
|
|
|
output += '\n$cwHaven';
|
|
|
|
}
|
|
|
|
|
2024-05-08 20:23:27 +00:00
|
|
|
if (hasFlutterSecureStorage) {
|
|
|
|
output += '\n$flutterSecureStorage\n';
|
|
|
|
}
|
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
|
2024-02-08 19:45:21 +00:00
|
|
|
if (hasLightning) {
|
|
|
|
output += '\n$cwLightning';
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2024-05-06 17:20:19 +00:00
|
|
|
Future<void> generateWalletTypes({
|
|
|
|
required bool hasMonero,
|
|
|
|
required bool hasBitcoin,
|
|
|
|
required bool hasHaven,
|
|
|
|
required bool hasEthereum,
|
|
|
|
required bool hasNano,
|
|
|
|
required bool hasBanano,
|
|
|
|
required bool hasBitcoinCash,
|
|
|
|
required bool hasPolygon,
|
|
|
|
required bool hasSolana,
|
|
|
|
required bool hasTron,
|
|
|
|
required bool hasLightning,
|
|
|
|
}) 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';
|
|
|
|
}
|
|
|
|
|
2024-02-13 18:13:17 +00:00
|
|
|
if (hasLightning) {
|
|
|
|
outputContent += '\tWalletType.lightning,\n';
|
|
|
|
}
|
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
if (hasTron) {
|
|
|
|
outputContent += '\tWalletType.tron,\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
|
|
|
}
|
2024-05-08 20:23:27 +00:00
|
|
|
|
|
|
|
Future<void> injectSecureStorage(bool hasFlutterSecureStorage) async {
|
|
|
|
const flutterSecureStorageHeader = """
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
|
|
""";
|
|
|
|
const abstractSecureStorage = """
|
|
|
|
abstract class SecureStorage {
|
|
|
|
Future<String?> read({required String key});
|
|
|
|
Future<void> write({required String key, required String? value});
|
|
|
|
Future<void> delete({required String key});
|
|
|
|
// Legacy
|
|
|
|
Future<String?> readNoIOptions({required String key});
|
|
|
|
}""";
|
|
|
|
const defaultSecureStorage = """
|
|
|
|
class DefaultSecureStorage extends SecureStorage {
|
|
|
|
DefaultSecureStorage._(this._secureStorage);
|
|
|
|
|
|
|
|
factory DefaultSecureStorage() => _instance;
|
|
|
|
|
|
|
|
static final _instance = DefaultSecureStorage._(FlutterSecureStorage(
|
|
|
|
iOptions: IOSOptions(accessibility: KeychainAccessibility.first_unlock),
|
|
|
|
));
|
|
|
|
|
|
|
|
final FlutterSecureStorage _secureStorage;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<String?> read({required String key}) async => await _readInternal(key, false);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> write({required String key, required String? value}) async {
|
|
|
|
// delete the value before writing on macOS because of a weird bug
|
|
|
|
// https://github.com/mogol/flutter_secure_storage/issues/581
|
|
|
|
if (Platform.isMacOS) {
|
|
|
|
await _secureStorage.delete(key: key);
|
|
|
|
}
|
|
|
|
await _secureStorage.write(key: key, value: value);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> delete({required String key}) async => _secureStorage.delete(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<String?> readNoIOptions({required String key}) async => await _readInternal(key, true);
|
|
|
|
|
2024-05-09 13:00:26 +00:00
|
|
|
Future<String?> _readInternal(String key, bool useNoIOptions) async {
|
|
|
|
return await _secureStorage.read(
|
|
|
|
key: key,
|
|
|
|
iOptions: useNoIOptions ? IOSOptions() : null,
|
|
|
|
);
|
2024-05-08 20:23:27 +00:00
|
|
|
}
|
|
|
|
}""";
|
|
|
|
const fakeSecureStorage = """
|
|
|
|
class FakeSecureStorage extends SecureStorage {
|
|
|
|
@override
|
|
|
|
Future<String?> read({required String key}) async => null;
|
|
|
|
@override
|
|
|
|
Future<void> write({required String key, required String? value}) async {}
|
|
|
|
@override
|
|
|
|
Future<void> delete({required String key}) async {}
|
|
|
|
@override
|
|
|
|
Future<String?> readNoIOptions({required String key}) async => null;
|
|
|
|
}""";
|
|
|
|
final outputFile = File(secureStoragePath);
|
|
|
|
final header = hasFlutterSecureStorage
|
|
|
|
? '${flutterSecureStorageHeader}\n\nfinal SecureStorage secureStorageShared = DefaultSecureStorage();\n'
|
|
|
|
: 'final SecureStorage secureStorageShared = FakeSecureStorage();\n';
|
|
|
|
var output = '';
|
|
|
|
if (outputFile.existsSync()) {
|
|
|
|
await outputFile.delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
output += '${header}\n${abstractSecureStorage}\n\n';
|
|
|
|
|
|
|
|
if (hasFlutterSecureStorage) {
|
|
|
|
output += '${defaultSecureStorage}\n';
|
|
|
|
} else {
|
|
|
|
output += '${fakeSecureStorage}\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
}
|