Skip to content

Unable to access unsigned data fields from Java #32

@angusscott

Description

@angusscott

Currently trying to use the library within a Java project, and have mostly been able to get a basic project working. Problem I have is that the inline UByte class isn't accessible to Java (can't see component1() or getDecimals()). Proposal would be to add Java friendly accessors like below

Additionally, as per the Kotlin guide, you cannot catch Kotlin exceptions, unless a method is annotated with @throws(SuiException::class)

https://kotlinlang.org/docs/java-to-kotlin-interop.html#checked-exceptions

data class SuiCoinMetadata(
    val decimals: UByte,
    val description: String,
    val iconUrl: String?,
    val id: String = "",
    val name: String,
    val symbol: String,
) {
    @JvmName("getDecimalsAsInt")
    fun getDecimalsAsInt(): Int = decimals.toInt()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions