commonMain.dev.icerock.moko.web3.contract.TupleParam.kt Maven / Gradle / Ivy
/*
* 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