From fc3ac2720544a9e8919efb582fb14a59d8922266 Mon Sep 17 00:00:00 2001 From: Honza Date: Tue, 24 Jan 2023 14:17:10 +0100 Subject: [PATCH] Update unsafe suffix documentation --- docs/Architecture.md | 2 +- .../client/model/LightWalletEndpointInfoUnsafe.kt | 5 +++++ .../lightwallet/client/model/RawTransactionUnsafe.kt | 5 +++++ .../lightwallet/client/model/SendResponseUnsafe.kt | 7 +++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/Architecture.md b/docs/Architecture.md index 5ba2f955..68bef90c 100644 --- a/docs/Architecture.md +++ b/docs/Architecture.md @@ -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: 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. # lightwallet-client-lib diff --git a/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/LightWalletEndpointInfoUnsafe.kt b/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/LightWalletEndpointInfoUnsafe.kt index 947c4eff..c5c7b02b 100644 --- a/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/LightWalletEndpointInfoUnsafe.kt +++ b/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/LightWalletEndpointInfoUnsafe.kt @@ -2,6 +2,11 @@ package co.electriccoin.lightwallet.client.model 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( val chainName: String, val consensusBranchId: String, diff --git a/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/RawTransactionUnsafe.kt b/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/RawTransactionUnsafe.kt index c644f526..2571f3c4 100644 --- a/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/RawTransactionUnsafe.kt +++ b/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/RawTransactionUnsafe.kt @@ -2,6 +2,11 @@ package co.electriccoin.lightwallet.client.model 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) { companion object { fun new(rawTransaction: RawTransaction) = RawTransactionUnsafe( diff --git a/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/SendResponseUnsafe.kt b/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/SendResponseUnsafe.kt index 71a9c3c1..9079a2c7 100644 --- a/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/SendResponseUnsafe.kt +++ b/lightwallet-client-lib/src/main/java/co/electriccoin/lightwallet/client/model/SendResponseUnsafe.kt @@ -2,6 +2,13 @@ package co.electriccoin.lightwallet.client.model 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( val code: Int, val message: String