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

commonMain.dev.icerock.moko.web3.contract.TupleParam.kt Maven / Gradle / Ivy

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

package dev.icerock.moko.web3.contract

import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject

class TupleParam(param: JsonObject) : DynamicEncoder> {
    private val params = param
        .getValue(key = "components")
        .jsonArray
        .map(JsonElement::jsonObject)

    override fun encode(item: List): ByteArray =
        ABIEncoder.encodeCallData(params, item)

    override fun decode(source: ByteArray): List =
        ABIDecoder.decodeCallData(params, source)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy