2024-04-20 23:20:52 +00:00
|
|
|
import 'dart:async';
|
2024-08-19 16:30:25 +00:00
|
|
|
import 'dart:convert';
|
2024-08-19 18:33:05 +00:00
|
|
|
import 'package:convert/convert.dart' as convert;
|
2024-04-25 14:23:01 +00:00
|
|
|
import 'dart:math';
|
2024-04-27 13:26:43 +00:00
|
|
|
import 'package:collection/collection.dart';
|
2024-04-22 23:26:34 +00:00
|
|
|
import 'package:crypto/crypto.dart';
|
2024-06-08 12:26:48 +00:00
|
|
|
import 'package:cw_core/cake_hive.dart';
|
|
|
|
import 'package:cw_core/mweb_utxo.dart';
|
2024-07-01 17:05:07 +00:00
|
|
|
import 'package:cw_mweb/mwebd.pbgrpc.dart';
|
2024-04-25 14:23:01 +00:00
|
|
|
import 'package:fixnum/fixnum.dart';
|
2024-08-09 20:15:30 +00:00
|
|
|
import 'package:bip39/bip39.dart' as bip39;
|
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:bitcoin_base/bitcoin_base.dart';
|
2024-08-11 23:49:45 +00:00
|
|
|
import 'package:blockchain_utils/blockchain_utils.dart';
|
2024-08-17 23:10:27 +00:00
|
|
|
import 'package:blockchain_utils/signer/ecdsa_signing_key.dart';
|
2024-08-09 20:15:30 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_mnemonic.dart';
|
|
|
|
import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
|
2024-04-23 12:37:44 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_unspent.dart';
|
2024-04-22 16:18:18 +00:00
|
|
|
import 'package:cw_bitcoin/electrum_transaction_info.dart';
|
2024-04-26 11:32:38 +00:00
|
|
|
import 'package:cw_bitcoin/pending_bitcoin_transaction.dart';
|
2024-04-28 10:17:28 +00:00
|
|
|
import 'package:cw_bitcoin/utils.dart';
|
2024-08-26 17:06:54 +00:00
|
|
|
import 'package:cw_bitcoin/electrum_derivations.dart';
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
import 'package:cw_core/encryption_file_utils.dart';
|
2022-10-12 17:09:57 +00:00
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
2024-04-25 14:23:01 +00:00
|
|
|
import 'package:cw_core/pending_transaction.dart';
|
2024-04-21 11:19:44 +00:00
|
|
|
import 'package:cw_core/sync_status.dart';
|
2024-04-22 16:18:18 +00:00
|
|
|
import 'package:cw_core/transaction_direction.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_core/unspent_coins_info.dart';
|
2024-08-09 20:15:30 +00:00
|
|
|
import 'package:cw_bitcoin/electrum_balance.dart';
|
|
|
|
import 'package:cw_bitcoin/electrum_wallet.dart';
|
|
|
|
import 'package:cw_bitcoin/electrum_wallet_snapshot.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_bitcoin/litecoin_wallet_addresses.dart';
|
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
2024-08-09 20:15:30 +00:00
|
|
|
import 'package:cw_core/wallet_info.dart';
|
|
|
|
import 'package:cw_core/wallet_keys_file.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
2024-09-19 22:35:47 +00:00
|
|
|
import 'package:grpc/grpc.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:mobx/mobx.dart';
|
2024-04-22 16:18:18 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2024-04-20 23:20:52 +00:00
|
|
|
import 'package:cw_mweb/cw_mweb.dart';
|
2024-08-17 23:10:27 +00:00
|
|
|
import 'package:bitcoin_base/src/crypto/keypair/sign_utils.dart';
|
|
|
|
import 'package:pointycastle/ecc/api.dart';
|
|
|
|
import 'package:pointycastle/ecc/curves/secp256k1.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
part 'litecoin_wallet.g.dart';
|
|
|
|
|
|
|
|
class LitecoinWallet = LitecoinWalletBase with _$LitecoinWallet;
|
|
|
|
|
|
|
|
abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
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
|
|
|
LitecoinWalletBase({
|
|
|
|
required String mnemonic,
|
|
|
|
required String password,
|
|
|
|
required WalletInfo walletInfo,
|
|
|
|
required Box<UnspentCoinsInfo> unspentCoinsInfo,
|
|
|
|
required Uint8List seedBytes,
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
required EncryptionFileUtils encryptionFileUtils,
|
2024-08-26 17:06:54 +00:00
|
|
|
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
|
|
|
String? addressPageType,
|
|
|
|
List<BitcoinAddressRecord>? initialAddresses,
|
2024-09-11 21:17:06 +00:00
|
|
|
List<BitcoinAddressRecord>? initialMwebAddresses,
|
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
|
|
|
ElectrumBalance? initialBalance,
|
|
|
|
Map<String, int>? initialRegularAddressIndex,
|
|
|
|
Map<String, int>? initialChangeAddressIndex,
|
2024-06-24 19:48:42 +00:00
|
|
|
int? initialMwebHeight,
|
2024-07-22 17:08:19 +00:00
|
|
|
bool? alwaysScan,
|
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
|
|
|
}) : super(
|
2024-06-24 19:48:42 +00:00
|
|
|
mnemonic: mnemonic,
|
|
|
|
password: password,
|
|
|
|
walletInfo: walletInfo,
|
|
|
|
unspentCoinsInfo: unspentCoinsInfo,
|
2024-08-12 17:54:24 +00:00
|
|
|
network: LitecoinNetwork.mainnet,
|
2024-06-24 19:48:42 +00:00
|
|
|
initialAddresses: initialAddresses,
|
|
|
|
initialBalance: initialBalance,
|
|
|
|
seedBytes: seedBytes,
|
2024-08-13 04:25:04 +00:00
|
|
|
encryptionFileUtils: encryptionFileUtils,
|
2024-06-24 19:48:42 +00:00
|
|
|
currency: CryptoCurrency.ltc,
|
|
|
|
) {
|
2024-08-12 21:55:55 +00:00
|
|
|
mwebHd = Bip32Slip10Secp256k1.fromSeed(seedBytes).derivePath("m/1000'") as Bip32Slip10Secp256k1;
|
2024-07-22 17:08:19 +00:00
|
|
|
mwebEnabled = alwaysScan ?? false;
|
2021-12-24 12:52:08 +00:00
|
|
|
walletAddresses = LitecoinWalletAddresses(
|
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
|
|
|
walletInfo,
|
|
|
|
initialAddresses: initialAddresses,
|
|
|
|
initialRegularAddressIndex: initialRegularAddressIndex,
|
|
|
|
initialChangeAddressIndex: initialChangeAddressIndex,
|
2024-09-11 21:17:06 +00:00
|
|
|
initialMwebAddresses: initialMwebAddresses,
|
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
|
|
|
mainHd: hd,
|
2024-08-11 23:49:45 +00:00
|
|
|
sideHd: accountHD.childKey(Bip32KeyIndex(1)),
|
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
|
|
|
network: network,
|
2024-05-17 07:06:06 +00:00
|
|
|
mwebHd: mwebHd,
|
2024-08-19 19:11:08 +00:00
|
|
|
mwebEnabled: mwebEnabled,
|
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
|
|
|
);
|
2024-01-23 05:15:24 +00:00
|
|
|
autorun((_) {
|
|
|
|
this.walletAddresses.isEnabledAutoGenerateSubaddress = this.isEnabledAutoGenerateSubaddress;
|
|
|
|
});
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
2024-08-12 17:54:24 +00:00
|
|
|
late final Bip32Slip10Secp256k1 mwebHd;
|
2024-06-08 12:26:48 +00:00
|
|
|
late final Box<MwebUtxo> mwebUtxosBox;
|
2024-05-29 15:54:50 +00:00
|
|
|
Timer? _syncTimer;
|
2024-09-23 21:26:56 +00:00
|
|
|
Timer? _stuckSyncTimer;
|
2024-08-14 19:31:27 +00:00
|
|
|
Timer? _feeRatesTimer;
|
2024-07-17 21:32:07 +00:00
|
|
|
StreamSubscription<Utxo>? _utxoStream;
|
2024-07-11 17:54:44 +00:00
|
|
|
late RpcClient _stub;
|
2024-07-22 17:08:19 +00:00
|
|
|
late bool mwebEnabled;
|
2024-04-22 16:18:18 +00:00
|
|
|
|
2024-08-12 17:54:24 +00:00
|
|
|
List<int> get scanSecret => mwebHd.childKey(Bip32KeyIndex(0x80000000)).privateKey.privKey.raw;
|
|
|
|
List<int> get spendSecret => mwebHd.childKey(Bip32KeyIndex(0x80000001)).privateKey.privKey.raw;
|
|
|
|
|
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
|
|
|
static Future<LitecoinWallet> create(
|
|
|
|
{required String mnemonic,
|
|
|
|
required String password,
|
|
|
|
required WalletInfo walletInfo,
|
|
|
|
required Box<UnspentCoinsInfo> unspentCoinsInfo,
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
required EncryptionFileUtils encryptionFileUtils,
|
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
|
|
|
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
|
|
|
String? addressPageType,
|
|
|
|
List<BitcoinAddressRecord>? initialAddresses,
|
2024-09-11 21:17:06 +00:00
|
|
|
List<BitcoinAddressRecord>? initialMwebAddresses,
|
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
|
|
|
ElectrumBalance? initialBalance,
|
|
|
|
Map<String, int>? initialRegularAddressIndex,
|
|
|
|
Map<String, int>? initialChangeAddressIndex}) async {
|
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
|
|
|
late Uint8List seedBytes;
|
|
|
|
|
|
|
|
switch (walletInfo.derivationInfo?.derivationType) {
|
|
|
|
case DerivationType.bip39:
|
|
|
|
seedBytes = await bip39.mnemonicToSeed(
|
|
|
|
mnemonic,
|
|
|
|
passphrase: passphrase ?? "",
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case DerivationType.electrum:
|
|
|
|
default:
|
2024-08-26 17:06:54 +00:00
|
|
|
seedBytes = await mnemonicToSeedBytes(mnemonic, passphrase: passphrase ?? "");
|
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
|
|
|
break;
|
|
|
|
}
|
2022-10-12 17:09:57 +00:00
|
|
|
return LitecoinWallet(
|
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
|
|
|
mnemonic: mnemonic,
|
|
|
|
password: password,
|
|
|
|
walletInfo: walletInfo,
|
|
|
|
unspentCoinsInfo: unspentCoinsInfo,
|
|
|
|
initialAddresses: initialAddresses,
|
2024-09-11 21:17:06 +00:00
|
|
|
initialMwebAddresses: initialMwebAddresses,
|
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
|
|
|
initialBalance: initialBalance,
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
encryptionFileUtils: encryptionFileUtils,
|
2024-08-26 17:06:54 +00:00
|
|
|
passphrase: passphrase,
|
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
|
|
|
seedBytes: seedBytes,
|
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
|
|
|
initialRegularAddressIndex: initialRegularAddressIndex,
|
|
|
|
initialChangeAddressIndex: initialChangeAddressIndex,
|
|
|
|
addressPageType: addressPageType,
|
|
|
|
);
|
2022-10-12 17:09:57 +00:00
|
|
|
}
|
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
static Future<LitecoinWallet> open({
|
2022-10-12 17:09:57 +00:00
|
|
|
required String name,
|
|
|
|
required WalletInfo walletInfo,
|
|
|
|
required Box<UnspentCoinsInfo> unspentCoinsInfo,
|
|
|
|
required String password,
|
2024-07-22 17:08:19 +00:00
|
|
|
required bool alwaysScan,
|
2024-08-13 04:25:04 +00:00
|
|
|
required EncryptionFileUtils encryptionFileUtils,
|
2021-12-24 12:52:08 +00:00
|
|
|
}) async {
|
2024-08-09 20:15:30 +00:00
|
|
|
final hasKeysFile = await WalletKeysFile.hasKeysFile(name, walletInfo.type);
|
|
|
|
|
|
|
|
ElectrumWalletSnapshot? snp = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
snp = await ElectrumWalletSnapshot.load(
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
encryptionFileUtils,
|
|
|
|
name,
|
|
|
|
walletInfo.type,
|
|
|
|
password,
|
|
|
|
LitecoinNetwork.mainnet,
|
|
|
|
);
|
2024-08-09 20:15:30 +00:00
|
|
|
} catch (e) {
|
|
|
|
if (!hasKeysFile) rethrow;
|
|
|
|
}
|
|
|
|
|
|
|
|
final WalletKeysData keysData;
|
|
|
|
// Migrate wallet from the old scheme to then new .keys file scheme
|
|
|
|
if (!hasKeysFile) {
|
|
|
|
keysData =
|
|
|
|
WalletKeysData(mnemonic: snp!.mnemonic, xPub: snp.xpub, passphrase: snp.passphrase);
|
|
|
|
} else {
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
keysData = await WalletKeysFile.readKeysFile(
|
|
|
|
name,
|
|
|
|
walletInfo.type,
|
|
|
|
password,
|
|
|
|
encryptionFileUtils,
|
|
|
|
);
|
2024-08-09 20:15:30 +00:00
|
|
|
}
|
|
|
|
|
2024-08-26 17:06:54 +00:00
|
|
|
walletInfo.derivationInfo ??= DerivationInfo();
|
|
|
|
|
|
|
|
// set the default if not present:
|
|
|
|
walletInfo.derivationInfo!.derivationPath ??= snp?.derivationPath ?? electrum_path;
|
|
|
|
walletInfo.derivationInfo!.derivationType ??= snp?.derivationType ?? DerivationType.electrum;
|
|
|
|
|
|
|
|
Uint8List? seedBytes = null;
|
|
|
|
final mnemonic = keysData.mnemonic;
|
|
|
|
final passphrase = keysData.passphrase;
|
|
|
|
|
|
|
|
if (mnemonic != null) {
|
|
|
|
switch (walletInfo.derivationInfo?.derivationType) {
|
|
|
|
case DerivationType.bip39:
|
|
|
|
seedBytes = await bip39.mnemonicToSeed(
|
|
|
|
mnemonic,
|
|
|
|
passphrase: passphrase ?? "",
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case DerivationType.electrum:
|
|
|
|
default:
|
|
|
|
seedBytes = await mnemonicToSeedBytes(mnemonic, passphrase: passphrase ?? "");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
return LitecoinWallet(
|
2024-08-09 20:15:30 +00:00
|
|
|
mnemonic: keysData.mnemonic!,
|
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
|
|
|
password: password,
|
|
|
|
walletInfo: walletInfo,
|
|
|
|
unspentCoinsInfo: unspentCoinsInfo,
|
2024-08-09 20:15:30 +00:00
|
|
|
initialAddresses: snp?.addresses,
|
2024-09-11 21:17:06 +00:00
|
|
|
initialMwebAddresses: snp?.mwebAddresses,
|
2024-08-09 20:15:30 +00:00
|
|
|
initialBalance: snp?.balance,
|
2024-08-26 17:06:54 +00:00
|
|
|
seedBytes: seedBytes!,
|
|
|
|
passphrase: passphrase,
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
encryptionFileUtils: encryptionFileUtils,
|
2024-08-09 20:15:30 +00:00
|
|
|
initialRegularAddressIndex: snp?.regularAddressIndex,
|
|
|
|
initialChangeAddressIndex: snp?.changeAddressIndex,
|
|
|
|
addressPageType: snp?.addressPageType,
|
2024-08-14 18:31:28 +00:00
|
|
|
alwaysScan: alwaysScan,
|
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
|
|
|
);
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 20:00:10 +00:00
|
|
|
Future<void> waitForMwebAddresses() async {
|
|
|
|
// ensure that we have the full 1000 mweb addresses generated before continuing:
|
|
|
|
final mwebAddrs = (walletAddresses as LitecoinWalletAddresses).mwebAddrs;
|
|
|
|
while (mwebAddrs.length < 1000) {
|
|
|
|
print("waiting for mweb addresses to finish generating...");
|
|
|
|
await Future.delayed(const Duration(milliseconds: 1000));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-20 23:20:52 +00:00
|
|
|
@action
|
|
|
|
@override
|
|
|
|
Future<void> startSync() async {
|
2024-08-23 21:52:40 +00:00
|
|
|
print("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
|
2024-08-23 19:17:28 +00:00
|
|
|
syncStatus = SyncronizingSyncStatus();
|
2024-07-19 06:37:29 +00:00
|
|
|
await subscribeForUpdates();
|
|
|
|
|
2024-09-13 05:53:04 +00:00
|
|
|
await updateFeeRates();
|
2024-08-14 19:31:27 +00:00
|
|
|
_feeRatesTimer?.cancel();
|
|
|
|
_feeRatesTimer =
|
|
|
|
Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
|
2024-07-19 06:37:29 +00:00
|
|
|
|
2024-08-23 19:17:28 +00:00
|
|
|
if (!mwebEnabled) {
|
2024-08-23 21:25:33 +00:00
|
|
|
try {
|
|
|
|
await updateAllUnspents();
|
2024-09-23 17:07:39 +00:00
|
|
|
await updateTransactions();
|
2024-08-23 21:25:33 +00:00
|
|
|
await updateBalance();
|
|
|
|
syncStatus = SyncedSyncStatus();
|
|
|
|
} catch (e, s) {
|
|
|
|
print(e);
|
|
|
|
print(s);
|
|
|
|
syncStatus = FailedSyncStatus();
|
|
|
|
}
|
2024-08-23 19:17:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-09-11 20:00:10 +00:00
|
|
|
await waitForMwebAddresses();
|
2024-09-19 22:35:47 +00:00
|
|
|
try {
|
|
|
|
await getStub();
|
|
|
|
await processMwebUtxos();
|
|
|
|
await updateTransactions();
|
|
|
|
await updateUnspent();
|
|
|
|
await updateBalance();
|
|
|
|
} catch (e) {
|
|
|
|
print("failed to start mweb sync: $e");
|
|
|
|
syncStatus = FailedSyncStatus();
|
|
|
|
return;
|
|
|
|
}
|
2024-08-23 19:17:28 +00:00
|
|
|
|
2024-05-29 15:54:50 +00:00
|
|
|
_syncTimer?.cancel();
|
2024-09-13 05:53:04 +00:00
|
|
|
_syncTimer = Timer.periodic(const Duration(milliseconds: 1500), (timer) async {
|
|
|
|
if (syncStatus is FailedSyncStatus) return;
|
2024-09-11 23:14:04 +00:00
|
|
|
|
2024-09-13 05:53:04 +00:00
|
|
|
final nodeHeight =
|
|
|
|
await electrumClient.getCurrentBlockChainTip() ?? 0; // current block height of our node
|
2024-09-19 22:35:47 +00:00
|
|
|
final resp = await CwMweb.status(StatusRequest());
|
2024-08-14 19:31:27 +00:00
|
|
|
|
2024-09-13 05:53:04 +00:00
|
|
|
if (resp.blockHeaderHeight < nodeHeight) {
|
|
|
|
int h = resp.blockHeaderHeight;
|
|
|
|
syncStatus = SyncingSyncStatus(nodeHeight - h, h / nodeHeight);
|
|
|
|
} else if (resp.mwebHeaderHeight < nodeHeight) {
|
|
|
|
int h = resp.mwebHeaderHeight;
|
|
|
|
syncStatus = SyncingSyncStatus(nodeHeight - h, h / nodeHeight);
|
|
|
|
} else if (resp.mwebUtxosHeight < nodeHeight) {
|
|
|
|
syncStatus = SyncingSyncStatus(1, 0.999);
|
|
|
|
} else {
|
|
|
|
// prevent unnecessary reaction triggers:
|
|
|
|
if (syncStatus is! SyncedSyncStatus) {
|
|
|
|
syncStatus = SyncedSyncStatus();
|
|
|
|
}
|
2024-05-29 15:54:50 +00:00
|
|
|
|
2024-09-13 05:53:04 +00:00
|
|
|
if (resp.mwebUtxosHeight > walletInfo.restoreHeight) {
|
|
|
|
await walletInfo.updateRestoreHeight(resp.mwebUtxosHeight);
|
|
|
|
await checkMwebUtxosSpent();
|
|
|
|
// update the confirmations for each transaction:
|
|
|
|
for (final transaction in transactionHistory.transactions.values) {
|
|
|
|
if (transaction.isPending) continue;
|
|
|
|
int txHeight = transaction.height ?? resp.mwebUtxosHeight;
|
|
|
|
final confirmations = (resp.mwebUtxosHeight - txHeight) + 1;
|
|
|
|
if (transaction.confirmations == confirmations) continue;
|
|
|
|
transaction.confirmations = confirmations;
|
|
|
|
transactionHistory.addOne(transaction);
|
2024-07-17 21:59:25 +00:00
|
|
|
}
|
2024-09-13 05:53:04 +00:00
|
|
|
await transactionHistory.save();
|
2024-07-17 21:59:25 +00:00
|
|
|
}
|
2024-09-23 21:26:56 +00:00
|
|
|
return;
|
2024-09-13 05:53:04 +00:00
|
|
|
}
|
|
|
|
});
|
2024-09-11 23:14:04 +00:00
|
|
|
|
2024-09-13 05:53:04 +00:00
|
|
|
// setup a watch dog to restart the sync process if it gets stuck:
|
|
|
|
List<double> lastFewProgresses = [];
|
2024-09-23 21:26:56 +00:00
|
|
|
_stuckSyncTimer?.cancel();
|
|
|
|
_stuckSyncTimer = Timer.periodic(const Duration(seconds: 10), (timer) async {
|
2024-09-13 05:53:04 +00:00
|
|
|
if (syncStatus is! SyncingSyncStatus) return;
|
2024-09-23 21:26:56 +00:00
|
|
|
if (syncStatus.progress() > 0.98) return; // don't check if we're close to synced
|
2024-09-13 05:53:04 +00:00
|
|
|
lastFewProgresses.add(syncStatus.progress());
|
2024-09-23 21:26:56 +00:00
|
|
|
if (lastFewProgresses.length < 10) return;
|
|
|
|
// limit list size to 10:
|
|
|
|
while (lastFewProgresses.length > 10) {
|
2024-09-13 05:53:04 +00:00
|
|
|
lastFewProgresses.removeAt(0);
|
|
|
|
}
|
2024-09-23 21:26:56 +00:00
|
|
|
// if the progress is the same over the last 100 seconds, restart the sync:
|
2024-09-13 05:53:04 +00:00
|
|
|
if (lastFewProgresses.every((p) => p == lastFewProgresses.first)) {
|
|
|
|
print("mweb syncing is stuck, restarting...");
|
2024-09-23 21:26:56 +00:00
|
|
|
syncStatus = LostConnectionSyncStatus();
|
2024-09-13 05:53:04 +00:00
|
|
|
await stopSync();
|
|
|
|
}
|
2024-05-29 15:54:50 +00:00
|
|
|
});
|
2024-04-22 23:26:34 +00:00
|
|
|
}
|
|
|
|
|
2024-07-17 16:27:31 +00:00
|
|
|
@action
|
|
|
|
@override
|
|
|
|
Future<void> stopSync() async {
|
2024-08-29 21:53:10 +00:00
|
|
|
print("STOPPING SYNC");
|
2024-07-17 16:27:31 +00:00
|
|
|
_syncTimer?.cancel();
|
2024-07-17 21:32:07 +00:00
|
|
|
_utxoStream?.cancel();
|
2024-09-24 00:20:17 +00:00
|
|
|
_stuckSyncTimer?.cancel();
|
2024-09-24 00:20:46 +00:00
|
|
|
_feeRatesTimer?.cancel();
|
2024-07-17 16:27:31 +00:00
|
|
|
await CwMweb.stop();
|
2024-09-18 18:32:01 +00:00
|
|
|
await super.stopSync();
|
2024-07-17 16:27:31 +00:00
|
|
|
}
|
|
|
|
|
2024-06-08 12:26:48 +00:00
|
|
|
Future<void> initMwebUtxosBox() async {
|
|
|
|
final boxName = "${walletInfo.name.replaceAll(" ", "_")}_${MwebUtxo.boxName}";
|
|
|
|
|
|
|
|
mwebUtxosBox = await CakeHive.openBox<MwebUtxo>(boxName);
|
|
|
|
}
|
|
|
|
|
2024-07-19 06:37:29 +00:00
|
|
|
@override
|
|
|
|
Future<void> renameWalletFiles(String newWalletName) async {
|
|
|
|
// rename the hive box:
|
|
|
|
final oldBoxName = "${walletInfo.name.replaceAll(" ", "_")}_${MwebUtxo.boxName}";
|
|
|
|
final newBoxName = "${newWalletName.replaceAll(" ", "_")}_${MwebUtxo.boxName}";
|
|
|
|
|
2024-09-09 19:49:22 +00:00
|
|
|
final oldBox = await CakeHive.openBox<MwebUtxo>(oldBoxName);
|
2024-07-19 06:37:29 +00:00
|
|
|
mwebUtxosBox = await CakeHive.openBox<MwebUtxo>(newBoxName);
|
|
|
|
for (final key in oldBox.keys) {
|
|
|
|
await mwebUtxosBox.put(key, oldBox.get(key)!);
|
|
|
|
}
|
2024-09-09 19:49:22 +00:00
|
|
|
oldBox.deleteFromDisk();
|
2024-07-19 06:37:29 +00:00
|
|
|
|
|
|
|
await super.renameWalletFiles(newWalletName);
|
|
|
|
}
|
|
|
|
|
2024-06-28 16:16:54 +00:00
|
|
|
@action
|
|
|
|
@override
|
|
|
|
Future<void> rescan({
|
|
|
|
required int height,
|
|
|
|
int? chainTip,
|
|
|
|
ScanData? scanData,
|
|
|
|
bool? doSingleScan,
|
|
|
|
bool? usingElectrs,
|
|
|
|
}) async {
|
2024-08-27 15:44:18 +00:00
|
|
|
_syncTimer?.cancel();
|
2024-08-27 16:10:25 +00:00
|
|
|
int oldHeight = walletInfo.restoreHeight;
|
2024-07-01 17:05:07 +00:00
|
|
|
await walletInfo.updateRestoreHeight(height);
|
2024-08-27 16:10:25 +00:00
|
|
|
|
|
|
|
// go through mwebUtxos and clear any that are above the new restore height:
|
|
|
|
if (height == 0) {
|
|
|
|
await mwebUtxosBox.clear();
|
|
|
|
transactionHistory.clear();
|
|
|
|
} else {
|
|
|
|
for (final utxo in mwebUtxosBox.values) {
|
|
|
|
if (utxo.height > height) {
|
|
|
|
await mwebUtxosBox.delete(utxo.outputId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// TODO: remove transactions that are above the new restore height!
|
|
|
|
}
|
2024-07-22 19:32:57 +00:00
|
|
|
|
|
|
|
// reset coin balances and txCount to 0:
|
|
|
|
unspentCoins.forEach((coin) {
|
|
|
|
if (coin.bitcoinAddressRecord is! BitcoinSilentPaymentAddressRecord)
|
|
|
|
coin.bitcoinAddressRecord.balance = 0;
|
|
|
|
coin.bitcoinAddressRecord.txCount = 0;
|
|
|
|
});
|
|
|
|
|
|
|
|
for (var addressRecord in walletAddresses.allAddresses) {
|
|
|
|
addressRecord.balance = 0;
|
|
|
|
addressRecord.txCount = 0;
|
|
|
|
}
|
|
|
|
|
2024-07-01 16:00:41 +00:00
|
|
|
await startSync();
|
2024-06-28 16:16:54 +00:00
|
|
|
}
|
|
|
|
|
2024-06-08 12:26:48 +00:00
|
|
|
@override
|
|
|
|
Future<void> init() async {
|
2024-07-01 17:05:07 +00:00
|
|
|
await super.init();
|
2024-06-08 12:26:48 +00:00
|
|
|
await initMwebUtxosBox();
|
|
|
|
}
|
2024-04-22 23:26:34 +00:00
|
|
|
|
2024-07-01 17:05:07 +00:00
|
|
|
Future<void> handleIncoming(MwebUtxo utxo, RpcClient stub) async {
|
|
|
|
final status = await stub.status(StatusRequest());
|
|
|
|
var date = DateTime.now();
|
|
|
|
var confirmations = 0;
|
|
|
|
if (utxo.height > 0) {
|
|
|
|
date = DateTime.fromMillisecondsSinceEpoch(utxo.blockTime * 1000);
|
|
|
|
confirmations = status.blockHeaderHeight - utxo.height + 1;
|
|
|
|
}
|
|
|
|
var tx = transactionHistory.transactions.values
|
|
|
|
.firstWhereOrNull((tx) => tx.outputAddresses?.contains(utxo.outputId) ?? false);
|
|
|
|
|
|
|
|
if (tx == null) {
|
|
|
|
tx = ElectrumTransactionInfo(
|
|
|
|
WalletType.litecoin,
|
|
|
|
id: utxo.outputId,
|
|
|
|
height: utxo.height,
|
|
|
|
amount: utxo.value.toInt(),
|
|
|
|
fee: 0,
|
|
|
|
direction: TransactionDirection.incoming,
|
|
|
|
isPending: utxo.height == 0,
|
|
|
|
date: date,
|
|
|
|
confirmations: confirmations,
|
|
|
|
inputAddresses: [],
|
|
|
|
outputAddresses: [utxo.outputId],
|
2024-09-23 05:29:37 +00:00
|
|
|
isReplaced: false,
|
2024-07-01 17:05:07 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-07-19 06:37:29 +00:00
|
|
|
// don't update the confirmations if the tx is updated by electrum:
|
|
|
|
if (tx.confirmations == 0 || utxo.height != 0) {
|
|
|
|
tx.height = utxo.height;
|
|
|
|
tx.isPending = utxo.height == 0;
|
|
|
|
tx.confirmations = confirmations;
|
|
|
|
}
|
|
|
|
|
2024-09-11 15:50:50 +00:00
|
|
|
bool isNew = transactionHistory.transactions[tx.id] == null;
|
|
|
|
|
2024-07-01 17:05:07 +00:00
|
|
|
if (!(tx.outputAddresses?.contains(utxo.address) ?? false)) {
|
|
|
|
tx.outputAddresses?.add(utxo.address);
|
|
|
|
isNew = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isNew) {
|
|
|
|
final addressRecord = walletAddresses.allAddresses
|
|
|
|
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
|
|
|
|
if (addressRecord == null) {
|
2024-08-14 19:31:27 +00:00
|
|
|
print("we don't have this address in the wallet! ${utxo.address}");
|
2024-07-01 17:05:07 +00:00
|
|
|
return;
|
|
|
|
}
|
2024-07-22 19:32:57 +00:00
|
|
|
|
|
|
|
// if our address isn't in the inputs, update the txCount:
|
|
|
|
final inputAddresses = tx.inputAddresses ?? [];
|
|
|
|
if (!inputAddresses.contains(utxo.address)) {
|
2024-07-11 22:55:37 +00:00
|
|
|
addressRecord.txCount++;
|
|
|
|
}
|
2024-07-22 19:32:57 +00:00
|
|
|
|
2024-07-01 17:05:07 +00:00
|
|
|
addressRecord.balance += utxo.value.toInt();
|
|
|
|
addressRecord.setAsUsed();
|
2024-07-22 19:32:57 +00:00
|
|
|
}
|
2024-07-10 19:45:30 +00:00
|
|
|
|
2024-07-22 19:32:57 +00:00
|
|
|
transactionHistory.addOne(tx);
|
|
|
|
|
|
|
|
if (isNew) {
|
2024-07-10 19:45:30 +00:00
|
|
|
// update the unconfirmed balance when a new tx is added:
|
2024-07-22 19:32:57 +00:00
|
|
|
// we do this after adding the tx to the history so that sub address balances are updated correctly
|
|
|
|
// (since that calculation is based on the tx history)
|
2024-07-10 19:45:30 +00:00
|
|
|
await updateBalance();
|
2024-07-01 17:05:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-22 23:26:34 +00:00
|
|
|
Future<void> processMwebUtxos() async {
|
2024-09-03 18:05:55 +00:00
|
|
|
if (!mwebEnabled) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-06-28 16:16:54 +00:00
|
|
|
int restoreHeight = walletInfo.restoreHeight;
|
|
|
|
print("SCANNING FROM HEIGHT: $restoreHeight");
|
2024-08-12 17:54:24 +00:00
|
|
|
final req = UtxosRequest(scanSecret: scanSecret, fromHeight: restoreHeight);
|
2024-06-24 19:48:42 +00:00
|
|
|
|
2024-07-12 20:40:37 +00:00
|
|
|
// process new utxos as they come in:
|
2024-07-17 21:32:07 +00:00
|
|
|
_utxoStream?.cancel();
|
2024-09-19 22:35:47 +00:00
|
|
|
ResponseStream<Utxo>? responseStream = await CwMweb.utxos(req);
|
|
|
|
if (responseStream == null) {
|
|
|
|
throw Exception("failed to get utxos stream!");
|
|
|
|
}
|
|
|
|
_utxoStream = responseStream.listen((Utxo sUtxo) async {
|
2024-06-24 19:48:42 +00:00
|
|
|
final utxo = MwebUtxo(
|
|
|
|
address: sUtxo.address,
|
|
|
|
blockTime: sUtxo.blockTime,
|
|
|
|
height: sUtxo.height,
|
|
|
|
outputId: sUtxo.outputId,
|
|
|
|
value: sUtxo.value.toInt(),
|
|
|
|
);
|
|
|
|
|
2024-08-14 19:31:27 +00:00
|
|
|
// if (mwebUtxosBox.containsKey(utxo.outputId)) {
|
|
|
|
// // we've already stored this utxo, skip it:
|
|
|
|
// return;
|
|
|
|
// }
|
2024-07-17 21:32:07 +00:00
|
|
|
|
|
|
|
await updateUnspent();
|
|
|
|
await updateBalance();
|
2024-06-24 19:48:42 +00:00
|
|
|
|
|
|
|
final mwebAddrs = (walletAddresses as LitecoinWalletAddresses).mwebAddrs;
|
|
|
|
|
2024-07-12 20:40:37 +00:00
|
|
|
// don't process utxos with addresses that are not in the mwebAddrs list:
|
2024-07-12 00:22:35 +00:00
|
|
|
if (utxo.address.isNotEmpty && !mwebAddrs.contains(utxo.address)) {
|
2024-07-17 21:32:07 +00:00
|
|
|
return;
|
2024-06-24 19:48:42 +00:00
|
|
|
}
|
2024-07-09 23:14:53 +00:00
|
|
|
|
2024-06-24 19:48:42 +00:00
|
|
|
await mwebUtxosBox.put(utxo.outputId, utxo);
|
2024-07-09 23:14:53 +00:00
|
|
|
|
2024-07-11 17:54:44 +00:00
|
|
|
await handleIncoming(utxo, _stub);
|
2024-07-17 21:32:07 +00:00
|
|
|
});
|
2024-04-20 23:20:52 +00:00
|
|
|
}
|
|
|
|
|
2024-04-22 23:26:34 +00:00
|
|
|
Future<void> checkMwebUtxosSpent() async {
|
2024-09-03 18:05:55 +00:00
|
|
|
if (!mwebEnabled) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:26:43 +00:00
|
|
|
while ((await Future.wait(transactionHistory.transactions.values
|
2024-05-29 15:54:50 +00:00
|
|
|
.where((tx) => tx.direction == TransactionDirection.outgoing && tx.isPending)
|
|
|
|
.map(checkPendingTransaction)))
|
|
|
|
.any((x) => x));
|
2024-09-11 15:50:50 +00:00
|
|
|
|
2024-05-29 15:54:50 +00:00
|
|
|
final outputIds =
|
2024-06-24 19:48:42 +00:00
|
|
|
mwebUtxosBox.values.where((utxo) => utxo.height > 0).map((utxo) => utxo.outputId).toList();
|
2024-06-19 02:07:13 +00:00
|
|
|
|
2024-09-19 22:35:47 +00:00
|
|
|
final resp = await CwMweb.spent(SpentRequest(outputId: outputIds));
|
2024-04-22 23:26:34 +00:00
|
|
|
final spent = resp.outputId;
|
|
|
|
if (spent.isEmpty) return;
|
2024-09-19 22:35:47 +00:00
|
|
|
final status = await CwMweb.status(StatusRequest());
|
2024-04-22 23:26:34 +00:00
|
|
|
final height = await electrumClient.getCurrentBlockChainTip();
|
2024-04-24 10:53:43 +00:00
|
|
|
if (height == null || status.blockHeaderHeight != height) return;
|
|
|
|
if (status.mwebUtxosHeight != height) return;
|
2024-09-11 15:50:50 +00:00
|
|
|
|
2024-04-22 23:26:34 +00:00
|
|
|
int amount = 0;
|
|
|
|
Set<String> inputAddresses = {};
|
2024-08-19 17:14:00 +00:00
|
|
|
var output = convert.AccumulatorSink<Digest>();
|
2024-04-22 23:26:34 +00:00
|
|
|
var input = sha256.startChunkedConversion(output);
|
2024-09-11 15:50:50 +00:00
|
|
|
|
2024-04-22 23:26:34 +00:00
|
|
|
for (final outputId in spent) {
|
2024-06-19 02:07:13 +00:00
|
|
|
final utxo = mwebUtxosBox.get(outputId);
|
2024-06-24 19:48:42 +00:00
|
|
|
await mwebUtxosBox.delete(outputId);
|
2024-04-27 13:26:43 +00:00
|
|
|
if (utxo == null) continue;
|
2024-05-29 15:54:50 +00:00
|
|
|
final addressRecord = walletAddresses.allAddresses
|
|
|
|
.firstWhere((addressRecord) => addressRecord.address == utxo.address);
|
2024-07-12 20:40:37 +00:00
|
|
|
if (!inputAddresses.contains(utxo.address)) {
|
|
|
|
addressRecord.txCount++;
|
|
|
|
}
|
2024-04-23 17:31:30 +00:00
|
|
|
addressRecord.balance -= utxo.value.toInt();
|
|
|
|
amount += utxo.value.toInt();
|
|
|
|
inputAddresses.add(utxo.address);
|
2024-04-27 13:26:43 +00:00
|
|
|
input.add(hex.decode(outputId));
|
2024-04-22 23:26:34 +00:00
|
|
|
}
|
2024-09-11 15:50:50 +00:00
|
|
|
|
2024-04-27 13:26:43 +00:00
|
|
|
if (inputAddresses.isEmpty) return;
|
2024-04-22 23:26:34 +00:00
|
|
|
input.close();
|
|
|
|
var digest = output.events.single;
|
2024-07-09 23:14:53 +00:00
|
|
|
final tx = ElectrumTransactionInfo(
|
|
|
|
WalletType.litecoin,
|
|
|
|
id: digest.toString(),
|
|
|
|
height: height,
|
|
|
|
amount: amount,
|
|
|
|
fee: 0,
|
|
|
|
direction: TransactionDirection.outgoing,
|
|
|
|
isPending: false,
|
|
|
|
date: DateTime.fromMillisecondsSinceEpoch(status.blockTime * 1000),
|
|
|
|
confirmations: 1,
|
|
|
|
inputAddresses: inputAddresses.toList(),
|
|
|
|
outputAddresses: [],
|
2024-09-23 05:29:37 +00:00
|
|
|
isReplaced: false,
|
2024-07-09 23:14:53 +00:00
|
|
|
);
|
2024-06-24 19:48:42 +00:00
|
|
|
|
2024-04-22 23:26:34 +00:00
|
|
|
transactionHistory.addOne(tx);
|
|
|
|
await transactionHistory.save();
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:26:43 +00:00
|
|
|
Future<bool> checkPendingTransaction(ElectrumTransactionInfo tx) async {
|
2024-09-03 18:05:55 +00:00
|
|
|
if (!mwebEnabled) return false;
|
2024-04-27 13:26:43 +00:00
|
|
|
if (!tx.isPending) return false;
|
|
|
|
final outputId = <String>[], target = <String>{};
|
|
|
|
final isHash = RegExp(r'^[a-f0-9]{64}$').hasMatch;
|
|
|
|
final spendingOutputIds = tx.inputAddresses?.where(isHash) ?? [];
|
|
|
|
final payingToOutputIds = tx.outputAddresses?.where(isHash) ?? [];
|
|
|
|
outputId.addAll(spendingOutputIds);
|
|
|
|
outputId.addAll(payingToOutputIds);
|
|
|
|
target.addAll(spendingOutputIds);
|
|
|
|
for (final outputId in payingToOutputIds) {
|
2024-05-29 15:54:50 +00:00
|
|
|
final spendingTx = transactionHistory.transactions.values
|
|
|
|
.firstWhereOrNull((tx) => tx.inputAddresses?.contains(outputId) ?? false);
|
2024-07-09 23:14:53 +00:00
|
|
|
if (spendingTx != null && !spendingTx.isPending) {
|
|
|
|
target.add(outputId);
|
|
|
|
}
|
2024-04-27 13:26:43 +00:00
|
|
|
}
|
2024-07-11 17:54:44 +00:00
|
|
|
if (outputId.isEmpty) {
|
|
|
|
return false;
|
|
|
|
}
|
2024-09-19 22:35:47 +00:00
|
|
|
final resp = await CwMweb.spent(SpentRequest(outputId: outputId));
|
2024-04-27 16:40:47 +00:00
|
|
|
if (!setEquals(resp.outputId.toSet(), target)) return false;
|
2024-09-19 22:35:47 +00:00
|
|
|
final status = await CwMweb.status(StatusRequest());
|
2024-04-27 13:26:43 +00:00
|
|
|
if (!tx.isPending) return false;
|
|
|
|
tx.height = status.mwebUtxosHeight;
|
|
|
|
tx.confirmations = 1;
|
|
|
|
tx.isPending = false;
|
2024-04-28 10:17:28 +00:00
|
|
|
await transactionHistory.save();
|
2024-04-27 13:26:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-05-30 02:08:33 +00:00
|
|
|
Future<void> updateUnspent() async {
|
2024-04-23 12:37:44 +00:00
|
|
|
await checkMwebUtxosSpent();
|
2024-08-23 19:17:28 +00:00
|
|
|
await updateAllUnspents();
|
2024-07-11 17:54:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
@action
|
|
|
|
Future<void> updateAllUnspents() async {
|
2024-08-23 19:17:28 +00:00
|
|
|
// get ltc unspents:
|
|
|
|
await super.updateAllUnspents();
|
2024-06-24 19:48:42 +00:00
|
|
|
|
2024-08-23 19:17:28 +00:00
|
|
|
if (!mwebEnabled) {
|
|
|
|
return;
|
2024-07-19 06:37:29 +00:00
|
|
|
}
|
2024-08-23 22:04:26 +00:00
|
|
|
await getStub();
|
|
|
|
|
2024-08-23 19:17:28 +00:00
|
|
|
// add the mweb unspents to the list:
|
|
|
|
List<BitcoinUnspent> mwebUnspentCoins = [];
|
|
|
|
// update mweb unspents:
|
|
|
|
final mwebAddrs = (walletAddresses as LitecoinWalletAddresses).mwebAddrs;
|
|
|
|
mwebUtxosBox.keys.forEach((dynamic oId) {
|
|
|
|
final String outputId = oId as String;
|
|
|
|
final utxo = mwebUtxosBox.get(outputId);
|
|
|
|
if (utxo == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (utxo.address.isEmpty) {
|
|
|
|
// not sure if a bug or a special case but we definitely ignore these
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
final addressRecord = walletAddresses.allAddresses
|
|
|
|
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
|
2024-08-12 17:54:24 +00:00
|
|
|
|
2024-08-23 19:17:28 +00:00
|
|
|
if (addressRecord == null) {
|
|
|
|
print("utxo contains an address that is not in the wallet: ${utxo.address}");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
final unspent = BitcoinUnspent(
|
|
|
|
addressRecord,
|
|
|
|
outputId,
|
|
|
|
utxo.value.toInt(),
|
|
|
|
mwebAddrs.indexOf(utxo.address),
|
|
|
|
);
|
|
|
|
if (unspent.vout == 0) {
|
|
|
|
unspent.isChange = true;
|
|
|
|
}
|
|
|
|
mwebUnspentCoins.add(unspent);
|
|
|
|
});
|
|
|
|
unspentCoins.addAll(mwebUnspentCoins);
|
2024-04-23 12:37:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2024-04-23 16:16:47 +00:00
|
|
|
Future<ElectrumBalance> fetchBalances() async {
|
|
|
|
final balance = await super.fetchBalances();
|
2024-08-23 21:52:40 +00:00
|
|
|
if (!mwebEnabled) {
|
|
|
|
return balance;
|
|
|
|
}
|
2024-08-23 22:04:26 +00:00
|
|
|
await getStub();
|
|
|
|
|
2024-08-23 19:17:28 +00:00
|
|
|
int confirmed = balance.confirmed;
|
|
|
|
int unconfirmed = balance.unconfirmed;
|
2024-09-12 20:15:20 +00:00
|
|
|
int confirmedMweb = 0;
|
|
|
|
int unconfirmedMweb = 0;
|
2024-08-23 21:25:33 +00:00
|
|
|
try {
|
|
|
|
mwebUtxosBox.values.forEach((utxo) {
|
|
|
|
if (utxo.height > 0) {
|
2024-09-12 20:15:20 +00:00
|
|
|
confirmedMweb += utxo.value.toInt();
|
2024-08-23 21:25:33 +00:00
|
|
|
} else {
|
2024-09-12 20:15:20 +00:00
|
|
|
unconfirmedMweb += utxo.value.toInt();
|
2024-08-23 21:25:33 +00:00
|
|
|
}
|
|
|
|
});
|
2024-09-23 21:29:13 +00:00
|
|
|
if (unconfirmedMweb > 0) {
|
2024-09-13 20:03:02 +00:00
|
|
|
unconfirmedMweb = -1 * (confirmedMweb - unconfirmedMweb);
|
|
|
|
}
|
2024-08-23 21:25:33 +00:00
|
|
|
} catch (_) {}
|
2024-07-11 18:49:14 +00:00
|
|
|
|
|
|
|
// update unspent balances:
|
2024-08-23 21:25:33 +00:00
|
|
|
await updateUnspent();
|
2024-08-23 21:52:40 +00:00
|
|
|
|
2024-07-22 19:32:57 +00:00
|
|
|
for (var addressRecord in walletAddresses.allAddresses) {
|
|
|
|
addressRecord.balance = 0;
|
|
|
|
addressRecord.txCount = 0;
|
|
|
|
}
|
2024-07-11 18:49:14 +00:00
|
|
|
|
|
|
|
unspentCoins.forEach((coin) {
|
|
|
|
final coinInfoList = unspentCoinsInfo.values.where(
|
|
|
|
(element) =>
|
|
|
|
element.walletId.contains(id) &&
|
|
|
|
element.hash.contains(coin.hash) &&
|
|
|
|
element.vout == coin.vout,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (coinInfoList.isNotEmpty) {
|
|
|
|
final coinInfo = coinInfoList.first;
|
|
|
|
|
|
|
|
coin.isFrozen = coinInfo.isFrozen;
|
|
|
|
coin.isSending = coinInfo.isSending;
|
|
|
|
coin.note = coinInfo.note;
|
|
|
|
if (coin.bitcoinAddressRecord is! BitcoinSilentPaymentAddressRecord)
|
|
|
|
coin.bitcoinAddressRecord.balance += coinInfo.value;
|
|
|
|
} else {
|
|
|
|
super.addCoinInfo(coin);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-07-22 19:32:57 +00:00
|
|
|
// update the txCount for each address using the tx history, since we can't rely on mwebd
|
|
|
|
// to have an accurate count, we should just keep it in sync with what we know from the tx history:
|
2024-08-14 19:31:27 +00:00
|
|
|
for (final tx in transactionHistory.transactions.values) {
|
|
|
|
// if (tx.isPending) continue;
|
2024-08-23 19:17:28 +00:00
|
|
|
if (tx.inputAddresses == null || tx.outputAddresses == null) {
|
|
|
|
continue;
|
|
|
|
}
|
2024-07-12 00:22:35 +00:00
|
|
|
final txAddresses = tx.inputAddresses! + tx.outputAddresses!;
|
2024-08-14 19:31:27 +00:00
|
|
|
for (final address in txAddresses) {
|
2024-07-12 00:22:35 +00:00
|
|
|
final addressRecord = walletAddresses.allAddresses
|
|
|
|
.firstWhereOrNull((addressRecord) => addressRecord.address == address);
|
|
|
|
if (addressRecord == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
addressRecord.txCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-12 20:15:20 +00:00
|
|
|
return ElectrumBalance(
|
|
|
|
confirmed: confirmed,
|
|
|
|
unconfirmed: unconfirmed,
|
|
|
|
frozen: balance.frozen,
|
|
|
|
secondConfirmed: confirmedMweb,
|
|
|
|
secondUnconfirmed: unconfirmedMweb,
|
|
|
|
);
|
2024-04-23 16:16:47 +00:00
|
|
|
}
|
|
|
|
|
2021-12-24 12:52:08 +00:00
|
|
|
@override
|
|
|
|
int feeRate(TransactionPriority priority) {
|
|
|
|
if (priority is LitecoinTransactionPriority) {
|
|
|
|
switch (priority) {
|
|
|
|
case LitecoinTransactionPriority.slow:
|
|
|
|
return 1;
|
|
|
|
case LitecoinTransactionPriority.medium:
|
|
|
|
return 2;
|
|
|
|
case LitecoinTransactionPriority.fast:
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2024-04-25 14:23:01 +00:00
|
|
|
|
|
|
|
@override
|
2024-05-29 16:18:21 +00:00
|
|
|
Future<int> calcFee({
|
|
|
|
required List<UtxoWithAddress> utxos,
|
|
|
|
required List<BitcoinBaseOutput> outputs,
|
|
|
|
required BasedUtxoNetwork network,
|
|
|
|
String? memo,
|
|
|
|
required int feeRate,
|
|
|
|
List<ECPrivateInfo>? inputPrivKeyInfos,
|
|
|
|
List<Outpoint>? vinOutpoints,
|
|
|
|
}) async {
|
2024-04-25 22:13:41 +00:00
|
|
|
final spendsMweb = utxos.any((utxo) => utxo.utxo.scriptType == SegwitAddresType.mweb);
|
2024-05-29 15:54:50 +00:00
|
|
|
final paysToMweb = outputs
|
|
|
|
.any((output) => output.toOutput.scriptPubKey.getAddressType() == SegwitAddresType.mweb);
|
2024-04-25 22:13:41 +00:00
|
|
|
if (!spendsMweb && !paysToMweb) {
|
2024-05-29 16:18:21 +00:00
|
|
|
return await super.calcFee(
|
|
|
|
utxos: utxos,
|
|
|
|
outputs: outputs,
|
|
|
|
network: network,
|
|
|
|
memo: memo,
|
|
|
|
feeRate: feeRate,
|
|
|
|
inputPrivKeyInfos: inputPrivKeyInfos,
|
|
|
|
vinOutpoints: vinOutpoints,
|
|
|
|
);
|
2024-04-25 22:13:41 +00:00
|
|
|
}
|
2024-09-03 18:05:55 +00:00
|
|
|
|
|
|
|
if (!mwebEnabled) {
|
|
|
|
throw Exception("MWEB is not enabled! can't calculate fee without starting the mweb server!");
|
|
|
|
}
|
|
|
|
|
2024-04-26 00:07:58 +00:00
|
|
|
if (outputs.length == 1 && outputs[0].toOutput.amount == BigInt.zero) {
|
2024-05-29 15:54:50 +00:00
|
|
|
outputs = [
|
|
|
|
BitcoinScriptOutput(
|
|
|
|
script: outputs[0].toOutput.scriptPubKey, value: utxos.sumOfUtxosValue())
|
|
|
|
];
|
2024-04-26 00:07:58 +00:00
|
|
|
}
|
2024-09-09 20:24:50 +00:00
|
|
|
// https://github.com/ltcmweb/mwebd?tab=readme-ov-file#fee-estimation
|
2024-05-29 15:54:50 +00:00
|
|
|
final preOutputSum =
|
|
|
|
outputs.fold<BigInt>(BigInt.zero, (acc, output) => acc + output.toOutput.amount);
|
2024-04-26 10:19:40 +00:00
|
|
|
final fee = utxos.sumOfUtxosValue() - preOutputSum;
|
2024-05-29 15:54:50 +00:00
|
|
|
final txb =
|
|
|
|
BitcoinTransactionBuilder(utxos: utxos, outputs: outputs, fee: fee, network: network);
|
2024-09-19 22:35:47 +00:00
|
|
|
final resp = await CwMweb.create(CreateRequest(
|
2024-04-25 14:23:01 +00:00
|
|
|
rawTx: txb.buildTransaction((a, b, c, d) => '').toBytes(),
|
2024-08-12 17:54:24 +00:00
|
|
|
scanSecret: scanSecret,
|
|
|
|
spendSecret: spendSecret,
|
2024-04-25 14:23:01 +00:00
|
|
|
feeRatePerKb: Int64(feeRate * 1000),
|
|
|
|
dryRun: true));
|
|
|
|
final tx = BtcTransaction.fromRaw(hex.encode(resp.rawTx));
|
2024-05-29 15:54:50 +00:00
|
|
|
final posUtxos = utxos
|
|
|
|
.where((utxo) => tx.inputs
|
|
|
|
.any((input) => input.txId == utxo.utxo.txHash && input.txIndex == utxo.utxo.vout))
|
|
|
|
.toList();
|
2024-04-25 14:23:01 +00:00
|
|
|
final posOutputSum = tx.outputs.fold<int>(0, (acc, output) => acc + output.amount.toInt());
|
|
|
|
final mwebInputSum = utxos.sumOfUtxosValue() - posUtxos.sumOfUtxosValue();
|
2024-04-26 10:19:40 +00:00
|
|
|
final expectedPegin = max(0, (preOutputSum - mwebInputSum).toInt());
|
|
|
|
var feeIncrease = posOutputSum - expectedPegin;
|
2024-04-28 10:17:28 +00:00
|
|
|
if (expectedPegin > 0 && fee == BigInt.zero) {
|
2024-05-29 15:54:50 +00:00
|
|
|
feeIncrease += await super.calcFee(
|
|
|
|
utxos: posUtxos,
|
|
|
|
outputs: tx.outputs
|
|
|
|
.map((output) =>
|
|
|
|
BitcoinScriptOutput(script: output.scriptPubKey, value: output.amount))
|
|
|
|
.toList(),
|
|
|
|
network: network,
|
|
|
|
memo: memo,
|
|
|
|
feeRate: feeRate) +
|
|
|
|
feeRate * 41;
|
2024-04-25 14:23:01 +00:00
|
|
|
}
|
2024-04-26 10:19:40 +00:00
|
|
|
return fee.toInt() + feeIncrease;
|
2024-04-25 14:23:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<PendingTransaction> createTransaction(Object credentials) async {
|
2024-06-24 19:48:42 +00:00
|
|
|
try {
|
2024-07-19 06:37:29 +00:00
|
|
|
var tx = await super.createTransaction(credentials) as PendingBitcoinTransaction;
|
|
|
|
tx.isMweb = mwebEnabled;
|
|
|
|
|
|
|
|
if (!mwebEnabled) {
|
|
|
|
return tx;
|
|
|
|
}
|
2024-09-11 20:00:10 +00:00
|
|
|
await waitForMwebAddresses();
|
2024-08-23 22:04:26 +00:00
|
|
|
await getStub();
|
2024-06-28 16:16:54 +00:00
|
|
|
|
2024-09-19 22:35:47 +00:00
|
|
|
final resp = await CwMweb.create(CreateRequest(
|
2024-04-26 11:32:38 +00:00
|
|
|
rawTx: hex.decode(tx.hex),
|
2024-08-12 17:54:24 +00:00
|
|
|
scanSecret: scanSecret,
|
|
|
|
spendSecret: spendSecret,
|
2024-06-24 19:48:42 +00:00
|
|
|
feeRatePerKb: Int64.parseInt(tx.feeRate) * 1000,
|
|
|
|
));
|
|
|
|
final tx2 = BtcTransaction.fromRaw(hex.encode(resp.rawTx));
|
2024-09-20 00:15:37 +00:00
|
|
|
|
|
|
|
// check if any of the inputs of this transaction are hog-ex:
|
|
|
|
tx2.inputs.forEach((txInput) {
|
|
|
|
bool isHogEx = true;
|
|
|
|
|
|
|
|
final utxo = unspentCoins
|
|
|
|
.firstWhere((utxo) => utxo.hash == txInput.txId && utxo.vout == txInput.txIndex);
|
|
|
|
|
|
|
|
// TODO: detect actual hog-ex inputs
|
|
|
|
|
|
|
|
if (!isHogEx) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int confirmations = utxo.confirmations ?? 0;
|
|
|
|
if (confirmations < 6) {
|
|
|
|
throw Exception(
|
|
|
|
"A transaction input has less than 6 confirmations, please try again later.");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-06-24 19:48:42 +00:00
|
|
|
tx.hexOverride = tx2
|
|
|
|
.copyWith(
|
|
|
|
witnesses: tx2.inputs.asMap().entries.map((e) {
|
|
|
|
final utxo = unspentCoins
|
|
|
|
.firstWhere((utxo) => utxo.hash == e.value.txId && utxo.vout == e.value.txIndex);
|
|
|
|
final key = generateECPrivate(
|
|
|
|
hd: utxo.bitcoinAddressRecord.isHidden
|
|
|
|
? walletAddresses.sideHd
|
|
|
|
: walletAddresses.mainHd,
|
|
|
|
index: utxo.bitcoinAddressRecord.index,
|
|
|
|
network: network);
|
|
|
|
final digest = tx2.getTransactionSegwitDigit(
|
2024-05-29 15:54:50 +00:00
|
|
|
txInIndex: e.key,
|
|
|
|
script: key.getPublic().toP2pkhAddress().toScriptPubKey(),
|
2024-06-24 19:48:42 +00:00
|
|
|
amount: BigInt.from(utxo.value),
|
|
|
|
);
|
|
|
|
return TxWitnessInput(stack: [key.signInput(digest), key.getPublic().toHex()]);
|
|
|
|
}).toList())
|
|
|
|
.toHex();
|
2024-09-20 18:56:04 +00:00
|
|
|
tx.outputAddresses = resp.outputId;
|
2024-09-23 17:07:39 +00:00
|
|
|
|
2024-06-24 19:48:42 +00:00
|
|
|
return tx
|
|
|
|
..addListener((transaction) async {
|
2024-07-16 04:58:11 +00:00
|
|
|
final addresses = <String>{};
|
|
|
|
transaction.inputAddresses?.forEach((id) async {
|
|
|
|
final utxo = mwebUtxosBox.get(id);
|
2024-09-13 20:03:02 +00:00
|
|
|
// await mwebUtxosBox.delete(id);
|
2024-07-16 04:58:11 +00:00
|
|
|
if (utxo == null) return;
|
2024-07-17 21:03:47 +00:00
|
|
|
final addressRecord = walletAddresses.allAddresses
|
|
|
|
.firstWhere((addressRecord) => addressRecord.address == utxo.address);
|
2024-07-16 04:58:11 +00:00
|
|
|
if (!addresses.contains(utxo.address)) {
|
|
|
|
addresses.add(utxo.address);
|
|
|
|
}
|
2024-07-17 21:03:47 +00:00
|
|
|
addressRecord.balance -= utxo.value.toInt();
|
2024-07-16 04:58:11 +00:00
|
|
|
});
|
|
|
|
transaction.inputAddresses?.addAll(addresses);
|
2024-07-12 20:40:37 +00:00
|
|
|
|
2024-07-16 04:56:20 +00:00
|
|
|
transactionHistory.addOne(transaction);
|
2024-06-24 19:48:42 +00:00
|
|
|
await updateUnspent();
|
|
|
|
await updateBalance();
|
2024-05-29 15:54:50 +00:00
|
|
|
});
|
2024-06-24 19:48:42 +00:00
|
|
|
} catch (e, s) {
|
|
|
|
print(e);
|
|
|
|
print(s);
|
2024-07-17 20:45:47 +00:00
|
|
|
if (e.toString().contains("commit failed")) {
|
|
|
|
throw Exception("Transaction commit failed (no peers responded), please try again.");
|
|
|
|
}
|
2024-06-24 19:48:42 +00:00
|
|
|
rethrow;
|
|
|
|
}
|
2024-04-25 14:23:01 +00:00
|
|
|
}
|
2024-06-08 12:26:48 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> save() async {
|
|
|
|
await super.save();
|
|
|
|
}
|
2024-07-17 16:41:26 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> close() async {
|
2024-07-19 16:15:28 +00:00
|
|
|
_utxoStream?.cancel();
|
2024-09-23 21:26:56 +00:00
|
|
|
_stuckSyncTimer?.cancel();
|
|
|
|
_feeRatesTimer?.cancel();
|
2024-07-17 16:41:26 +00:00
|
|
|
_syncTimer?.cancel();
|
2024-09-23 23:18:38 +00:00
|
|
|
await stopSync();
|
|
|
|
await super.close();
|
2024-07-17 16:41:26 +00:00
|
|
|
}
|
2024-07-19 06:37:29 +00:00
|
|
|
|
2024-09-09 20:24:50 +00:00
|
|
|
Future<void> setMwebEnabled(bool enabled) async {
|
2024-07-22 18:21:04 +00:00
|
|
|
if (mwebEnabled == enabled) {
|
|
|
|
return;
|
2024-07-19 06:37:29 +00:00
|
|
|
}
|
2024-07-22 18:21:04 +00:00
|
|
|
|
2024-07-19 06:37:29 +00:00
|
|
|
mwebEnabled = enabled;
|
2024-08-19 19:11:08 +00:00
|
|
|
(walletAddresses as LitecoinWalletAddresses).mwebEnabled = enabled;
|
2024-09-09 20:24:50 +00:00
|
|
|
await stopSync();
|
|
|
|
await startSync();
|
2024-07-19 06:37:29 +00:00
|
|
|
}
|
2024-08-14 18:31:28 +00:00
|
|
|
|
|
|
|
Future<RpcClient> getStub() async {
|
|
|
|
_stub = await CwMweb.stub();
|
|
|
|
return _stub;
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<StatusResponse> getStatusRequest() async {
|
2024-09-19 22:35:47 +00:00
|
|
|
final resp = await CwMweb.status(StatusRequest());
|
2024-08-14 18:31:28 +00:00
|
|
|
return resp;
|
|
|
|
}
|
2024-08-19 16:02:15 +00:00
|
|
|
|
2024-08-17 23:10:27 +00:00
|
|
|
@override
|
|
|
|
Future<String> signMessage(String message, {String? address = null}) async {
|
|
|
|
final index = address != null
|
|
|
|
? walletAddresses.allAddresses.firstWhere((element) => element.address == address).index
|
|
|
|
: null;
|
|
|
|
final HD = index == null ? hd : hd.childKey(Bip32KeyIndex(index));
|
|
|
|
final priv = ECPrivate.fromHex(HD.privateKey.privKey.toHex());
|
|
|
|
|
|
|
|
final privateKey = ECDSAPrivateKey.fromBytes(
|
|
|
|
priv.toBytes(),
|
|
|
|
Curves.generatorSecp256k1,
|
|
|
|
);
|
|
|
|
|
|
|
|
final signature =
|
|
|
|
signLitecoinMessage(utf8.encode(message), privateKey: privateKey, bipPrive: priv.prive);
|
|
|
|
|
|
|
|
return base64Encode(signature);
|
|
|
|
}
|
|
|
|
|
|
|
|
List<int> _magicPrefix(List<int> message, List<int> messagePrefix) {
|
|
|
|
final encodeLength = IntUtils.encodeVarint(message.length);
|
|
|
|
|
|
|
|
return [...messagePrefix, ...encodeLength, ...message];
|
|
|
|
}
|
|
|
|
|
|
|
|
List<int> signLitecoinMessage(List<int> message,
|
|
|
|
{required ECDSAPrivateKey privateKey, required Bip32PrivateKey bipPrive}) {
|
|
|
|
String messagePrefix = '\x19Litecoin Signed Message:\n';
|
|
|
|
final messageHash = QuickCrypto.sha256Hash(magicMessage(message, messagePrefix));
|
|
|
|
final signingKey = EcdsaSigningKey(privateKey);
|
|
|
|
ECDSASignature ecdsaSign =
|
|
|
|
signingKey.signDigestDeterminstic(digest: messageHash, hashFunc: () => SHA256());
|
|
|
|
final n = Curves.generatorSecp256k1.order! >> 1;
|
|
|
|
BigInt newS;
|
|
|
|
if (ecdsaSign.s.compareTo(n) > 0) {
|
|
|
|
newS = Curves.generatorSecp256k1.order! - ecdsaSign.s;
|
|
|
|
} else {
|
|
|
|
newS = ecdsaSign.s;
|
|
|
|
}
|
|
|
|
final rawSig = ECDSASignature(ecdsaSign.r, newS);
|
|
|
|
final rawSigBytes = rawSig.toBytes(BitcoinSignerUtils.baselen);
|
|
|
|
|
|
|
|
final pub = bipPrive.publicKey;
|
|
|
|
final ECDomainParameters curve = ECCurve_secp256k1();
|
|
|
|
final point = curve.curve.decodePoint(pub.point.toBytes());
|
|
|
|
|
|
|
|
final rawSigEc = ECSignature(rawSig.r, rawSig.s);
|
|
|
|
|
|
|
|
final recId = SignUtils.findRecoveryId(
|
|
|
|
SignUtils.getHexString(messageHash, offset: 0, length: messageHash.length),
|
|
|
|
rawSigEc,
|
|
|
|
Uint8List.fromList(pub.uncompressed),
|
|
|
|
);
|
|
|
|
|
|
|
|
final v = recId + 27 + (point!.isCompressed ? 4 : 0);
|
|
|
|
|
|
|
|
final combined = Uint8List.fromList([v, ...rawSigBytes]);
|
|
|
|
|
|
|
|
return combined;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<int> magicMessage(List<int> message, String messagePrefix) {
|
|
|
|
final prefixBytes = StringUtils.encode(messagePrefix);
|
|
|
|
final magic = _magicPrefix(message, prefixBytes);
|
|
|
|
return QuickCrypto.sha256Hash(magic);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<bool> verifyMessage(String message, String signature, {String? address = null}) async {
|
|
|
|
if (address == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<int> sigDecodedBytes = [];
|
|
|
|
|
|
|
|
if (signature.endsWith('=')) {
|
|
|
|
sigDecodedBytes = base64.decode(signature);
|
|
|
|
} else {
|
|
|
|
sigDecodedBytes = hex.decode(signature);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sigDecodedBytes.length != 64 && sigDecodedBytes.length != 65) {
|
|
|
|
throw ArgumentException(
|
|
|
|
"litecoin signature must be 64 bytes without recover-id or 65 bytes with recover-id");
|
|
|
|
}
|
|
|
|
|
|
|
|
String messagePrefix = '\x19Litecoin Signed Message:\n';
|
|
|
|
final messageHash = QuickCrypto.sha256Hash(magicMessage(utf8.encode(message), messagePrefix));
|
|
|
|
|
|
|
|
List<int> correctSignature =
|
|
|
|
sigDecodedBytes.length == 65 ? sigDecodedBytes.sublist(1) : List.from(sigDecodedBytes);
|
|
|
|
List<int> rBytes = correctSignature.sublist(0, 32);
|
|
|
|
List<int> sBytes = correctSignature.sublist(32);
|
|
|
|
final sig = ECDSASignature(BigintUtils.fromBytes(rBytes), BigintUtils.fromBytes(sBytes));
|
|
|
|
|
|
|
|
List<int> possibleRecoverIds = [0, 1];
|
|
|
|
|
2024-09-20 14:24:25 +00:00
|
|
|
final baseAddress = RegexUtils.addressTypeFromStr(address, network);
|
2024-08-17 23:10:27 +00:00
|
|
|
|
|
|
|
for (int recoveryId in possibleRecoverIds) {
|
|
|
|
final pubKey = sig.recoverPublicKey(messageHash, Curves.generatorSecp256k1, recoveryId);
|
|
|
|
final recoveredPub = ECPublic.fromBytes(pubKey!.toBytes());
|
|
|
|
|
|
|
|
String? recoveredAddress;
|
|
|
|
|
|
|
|
if (baseAddress is P2pkAddress) {
|
|
|
|
recoveredAddress = recoveredPub.toP2pkAddress().toAddress(network);
|
|
|
|
} else if (baseAddress is P2pkhAddress) {
|
|
|
|
recoveredAddress = recoveredPub.toP2pkhAddress().toAddress(network);
|
|
|
|
} else if (baseAddress is P2wshAddress) {
|
|
|
|
recoveredAddress = recoveredPub.toP2wshAddress().toAddress(network);
|
|
|
|
} else if (baseAddress is P2wpkhAddress) {
|
|
|
|
recoveredAddress = recoveredPub.toP2wpkhAddress().toAddress(network);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recoveredAddress == address) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|