2024-10-28 12:16:23 -03:00
import ' dart:async ' ;
2024-05-17 08:15:19 -05:00
import ' dart:convert ' ;
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 13:13:30 -03:00
import ' package:bitcoin_base/bitcoin_base.dart ' ;
2024-08-11 20:49:45 -03:00
import ' package:blockchain_utils/blockchain_utils.dart ' ;
2025-04-16 18:17:14 -03:00
import ' package:cw_bitcoin/seedbyte_types.dart ' ;
2024-05-17 08:15:19 -05:00
import ' package:cw_bitcoin/bitcoin_address_record.dart ' ;
2024-12-19 13:18:58 -03:00
import ' package:cw_bitcoin/bitcoin_transaction_credentials.dart ' ;
2025-01-15 17:52:31 -03:00
import ' package:cw_bitcoin/bitcoin_wallet_snapshot.dart ' ;
2024-11-05 12:49:07 -03:00
import ' package:cw_bitcoin/electrum_worker/methods/methods.dart ' ;
2024-12-19 13:18:58 -03:00
import ' package:cw_bitcoin/exceptions.dart ' ;
import ' package:cw_bitcoin/pending_bitcoin_transaction.dart ' ;
2024-10-29 20:52:19 -03:00
import ' package:cw_bitcoin/psbt_transaction_builder.dart ' ;
2024-10-28 12:16:23 -03:00
import ' package:cw_bitcoin/bitcoin_unspent.dart ' ;
import ' package:cw_bitcoin/electrum_transaction_info.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-13 00:18:14 +02:00
import ' package:cw_core/encryption_file_utils.dart ' ;
import ' package:cw_bitcoin/electrum_derivations.dart ' ;
2024-05-17 08:15:19 -05:00
import ' package:cw_bitcoin/bitcoin_wallet_addresses.dart ' ;
import ' package:cw_bitcoin/electrum_wallet.dart ' ;
2022-10-12 13:09:57 -04:00
import ' package:cw_core/crypto_currency.dart ' ;
2024-12-19 13:18:58 -03:00
import ' package:cw_core/pending_transaction.dart ' ;
2024-10-28 12:16:23 -03:00
import ' package:cw_core/sync_status.dart ' ;
import ' package:cw_core/transaction_direction.dart ' ;
2021-12-24 14:52:08 +02:00
import ' package:cw_core/unspent_coins_info.dart ' ;
2024-05-17 08:15:19 -05:00
import ' package:cw_core/wallet_info.dart ' ;
2024-08-09 23:15:30 +03:00
import ' package:cw_core/wallet_keys_file.dart ' ;
2021-12-24 14:52:08 +02:00
import ' package:hive/hive.dart ' ;
2024-05-04 20:44:50 -05:00
import ' package:ledger_bitcoin/ledger_bitcoin.dart ' ;
2024-10-23 17:38:31 +02:00
import ' package:ledger_flutter_plus/ledger_flutter_plus.dart ' ;
2021-12-24 14:52:08 +02:00
import ' package:mobx/mobx.dart ' ;
2025-01-22 20:12:41 -03:00
import ' package:collection/collection.dart ' ;
2021-12-24 14:52:08 +02:00
part ' bitcoin_wallet.g.dart ' ;
class BitcoinWallet = BitcoinWalletBase with _ $BitcoinWallet ;
2025-03-12 14:25:51 -03:00
abstract class BitcoinWalletBase extends ElectrumWallet < BitcoinWalletAddresses > with Store {
2024-11-24 19:05:09 -03:00
@ observable
2025-03-13 16:50:03 -03:00
bool nodeSupportsSilentPayments = false ;
2025-02-18 15:51:28 -03:00
2024-11-24 19:05:09 -03:00
@ observable
bool allowedToSwitchNodesForScanning = false ;
2025-02-18 15:51:28 -03:00
@ observable
bool _silentPaymentsScanningActive = false ;
@ computed
bool get silentPaymentsScanningActive = > _silentPaymentsScanningActive ;
@ observable
bool _alwaysScan ;
@ computed
bool get alwaysScan = > _alwaysScan ;
2025-02-25 16:53:45 -03:00
@ observable
bool _forceStopScanning = false ;
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 13:13:30 -03:00
BitcoinWalletBase ( {
2025-01-21 14:02:01 -03:00
required super . password ,
required super . walletInfo ,
required super . unspentCoinsInfo ,
required super . encryptionFileUtils ,
2025-01-22 20:12:41 -03:00
required super . hdWallets ,
2025-01-21 14:02:01 -03:00
super . mnemonic ,
super . xpub ,
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 13:13:30 -03:00
BasedUtxoNetwork ? networkParam ,
2025-01-21 14:02:01 -03:00
super . initialBalance ,
super . passphrase ,
2025-02-18 15:51:28 -03:00
bool ? alwaysScan ,
2024-11-16 14:53:00 -03:00
super . initialUnspentCoins ,
2025-01-22 20:12:41 -03:00
Map < String , dynamic > ? walletAddressesSnapshot ,
2025-02-18 15:51:28 -03:00
} ) : _alwaysScan = alwaysScan ? ? false ,
super (
2024-08-11 20:49:45 -03:00
network: networkParam = = null
? BitcoinNetwork . mainnet
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* 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
* 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
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* 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]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* 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
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 11:43:48 -03:00
: networkParam = = BitcoinNetwork . mainnet
2024-08-11 20:49:45 -03:00
? BitcoinNetwork . mainnet
: BitcoinNetwork . testnet ,
2024-10-04 11:49:49 -03:00
currency:
networkParam = = BitcoinNetwork . testnet ? CryptoCurrency . tbtc : CryptoCurrency . btc ,
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* 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
* 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
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* 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]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* 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
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 11:43:48 -03:00
) {
2025-01-22 20:12:41 -03:00
if ( walletAddressesSnapshot ! = null ) {
walletAddresses = BitcoinWalletAddressesBase . fromJson (
walletAddressesSnapshot ,
walletInfo ,
network: network ,
isHardwareWallet: isHardwareWallet ,
hdWallets: hdWallets ,
) ;
} else {
this . walletAddresses = BitcoinWalletAddresses (
walletInfo ,
network: networkParam ? ? network ,
isHardwareWallet: isHardwareWallet ,
hdWallets: hdWallets ,
) ;
}
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* 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
* 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
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* 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]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* 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
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 11:43:48 -03:00
2024-01-23 07:15:24 +02:00
autorun ( ( _ ) {
2025-04-18 06:05:32 -03:00
this . walletAddresses . isEnabledAutoGenerateNewAddress = this . isEnabledAutoGenerateSubaddress ;
2024-01-23 07:15:24 +02:00
} ) ;
2021-12-24 14:52:08 +02:00
}
2025-03-21 04:18:47 +02:00
@ override
bool get hasRescan = > true ;
2025-02-11 17:56:12 -03:00
@ override
int get dustAmount = > network = = BitcoinNetwork . testnet ? 0 : 546 ;
Future < bool > get mempoolAPIEnabled async {
bool isMempoolAPIEnabled = ( await sharedPrefs . future ) . getBool ( " use_mempool_fee_api " ) ? ? true ;
return isMempoolAPIEnabled ;
}
2025-04-16 18:17:14 -03:00
@ override
2025-04-22 18:47:13 -03:00
Future < bool ? > initAddresses ( [ bool ? sync ] ) async {
var isDiscovered = await super . initAddresses ( sync ) ;
bool ? discovered ;
// NOTE: will initiate by priority from the first walletAddressTypes
// then proceeds to following ones after got fully discovered response from worker response
if ( isDiscovered ! = false ) {
for ( final addressType in walletAddresses . walletAddressTypes ) {
if ( isHardwareWallet & & addressType ! = SegwitAddressType . p2wpkh ) continue ;
for ( final seedBytesType in hdWallets . keys ) {
// p2wpkh has always had the right derivations, skip if creating old derivations
if ( seedBytesType . isOldDerivation & & addressType = = SegwitAddressType . p2wpkh ) {
continue ;
}
final bitcoinDerivationInfo = BitcoinAddressUtils . getDerivationFromType (
addressType ,
network: network ,
isElectrum: seedBytesType . isElectrum ,
) ;
bool alreadyDidDerivation = false ;
for ( final derivationInfo in [
bitcoinDerivationInfo ,
BitcoinDerivationInfos . BIP84 ,
BitcoinDerivationInfos . ELECTRUM ,
] ) {
final derivationPath = derivationInfo . derivationPath . toString ( ) ;
if ( alreadyDidDerivation & &
derivationPath = = bitcoinDerivationInfo . derivationPath . toString ( ) ) {
continue ;
}
alreadyDidDerivation = true ;
for ( final isChange in [ true , false ] ) {
isDiscovered = walletAddresses . discoveredAddressesRecord . getIsDiscovered (
addressType: addressType ,
seedBytesType: seedBytesType ,
derivationPath: derivationPath ,
isChange: isChange ,
) ;
if ( isDiscovered = = false ) {
break ;
} else if ( sync = = true )
subscribeForStatuses (
walletAddresses . addressesRecords
. getRecords (
addressType: addressType ,
seedBytesType: seedBytesType ,
derivationPath: derivationPath ,
isChange: isChange ,
)
. whereType < BitcoinAddressRecord > ( )
. toList ( ) ,
) ;
}
if ( isDiscovered = = false ) {
discovered = await generateInitialAddresses (
addressType: addressType ,
seedBytesType: seedBytesType ,
bitcoinDerivationInfo: derivationInfo ,
) ;
break ;
}
}
if ( isDiscovered = = false ) break ;
2025-04-16 18:17:14 -03:00
}
2025-04-22 18:47:13 -03:00
if ( isDiscovered = = false ) break ;
2025-04-16 18:17:14 -03:00
}
}
2025-04-22 18:47:13 -03:00
if ( isDiscovered = = true & & sync = = false )
initAddresses ( true ) ;
else if ( isDiscovered = = true )
syncStatus = SyncedSyncStatus ( ) ;
else if ( isDiscovered = = false & & discovered = = false ) initAddresses ( sync ) ;
return isDiscovered ;
2025-04-16 18:17:14 -03:00
}
2022-10-12 13:09:57 -04:00
static Future < BitcoinWallet > 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-13 00:18:14 +02: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-29 17:49:56 -07: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 13:13:30 -03:00
BasedUtxoNetwork ? network ,
2022-10-12 13:09:57 -04:00
} ) async {
2025-01-22 20:12:41 -03:00
final hdWallets = await ElectrumWalletBase . getAccountHDWallets (
walletInfo: walletInfo ,
network: network ? ? BitcoinNetwork . mainnet ,
mnemonic: mnemonic ,
passphrase: passphrase ,
) ;
2022-10-12 13:09:57 -04:00
return BitcoinWallet (
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 13:13:30 -03:00
mnemonic: mnemonic ,
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-29 17:49:56 -07:00
passphrase: 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 13:13:30 -03:00
password: password ,
walletInfo: walletInfo ,
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-13 00:18:14 +02:00
encryptionFileUtils: encryptionFileUtils ,
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 13:13:30 -03:00
networkParam: network ,
2025-01-22 20:12:41 -03:00
hdWallets: hdWallets ,
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 13:13:30 -03:00
) ;
2022-10-12 13:09:57 -04:00
}
2021-12-24 14:52:08 +02:00
static Future < BitcoinWallet > open ( {
2022-10-12 13:09:57 -04:00
required String name ,
required WalletInfo walletInfo ,
required Box < UnspentCoinsInfo > unspentCoinsInfo ,
required String password ,
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-13 00:18:14 +02:00
required EncryptionFileUtils encryptionFileUtils ,
2021-12-24 14:52:08 +02:00
} ) async {
2024-03-21 04:51:57 +02:00
final network = walletInfo . network ! = null
? BasedUtxoNetwork . fromName ( walletInfo . network ! )
: BitcoinNetwork . mainnet ;
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 13:13:30 -03:00
2024-08-09 23:15:30 +03:00
final hasKeysFile = await WalletKeysFile . hasKeysFile ( name , walletInfo . type ) ;
2025-01-15 17:52:31 -03:00
BitcoinWalletSnapshot ? snp = null ;
2024-08-09 23:15:30 +03:00
try {
2025-01-15 17:52:31 -03:00
snp = await BitcoinWalletSnapshot . 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-13 00:18:14 +02:00
encryptionFileUtils ,
name ,
2025-01-24 13:04:36 -03:00
walletInfo ,
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-13 00:18:14 +02:00
password ,
network ,
) ;
2024-08-09 23:15:30 +03:00
} catch ( e ) {
if ( ! hasKeysFile ) rethrow ;
}
final WalletKeysData keysData ;
// Migrate wallet from the old scheme to then new .keys file scheme
if ( ! hasKeysFile ) {
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-13 00:18:14 +02:00
keysData = WalletKeysData (
mnemonic: snp ! . mnemonic ,
xPub: snp . xpub ,
passphrase: snp . passphrase ,
) ;
2024-08-09 23:15:30 +03:00
} 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-13 00:18:14 +02:00
keysData = await WalletKeysFile . readKeysFile (
name ,
walletInfo . type ,
password ,
encryptionFileUtils ,
) ;
2024-08-09 23:15:30 +03:00
}
walletInfo . derivationInfo ? ? = DerivationInfo ( ) ;
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-29 17:49:56 -07:00
// set the default if not present:
2024-10-04 11:49:49 -03:00
walletInfo . derivationInfo ! . derivationPath ? ? = snp ? . derivationPath ? ? electrum_path ;
walletInfo . derivationInfo ! . derivationType ? ? = snp ? . derivationType ? ? DerivationType . electrum ;
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-29 17:49:56 -07:00
2025-01-22 20:12:41 -03:00
final hdWallets = await ElectrumWalletBase . getAccountHDWallets (
walletInfo: walletInfo ,
network: network ,
mnemonic: keysData . mnemonic ,
passphrase: keysData . passphrase ,
xpub: keysData . xPub ,
) ;
2021-12-24 14:52:08 +02:00
return BitcoinWallet (
2025-01-21 14:02:01 -03:00
mnemonic: keysData . mnemonic ,
2024-08-09 23:15:30 +03:00
xpub: keysData . xPub ,
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 13:13:30 -03:00
password: password ,
2025-01-21 14:02:01 -03:00
passphrase: keysData . 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 13:13:30 -03:00
walletInfo: walletInfo ,
unspentCoinsInfo: unspentCoinsInfo ,
2024-08-09 23:15:30 +03:00
initialBalance: snp ? . balance ,
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-13 00:18:14 +02:00
encryptionFileUtils: encryptionFileUtils ,
2024-03-21 04:51:57 +02:00
networkParam: network ,
2025-02-18 15:51:28 -03:00
alwaysScan: snp ? . alwaysScan ,
2025-01-08 09:41:21 -03:00
initialUnspentCoins: snp ? . unspentCoins ,
2025-01-22 20:12:41 -03:00
walletAddressesSnapshot: snp ? . walletAddressesSnapshot ,
hdWallets: hdWallets ,
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 13:13:30 -03:00
) ;
2021-12-24 14:52:08 +02:00
}
2024-05-04 20:44:50 -05:00
2024-11-06 12:06:52 -03:00
Future < bool > getNodeIsElectrs ( ) async {
2024-11-24 19:05:09 -03:00
if ( node ? . isElectrs ! = null ) {
return node ! . isElectrs ! ;
}
final isNamedElectrs = node ? . uri . host . contains ( " electrs " ) ? ? false ;
if ( isNamedElectrs ) {
node ! . isElectrs = true ;
2025-01-24 13:04:36 -03:00
node ! . save ( ) ;
return true ;
2024-11-22 21:29:29 -03:00
}
2024-11-24 19:05:09 -03:00
final isNamedFulcrum = node ! . uri . host . contains ( " fulcrum " ) ;
if ( isNamedFulcrum ) {
node ! . isElectrs = false ;
2025-01-24 13:04:36 -03:00
node ! . save ( ) ;
return false ;
2024-11-24 19:05:09 -03:00
}
2024-11-06 12:06:52 -03:00
2025-04-16 18:17:14 -03:00
final version = ElectrumWorkerGetVersionResponse . fromJson (
await waitSendWorker ( ElectrumWorkerGetVersionRequest ( ) ) ,
) . result ;
2024-11-24 19:05:09 -03:00
2025-04-16 18:17:14 -03:00
if ( version . toLowerCase ( ) . contains ( ' electrs ' ) ) {
2025-01-24 13:04:36 -03:00
node ! . isElectrs = true ;
} else {
node ! . isElectrs = false ;
2024-11-06 12:06:52 -03:00
}
node ! . save ( ) ;
return node ! . isElectrs ! ;
}
2024-11-01 17:31:26 -03:00
Future < bool > getNodeSupportsSilentPayments ( ) async {
2024-11-24 19:05:09 -03:00
if ( node ? . supportsSilentPayments ! = null ) {
return node ! . supportsSilentPayments ! ;
2024-11-22 21:29:29 -03:00
}
2024-11-01 17:31:26 -03:00
// As of today (august 2024), only ElectrumRS supports silent payments
2024-11-24 19:05:09 -03:00
final isElectrs = await getNodeIsElectrs ( ) ;
if ( ! isElectrs ) {
node ! . supportsSilentPayments = false ;
2024-11-22 21:29:29 -03:00
}
2024-11-01 17:31:26 -03:00
2024-11-24 19:05:09 -03:00
if ( node ! . supportsSilentPayments = = null ) {
try {
final tweaksResponse = ElectrumWorkerCheckTweaksResponse . fromJson (
2025-04-16 18:17:14 -03:00
await waitSendWorker ( ElectrumWorkerCheckTweaksRequest ( ) ) ,
) . result ;
final supportsScanning = tweaksResponse = = true ;
2024-11-01 17:31:26 -03:00
2024-11-24 19:05:09 -03:00
if ( supportsScanning ) {
node ! . supportsSilentPayments = true ;
} else {
node ! . supportsSilentPayments = false ;
}
} catch ( _ ) {
node ! . supportsSilentPayments = false ;
2024-11-22 21:29:29 -03:00
}
2024-11-24 19:05:09 -03:00
}
2024-11-22 21:29:29 -03:00
node ! . save ( ) ;
return node ! . supportsSilentPayments ! ;
2024-11-01 17:31:26 -03:00
}
2024-10-23 17:38:31 +02:00
LedgerConnection ? _ledgerConnection ;
2024-05-04 20:44:50 -05:00
BitcoinLedgerApp ? _bitcoinLedgerApp ;
2024-10-23 17:38:31 +02:00
@ override
void setLedgerConnection ( LedgerConnection connection ) {
_ledgerConnection = connection ;
_bitcoinLedgerApp = BitcoinLedgerApp ( _ledgerConnection ! ,
derivationPath: walletInfo . derivationInfo ! . derivationPath ! ) ;
2024-05-04 20:44:50 -05:00
}
@ override
Future < BtcTransaction > buildHardwareWalletTransaction ( {
required List < BitcoinBaseOutput > outputs ,
required BigInt fee ,
required List < UtxoWithAddress > utxos ,
required Map < String , PublicKeyWithDerivationPath > publicKeys ,
String ? memo ,
bool enableRBF = false ,
BitcoinOrdering inputOrdering = BitcoinOrdering . bip69 ,
BitcoinOrdering outputOrdering = BitcoinOrdering . bip69 ,
} ) async {
2024-10-23 17:38:31 +02:00
final masterFingerprint = await _bitcoinLedgerApp ! . getMasterFingerprint ( ) ;
2024-05-04 20:44:50 -05:00
final psbtReadyInputs = < PSBTReadyUtxoWithAddress > [ ] ;
for ( final utxo in utxos ) {
2025-01-24 13:04:36 -03:00
final rawTx = await getTransactionHex ( hash: utxo . utxo . txHash ) ;
2024-10-04 11:49:49 -03:00
final publicKeyAndDerivationPath = publicKeys [ utxo . ownerDetails . address . pubKeyHash ( ) ] ! ;
2024-05-04 20:44:50 -05:00
psbtReadyInputs . add ( PSBTReadyUtxoWithAddress (
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* 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
* 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
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* 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]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* 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
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 11:43:48 -03:00
utxo: utxo . utxo ,
rawTx: rawTx ,
ownerDetails: utxo . ownerDetails ,
ownerDerivationPath: publicKeyAndDerivationPath . derivationPath ,
ownerMasterFingerprint: masterFingerprint ,
ownerPublicKey: publicKeyAndDerivationPath . publicKey ,
2024-05-04 20:44:50 -05:00
) ) ;
}
2024-10-04 11:49:49 -03:00
final psbt =
PSBTTransactionBuild ( inputs: psbtReadyInputs , outputs: outputs , enableRBF: enableRBF ) ;
2024-05-04 20:44:50 -05:00
2024-10-23 17:38:31 +02:00
final rawHex = await _bitcoinLedgerApp ! . signPsbt ( psbt: psbt . psbt ) ;
2024-08-11 20:49:45 -03:00
return BtcTransaction . fromRaw ( BytesUtils . toHexString ( rawHex ) ) ;
2024-05-04 20:44:50 -05:00
}
2024-05-17 08:15:19 -05:00
@ override
Future < String > signMessage ( String message , { String ? address = null } ) async {
if ( walletInfo . isHardwareWallet ) {
final addressEntry = address ! = null
2024-10-04 11:49:49 -03:00
? walletAddresses . allAddresses . firstWhere ( ( element ) = > element . address = = address )
2024-05-17 08:15:19 -05:00
: null ;
final index = addressEntry ? . index ? ? 0 ;
2024-10-04 11:49:49 -03:00
final isChange = addressEntry ? . isChange = = true ? 1 : 0 ;
2024-05-17 08:15:19 -05:00
final accountPath = walletInfo . derivationInfo ? . derivationPath ;
2024-10-04 11:49:49 -03:00
final derivationPath = accountPath ! = null ? " $ accountPath / $ isChange / $ index " : null ;
2024-05-17 08:15:19 -05:00
2024-10-04 11:49:49 -03:00
final signature = await _bitcoinLedgerApp !
. signMessage ( message: ascii . encode ( message ) , signDerivationPath: derivationPath ) ;
2024-05-17 08:15:19 -05:00
return base64Encode ( signature ) ;
}
return super . signMessage ( message , address: address ) ;
}
2024-10-28 12:16:23 -03:00
2025-01-14 17:57:59 -03:00
@ override
Future < void > updateFeeRates ( ) async {
workerSendPort ! . send (
ElectrumWorkerGetFeesRequest ( mempoolAPIEnabled: await mempoolAPIEnabled ) . toJson ( ) ,
) ;
}
@ override
Future < ElectrumTransactionBundle > getTransactionExpanded ( { required String hash } ) async {
2025-04-16 18:17:14 -03:00
return ElectrumWorkerTxExpandedResponse . fromJson (
await waitSendWorker (
ElectrumWorkerTxExpandedRequest (
txHash: hash ,
currentChainTip: currentChainTip ! ,
mempoolAPIEnabled: await mempoolAPIEnabled ,
) ,
2025-01-14 17:57:59 -03:00
) ,
2025-04-16 18:17:14 -03:00
) . result ;
2025-01-14 17:57:59 -03:00
}
@ override
2025-01-15 17:52:31 -03:00
Future < ElectrumWorkerGetHistoryRequest > getUpdateTransactionsRequest ( [
List < BitcoinAddressRecord > ? addresses ,
] ) async {
return ElectrumWorkerGetHistoryRequest (
2025-01-16 13:43:34 -03:00
addresses: addresses ? ? walletAddresses . allAddresses . toList ( ) ,
2025-01-14 17:57:59 -03:00
storedTxs: transactionHistory . transactions . values . toList ( ) ,
walletType: type ,
// If we still don't have currentChainTip, txs will still be fetched but shown
// with confirmations as 0 but will be auto fixed on onHeadersResponse
chainTip: currentChainTip ? ? - 1 ,
network: network ,
mempoolAPIEnabled: await mempoolAPIEnabled ,
2025-01-15 17:52:31 -03:00
) ;
2025-01-14 17:57:59 -03:00
}
2024-10-28 12:16:23 -03:00
@ action
2025-02-17 18:40:45 -03:00
Future < void > setSilentPaymentsScanning (
2025-02-25 16:53:45 -03:00
bool active , {
2025-02-17 18:40:45 -03:00
int ? height ,
bool ? doSingleScan ,
2025-02-18 15:51:28 -03:00
bool ? forceStop ,
2025-02-25 16:53:45 -03:00
} ) async {
2025-02-18 15:51:28 -03:00
_silentPaymentsScanningActive = active ;
bool isAllowedToScan = allowedToSwitchNodesForScanning ;
if ( ! isAllowedToScan ) {
final nodeSupportsSilentPayments = await getNodeSupportsSilentPayments ( ) ;
isAllowedToScan = nodeSupportsSilentPayments ;
}
2024-10-28 12:16:23 -03:00
2024-11-24 19:05:09 -03:00
if ( active & & isAllowedToScan ) {
2024-10-28 12:16:23 -03:00
syncStatus = AttemptingScanSyncStatus ( ) ;
final tip = currentChainTip ! ;
2025-01-24 13:04:36 -03:00
final beginHeight = height ? ? walletInfo . restoreHeight ;
2024-10-28 12:16:23 -03:00
2025-01-24 13:04:36 -03:00
if ( tip = = beginHeight ) {
2024-10-28 12:16:23 -03:00
syncStatus = SyncedTipSyncStatus ( tip ) ;
return ;
}
2025-01-24 13:04:36 -03:00
if ( tip > beginHeight ) {
2025-03-12 14:25:51 -03:00
_requestTweakScanning ( beginHeight , doSingleScan ) ;
2024-10-28 12:16:23 -03:00
}
2024-11-22 21:29:29 -03:00
} else if ( syncStatus is ! SyncedSyncStatus ) {
2025-02-25 16:53:45 -03:00
if ( forceStop = = true ) {
_forceStopScanning = true ;
await connectToNode ( node: this . node ! ) ;
} else {
await startSync ( ) ;
}
2024-10-28 12:16:23 -03:00
}
}
2025-02-18 15:51:28 -03:00
@ action
Future < void > setAlwaysScanning ( bool active ) async {
_alwaysScan = active ;
2025-02-25 16:53:45 -03:00
if ( ! active & & ! _silentPaymentsScanningActive ) {
await setSilentPaymentsScanning ( false ) ;
2025-02-18 15:51:28 -03:00
}
await save ( ) ;
}
2024-11-16 14:53:00 -03:00
@ override
@ action
2025-04-16 18:17:14 -03:00
Future < ElectrumWorkerListUnspentResponse ? > updateAllUnspents ( [
2025-04-18 06:05:32 -03:00
List < String > ? scripthashes ,
2025-04-16 18:17:14 -03:00
bool ? wait ,
] ) async {
2025-02-17 18:40:45 -03:00
scripthashes ? ? = this . walletAddresses . allScriptHashes ;
2025-01-27 20:08:06 -03:00
await super . updateAllUnspents ( scripthashes , wait ) ;
2024-11-16 14:53:00 -03:00
walletAddresses . silentPaymentAddresses . forEach ( ( addressRecord ) {
addressRecord . txCount = 0 ;
addressRecord . balance = 0 ;
} ) ;
walletAddresses . receivedSPAddresses . forEach ( ( addressRecord ) {
addressRecord . txCount = 0 ;
addressRecord . balance = 0 ;
} ) ;
final silentPaymentWallet = walletAddresses . silentPaymentWallet ;
unspentCoins . forEach ( ( unspent ) {
if ( unspent . bitcoinAddressRecord is BitcoinReceivedSPAddressRecord ) {
_updateSilentAddressRecord ( unspent ) ;
final receiveAddressRecord = unspent . bitcoinAddressRecord as BitcoinReceivedSPAddressRecord ;
final silentPaymentAddress = SilentPaymentAddress (
version: silentPaymentWallet ! . version ,
B_scan: silentPaymentWallet . B_scan ,
B_spend: receiveAddressRecord . labelHex ! = null
? silentPaymentWallet . B_spend . tweakAdd (
BigintUtils . fromBytes (
BytesUtils . fromHexString ( receiveAddressRecord . labelHex ! ) ,
) ,
)
: silentPaymentWallet . B_spend ,
) ;
walletAddresses . silentPaymentAddresses . forEach ( ( addressRecord ) {
if ( addressRecord . address = = silentPaymentAddress . toAddress ( network ) ) {
addressRecord . txCount + = 1 ;
addressRecord . balance + = unspent . value ;
}
} ) ;
walletAddresses . receivedSPAddresses . forEach ( ( addressRecord ) {
if ( addressRecord . address = = receiveAddressRecord . address ) {
addressRecord . txCount + = 1 ;
addressRecord . balance + = unspent . value ;
}
} ) ;
}
} ) ;
await walletAddresses . updateAddressesInBox ( ) ;
2025-04-16 18:17:14 -03:00
return null ;
2024-11-16 14:53:00 -03:00
}
2024-10-28 12:16:23 -03:00
@ override
void updateCoin ( BitcoinUnspent 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 {
addCoinInfo ( coin ) ;
}
}
2025-01-22 20:12:41 -03:00
@ override
@ action
Future < void > addCoinInfo ( BitcoinUnspent coin ) async {
// Check if the coin is already in the unspentCoinsInfo for the wallet
final existingCoinInfo = unspentCoinsInfo . values
. firstWhereOrNull ( ( element ) = > element . walletId = = walletInfo . id & & element = = coin ) ;
if ( existingCoinInfo = = null ) {
final newInfo = UnspentCoinsInfo (
walletId: id ,
hash: coin . hash ,
isFrozen: coin . isFrozen ,
isSending: coin . isSending ,
noteRaw: coin . note ,
address: coin . bitcoinAddressRecord . address ,
value: coin . value ,
vout: coin . vout ,
isChange: coin . isChange ,
isSilentPayment: coin . address is BitcoinReceivedSPAddressRecord ,
) ;
await unspentCoinsInfo . add ( newInfo ) ;
}
}
2024-10-28 12:16:23 -03:00
@ action
@ override
2025-02-18 15:51:28 -03:00
Future < void > rescan ( {
required int height ,
bool ? doSingleScan ,
bool ? forceStop ,
} ) async {
2025-02-25 16:53:45 -03:00
setSilentPaymentsScanning (
true ,
height: height ,
doSingleScan: doSingleScan ,
forceStop: forceStop ,
) ;
2024-10-28 12:16:23 -03:00
}
@ action
void _updateSilentAddressRecord ( BitcoinUnspent unspent ) {
2024-11-16 14:53:00 -03:00
walletAddresses . addReceivedSPAddresses (
[ unspent . bitcoinAddressRecord as BitcoinReceivedSPAddressRecord ] ,
2024-10-28 12:16:23 -03:00
) ;
}
2024-11-05 12:49:07 -03:00
@ override
@ action
Future < void > handleWorkerResponse ( dynamic message ) async {
super . handleWorkerResponse ( message ) ;
Map < String , dynamic > messageJson ;
if ( message is String ) {
messageJson = jsonDecode ( message ) as Map < String , dynamic > ;
} else {
messageJson = message as Map < String , dynamic > ;
}
final workerMethod = messageJson [ ' method ' ] as String ;
switch ( workerMethod ) {
case ElectrumRequestMethods . tweaksSubscribeMethod:
final response = ElectrumWorkerTweaksSubscribeResponse . fromJson ( messageJson ) ;
onTweaksSyncResponse ( response . result ) ;
break ;
}
}
@ action
Future < void > onTweaksSyncResponse ( TweaksSyncResponse result ) async {
if ( result . transactions ? . isNotEmpty = = true ) {
2025-03-12 14:25:51 -03:00
walletAddresses . silentPaymentAddresses . forEach ( ( addressRecord ) {
2024-11-16 14:53:00 -03:00
addressRecord . txCount = 0 ;
addressRecord . balance = 0 ;
} ) ;
2025-03-12 14:25:51 -03:00
walletAddresses . receivedSPAddresses . forEach ( ( addressRecord ) {
2024-11-16 14:53:00 -03:00
addressRecord . txCount = 0 ;
addressRecord . balance = 0 ;
} ) ;
2024-11-05 12:49:07 -03:00
for ( final map in result . transactions ! . entries ) {
final txid = map . key ;
2025-01-08 09:41:21 -03:00
final data = map . value ;
final tx = data . txInfo ;
final unspents = data . unspents ;
2024-11-05 12:49:07 -03:00
2025-01-08 09:41:21 -03:00
if ( unspents . isNotEmpty ) {
2024-11-05 12:49:07 -03:00
final existingTxInfo = transactionHistory . transactions [ txid ] ;
final txAlreadyExisted = existingTxInfo ! = null ;
// Updating tx after re-scanned
if ( txAlreadyExisted ) {
existingTxInfo . amount = tx . amount ;
existingTxInfo . confirmations = tx . confirmations ;
existingTxInfo . height = tx . height ;
2025-01-08 09:41:21 -03:00
final newUnspents = unspents
. where (
( unspent ) = > ! unspentCoins . any ( ( element ) = >
element . hash . contains ( unspent . hash ) & &
element . vout = = unspent . vout & &
element . value = = unspent . value ) ,
)
2024-11-05 12:49:07 -03:00
. toList ( ) ;
if ( newUnspents . isNotEmpty ) {
newUnspents . forEach ( _updateSilentAddressRecord ) ;
2025-01-08 09:41:21 -03:00
unspentCoins . addAll ( newUnspents ) ;
unspentCoins . forEach ( updateCoin ) ;
await refreshUnspentCoinsInfo ( ) ;
2024-11-05 12:49:07 -03:00
final newAmount = newUnspents . length > 1
? newUnspents . map ( ( e ) = > e . value ) . reduce ( ( value , unspent ) = > value + unspent )
: newUnspents [ 0 ] . value ;
if ( existingTxInfo . direction = = TransactionDirection . incoming ) {
existingTxInfo . amount + = newAmount ;
}
// Updates existing TX
transactionHistory . addOne ( existingTxInfo ) ;
// Update balance record
balance [ currency ] ! . confirmed + = newAmount ;
}
} else {
// else: First time seeing this TX after scanning
2025-01-08 09:41:21 -03:00
unspentCoins . forEach ( _updateSilentAddressRecord ) ;
2024-11-05 12:49:07 -03:00
transactionHistory . addOne ( tx ) ;
balance [ currency ] ! . confirmed + = tx . amount ;
}
await updateAllUnspents ( ) ;
}
}
}
final newSyncStatus = result . syncStatus ;
if ( newSyncStatus ! = null ) {
if ( newSyncStatus is UnsupportedSyncStatus ) {
nodeSupportsSilentPayments = false ;
}
if ( newSyncStatus is SyncingSyncStatus ) {
syncStatus = SyncingSyncStatus ( newSyncStatus . blocksLeft , newSyncStatus . ptc ) ;
} else {
syncStatus = newSyncStatus ;
2024-11-22 21:29:29 -03:00
if ( newSyncStatus is SyncedSyncStatus ) {
2025-02-18 15:51:28 -03:00
if ( ! _alwaysScan ) {
_silentPaymentsScanningActive = false ;
}
2024-11-22 21:29:29 -03:00
}
2024-11-05 12:49:07 -03:00
}
2024-11-22 21:29:29 -03:00
final height = result . height ;
2025-01-24 13:04:36 -03:00
if ( height ! = null & & result . wasSingleBlock = = false ) {
2024-11-22 21:29:29 -03:00
await walletInfo . updateRestoreHeight ( height ) ;
}
2024-11-05 12:49:07 -03:00
}
}
2024-10-28 12:16:23 -03:00
@ action
2025-03-12 14:25:51 -03:00
Future < void > _requestTweakScanning ( int height , [ bool ? doSingleScan ] ) async {
2025-02-18 15:51:28 -03:00
_silentPaymentsScanningActive = true ;
2025-03-12 14:25:51 -03:00
final wallets = walletAddresses . silentPaymentWallets ;
final addresses =
walletAddresses . silentPaymentWallets . map ( ( wallet ) = > wallet . toAddress ( network ) ) . toList ( ) ;
2025-02-17 18:40:45 -03:00
2024-10-28 12:16:23 -03:00
if ( currentChainTip = = null ) {
throw Exception ( " currentChainTip is null " ) ;
}
final chainTip = currentChainTip ! ;
if ( chainTip = = height ) {
syncStatus = SyncedSyncStatus ( ) ;
return ;
}
syncStatus = AttemptingScanSyncStatus ( ) ;
2024-11-05 12:49:07 -03:00
workerSendPort ! . send (
ElectrumWorkerTweaksSubscribeRequest (
scanData: ScanData (
2025-03-12 14:25:51 -03:00
silentPaymentsWallets: wallets ,
2024-10-28 12:16:23 -03:00
network: network ,
height: height ,
chainTip: chainTip ,
transactionHistoryIds: transactionHistory . transactions . keys . toList ( ) ,
2025-02-25 11:40:28 -03:00
labels: walletAddresses . getLabels ( addresses ) ,
2024-11-07 13:01:32 -03:00
labelIndexes: walletAddresses . silentPaymentAddresses
2025-01-07 19:26:48 -03:00
. where ( ( addr ) = > addr . type = = SilentPaymentsAddresType . p2sp & & addr . labelIndex > = 1 )
2024-10-28 12:16:23 -03:00
. map ( ( addr ) = > addr . labelIndex )
. toList ( ) ,
isSingleScan: doSingleScan ? ? false ,
2024-11-24 19:05:09 -03:00
shouldSwitchNodes:
! ( await getNodeSupportsSilentPayments ( ) ) & & allowedToSwitchNodesForScanning ,
2024-11-05 12:49:07 -03:00
) ,
) . toJson ( ) ,
) ;
2024-10-28 12:16:23 -03:00
}
2025-02-18 15:51:28 -03:00
@ override
@ action
2025-02-25 16:53:45 -03:00
Future < void > startSync ( ) async {
2025-02-18 15:51:28 -03:00
await super . startSync ( ) ;
2025-02-25 16:53:45 -03:00
if ( _forceStopScanning ! = true & & _alwaysScan = = true & & syncStatus is SyncedSyncStatus ) {
await setSilentPaymentsScanning ( true ) ;
2025-02-18 15:51:28 -03:00
}
2025-02-25 16:53:45 -03:00
_forceStopScanning = false ;
2025-02-18 15:51:28 -03:00
}
2024-11-05 12:49:07 -03:00
@ override
@ action
2025-04-15 13:43:55 -03:00
Future < void > onHeadersResponse ( ElectrumWorkerHeadersResponse response ) async {
2024-11-05 12:49:07 -03:00
super . onHeadersResponse ( response ) ;
2024-10-28 12:16:23 -03:00
2024-11-05 12:49:07 -03:00
_setInitialScanHeight ( ) ;
}
Future < void > _setInitialScanHeight ( ) async {
final validChainTip = currentChainTip ! = null & & currentChainTip ! = 0 ;
if ( validChainTip & & walletInfo . restoreHeight = = 0 ) {
await walletInfo . updateRestoreHeight ( currentChainTip ! ) ;
}
}
2024-10-28 12:16:23 -03:00
@ override
@ action
void syncStatusReaction ( SyncStatus syncStatus ) {
switch ( syncStatus . runtimeType ) {
case SyncingSyncStatus:
return ;
case SyncedTipSyncStatus:
2025-02-18 15:51:28 -03:00
if ( ! _alwaysScan ) {
_silentPaymentsScanningActive = false ;
}
2024-11-22 21:29:29 -03:00
2024-10-28 12:16:23 -03:00
// Message is shown on the UI for 3 seconds, then reverted to synced
Timer ( Duration ( seconds: 3 ) , ( ) {
if ( this . syncStatus is SyncedTipSyncStatus ) this . syncStatus = SyncedSyncStatus ( ) ;
} ) ;
break ;
default :
super . syncStatusReaction ( syncStatus ) ;
}
}
2024-12-19 13:18:58 -03:00
@ override
2024-12-26 18:55:25 -03:00
int calcFee ( {
2024-12-19 13:18:58 -03:00
required List < UtxoWithAddress > utxos ,
required List < BitcoinBaseOutput > outputs ,
String ? memo ,
required int feeRate ,
List < ECPrivateInfo > ? inputPrivKeyInfos ,
List < Outpoint > ? vinOutpoints ,
2024-12-26 18:55:25 -03:00
} ) = >
2024-12-19 13:18:58 -03:00
feeRate *
BitcoinTransactionBuilder . estimateTransactionSize (
utxos: utxos ,
outputs: outputs ,
network: network ,
memo: memo ,
inputPrivKeyInfos: inputPrivKeyInfos ,
vinOutpoints: vinOutpoints ,
) ;
@ override
2025-01-22 20:12:41 -03:00
BitcoinTxCreateUtxoDetails createUTXOS ( {
2024-12-19 13:18:58 -03:00
required bool sendAll ,
bool paysToSilentPayment = false ,
int credentialsAmount = 0 ,
int ? inputsCount ,
} ) {
List < UtxoWithAddress > utxos = [ ] ;
List < Outpoint > vinOutpoints = [ ] ;
List < ECPrivateInfo > inputPrivKeyInfos = [ ] ;
final publicKeys = < String , PublicKeyWithDerivationPath > { } ;
int allInputsAmount = 0 ;
bool spendsSilentPayment = false ;
bool spendsUnconfirmedTX = false ;
int leftAmount = credentialsAmount ;
var availableInputs = unspentCoins . where ( ( utx ) {
2025-03-17 18:16:10 -03:00
final unspentCoinInfo = unspentCoinsInfo . values . firstWhereOrNull (
( element ) = > element . walletId = = id & & element = = utx ,
) ;
2024-12-19 13:18:58 -03:00
if ( ! utx . isSending | | utx . isFrozen ) {
return false ;
}
2025-03-17 18:16:10 -03:00
if ( unspentCoinInfo ! = null ) {
if ( ! unspentCoinInfo . isSending | | unspentCoinInfo . isFrozen ) {
return false ;
}
}
2024-12-19 13:18:58 -03:00
return true ;
} ) . toList ( ) ;
final unconfirmedCoins = availableInputs . where ( ( utx ) = > utx . confirmations = = 0 ) . toList ( ) ;
for ( int i = 0 ; i < availableInputs . length ; i + + ) {
final utx = availableInputs [ i ] ;
2025-03-05 16:08:30 -03:00
if ( ! spendsUnconfirmedTX )
spendsUnconfirmedTX = utx . confirmations = = null | | utx . confirmations ! < = 0 ;
2024-12-19 13:18:58 -03:00
if ( paysToSilentPayment ) {
// Check inputs for shared secret derivation
2025-01-10 12:03:11 -03:00
if ( utx . bitcoinAddressRecord . type = = SegwitAddressType . p2wsh ) {
2024-12-19 13:18:58 -03:00
throw BitcoinTransactionSilentPaymentsNotSupported ( ) ;
}
}
allInputsAmount + = utx . value ;
leftAmount = leftAmount - utx . value ;
final address = RegexUtils . addressTypeFromStr ( utx . address , network ) ;
ECPrivate ? privkey ;
bool ? isSilentPayment = false ;
if ( utx . bitcoinAddressRecord is BitcoinSilentPaymentAddressRecord ) {
privkey = ( utx . bitcoinAddressRecord as BitcoinReceivedSPAddressRecord ) . getSpendKey (
2025-03-12 14:25:51 -03:00
walletAddresses . silentPaymentWallets ,
2024-12-19 13:18:58 -03:00
network ,
) ;
spendsSilentPayment = true ;
isSilentPayment = true ;
} else if ( ! isHardwareWallet ) {
final addressRecord = ( utx . bitcoinAddressRecord as BitcoinAddressRecord ) ;
final path = addressRecord . derivationInfo . derivationPath
. addElem ( Bip32KeyIndex (
BitcoinAddressUtils . getAccountFromChange ( addressRecord . isChange ) ,
) )
. addElem ( Bip32KeyIndex ( addressRecord . index ) ) ;
2025-01-15 17:52:31 -03:00
privkey = ECPrivate . fromBip32 ( bip32: hdWallet . derive ( path ) ) ;
2024-12-19 13:18:58 -03:00
}
vinOutpoints . add ( Outpoint ( txid: utx . hash , index: utx . vout ) ) ;
String pubKeyHex ;
if ( privkey ! = null ) {
inputPrivKeyInfos . add ( ECPrivateInfo (
privkey ,
2025-01-10 12:03:11 -03:00
address . type = = SegwitAddressType . p2tr ,
2024-12-19 13:18:58 -03:00
tweak: ! isSilentPayment ,
) ) ;
pubKeyHex = privkey . getPublic ( ) . toHex ( ) ;
} else {
pubKeyHex = walletAddresses . hdWallet
. childKey ( Bip32KeyIndex ( utx . bitcoinAddressRecord . index ) )
. publicKey
. toHex ( ) ;
}
if ( utx . bitcoinAddressRecord is BitcoinAddressRecord ) {
final derivationPath = ( utx . bitcoinAddressRecord as BitcoinAddressRecord )
. derivationInfo
. derivationPath
. toString ( ) ;
publicKeys [ address . pubKeyHash ( ) ] = PublicKeyWithDerivationPath ( pubKeyHex , derivationPath ) ;
}
utxos . add (
UtxoWithAddress (
utxo: BitcoinUtxo (
txHash: utx . hash ,
value: BigInt . from ( utx . value ) ,
vout: utx . vout ,
scriptType: BitcoinAddressUtils . getScriptType ( address ) ,
isSilentPayment: isSilentPayment ,
) ,
ownerDetails: UtxoAddressDetails (
publicKey: pubKeyHex ,
address: address ,
) ,
) ,
) ;
// sendAll continues for all inputs
if ( ! sendAll ) {
bool amountIsAcquired = leftAmount < = 0 ;
if ( ( inputsCount = = null & & amountIsAcquired ) | | inputsCount = = i + 1 ) {
break ;
}
}
}
if ( utxos . isEmpty ) {
throw BitcoinTransactionNoInputsException ( ) ;
}
2025-01-22 20:12:41 -03:00
return BitcoinTxCreateUtxoDetails (
2024-12-19 13:18:58 -03:00
availableInputs: availableInputs ,
unconfirmedCoins: unconfirmedCoins ,
utxos: utxos ,
vinOutpoints: vinOutpoints ,
inputPrivKeyInfos: inputPrivKeyInfos ,
publicKeys: publicKeys ,
allInputsAmount: allInputsAmount ,
spendsSilentPayment: spendsSilentPayment ,
spendsUnconfirmedTX: spendsUnconfirmedTX ,
) ;
}
@ override
2025-01-22 20:12:41 -03:00
Future < BitcoinEstimatedTx > estimateSendAllTx (
2024-12-19 13:18:58 -03:00
List < BitcoinOutput > outputs ,
int feeRate , {
String ? memo ,
bool hasSilentPayment = false ,
} ) async {
final utxoDetails = createUTXOS ( sendAll: true , paysToSilentPayment: hasSilentPayment ) ;
int fee = await calcFee (
utxos: utxoDetails . utxos ,
outputs: outputs ,
memo: memo ,
feeRate: feeRate ,
inputPrivKeyInfos: utxoDetails . inputPrivKeyInfos ,
vinOutpoints: utxoDetails . vinOutpoints ,
) ;
if ( fee = = 0 ) {
throw BitcoinTransactionNoFeeException ( ) ;
}
// Here, when sending all, the output amount equals to the input value - fee to fully spend every input on the transaction and have no amount left for change
int amount = utxoDetails . allInputsAmount - fee ;
if ( amount < = 0 ) {
throw BitcoinTransactionWrongBalanceException ( amount: utxoDetails . allInputsAmount + fee ) ;
}
// Attempting to send less than the dust limit
if ( isBelowDust ( amount ) ) {
throw BitcoinTransactionNoDustException ( ) ;
}
if ( outputs . length = = 1 ) {
outputs [ 0 ] = BitcoinOutput ( address: outputs . last . address , value: BigInt . from ( amount ) ) ;
}
2025-01-22 20:12:41 -03:00
return BitcoinEstimatedTx (
2024-12-19 13:18:58 -03:00
utxos: utxoDetails . utxos ,
inputPrivKeyInfos: utxoDetails . inputPrivKeyInfos ,
publicKeys: utxoDetails . publicKeys ,
fee: fee ,
amount: amount ,
isSendAll: true ,
hasChange: false ,
memo: memo ,
spendsUnconfirmedTX: utxoDetails . spendsUnconfirmedTX ,
spendsSilentPayment: utxoDetails . spendsSilentPayment ,
) ;
}
@ override
2025-01-22 20:12:41 -03:00
Future < BitcoinEstimatedTx > estimateTxForAmount (
2024-12-19 13:18:58 -03:00
int credentialsAmount ,
List < BitcoinOutput > outputs ,
int feeRate , {
2024-12-26 18:55:25 -03:00
List < BitcoinOutput > ? updatedOutputs ,
2024-12-19 13:18:58 -03:00
int ? inputsCount ,
String ? memo ,
bool ? useUnconfirmed ,
bool hasSilentPayment = false ,
2024-12-26 18:55:25 -03:00
bool isFakeTx = false ,
2025-01-08 11:33:07 -03:00
} ) async {
2024-12-26 18:55:25 -03:00
if ( updatedOutputs = = null ) {
updatedOutputs = outputs . map ( ( output ) = > output ) . toList ( ) ;
}
2024-12-19 13:18:58 -03:00
// Attempting to send less than the dust limit
2024-12-26 18:55:25 -03:00
if ( ! isFakeTx & & isBelowDust ( credentialsAmount ) ) {
2024-12-19 13:18:58 -03:00
throw BitcoinTransactionNoDustException ( ) ;
}
final utxoDetails = createUTXOS (
sendAll: false ,
credentialsAmount: credentialsAmount ,
inputsCount: inputsCount ,
paysToSilentPayment: hasSilentPayment ,
) ;
final spendingAllCoins = utxoDetails . availableInputs . length = = utxoDetails . utxos . length ;
final spendingAllConfirmedCoins = ! utxoDetails . spendsUnconfirmedTX & &
utxoDetails . utxos . length = =
utxoDetails . availableInputs . length - utxoDetails . unconfirmedCoins . length ;
// How much is being spent - how much is being sent
int amountLeftForChangeAndFee = utxoDetails . allInputsAmount - credentialsAmount ;
if ( amountLeftForChangeAndFee < = 0 ) {
if ( ! spendingAllCoins ) {
return estimateTxForAmount (
credentialsAmount ,
outputs ,
feeRate ,
updatedOutputs: updatedOutputs ,
inputsCount: utxoDetails . utxos . length + 1 ,
memo: memo ,
hasSilentPayment: hasSilentPayment ,
2024-12-26 18:55:25 -03:00
isFakeTx: isFakeTx ,
2024-12-19 13:18:58 -03:00
) ;
}
throw BitcoinTransactionWrongBalanceException ( ) ;
}
2025-01-22 20:12:41 -03:00
final changeAddress = await walletAddresses . getChangeAddress ( ) ;
2024-12-19 13:18:58 -03:00
final address = RegexUtils . addressTypeFromStr ( changeAddress . address , network ) ;
updatedOutputs . add ( BitcoinOutput (
address: address ,
value: BigInt . from ( amountLeftForChangeAndFee ) ,
isChange: true ,
) ) ;
outputs . add ( BitcoinOutput (
address: address ,
value: BigInt . from ( amountLeftForChangeAndFee ) ,
isChange: true ,
) ) ;
// Get Derivation path for change Address since it is needed in Litecoin and BitcoinCash hardware Wallets
2025-01-07 19:26:48 -03:00
final changeDerivationPath =
( changeAddress as BitcoinAddressRecord ) . derivationInfo . derivationPath . toString ( ) ;
2024-12-19 13:18:58 -03:00
utxoDetails . publicKeys [ address . pubKeyHash ( ) ] =
PublicKeyWithDerivationPath ( ' ' , changeDerivationPath ) ;
// calcFee updates the silent payment outputs to calculate the tx size accounting
// for taproot addresses, but if more inputs are needed to make up for fees,
// the silent payment outputs need to be recalculated for the new inputs
var temp = outputs . map ( ( output ) = > output ) . toList ( ) ;
2024-12-26 18:55:25 -03:00
int fee = calcFee (
2024-12-19 13:18:58 -03:00
utxos: utxoDetails . utxos ,
// Always take only not updated bitcoin outputs here so for every estimation
// the SP outputs are re-generated to the proper taproot addresses
outputs: temp ,
memo: memo ,
feeRate: feeRate ,
inputPrivKeyInfos: utxoDetails . inputPrivKeyInfos ,
vinOutpoints: utxoDetails . vinOutpoints ,
) ;
updatedOutputs . clear ( ) ;
updatedOutputs . addAll ( temp ) ;
if ( fee = = 0 ) {
throw BitcoinTransactionNoFeeException ( ) ;
}
int amount = credentialsAmount ;
final lastOutput = updatedOutputs . last ;
final amountLeftForChange = amountLeftForChangeAndFee - fee ;
2024-12-26 18:55:25 -03:00
if ( ! isFakeTx & & isBelowDust ( amountLeftForChange ) ) {
2024-12-19 13:18:58 -03:00
// If has change that is lower than dust, will end up with tx rejected by network rules
// so remove the change amount
updatedOutputs . removeLast ( ) ;
outputs . removeLast ( ) ;
if ( amountLeftForChange < 0 ) {
if ( ! spendingAllCoins ) {
return estimateTxForAmount (
credentialsAmount ,
outputs ,
feeRate ,
updatedOutputs: updatedOutputs ,
inputsCount: utxoDetails . utxos . length + 1 ,
memo: memo ,
useUnconfirmed: useUnconfirmed ? ? spendingAllConfirmedCoins ,
hasSilentPayment: hasSilentPayment ,
2024-12-26 18:55:25 -03:00
isFakeTx: isFakeTx ,
2024-12-19 13:18:58 -03:00
) ;
} else {
throw BitcoinTransactionWrongBalanceException ( ) ;
}
}
2025-01-22 20:12:41 -03:00
return BitcoinEstimatedTx (
2024-12-19 13:18:58 -03:00
utxos: utxoDetails . utxos ,
inputPrivKeyInfos: utxoDetails . inputPrivKeyInfos ,
publicKeys: utxoDetails . publicKeys ,
fee: fee ,
amount: amount ,
hasChange: false ,
isSendAll: spendingAllCoins ,
memo: memo ,
spendsUnconfirmedTX: utxoDetails . spendsUnconfirmedTX ,
spendsSilentPayment: utxoDetails . spendsSilentPayment ,
) ;
} else {
// Here, lastOutput already is change, return the amount left without the fee to the user's address.
updatedOutputs [ updatedOutputs . length - 1 ] = BitcoinOutput (
address: lastOutput . address ,
value: BigInt . from ( amountLeftForChange ) ,
isSilentPayment: lastOutput . isSilentPayment ,
isChange: true ,
) ;
outputs [ outputs . length - 1 ] = BitcoinOutput (
address: lastOutput . address ,
value: BigInt . from ( amountLeftForChange ) ,
isSilentPayment: lastOutput . isSilentPayment ,
isChange: true ,
) ;
2025-01-22 20:12:41 -03:00
return BitcoinEstimatedTx (
2024-12-19 13:18:58 -03:00
utxos: utxoDetails . utxos ,
inputPrivKeyInfos: utxoDetails . inputPrivKeyInfos ,
publicKeys: utxoDetails . publicKeys ,
fee: fee ,
amount: amount ,
hasChange: true ,
isSendAll: spendingAllCoins ,
memo: memo ,
spendsUnconfirmedTX: utxoDetails . spendsUnconfirmedTX ,
spendsSilentPayment: utxoDetails . spendsSilentPayment ,
) ;
}
}
@ override
Future < PendingTransaction > createTransaction ( Object credentials ) async {
try {
final outputs = < BitcoinOutput > [ ] ;
final transactionCredentials = credentials as BitcoinTransactionCredentials ;
final hasMultiDestination = transactionCredentials . outputs . length > 1 ;
final sendAll = ! hasMultiDestination & & transactionCredentials . outputs . first . sendAll ;
final memo = transactionCredentials . outputs . first . memo ;
int credentialsAmount = 0 ;
bool hasSilentPayment = false ;
for ( final out in transactionCredentials . outputs ) {
final outputAmount = out . formattedCryptoAmount ! ;
if ( ! sendAll & & isBelowDust ( outputAmount ) ) {
throw BitcoinTransactionNoDustException ( ) ;
}
if ( hasMultiDestination ) {
if ( out . sendAll ) {
throw BitcoinTransactionWrongBalanceException ( ) ;
}
}
credentialsAmount + = outputAmount ;
final address = RegexUtils . addressTypeFromStr (
out . isParsedAddress ? out . extractedAddress ! : out . address , network ) ;
final isSilentPayment = address is SilentPaymentAddress ;
if ( isSilentPayment ) {
hasSilentPayment = true ;
}
if ( sendAll ) {
// The value will be changed after estimating the Tx size and deducting the fee from the total to be sent
outputs . add ( BitcoinOutput (
address: address ,
value: BigInt . from ( 0 ) ,
isSilentPayment: isSilentPayment ,
) ) ;
} else {
outputs . add ( BitcoinOutput (
address: address ,
value: BigInt . from ( outputAmount ) ,
isSilentPayment: isSilentPayment ,
) ) ;
}
}
final feeRateInt = transactionCredentials . feeRate ! = null
? transactionCredentials . feeRate !
: feeRate ( transactionCredentials . priority ! ) ;
2025-01-22 20:12:41 -03:00
BitcoinEstimatedTx estimatedTx ;
2024-12-19 13:18:58 -03:00
final updatedOutputs = outputs
. map ( ( e ) = > BitcoinOutput (
address: e . address ,
value: e . value ,
isSilentPayment: e . isSilentPayment ,
isChange: e . isChange ,
) )
. toList ( ) ;
if ( sendAll ) {
estimatedTx = await estimateSendAllTx (
updatedOutputs ,
feeRateInt ,
memo: memo ,
hasSilentPayment: hasSilentPayment ,
) ;
} else {
estimatedTx = await estimateTxForAmount (
credentialsAmount ,
outputs ,
feeRateInt ,
updatedOutputs: updatedOutputs ,
memo: memo ,
hasSilentPayment: hasSilentPayment ,
) ;
}
if ( walletInfo . isHardwareWallet ) {
final transaction = await buildHardwareWalletTransaction (
utxos: estimatedTx . utxos ,
outputs: updatedOutputs ,
publicKeys: estimatedTx . publicKeys ,
fee: BigInt . from ( estimatedTx . fee ) ,
memo: estimatedTx . memo ,
outputOrdering: BitcoinOrdering . none ,
enableRBF: true ,
) ;
return PendingBitcoinTransaction (
transaction ,
type ,
2025-04-16 18:17:14 -03:00
waitSendWorker: waitSendWorker ,
2024-12-19 13:18:58 -03:00
amount: estimatedTx . amount ,
fee: estimatedTx . fee ,
feeRate: feeRateInt . toString ( ) ,
hasChange: estimatedTx . hasChange ,
isSendAll: estimatedTx . isSendAll ,
hasTaprootInputs: false , // ToDo: (Konsti) Support Taproot
) . . addListener ( ( transaction ) async {
transactionHistory . addOne ( transaction ) ;
await updateBalance ( ) ;
} ) ;
}
final txb = BitcoinTransactionBuilder (
utxos: estimatedTx . utxos ,
outputs: updatedOutputs ,
fee: BigInt . from ( estimatedTx . fee ) ,
network: network ,
memo: estimatedTx . memo ,
outputOrdering: BitcoinOrdering . none ,
enableRBF: ! estimatedTx . spendsUnconfirmedTX ,
) ;
bool hasTaprootInputs = false ;
final transaction = txb . buildTransaction ( ( txDigest , utxo , publicKey , sighash ) {
String error = " Cannot find private key. " ;
ECPrivateInfo ? key ;
if ( estimatedTx . inputPrivKeyInfos . isEmpty ) {
error + = " \n No private keys generated. " ;
} else {
error + = " \n Address: ${ utxo . ownerDetails . address . toAddress ( network ) } " ;
try {
key = estimatedTx . inputPrivKeyInfos . firstWhere ( ( element ) {
final elemPubkey = element . privkey . getPublic ( ) . toHex ( ) ;
if ( elemPubkey = = publicKey ) {
return true ;
} else {
error + = " \n Expected: $ publicKey " ;
error + = " \n Pubkey: $ elemPubkey " ;
return false ;
}
} ) ;
} catch ( _ ) {
throw Exception ( error ) ;
}
}
if ( key = = null ) {
throw Exception ( error ) ;
}
2025-01-10 12:03:11 -03:00
if ( utxo . utxo . isP2tr ) {
2024-12-19 13:18:58 -03:00
hasTaprootInputs = true ;
return key . privkey . signTapRoot (
txDigest ,
sighash: sighash ,
tweak: utxo . utxo . isSilentPayment ! = true ,
) ;
} else {
return key . privkey . signInput ( txDigest , sigHash: sighash ) ;
}
} ) ;
return PendingBitcoinTransaction (
transaction ,
type ,
2025-04-16 18:17:14 -03:00
waitSendWorker: waitSendWorker ,
2024-12-19 13:18:58 -03:00
amount: estimatedTx . amount ,
fee: estimatedTx . fee ,
feeRate: feeRateInt . toString ( ) ,
hasChange: estimatedTx . hasChange ,
isSendAll: estimatedTx . isSendAll ,
hasTaprootInputs: hasTaprootInputs ,
utxos: estimatedTx . utxos ,
hasSilentPayment: hasSilentPayment ,
) . . addListener ( ( transaction ) async {
transactionHistory . addOne ( transaction ) ;
if ( estimatedTx . spendsSilentPayment ) {
transactionHistory . transactions . values . forEach ( ( tx ) {
2025-01-08 09:41:21 -03:00
// tx.unspents?.removeWhere(
// (unspent) => estimatedTx.utxos.any((e) => e.utxo.txHash == unspent.hash));
2024-12-19 13:18:58 -03:00
transactionHistory . addOne ( tx ) ;
} ) ;
}
unspentCoins
. removeWhere ( ( utxo ) = > estimatedTx . utxos . any ( ( e ) = > e . utxo . txHash = = utxo . hash ) ) ;
await updateBalance ( ) ;
} ) ;
2024-12-20 20:22:45 -03:00
} catch ( e ) {
2024-12-19 13:18:58 -03:00
throw e ;
}
}
2025-01-27 20:08:06 -03:00
@ override
@ action
Future < void > onUnspentResponse ( Map < String , List < ElectrumUtxo > > unspents ) async {
final silentPaymentUnspents = unspentCoins
. where ( ( utxo ) = >
utxo . bitcoinAddressRecord is BitcoinSilentPaymentAddressRecord | |
utxo . bitcoinAddressRecord is BitcoinReceivedSPAddressRecord )
. toList ( ) ;
unspentCoins . addAll ( silentPaymentUnspents ) ;
super . onUnspentResponse ( unspents ) ;
}
2025-02-18 15:51:28 -03:00
@ override
String toJSON ( ) {
final json = jsonDecode ( super . toJSON ( ) ) ;
json [ ' alwaysScan ' ] = _alwaysScan ;
return jsonEncode ( json ) ;
}
2024-10-30 12:13:59 -03:00
}
2025-01-22 20:12:41 -03:00
class BitcoinEstimatedTx extends ElectrumEstimatedTx {
BitcoinEstimatedTx ( {
required super . utxos ,
required super . inputPrivKeyInfos ,
required super . publicKeys ,
required super . fee ,
required super . amount ,
required super . hasChange ,
required super . isSendAll ,
required super . spendsUnconfirmedTX ,
super . memo ,
this . spendsSilentPayment = false ,
} ) ;
final bool spendsSilentPayment ;
}
class BitcoinTxCreateUtxoDetails extends ElectrumTxCreateUtxoDetails {
final bool spendsSilentPayment ;
BitcoinTxCreateUtxoDetails ( {
required super . availableInputs ,
required super . unconfirmedCoins ,
required super . utxos ,
required super . vinOutpoints ,
required super . inputPrivKeyInfos ,
required super . publicKeys ,
required super . allInputsAmount ,
required super . spendsUnconfirmedTX ,
this . spendsSilentPayment = false ,
} ) ;
}