commonMain.dev.icerock.moko.web3.entity.LogEvent.kt Maven / Gradle / Ivy
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
@file:UseSerializers(BigIntegerSerializer::class)
package dev.icerock.moko.web3.entity
import com.ionspin.kotlin.bignum.integer.BigInteger
import dev.icerock.moko.web3.BlockHash
import dev.icerock.moko.web3.ContractAddress
import dev.icerock.moko.web3.EthereumAddress
import dev.icerock.moko.web3.TransactionHash
import dev.icerock.moko.web3.hex.Hex32String
import dev.icerock.moko.web3.hex.HexString
import dev.icerock.moko.web3.serializer.BigIntegerSerializer
import kotlinx.serialization.*
@Serializable
data class LogEvent(
val address: EthereumAddress,
val blockHash: BlockHash,
val transactionHash: TransactionHash,
val blockNumber: BigInteger,
val data: HexString,
val logIndex: BigInteger,
val removed: Boolean,
val topics: List,
val transactionIndex: BigInteger
) {
fun deserializeData(dataDeserializer: DataDeserializer): T =
dataDeserializer.deserialize(data.withoutPrefix.chunked(size = 32 * 2).map(::Hex32String))
fun interface DataDeserializer {
fun deserialize(source: List): T
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy