Commit Graph

206 Commits

Author SHA1 Message Date
Sean Gilligan
839139f8fb walletfx: Initialize scene earlier in MainController 2021-09-23 09:25:36 -07:00
Sean Gilligan
0f8cc09073 walletfx: Improve calculation of estimatedKeyDerivationTime
* Make the static field `estimatedKeyDerivationTime` private
* Refactor the calculation to a private, side-effect free function
* Replace `estimatedKeyDerivationTimeMsec()` with `initEstimatedKeyDerivationTime()`
** Don’t return a value that wasn’t unused anyway
** Make better use of CompletableFuture API
* Platform.runLater wasn’t needed because no JavaFX functions are called
2021-09-23 17:55:19 +02:00
Sean Gilligan
36243ca24e walletfx: factor out WalletApplication::startWalletAppKit 2021-09-23 07:30:15 -07:00
Sean Gilligan
188a0a7e45 walletfx: replace MainController.instance with app.mainWindowController() 2021-09-23 01:04:05 -07:00
Sean Gilligan
85725a18a6 walletfx: WalletApplication to improve encapsulation
* Make all public fields private and wrap with accessors
* Make `WalletAppKit` (was confusingly named `bitcoin`) field a member not a static
* Rename `bitcoin` to `walletAppKit`
2021-09-23 09:57:18 +02:00
Sean Gilligan
515a558ec2 walletfx: Extract MainWindowController abstract base class
* Extract `MainWindowController` from `wallettemplate.MainController`
* WalletApplication: `wallettemplate.MainController` with `MainWindowController`
2021-09-22 12:16:45 -07:00
Sean Gilligan
d1aa5e3d36 walletfx: Extract WalletApplication from WalletTemplate
* Extract abstract class `WalletApplication` from `WalletTemplate`
* `WalletTemplate` implements `loadController()` with resource names
* `MainController`: Add `scene` member and `scene()` method
2021-09-22 11:36:04 -07:00
Sean Gilligan
d8b6733c9c walletfx: Create WalletTemplate implementing AppDelegate
* Introduce `AppDelegate` class for delegating JavaFX `Application`
* Move almost all of `Main` to `WalletTemplate`

Rationale:

* The “template” JavaFX Application main class (`Main`) is now about 30 lines of code
* `Main` class allows easy switching between TestNet and MainNet (in fact it could become a command-line argument) and other configuration changes (e.g. `preferredOutputScriptType`)
* Prepares the way for the next steps of refactoring
2021-09-22 09:21:25 -07:00
Sean Gilligan
a7161eed8e walletfx: Move wallettemplate.controls to org.bitcoinj.walletfx 2021-09-21 07:56:17 -07:00
Sean Gilligan
9292bf3c43 walletfx: Refactor overlay, reduce usage of instance static globals
* OverlayController: rename init method, add rootController to params
* OverlayableStackPaneController: update to use updated initOverlay() method, 
          also pass this.getClass() into GuiUtils.getResource()
* GuiUtils.getResource(): replace reference to MainController.class with clazz parameter
* Main: Reduce visibility to “package” of 3 static globals
* MainController: Reduce visibility of `instance` static to “package”, initialize
                  addressControl by calling 2 initialization methods
* 4 other controllers: Update for OverlayController changes
* ClickableBitcoinAddress: OverlayController changes, eliminate use of Main.APP_NAME

Rationale:

* Decrease coupling
* Eliminate cross-package use of `Main` and `MainController` static globals
* Prepare for further refactoring — moving wallettemplate.controls package
  to org.bitcoinj.walletfx.controls
2021-09-21 09:39:08 +02:00
Sean Gilligan
93f0bb7a54 walletfx: Extract OverlayableStackPaneController
* Extract abstract class OverlayableStackPaneController from MainController
* Rename OverlayWindowController to OverlayController (Window was misleading)

Rationale:

1. Overlay functionality is independent of MainContoller’s wallet functions
2. Increases reusability of classes in module
3. Prepares for further refactoring
2021-09-20 12:20:38 -07:00
Sean Gilligan
44ca7f6689 walletfx: Introduce OverlayWindowController interface
Rationale:

1. Stronger typing makes code more readable and refactorable
2. Eliminates “automatic” reflection in MainController
3. Makes overlayUI field in implementing classes private
4. Is a step towards further refactoring and reusability
2021-09-19 12:35:38 -07:00
Sean Gilligan
17aeea2d75 walletfx: move OverlayUI from Main to MainController
Move OverlayUI and other related functionality from Main (Application) class
to MainController.

