From c273b5833301e377aba00903147f6e24efe14705 Mon Sep 17 00:00:00 2001 From: Guillermo Orellana Date: Thu, 14 Nov 2024 13:39:03 +0100 Subject: [PATCH] add typealias and remove unused method --- .../solana/domain/core/SignedTransaction.kt | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/solana-kotlin/src/commonMain/kotlin/net/avianlabs/solana/domain/core/SignedTransaction.kt b/solana-kotlin/src/commonMain/kotlin/net/avianlabs/solana/domain/core/SignedTransaction.kt index 3b38936..a678d3f 100644 --- a/solana-kotlin/src/commonMain/kotlin/net/avianlabs/solana/domain/core/SignedTransaction.kt +++ b/solana-kotlin/src/commonMain/kotlin/net/avianlabs/solana/domain/core/SignedTransaction.kt @@ -54,7 +54,7 @@ public data class SignedTransaction internal constructor( override fun toString(): String = "SignedTransaction(message=${originalMessage}, signatures=$signatures)" - public fun serialize(): ByteArray { + public fun serialize(): SerializedTransaction { val signaturesSize = signatures.size val signaturesLength = ShortVecEncoding.encodeLength(signaturesSize) val bufferSize = @@ -70,18 +70,6 @@ public data class SignedTransaction internal constructor( out.write(signedMessage) return out.readByteArray(bufferSize.toLong()) } - - public fun validate(): Boolean { - val message = signedMessage - val messageLength = message.size - val signaturesSize = signatures.size - val signaturesLength = ShortVecEncoding.encodeLength(signaturesSize) - val signaturesSizeBytes = signaturesLength.size - val signatureSize = TweetNaCl.Signature.SIGNATURE_BYTES - val signatureSizeBytes = ShortVecEncoding.encodeLength(signatureSize) - val signatureSizeBytesLength = signatureSizeBytes.size - val expectedSize = - messageLength + signaturesSizeBytes + signaturesSize * (signatureSize + signatureSizeBytesLength) - return expectedSize == serialize().size - } } + +public typealias SerializedTransaction = ByteArray