com.wavesenterprise.serialization.AssetIdUtils.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of we-models Show documentation
Show all versions of we-models Show documentation
Library for Waves Enterprise blockchain platform
package com.wavesenterprise.serialization
import com.google.common.io.ByteArrayDataOutput
import com.wavesenterprise.state.ByteStr
import com.wavesenterprise.transaction.{AssetId, AssetIdLength}
object AssetIdUtils {
def assetIdWriter(value: AssetId, output: ByteArrayDataOutput): Unit = {
output.write(value.arr)
}
def assetIdReader(bytes: Array[Byte], pos: Int): (AssetId, Int) = {
val (result, resultEnd) = ByteStr(bytes.slice(pos, pos + AssetIdLength)) -> (pos + AssetIdLength)
result -> resultEnd
}
}