Fix typos and cleanup

This commit is contained in:
Dimitris Apostolou 2020-03-26 13:00:04 +02:00 committed by GitHub
parent 170c86fc84
commit 44cba56d30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 28 deletions

View File

@ -45,7 +45,7 @@ Thankfully, the only thing an app developer has to be concerned with is the foll
## Overview
At a high level, this SDK simply helps native Android codebases connect to Zcash's Rust crypto libraries without needing to know Rust or be a Cryptographer. Think of it as welding. The SDK takes separate things and tightly bonds them together such that each can remain as idiomatic as possible. It's goal is to make it easy for an app to incorporate shielded transactions while remaining a good citizen on mobile devices.
At a high level, this SDK simply helps native Android codebases connect to Zcash's Rust crypto libraries without needing to know Rust or be a Cryptographer. Think of it as welding. The SDK takes separate things and tightly bonds them together such that each can remain as idiomatic as possible. Its goal is to make it easy for an app to incorporate shielded transactions while remaining a good citizen on mobile devices.
Given all the moving parts, making things easy requires coordination. The [Synchronizer](docs/-synchronizer/README.md) provides that layer of abstraction so that the primary steps to make use of this SDK are simply:
@ -111,7 +111,7 @@ synchronizer.sendToAddress(spendingKey, zatoshi, address, memo)
In the event that you *do* want to compile the SDK from sources, follow these steps:
1. [Install rust](https://www.rust-lang.org/learn/get-started)
2. Then, add the android targets via:
2. Then, add the android targets via:
```bash
rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android
```
@ -128,7 +128,7 @@ rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-andro
</p>
7. [Create an emulator](https://developer.android.com/studio/run/managing-avds) if you dont already have one (recommended target: API 29)
8. Select your desired build variant. Currently, we recommend `zcashmainnetDebug` as the testnet variants are slower to sync to current height due to a lack of checkpoints.
8. Select your desired build variant. Currently, we recommend `zcashmainnetDebug` as the testnet variants are slower to sync to current height due to a lack of checkpoints.
<p align="center">
<img src="assets/build-variants.png?raw=true" width="54%"/>
</p>

View File

@ -56,7 +56,7 @@ In the UNTRUSTED scenario:
## Security Invariants
Given these scenarios and adversaries, we can now state the security invariants
we stive to satisfy. While we pride ourselves on building high-quality software,
we strive to satisfy. While we pride ourselves on building high-quality software,
all software contains bugs, and so this threat model must not be construed as
any kind of warranty that our software satisfies these properties.

View File

@ -33,7 +33,7 @@ To explore the app, click on each menu item, in order, and also look at the asso
![The android demo app, running in Android Studio](assets/demo-app.png?raw=true "Demo App with Android Studio")
The demo app is not trying to show what's possible, but to present how to accomplish the building blocks of wallet functionality in a simple way in code. It is comprised of the following self-contained demos. All data is reset between demos in order to keep the behavior repeatable and independant of state.
The demo app is not trying to show what's possible, but to present how to accomplish the building blocks of wallet functionality in a simple way in code. It is comprised of the following self-contained demos. All data is reset between demos in order to keep the behavior repeatable and independent of state.
### Demos
@ -44,7 +44,7 @@ Get Address|[GetAddressFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/
Get Latest Height|[GetLatestHeightFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/getlatestheight/GetLatestHeightFragment.kt)|Given a lightwalletd server, retrieve the latest block height
Get Block|[GetBlockFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/getblock/GetBlockFragment.kt)|Given a lightwalletd server, retrieve a compact block
Get Block Range|[GetBlockRangeFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/getblockrange/GetBlockRangeFragment.kt)|Given a lightwalletd server, retrieve a range of compact blocks
List Transactions|[ListTransactionsFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/listtransactions/ListTransactionsFragment.kt)|Given a seed, list all related shielded transations
List Transactions|[ListTransactionsFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/listtransactions/ListTransactionsFragment.kt)|Given a seed, list all related shielded transactions
Send|[SendFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/send/SendFragment.kt)|Send and monitor a transaction, the most complex demo
[Back to contents](#contents)

View File

@ -164,7 +164,7 @@ class Initializer(
/**
* Initializes the databases that the rust library uses for managing state. The "data db" is
* created and a row is entered corresponding to the given birthday so that scanning does not
* need to start from the beginning of time. Lastly, the accounts table is initialized to
* need to start from the beginning of time. Lastly, the accounts table is initialized to
* simply hold the address and viewing key for each account, which simplifies the process of
* scanning and decrypting compact blocks.
*
@ -174,7 +174,7 @@ class Initializer(
* @param birthday the birthday to use for this wallet. This is used in order to seed the data
* DB with the first sapling tree, which also determines where the SDK begins downloading and
* scanning. Any blocks lower than the height represented by this birthday can safely be ignored
* since a wallet cannot have transactions prior to it's creation.
* since a wallet cannot have transactions prior to its creation.
* @param numberOfAccounts the number of accounts to create. Only 1 account is tested and
* supported at this time. It is possible, although unlikely that multiple accounts would behave
* as expected. Due to the nature of shielded address, the official Zcash recommendation is to
@ -696,4 +696,4 @@ internal fun validateAlias(alias: String) {
"ERROR: Invalid alias ($alias). For security, the alias must be shorter than 100 " +
"characters and only contain letters, digits or underscores and start with a letter"
}
}
}

View File

@ -141,7 +141,7 @@ class SdkSynchronizer internal constructor(
*
* @param parentScope the scope to use for this synchronizer, typically something with a
* lifecycle such as an Activity for single-activity apps or a logged in user session. This
* scope is only used for launching this synchronzer's job as a child. If no scope is provided,
* scope is only used for launching this synchronizer's job as a child. If no scope is provided,
* then this synchronizer and all of its coroutines will run until stop is called, which is not
* recommended since it can leak resources. That type of behavior is more useful for tests.
*
@ -444,7 +444,7 @@ fun Synchronizer(
* @param downloader the component responsible for downloading ranges of compact blocks.
* @param manager the component that manages outbound transactions in order to report which ones are
* still pending, particularly after failed attempts or dropped connectivity. The intent is to help
* monitor outbound transactions status through to completion.
* monitor outbound transactions status through to completion.
* @param processor the component responsible for processing compact blocks. This is effectively the
* brains of the synchronizer that implements most of the high-level business logic and determines
* the current state of the wallet.

View File

@ -277,7 +277,7 @@ interface Synchronizer {
/**
* An instance of [AddressType] corresponding to an invalid address.
*
* @param reason a descrption of why the address was invalid.
* @param reason a description of why the address was invalid.
*/
class Invalid(val reason: String = "Invalid") : AddressType()
@ -287,4 +287,4 @@ interface Synchronizer {
val isNotValid get() = this !is Valid
}
}
}

View File

@ -267,7 +267,7 @@ class CompactBlockProcessor(
*
* @param range the range of blocks to validate.
*
* @return -1 when there is not problem. Otherwise, return the lowest height where an error was
* @return -1 when there is no problem. Otherwise, return the lowest height where an error was
* found. In other words, validation starts at the back of the chain and works toward the tip.
*/
private fun validateNewBlocks(range: IntRange?): Int {
@ -288,7 +288,7 @@ class CompactBlockProcessor(
*
* @param range the range of blocks to scan.
*
* @return -1 when there is not problem. Otherwise, return the lowest height where an error was
* @return -1 when there is no problem. Otherwise, return the lowest height where an error was
* found. In other words, scanning starts at the back of the chain and works toward the tip.
*/
private suspend fun scanNewBlocks(range: IntRange?): Boolean = withContext(IO) {
@ -570,4 +570,4 @@ class CompactBlockProcessor(
}
}
}
}

View File

@ -5,7 +5,7 @@ import java.lang.RuntimeException
/**
* Marker for all custom exceptions from the SDK. Making it an interface would result in more typing
* so its a supertype, instead.
* so it's a supertype, instead.
*/
open class SdkException(message: String, cause: Throwable?) : RuntimeException(message, cause)
@ -28,7 +28,7 @@ sealed class RepositoryException(message: String, cause: Throwable? = null) : Sd
}
/**
* High-level exceptions thrown by the synchronizer, which do not fall within the umbrealla of a
* High-level exceptions thrown by the synchronizer, which do not fall within the umbrella of a
* child component.
*/
sealed class SynchronizerException(message: String, cause: Throwable? = null) : SdkException(message, cause) {

View File

@ -133,7 +133,7 @@ inline fun BigDecimal?.toUsdString(
/**
* Create a number formatter for use with converting currency to strings. This probably isn't needed
* externally since the other formatting functions leverage this, instead. Leverages the default
* rounding mode for zec found in ZEC_FORMATTER.
* rounding mode for ZEC found in ZEC_FORMATTER.
*
* @param maxDecimals the number of decimal places to use in the format. Default is 6 because ZEC is
* glorious.
@ -358,4 +358,4 @@ internal inline fun String.masked(addressCharsToShow: Int = 4): String =
*
* @return true when this function starts with 'z' rather than 't'.
*/
inline fun String?.isShielded() = this != null && startsWith('z')
inline fun String?.isShielded() = this != null && startsWith('z')

View File

@ -64,7 +64,7 @@ inline fun retrySimple(retries: Int = 2, sleepTime: Long = 20L, block: (Int) ->
* @param onErrorListener a callback that gets the first shot at processing any error and can veto
* the retry behavior by returning false.
* @param initialDelayMillis the initial delay before retrying.
* @param maxDelayMillis the maximum delay between retrys.
* @param maxDelayMillis the maximum delay between retries.
* @param block the logic to run once and then run again if it fails.
*/
suspend inline fun retryWithBackoff(noinline onErrorListener: ((Throwable) -> Boolean)? = null, initialDelayMillis: Long = 1000L, maxDelayMillis: Long = MAX_BACKOFF_INTERVAL, block: () -> Unit) {
@ -99,4 +99,4 @@ suspend inline fun retryWithBackoff(noinline onErrorListener: ((Throwable) -> Bo
*/
internal fun dbExists(appContext: Context, dbFileName: String): Boolean {
return File(appContext.getDatabasePath(dbFileName).absolutePath).exists()
}
}

View File

@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.Flow
* Constructs a `Flow<PagedList>`, from this `DataSource.Factory`, convenience for
* [FlowPagedListBuilder].
*
* No work (such as loading) is done immediately, the creation of the first PagedList is is
* No work (such as loading) is done immediately, the creation of the first PagedList is
* deferred until the Flow is collected.
*
* @param config Paging configuration.
@ -39,7 +39,7 @@ fun <Key, Value> DataSource.Factory<Key, Value>.toFlowPagedList(
* Constructs a `Flow<PagedList>`, from this `DataSource.Factory`, convenience for
* [FlowPagedListBuilder].
*
* No work (such as loading) is done immediately, the creation of the first PagedList is is
* No work (such as loading) is done immediately, the creation of the first PagedList is
* deferred until the Flow is collected.
*
* @param pageSize Page size.

View File

@ -39,7 +39,7 @@ class FlowPagedListBuilder<Key, Value>(
/**
* Constructs the `Flow<PagedList>`.
*
* No work (such as loading) is done immediately, the creation of the first PagedList is is
* No work (such as loading) is done immediately, the creation of the first PagedList is
* deferred until the Flow is collected.
*
* @return The Flow of PagedLists

View File

@ -54,7 +54,7 @@ interface OutboundTransactionManager {
* Given a transaction and the height at which it was mined, update the transaction to indicate
* that it was mined.
*
* @param pendingTx the pending transaction that has been mineed.
* @param pendingTx the pending transaction that has been mined.
* @param minedHeight the height at which the given transaction was mined, according to the data
* that has been processed from the blockchain.
*/
@ -67,7 +67,7 @@ interface OutboundTransactionManager {
* @param id the id to monitor.
*
* @return a flow of pending transactions that are emitted anytime the transaction associated
* withh the given id changes.
* with the given id changes.
*/
suspend fun monitorById(id: Long): Flow<PendingTransaction>
@ -115,4 +115,4 @@ interface TransactionError {
* The message associated with this error.
*/
val message: String
}
}