org.sol4k.rpc.BigIntegerSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sol4k Show documentation
Show all versions of sol4k Show documentation
Kotlin, JVM, and Android client for Solana
package org.sol4k.rpc
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind.STRING
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import java.math.BigInteger
internal object BigIntegerSerializer : KSerializer {
override fun deserialize(decoder: Decoder): BigInteger = decoder.decodeString().toBigInteger()
override fun serialize(encoder: Encoder, value: BigInteger) = encoder.encodeString(value.toString())
override val descriptor: SerialDescriptor
get() = PrimitiveSerialDescriptor("BigInteger", STRING)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy