All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dev.icerock.moko.web3.ContractAddress.kt Maven / Gradle / Ivy

There is a newer version: 0.18.4-ktor2_ionspinbignum
Show newest version
/*
 * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
 */

package dev.icerock.moko.web3

import dev.icerock.moko.web3.crypto.createChecksummedAddress
import dev.icerock.moko.web3.hex.HexString
import dev.icerock.moko.web3.hex.ParametrizedHexStringSerializer
import kotlinx.serialization.Serializable

object ContractAddressSerializer : ParametrizedHexStringSerializer(ContractAddress)

@Serializable(with = ContractAddressSerializer::class)
open class ContractAddress(value: String) : EthereumAddress(value) {
    companion object : SizedFactory {
        override val size = 20
        override fun createInstance(value: String): ContractAddress = ContractAddress(value)
    }

    override fun toChecksummedAddress(): ContractAddress =
        createChecksummedAddress(sourceAddress = this, factoryTypeclass = ContractAddress)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy