Update unsafe suffix documentation

This commit is contained in:
Honza 2023-01-24 14:17:10 +01:00
parent 2b834013cb
commit fc3ac27205
4 changed files with 18 additions and 1 deletions

View File

@ -26,7 +26,7 @@ The SDK is broken down into several logical components, implemented as Gradle mo
Before diving into some of the module specifics, it is helpful to provide some context on the data model representations as data flows between the different modules of this repository. There are multiple data representations, including: Before diving into some of the module specifics, it is helpful to provide some context on the data model representations as data flows between the different modules of this repository. There are multiple data representations, including:
1. Network — The wire representation for calls to and from the Lightwalletd server. These are generated by `protoc` at compile time. These are not generally a public API. 1. Network — The wire representation for calls to and from the Lightwalletd server. These are generated by `protoc` at compile time. These are not generally a public API.
2. Unsafe — The representation provided as the public API from `lightwallet-client-lib`. These values are not necessarily validated, hence the smurf naming with the suffix `Unsafe`. These are not generally a public API. 2. Unsafe — The representation provided as the output from `lightwallet-client-lib`. These values are not necessarily validated, hence the smurf naming with the suffix `Unsafe`. These are not generally a public API for clients of the SDK.
3. SDK — Objects exposed as a public API for clients of the SDK. 3. SDK — Objects exposed as a public API for clients of the SDK.
# lightwallet-client-lib # lightwallet-client-lib

View File

@ -2,6 +2,11 @@ package co.electriccoin.lightwallet.client.model
import cash.z.wallet.sdk.internal.rpc.Service import cash.z.wallet.sdk.internal.rpc.Service
/**
* A lightwalletd endpoint information, which has come from the Light Wallet server.
*
* It is marked as "unsafe" because it is not guaranteed to be valid.
*/
data class LightWalletEndpointInfoUnsafe( data class LightWalletEndpointInfoUnsafe(
val chainName: String, val chainName: String,
val consensusBranchId: String, val consensusBranchId: String,

View File

@ -2,6 +2,11 @@ package co.electriccoin.lightwallet.client.model
import cash.z.wallet.sdk.internal.rpc.Service.RawTransaction import cash.z.wallet.sdk.internal.rpc.Service.RawTransaction
/**
* RawTransaction contains the complete transaction data, which has come from the Light Wallet server.
*
* It is marked as "unsafe" because it is not guaranteed to be valid.
*/
class RawTransactionUnsafe(val height: BlockHeightUnsafe, val data: ByteArray) { class RawTransactionUnsafe(val height: BlockHeightUnsafe, val data: ByteArray) {
companion object { companion object {
fun new(rawTransaction: RawTransaction) = RawTransactionUnsafe( fun new(rawTransaction: RawTransaction) = RawTransactionUnsafe(

View File

@ -2,6 +2,13 @@ package co.electriccoin.lightwallet.client.model
import cash.z.wallet.sdk.internal.rpc.Service import cash.z.wallet.sdk.internal.rpc.Service
/**
* A SendResponse encodes an error code and a string. It is currently used only by SendTransaction(). If error code
* is zero, the operation was successful; if non-zero, it and the message specify the failure. It has come from the
* Light Wallet server.
*
* It is marked as "unsafe" because it is not guaranteed to be valid.
*/
data class SendResponseUnsafe( data class SendResponseUnsafe(
val code: Int, val code: Int,
val message: String val message: String