[#1400] Update public Memo class API
- Closes #1400 - Adds a few more minor changes - Changelog update
This commit is contained in:
parent
a0335a3571
commit
f5ab7d9d19
|
@ -12,9 +12,11 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
`sdk-lib/src/main/java/cash/z/ecc/android/sdk/model/WalletBalance.kt`
|
||||
- `Synchronizer.transparentBalances: WalletBalance` to `Synchronizer.transparentBalance: Zatoshi`
|
||||
- `WalletSnapshot.transparentBalance: WalletBalance` to `WalletSnapshot.transparentBalance: Zatoshi`
|
||||
- `Memo.MAX_MEMO_LENGTH_BYTES` is now available in public API
|
||||
|
||||
### Added
|
||||
- `WalletBalanceFixture` class with mock values that are supposed to be used only for testing purposes
|
||||
- `Memo.countLength(memoString: String)` to count memo length in bytes
|
||||
|
||||
## [2.0.6] - 2024-01-30
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ FLANK_VERSION=23.10.1
|
|||
# When changing this, be sure to change build-conventions/gradle.properties#FOOJAY_TOOLCHAIN_RESOLVER_VERSION too
|
||||
FOOJAY_TOOLCHAIN_RESOLVER_VERSION=0.5.0
|
||||
FULLADLE_VERSION=0.17.4
|
||||
GRADLE_VERSIONS_PLUGIN_VERSION=0.50.0
|
||||
GRADLE_VERSIONS_PLUGIN_VERSION=0.51.0
|
||||
KSP_VERSION=1.8.20-1.0.10
|
||||
KTLINT_VERSION=1.1.0
|
||||
PROTOBUF_GRADLE_PLUGIN_VERSION=0.9.4
|
||||
|
@ -103,7 +103,7 @@ ANDROIDX_ANNOTATION_VERSION=1.7.0
|
|||
ANDROIDX_APPCOMPAT_VERSION=1.6.1
|
||||
ANDROIDX_COMPOSE_COMPILER_VERSION=1.5.7
|
||||
ANDROIDX_COMPOSE_MATERIAL3_VERSION=1.1.1
|
||||
ANDROIDX_COMPOSE_VERSION=1.5.4
|
||||
ANDROIDX_COMPOSE_VERSION=1.6.2
|
||||
ANDROIDX_COMPOSE_MATERIAL_ICONS_VERSION=1.5.4
|
||||
ANDROIDX_CONSTRAINT_LAYOUT_VERSION=2.1.4
|
||||
ANDROIDX_CORE_VERSION=1.12.0
|
||||
|
|
|
@ -17,8 +17,10 @@ value class Memo(val value: String) {
|
|||
*
|
||||
* https://zips.z.cash/zip-0321
|
||||
*/
|
||||
private const val MAX_MEMO_LENGTH_BYTES = 512
|
||||
const val MAX_MEMO_LENGTH_BYTES = 512
|
||||
|
||||
fun isWithinMaxLength(memoString: String) = memoString.sizeInUtf8Bytes() <= MAX_MEMO_LENGTH_BYTES
|
||||
fun countLength(memoString: String): Int = memoString.sizeInUtf8Bytes()
|
||||
|
||||
fun isWithinMaxLength(memoString: String) = countLength(memoString) <= MAX_MEMO_LENGTH_BYTES
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ object ZecSendExt {
|
|||
add(ZecSendValidation.Invalid.ValidationError.INVALID_AMOUNT)
|
||||
}
|
||||
|
||||
// TODO [#342]: Verify Addresses without Synchronizer
|
||||
// TODO [#342]: https://github.com/zcash/zcash-android-wallet-sdk/issues/342
|
||||
}
|
||||
|
||||
|
|
|
@ -616,9 +616,8 @@ class SdkSynchronizer private constructor(
|
|||
|
||||
override suspend fun isValidUnifiedAddr(address: String) = txManager.isValidUnifiedAddress(address)
|
||||
|
||||
override suspend fun validateAddress(address: String): AddressType {
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
return try {
|
||||
override suspend fun validateAddress(address: String): AddressType =
|
||||
runCatching {
|
||||
if (isValidShieldedAddr(address)) {
|
||||
Shielded
|
||||
} else if (isValidTransparentAddr(address)) {
|
||||
|
@ -628,12 +627,9 @@ class SdkSynchronizer private constructor(
|
|||
} else {
|
||||
AddressType.Invalid("Not a Zcash address")
|
||||
}
|
||||
} catch (
|
||||
@Suppress("TooGenericExceptionCaught") error: Throwable
|
||||
) {
|
||||
}.getOrElse { error ->
|
||||
AddressType.Invalid(error.message ?: "Invalid")
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun validateConsensusBranch(): ConsensusMatchType {
|
||||
val serverBranchId = tryNull { processor.downloader.getServerInfo()?.consensusBranchId }
|
||||
|
|
Loading…
Reference in New Issue