Skip to content

v5.0.0

Latest
Compare
Choose a tag to compare
@christroutner christroutner released this 24 Aug 15:02
· 132 commits to master since this release
7d2ab25

v5.0.0 changes the initialization of the wallet. See examples in the README for code examples.

Before, it was necessary to await wallet.walletInfoPromise after instantiating the Class. This is still needed. Waiting did two things:

  • It waited for the cryptography to execute to create the wallet.
  • It waited for the wallet to make a network call to get blockchain data about the wallet.

Those two steps have been separated in v5. It's still needed to await wallet.walletInfoPromise in order to wait for the cryptography to finish and create the wallet. This makes no network calls.

But it is now necessary to call await wallet.initialize() in order to make the network call to hydrate the wallet with blockchain info (UTXOs, tokens, etc).

Separating these calls makes it easier to test applications that depend on this wallet library. This is the primary reason for the change.

To expand: It is not necessary to mock the wallet's creation during tests, which is quite complex. Devs can simply mock the initialize() function in unit tests, in order to prevent it from making network calls.