Motivation:

1. This simplifies the Main class
2. The code more logically belongs in the controller
3. The code being in the controller increases reusability
4. Is a first step towards additional refactoring made possible
   because MainController can subclass an abstract class and Main
   can’t because it must subclass Application
2021-09-19 19:04:12 +02:00
Sean Gilligan
1e7fc7aad5 walletfx: Hook up the unused “Primary” and “Secondary” buttons
I did this for two reasons:

1. So users will know why the buttons are there and that they work
2. A convenient way to test the informational alert function.
2021-09-18 17:42:33 -07:00
Sean Gilligan
e9980e73fa wallettemplate: rename package wallettemplate.utils to org.bitcoinj.walletfx.utils
This is a step towards (a renewed effort at) separating the wallettemplate
into a JavaFX wallet library and a template application.
2021-09-18 19:03:17 +02:00
Sean Gilligan
62f5097933 build.gradle: Update JavaFX to 17.0.0.1. 2021-09-17 17:33:53 +02:00
Sean Gilligan
65e9d9523b build.gradle: Update ZXing to 3.4.1. 2021-09-17 11:57:24 +02:00
Sean Gilligan
6da10f8641 build.gradle: Update SLF4J to 1.7.32. 2021-09-17 11:51:11 +02:00
Sean Gilligan
1e5fa2ed0c wallettemplate: upgrade JavaFX to version 15
JavaFX 15 is now released and is the now the latest supported
version. It supports JDK 11 and later — same as the previous release.

Release notes are here:
https://github.com/openjdk/jfx/blob/jfx15/doc-files/release-notes-15.md#release-notes-for-javafx-15
2020-09-08 15:43:22 -07:00
Andreas Schildbach
a966cd38a1 Apply "Lambda can be replaced with method reference" refactoring. 2020-09-07 21:15:51 +02:00
Andreas Schildbach
e7b00b65f9 Apply "Statement lambda can be replaced with expression lambda" refactoring. 2020-09-07 21:13:14 +02:00
Andreas Schildbach
c08a4d97d3 Apply "Anonymous type can be replaced with lambda" refactoring. 2020-09-07 21:13:14 +02:00
Andreas Schildbach
4847a9df27 Apply "Explicit generic type can be replaced with <>" refactoring. 2020-09-07 21:10:44 +02:00
Sean Gilligan
b4d3372198 build.gradle: Update ZXing (only in wallettemplate) to 3.4.0.
Release notes:
https://github.com/zxing/zxing/releases/tag/zxing-3.4.0
2020-04-23 08:54:29 +02:00
Sean Gilligan
0d3a767cd4 build.gradle: Update JavaFX to 14.0.1.
This is a bug fix release:
https://github.com/openjdk/jfx/blob/jfx14/doc-files/release-notes-14.0.1.md#release-notes-for-javafx-1401
2020-04-23 08:51:08 +02:00
Sean Gilligan
47a2335a73 Update JavaFX to 14, JavaFX Plugin to 0.0.8. 2020-03-19 10:59:08 +01:00
Sean Gilligan
e4c6b98536 Make Guava an api dependency using java-library
Use the Gradle java-library plugin to make Guava an `api`
dependency since Guava types are used in the bitcoinj public API.

This allows us to remove explicit dependencies on
Guava in the other modules.
2020-02-29 15:28:09 -08:00
Andreas Schildbach
0112e3ccbe Update slf4j to 1.7.30. 2020-01-23 01:16:58 +01:00
Andreas Schildbach
68538e57af Update Guava to 28.2-android. 2020-01-23 01:09:35 +01:00
Andreas Schildbach
ded215e69e Update slf4j to 1.7.29. 2019-11-21 12:35:13 +01:00
Andreas Schildbach
f396327246 Update Guava to 28.1-android. 2019-10-21 12:15:53 +02:00
Sean Gilligan
03d7d7369f Update slf4j to 1.7.28.
1.7.28 fixes an error in 1.7.27 that could affect some users of JPMS modules.
2019-08-27 12:16:59 +02:00
Sean Gilligan
1394f91d61 Update slf4j to 1.7.27. 2019-08-08 09:43:56 +02:00
Andreas Schildbach
726c7291ac Wallet: Remove global coinSelector and allowSpendingUnconfirmedTransactions().
Coin selection is a per SendRequest, per createSend() or per getBalance() call affair.
Having it wallet-global can lead to race conditions, as sometimes experienced in the
WalletTest unit tests.
2019-07-26 20:30:27 +02:00
Andreas Schildbach
cee5264ab9 build.gradle: Specify javadoc encodings. 2019-07-26 17:14:37 +02:00
Sean Gilligan
951d18b9a7 Update slf4j to 1.7.26. 2019-07-26 10:43:57 +02:00
Sean Gilligan
3c5744a6cb AppDataDirectory: Move from wallettemplate/.utils to core/.utils
This allows usage in both wallettemplate and tools and replaces
similar code in BlockFileLoader.java in core.
Requires minor back-port of Path.of() functionality from JDK11.
2019-06-20 10:09:21 +02:00
Sean Gilligan
d446951ceb AppDataDirectory: Use lower-case appName for data dir on Windows/Linux/Unix. 2019-06-19 21:27:01 +02:00
Andreas Schildbach
ab2fb2f9cf KeyChainGroup: New CurrentKeyChangeEventListener that fires when a current key and/or address changes.
This also changes wallet-template to make use of the new listener for updating its current address in the UI.
2019-05-19 08:23:39 +02:00
Sean Gilligan
46195cd24e wallet-template: Put wallet data files in app data directory.
Previously WalletTemplate would store the .spvchain and .wallet files
in the app’s current working directory which could vary depending upon
how the app was launched.

This PR stores the app’s data files in the “app data directory” which
is always named “WalletTemplate” (APP_NAME) and located in the standard
location for application data directories on the current OS platform.

For macOS: `~/Library/Application Support/WalletTemplate`
For Linux/unix: `~/.WalletTemplate`
For Windows: ${APPDATA}/WalletTemplate  (where APPDATA is a standard
Windows environment variable)

Changes:

* Added AppDataDirectory class to return current dir Path
* Modified Main to use appDataDirectory rather than “.”
2019-04-29 10:29:45 +02:00
Sean Gilligan
88dd0028cd ClickableBitcoinAddress: Break out QRCodeImages utility class for QR Code FX image creation. 2019-04-24 11:21:12 +02:00
Sean Gilligan
2dbe4f21bc Use TestNet3 in WalletTemplate.
WalletTemplate is not a production-ready wallet and (for now, at least)
should default (currently hard-coded) to TestNet3.
2019-04-23 17:12:38 +02:00
Sean Gilligan
c2253d2e97 MainController: Replace EasyBind with two static methods.
This removes the dependency on EasyBind.
2019-04-22 09:06:09 +02:00
Sean Gilligan
7bfeff65f6 build.gradle: Use plugins block rather than 'apply plugin' statements. 2019-04-18 16:41:12 +02:00
Sean Gilligan
c18cf90a8e build.gradle: Remove redundant wallet_template Gradle task. 2019-04-08 11:11:51 +02:00
Sean Gilligan
3538d3342e ClickableBitcoinAddress: Write QR code directly to a JavaFX image, rather than transitioning through a PNG image.
This gets rid of the ZXing-JavaSE dependency.
2019-04-07 11:34:45 +02:00
Sean Gilligan
560e128458 build.gradle: Replace usage of QRGen by direct usage of ZXing 3.3.3 for generating QR codes. 2019-04-06 17:14:59 +02:00
Sean Gilligan
170cc80e45 Update Guava to 27.1-android. 2019-04-05 10:31:35 +02:00
Sean Gilligan
7b934591e5 Update EasyBind to 1.0.3. 2019-04-05 10:28:32 +02:00
Andreas Schildbach
83b1e44d7d settings.gradle: Prefix project names by 'bitcoinj-'. 2019-03-24 10:34:23 +01:00
Sean Gilligan
4daf6de1eb settings.gradle: If at least Java 11 and Gradle 4.10 are detected, wallet-template is being built again.
This also means wallet-template is under continuous integration by Travis again.
2019-02-26 11:56:32 +01:00
Andreas Schildbach
f24a4aa19a Update Guava to 27.0.1-android. 2019-02-15 03:34:11 +01:00
Andreas Schildbach
34e8bc217a build.gradle: Configure Eclipse plugin. 2019-02-14 23:03:24 +01:00
Andreas Schildbach
bfe2a195b6 Receive to and send from native segwit addresses
- Hierarchical-deterministic derivation of native segwit addresses.
- Receive payments to native segwit addresses.
- Spend and sign payments from native segwit addresses.
- Watch-only wallets with native segwit addresses (zpub/vpub).
- WalletAppKit, Wallet-tool and Wallet-template are taught to deal with segwit-enabled wallets.

Be aware this adds a new field in the wallet protobuf: output_script_type in Key, which keeps track
of the script type of DeterministicKeyChains. Protobufs will be migrated; old DeterministicKeyChains
are assumed to be of type P2PKH.

