diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b39440f..b3419e1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,8 @@ Change Log ### Added - `cash.z.ecc.android.sdk`: - - `Synchronizer.getCurrentAddress` - - `Synchronizer.getLegacySaplingAddress` - - `Synchronizer.getLegacyTransparentAddress` + - `Synchronizer.getUnifiedAddress` + - `Synchronizer.getSaplingAddress` - `Synchronizer.isValidUnifiedAddr` - `Synchronizer.getMemos(TransactionOverview)` - `Synchronizer.getReceipients(TransactionOverview)` @@ -51,9 +50,8 @@ Change Log ### Removed - `cash.z.ecc.android.sdk`: - `Initializer` (use `Synchronizer.new` instead) - - `Synchronizer.getAddress` (use `Synchronizer.getCurrentAddress` instead). - - `Synchronizer.getShieldedAddress` (use `Synchronizer.getLegacySaplingAddress` instead). - - `Synchronizer.getTransparentAddress` (use `Synchronizer.getLegacyTransparentAddress` instead). + - `Synchronizer.getAddress` (use `Synchronizer.getUnifiedAddress` instead). + - `Synchronizer.getShieldedAddress` (use `Synchronizer.getSaplingAddress` instead) - `Synchronizer.cancel` - `cash.z.ecc.android.sdk.type.UnifiedViewingKey` - This type had a bug where the `extpub` field actually was storing a plain transparent diff --git a/MIGRATIONS.md b/MIGRATIONS.md index b2f56cf7..4490e127 100644 --- a/MIGRATIONS.md +++ b/MIGRATIONS.md @@ -22,7 +22,7 @@ For SDK clients that store the key separately from the mnemonic, the migration m provided that they can be rederived from the mnemonic. * Re-generate the key from the mnemonic using `DerivationTool.deriveUnifiedFullViewingKeys` -To support Unified Addresses (UAs), some APIs have been modified. In particular, `Synchronizer.getCurrentAddress()` returns the unified address while `Synchronizer.getLegacySaplingAddress()` and `Synchronizer.getLegacyTransparentAddress()` return the sapling or transparent components of the unified address. Due to this change and the derivation of different addresses from UAs, clients may notice that the transparent address returned by this API is different from the transparent address returned by older versions of the SDK. Note that UA support does not yet encompass orchard addresses. +To support Unified Addresses (UAs), some APIs have been modified. In particular, `Synchronizer.getUnifiedAddress()` returns the unified address while `Synchronizer.getSaplingAddress()` and `Synchronizer.getTransparentAddress()` return the sapling or transparent components of the unified address. Due to this change and the derivation of different addresses from UAs, clients may notice that the transparent address returned by this API is different from the transparent address returned by older versions of the SDK. Note that UA support does not yet encompass orchard addresses. Due to internal changes in the SDK, the way transactions are queried and represented works differently. The previous ConfirmedTransaction object has been replaced with `TransactionOverview` which contains less information. Missing fields, such as memos and recipients, can be queried with `Synchronizer.getMemos(TransactionOverview)` and `Synchronizer.getReceipients(TransactionOverview)`. diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt index 861110b1..fca3b33e 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt @@ -79,9 +79,9 @@ class TestWallet( val available get() = synchronizer.saplingBalances.value?.available val unifiedAddress = - runBlocking { synchronizer.getCurrentAddress(Account.DEFAULT) } + runBlocking { synchronizer.getUnifiedAddress(Account.DEFAULT) } val transparentAddress = - runBlocking { synchronizer.getLegacyTransparentAddress(Account.DEFAULT) } + runBlocking { synchronizer.getTransparentAddress(Account.DEFAULT) } val birthdayHeight get() = synchronizer.latestBirthdayHeight val networkName get() = synchronizer.network.networkName diff --git a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt index 7c9a5ff2..c65e20b9 100644 --- a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt +++ b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt @@ -65,7 +65,7 @@ class SampleCodeTest { // /////////////////////////////////////////////////// // Get Address @Test fun getAddress() = runBlocking { - val address = synchronizer.getCurrentAddress() + val address = synchronizer.getUnifiedAddress() assertFalse(address.isBlank()) log("Address: $address") } diff --git a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/getaddress/GetAddressFragment.kt b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/getaddress/GetAddressFragment.kt index a83a879b..9f850df6 100644 --- a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/getaddress/GetAddressFragment.kt +++ b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/getaddress/GetAddressFragment.kt @@ -61,17 +61,17 @@ class GetAddressFragment : BaseDemoFragment() { private fun displayAddress() { viewLifecycleOwner.lifecycleScope.launchWhenStarted { binding.unifiedAddress.apply { - val uaddress = synchronizer.getCurrentAddress() + val uaddress = synchronizer.getUnifiedAddress() text = uaddress setOnClickListener { copyToClipboard(uaddress) } } binding.saplingAddress.apply { - val sapling = synchronizer.getLegacySaplingAddress() + val sapling = synchronizer.getSaplingAddress() text = sapling setOnClickListener { copyToClipboard(sapling) } } binding.transparentAddress.apply { - val transparent = synchronizer.getLegacyTransparentAddress() + val transparent = synchronizer.getTransparentAddress() text = transparent setOnClickListener { copyToClipboard(transparent) } } diff --git a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/listutxos/ListUtxosFragment.kt b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/listutxos/ListUtxosFragment.kt index 5fb98c52..0dc51acb 100644 --- a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/listutxos/ListUtxosFragment.kt +++ b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/listutxos/ListUtxosFragment.kt @@ -174,7 +174,7 @@ class ListUtxosFragment : BaseDemoFragment() { resetInBackground() viewLifecycleOwner.lifecycleScope.launchWhenStarted { binding.inputAddress.setText( - synchronizer.getLegacyTransparentAddress(Account.DEFAULT) + synchronizer.getTransparentAddress(Account.DEFAULT) ) } } diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt index 097cf0ba..7706bd98 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt @@ -63,7 +63,7 @@ class TestnetIntegrationTest : ScopedTest() { @Test @Ignore("This test is broken") fun getAddress() = runBlocking { - assertEquals(address, synchronizer.getCurrentAddress()) + assertEquals(address, synchronizer.getUnifiedAddress()) } // This is an extremely slow test; it is disabled so that we can get CI set up diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt index 8d3aa208..55d2f0a5 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt @@ -77,9 +77,9 @@ class TestWallet( val available get() = synchronizer.saplingBalances.value?.available val unifiedAddress = - runBlocking { synchronizer.getCurrentAddress(Account.DEFAULT) } + runBlocking { synchronizer.getUnifiedAddress(Account.DEFAULT) } val transparentAddress = - runBlocking { synchronizer.getLegacyTransparentAddress(Account.DEFAULT) } + runBlocking { synchronizer.getTransparentAddress(Account.DEFAULT) } val birthdayHeight get() = synchronizer.latestBirthdayHeight val networkName get() = synchronizer.network.networkName diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/SdkSynchronizer.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/SdkSynchronizer.kt index 5a9618e0..686ccc75 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/SdkSynchronizer.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/SdkSynchronizer.kt @@ -375,7 +375,7 @@ class SdkSynchronizer internal constructor( suspend fun refreshUtxos() { twig("refreshing utxos", -1) - refreshUtxos(getLegacyTransparentAddress()) + refreshUtxos(getTransparentAddress()) } /** @@ -397,7 +397,7 @@ class SdkSynchronizer internal constructor( suspend fun refreshTransparentBalance() { twig("refreshing transparent balance") - _transparentBalances.value = processor.getUtxoCacheBalance(getLegacyTransparentAddress()) + _transparentBalances.value = processor.getUtxoCacheBalance(getTransparentAddress()) } suspend fun isValidAddress(address: String): Boolean { @@ -612,19 +612,19 @@ class SdkSynchronizer internal constructor( /** * Returns the current Unified Address for this account. */ - override suspend fun getCurrentAddress(account: Account): String = + override suspend fun getUnifiedAddress(account: Account): String = processor.getCurrentAddress(account) /** * Returns the legacy Sapling address corresponding to the current Unified Address for this account. */ - override suspend fun getLegacySaplingAddress(account: Account): String = + override suspend fun getSaplingAddress(account: Account): String = processor.getLegacySaplingAddress(account) /** * Returns the legacy transparent address corresponding to the current Unified Address for this account. */ - override suspend fun getLegacyTransparentAddress(account: Account): String = + override suspend fun getTransparentAddress(account: Account): String = processor.getTransparentAddress(account) override suspend fun sendToAddress( diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt index 6c910257..49634122 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt @@ -204,7 +204,7 @@ interface Synchronizer { * * @return the current unified address for the given account. */ - suspend fun getCurrentAddress(account: Account = Account.DEFAULT): String + suspend fun getUnifiedAddress(account: Account = Account.DEFAULT): String /** * Gets the legacy Sapling address corresponding to the current unified address for the given account. @@ -214,7 +214,7 @@ interface Synchronizer { * * @return a legacy Sapling address for the given account. */ - suspend fun getLegacySaplingAddress(account: Account = Account.DEFAULT): String + suspend fun getSaplingAddress(account: Account = Account.DEFAULT): String /** * Gets the legacy transparent address corresponding to the current unified address for the given account. @@ -224,7 +224,7 @@ interface Synchronizer { * * @return a legacy transparent address for the given account. */ - suspend fun getLegacyTransparentAddress(account: Account = Account.DEFAULT): String + suspend fun getTransparentAddress(account: Account = Account.DEFAULT): String /** * Sends zatoshi.