Skip to content

Commit

Permalink
Merge pull request #73 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.12.0
  • Loading branch information
anton6tak authored Oct 15, 2021
2 parents 1db3fe5 + 5137ad8 commit 5ab0ed5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:web3:0.11.0")
commonMainApi("dev.icerock.moko:web3:0.12.0")
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ kbignumVersion = "2.2.0"
klockVersion = "2.2.2"
ktorClientVersion = "1.6.1"
mokoTestVersion = "0.4.0"
mokoWeb3Version = "0.11.0"
mokoWeb3Version = "0.12.0"
multidexVersion = "2.0.1"

[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,26 @@ package dev.icerock.moko.web3

import dev.icerock.moko.web3.hex.Hex32String
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

@Serializable
@Serializable(with = TransactionHash.Serializer::class)
class TransactionHash(private val value: String) : Hex32String by Hex32String(value) {
override fun toString() = withoutPrefix
override fun toString() = withoutPrefix
override fun hashCode(): Int = withoutPrefix.hashCode()
override fun equals(other: Any?): Boolean = other is TransactionHash && other.withoutPrefix == withoutPrefix

@kotlinx.serialization.Serializer(forClass = TransactionHash::class)
object Serializer {
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(
serialName = "dev.icerock.mokoWeb3.TransactionHash",
kind = PrimitiveKind.STRING
)

override fun deserialize(decoder: Decoder): TransactionHash = TransactionHash(decoder.decodeString())
override fun serialize(encoder: Encoder, value: TransactionHash) = encoder.encodeString(value.value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ enum class StaticEncoders(
val typeAnnotation: String,
val encoder: StaticEncoder<*>
) {
UInt8(typeAnnotation = "uint8", encoder = UInt256Param),
UInt256(typeAnnotation = "uint256", encoder = UInt256Param),
Address(typeAnnotation = "address", encoder = AddressParam);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class HexStringValueClass(private val value: String): HexString {

override val withoutPrefix: String get() = value.removePrefix(HEX_PREFIX)
override val prefixed: String get() = "$HEX_PREFIX$withoutPrefix"
override val bigInt: BigInt get() = value.bi(RADIX)
override val bigInt: BigInt get() = withoutPrefix.bi(RADIX)

override fun toString() = withoutPrefix
override fun hashCode(): Int = withoutPrefix.hashCode()
Expand Down

0 comments on commit 5ab0ed5

Please sign in to comment.