Includes some code by Fabrice Drouin.
2019-02-11 16:48:37 +01:00
Andreas Schildbach
0d90157749 Wallet-template: Allow sending to Bech32 addresses. 2019-02-06 12:02:31 +01:00
Nicola Atzei
0833fe1cea In JavaDocs change <tt> tags to @code. 2019-01-04 18:36:59 +01:00
Andreas Schildbach
7b0a9c207f Update Guava to 25.1-android. 2018-11-27 13:41:58 +01:00
Andreas Schildbach
2992cc16ff build.gradle: Specify source encodings. 2018-10-31 11:12:49 +01:00
Andreas Schildbach
ad262de961 Migrate from SpongyCastle back to BouncyCastle.
Google moved their broken BouncyCastle out of the way with Android 3.0
(see 0ac85ead96%5E%21/).
2018-10-23 16:09:10 +02:00
Andreas Schildbach
aaa5262ef4 Migrate from Maven to Gradle 3.4 for building. 2018-05-01 16:49:30 +02:00
Andreas Schildbach
8ee5e48171 Update to protobuf-java 3.5.1.
In the test data for DeterministicKeyChainTest all occurences of the (often invisible) 0x7f
character is replaced by its numerical literal "\177". This change is needed because a bug of
previous versions was fixed, which caused this character not being printed as text.
2018-03-13 21:55:47 +01:00
Andreas Schildbach
c35d892fa6 Add Utils.isLinux() and Utils.isMac() helpers. 2018-03-13 13:05:59 +01:00
Andreas Schildbach
4bbb7be059 Migrate fully qualified names to using imports. 2018-03-11 21:36:25 +01:00
Andreas Schildbach
fa5bdbb672 JavaDoc: Fix HTML structure. 2018-03-11 20:40:28 +01:00
Andreas Schildbach
7f5b6753f5 Use Address whereever possible in the API, rather than LegacyAddress.
This is a preparation for the remaining segwit changes. LegacyAddress
variables in unit tests are also changed.
2018-03-05 10:35:09 +01:00
Andreas Schildbach
e11119b64f Rename VersionedChecksummedBytes→PrefixedChecksummedBytes, Address→LegacyAddress and AbstractAddress→Address.
This also renames corresponding test classes and mentions in comments.
2018-02-28 16:57:16 +01:00
Andreas Schildbach
71a5b1b89f Remove some unused imports. 2018-02-23 20:09:41 +01:00
Andreas Schildbach
e0e8ecbd69 Update to Guava 24.0-android. 2018-02-23 12:24:06 +01:00
Andreas Schildbach
1692cd973e Update wallet-template to Guava 22.0-android too. 2017-06-23 11:49:55 +02:00
Andreas Schildbach
afc198600a Utils: Inline join(). 2017-06-02 16:55:40 +02:00
Andreas Schildbach
7e609a2409 Remove Orchid forked subproject and support for connecting via Tor. 2016-11-25 23:14:39 +01:00
Andreas Schildbach
736fd7dbde Add the generic license header to POMs, shell scripts and JavaScript/Python examples. 2016-06-06 21:32:02 +02:00
Andreas Schildbach
3773a4343c Add a generic copyright statement to all license headers that don't have one.
Note it is not legally necessary to state copyright, but we think it makes things easier.
2016-06-06 21:32:02 +02:00
Andreas Schildbach
a407f04b56 0.15-SNAPSHOT 2016-04-02 18:04:21 +02:00
Andreas Schildbach
4e29e4fb00 Wallet: Make SendRequest a top level class. 2016-04-01 22:03:14 +02:00
Andreas Schildbach
1e66b9a8e3 Finish moving wallet related classes to .wallet package.
These classes are moved to .wallet:
- Wallet + WalletTest
- WalletExtension + WalletExtensionsTest
- WalletProtobufSerializer
- UnreadableWalletException

