Rename Synchronizer.getAddress APIs
This commit is contained in:
parent
ee99b36798
commit
b288b8cad9
10
CHANGELOG.md
10
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
|
||||
|
|
|
@ -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)`.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -61,17 +61,17 @@ class GetAddressFragment : BaseDemoFragment<FragmentGetAddressBinding>() {
|
|||
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) }
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ class ListUtxosFragment : BaseDemoFragment<FragmentListUtxosBinding>() {
|
|||
resetInBackground()
|
||||
viewLifecycleOwner.lifecycleScope.launchWhenStarted {
|
||||
binding.inputAddress.setText(
|
||||
synchronizer.getLegacyTransparentAddress(Account.DEFAULT)
|
||||
synchronizer.getTransparentAddress(Account.DEFAULT)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue