Package-level declarations

Types

Link copied to clipboard
data class Balance(val balance: String, val pending: String, val total: String)
Link copied to clipboard
data class BaseRequest(val url: URL, val body: Map<String, Any> = emptyMap(), val headers: Map<String, String>? = null)
Link copied to clipboard
data class JsonRpcError(val code: Int, val message: String)
Link copied to clipboard
typealias JsonRpcId = Int
Link copied to clipboard
Link copied to clipboard
data class JsonRpcPayload(val jsonRpc: JsonRpcIdentifier = version, val id: JsonRpcId = 1, val method: String, val params: Array<Any>)
Link copied to clipboard
data class JsonRpcResponse<T>(val id: JsonRpcId, val jsonRpc: JsonRpcIdentifier, val result: T?, val error: JsonRpcError?)
Link copied to clipboard
data class Transaction(var number: Long, var parentHash: String, var daemonHash: String, var timestamp: Long = Instant.now().epochSecond, var owner: Address, var linker: Address? = Address(ZERO_LTC_ADDR), val type: TxTypeEnum, var hub: Array<String> = emptyArray(), var code: String? = null, val codeHash: String? = null, var payload: String? = "0x", var amount: Long = 0, var income: Long? = null, var joule: Long = 0, var sign: String? = null, var proofOfWork: String? = null, var version: Int = TxVersionEnum.LATEST.version(), var difficulty: Int? = 0)

交易数据类

Link copied to clipboard

交易类型枚举

Link copied to clipboard

链交易的版本号

Properties

Link copied to clipboard
const val ZERO_HASH: String
Link copied to clipboard

Functions

Link copied to clipboard
fun Transaction.calculateTransactionHash(isGM: Boolean = true, useProofOfWork: Boolean = false): String

calculate transaction hash

Link copied to clipboard
fun Transaction.getPow(codeHash: String, chainId: Int, isGM: Boolean = true): String
Link copied to clipboard
fun Transaction.hash(isGM: Boolean = true, chainId: Int = 1, useProofOfWork: Boolean = false): Pair<String, ByteArray>

对交易进行哈希运算

Link copied to clipboard
fun Transaction.hashSeal(codeHash: String, pow: String, chainId: Int, isGM: Boolean = true, useProofOfWork: Boolean = false, isSign: Boolean = false): ByteArray
Link copied to clipboard
fun Transaction.sign(privateKey: String, isGM: Boolean = true, chainId: Int = 1, useProofOfWork: Boolean = false): Pair<String, SignatureData>

签名交易

Link copied to clipboard
Link copied to clipboard

convert Transaction to SendTBlock

Link copied to clipboard
Link copied to clipboard