These classes are moved to .wallet.listeners:
- WalletEventListener
- WalletChangeEventListener
- WalletCoinsReceivedEventListener
- WalletCoinsSentEventListener
- WalletReorganizeEventListener
- ScriptsChangeEventListener
- AbstractWalletEventListener
- KeyChainEventListener
- AbstractKeyChainEventListener
2016-04-01 21:44:30 +02:00
Andreas Schildbach
c1938fec75 Harmonize license headers. 2016-03-26 19:55:05 +01:00
Andreas Schildbach
85f7c39aa5 Refresh bundled checkpoints and switch to textual format for easier audit. 2016-03-21 21:40:14 +01:00
Andreas Schildbach
9e52e4e0bf wallet-template: When constructing the wallet file name from the app's name, replace problematic characters so the filesystem doesn't throw up. 2016-02-29 16:41:49 +01:00
Ross Nicoll
aca39ee9de Split wallet events into single method interfaces 2016-02-06 20:01:38 +01:00
Kirill Vlasov
e3e8e8079d Constructors should only call non-overridable methods 2016-01-06 14:11:00 +01:00
Mike Hearn
9ba1be762a Wallet: flip argument ordering in deprecated Wallet.addEventListener to restore compatibility with 0.13 2015-10-05 17:12:55 +02:00
Andreas Schildbach
d4c7ce5c77 wallet-template: Fix warning about missing @Nullable annotation. 2015-08-24 18:54:00 +02:00
Andreas Schildbach
200f2368c6 AddressFormatException: Make unchecked. Base58 strings are rarely typed manually these days. 2015-08-08 16:33:29 +02:00
Ross Nicoll
ecbd021167 Refactor listener interfaces.
Refactor listener interfaces into their own package.
Split listener interfaces into smaller interfaces.
Make abstract implementations actually abstract.
Rearrange methods for adding listeners to put executor first.
2015-08-08 15:37:46 +02:00
Andreas Schildbach
0441b38599 Provide a consistent fromBase58/toBase58 API for the VersionChecksummedBytes hierarchy.
Deprecates the old constructors and migrates bitcoinj itself to use the new API. Also makes DumpedPrivateKey use WrongNetworkException when appropriate. Adds missing testcases and corrects/adds a bit of JavaDoc.
2015-07-18 13:53:59 +02:00
Andreas Schildbach
ce58f6945f Upgrade to Guava 18.0. 2015-07-06 10:03:31 +02:00
Andreas Schildbach
24de5e2a40 0.14-SNAPSHOT 2015-07-06 09:54:04 +02:00
Amichai Rothman
820765753c Clean up toString and other string-related code. 2015-06-30 12:45:59 +02:00
Mike Hearn
db86185972 WalletTemplate: remove bit of redundant fxml 2015-04-09 17:00:55 +02:00
Mike Hearn
cd337504b7 WalletTemplate: expose MainWindow in Main 2015-04-09 17:00:05 +02:00
Carlos Lopez-Camey
48401a0af1 Removes deprecation warnings. In pom.xml artifactId is project.artifactId. Sha256Hash.createHash is Sha256Hash.hashTwice. LazyECPoint.getX and getY use getXCoord and getYCoord while forcing normalization. 2015-03-22 17:07:17 +01:00
Mike Hearn
114a4b4fd1 wallettemplate/pom.xml: fix a maven deprecation warning 2015-03-22 16:50:20 +01:00
Mike Hearn
04bc624a91 Rewrite TxConfidenceTable to actually track confidence objects. Make Transaction.getConfidence() fetch the object from the table via the context. This allows us to simplify large chunks of code quite considerably. Note that confidence listeners are not yet pinning the attached confidence to the root set, so the same old bugs remain if you don't pin the tx object. That will be fixed next. 2015-03-21 17:07:44 +01:00
Mike Hearn
e0870efd61 Rewrite how WalletTemplate estimates scrypt difficulty, as the old approach was horribly busted and could use tons of RAM. Backport from Lighthouse. 2015-02-25 18:58:15 +01:00
Mike Hearn
99ff22d77b Fix a bug in SendMoneyController that caused it to forget the amount of money requested across password requests. Fixes #316. 2015-02-25 18:49:25 +01:00
Mike Hearn
1efa1442c8 (API CHANGE) Pass the FilteredBlock into PeerEventListener.onBlocksDownloaded when present.
Keep track of downloaded vs server-side filtered transactions per second.
Add a keyboard shortcut to wallet-template to force disconnection from the current peer.
2015-02-17 17:02:57 +01:00
Mike Hearn
71e9a2d4b2 WalletTemplate: don't override default PeerGroup params as they should be appropriate out of the box. Propagate WAK startup errors to the UI. 2015-01-21 15:48:42 +01:00
Tyler Houlihan
3d7d649827 Creating a useful shaded jar, that can be run with java -jar.
This appeared to be in the video for building a simple wallet, but not in the pom itself.
2014-12-23 18:14:15 +01:00
Mike Hearn
2b6db0dc80 Add an experimental HTTP based peer discovery engine that uses signed gzipped protocol buffers. 2014-12-19 02:30:58 +01:00