Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Dec 4, 2024
1 parent 60eb9b7 commit 09da683
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data class TestVector(
val address: String,
val privateKey: String,
val publicKey: String
) {}
)

class WalletTestVectors {
val phrase = "later puppy sound rebuild rebuild noise ozone amazing hope broccoli crystal grief"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DebugPayload(val nonce: Int) : XyoPayload() {
set(value) = Unit
}

class BasicPayload(): XyoPayload() {
class BasicPayload : XyoPayload() {
override var schema: String
get() = "network.xyo.basic"
set(value) = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.junit.Before
import org.junit.Test
import org.junit.jupiter.api.Assertions.*

class DiscoverPayload(): XyoPayload() {
class DiscoverPayload : XyoPayload() {
override var schema = "network.xyo.query.module.discover"
}

Expand Down
4 changes: 2 additions & 2 deletions sdk/src/main/java/network/xyo/client/account/Account.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import java.security.SecureRandom

open class Account private constructor (private val _privateKey: PrivateKey, private var _previousHash: ByteArray? = null): AccountInstance {

constructor(privateKey: ByteArray, previousHash: ByteArray? = null) : this(PrivateKey.fromBytes(privateKey, secp256k1Curve), previousHash) {}
constructor(privateKey: BigInteger, previousHash: ByteArray? = null) : this(privateKey.toByteArray(), previousHash) {}
constructor(privateKey: ByteArray, previousHash: ByteArray? = null) : this(PrivateKey.fromBytes(privateKey, secp256k1Curve), previousHash)
constructor(privateKey: BigInteger, previousHash: ByteArray? = null) : this(privateKey.toByteArray(), previousHash)

private val _address = addressFromUncompressedPublicKey(publicKeyUncompressed)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package network.xyo.client.archivist.wrapper
import network.xyo.client.payload.XyoPayload


class ArchivistInsertQueryPayload(): XyoPayload() {
class ArchivistInsertQueryPayload : XyoPayload() {
override var schema = ArchivistInsertQueryPayload.schema

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import network.xyo.data.PreviousHashPrefsDataStoreProtos
import network.xyo.data.PreviousHashPrefsDataStoreProtos.PreviousHashPrefsDataStore
import java.io.File

fun Context.xyoPreviousHashDataStore(name: String?, path: String?): DataStore<PreviousHashPrefsDataStoreProtos.PreviousHashPrefsDataStore> {
fun Context.xyoPreviousHashDataStore(name: String?, path: String?): DataStore<PreviousHashPrefsDataStore> {
val resolvedName = name ?: defaultXyoSdkSettings.previousHashStorePreferences.fileName
val resolvedPath = path ?: defaultXyoSdkSettings.previousHashStorePreferences.storagePath

Expand Down
3 changes: 1 addition & 2 deletions sdk/src/main/java/network/xyo/client/lib/XyoSerializable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ abstract class XyoSerializable: Serializable {
fun sortJson(jsonArray: JSONArray, removeMeta: Boolean = false): JSONArray {
val newJsonArray = JSONArray()
for (i in 0 until jsonArray.length()) {
val value = jsonArray[i]
when (value) {
when (val value = jsonArray[i]) {
is JSONArray -> {
newJsonArray.put(sortJson(value, removeMeta))
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/network/xyo/client/payload/XyoPayload.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open class XyoValidationException(message: String): XyoException(message)
open class XyoInvalidSchemaException(val schema: String): XyoValidationException("'schema' must be lowercase [${schema}]")

@JsonClass(generateAdapter = true)
open class XyoPayload(): Payload, XyoSerializable() {
open class XyoPayload : Payload, XyoSerializable() {
// Note: Has to be var because "Moshi does not consider a val as a serializable member because
// it cannot be symmetrically deserialized."
// see - https://github.com/square/moshi/issues/1803
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/network/xyo/client/settings/Defaults.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package network.xyo.client.settings
const val DefaultStoragePath = "__xyo-client-sdk__"
const val DefaultFileName = "network-xyo-sdk-prefs"

open class DefaultXyoSdkSettings(): SettingsInterface {
open class DefaultXyoSdkSettings : SettingsInterface {
override val accountPreferences: AccountPreferences = DefaultAccountPreferences()
override val previousHashStorePreferences: PreviousHashStorePreferences = DefaultPreviousHashStorePreferences()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ interface StorageLocationPreference {
val storagePath: String?
}

interface AccountPreferences: StorageLocationPreference {}
interface AccountPreferences: StorageLocationPreference

interface PreviousHashStorePreferences: StorageLocationPreference {}
interface PreviousHashStorePreferences: StorageLocationPreference

0 comments on commit 09da683

Please sign in to comment.