diff --git a/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt b/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt index fcf7c59..01bbc46 100644 --- a/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt +++ b/client/src/main/kotlin/io/provenance/client/grpc/AbstractPbClient.kt @@ -121,11 +121,15 @@ open class AbstractPbClient>( gasEstimate: GasEstimate, mode: ServiceOuterClass.BroadcastMode = ServiceOuterClass.BroadcastMode.BROADCAST_MODE_SYNC, txHashHandler: PreBroadcastTxHashHandler? = null, - signatures: List = emptyList(), + signatures: List = List(baseReq.signers.size) { null }, ): ServiceOuterClass.BroadcastTxResponse { val authInfoBytes = baseReq.buildAuthInfo(gasEstimate).toByteString() val txBodyBytes = baseReq.body.toByteString() + require(signatures.size == baseReq.signers.size) { + "The number of signatures must match the number of signers. A null/empty signature entry will sign using the Signer implementation." + } + val txRaw = baseReq.signers.mapIndexed { index, baseReqSigner -> signatures[index]?.takeIf { it.isNotEmpty() } ?: baseReqSigner.signer.sign( @@ -169,7 +173,7 @@ open class AbstractPbClient>( feeGranter: String? = null, feePayer: String? = null, txHashHandler: PreBroadcastTxHashHandler? = null, - signatures: List = emptyList(), + signatures: List = List(signers.size) { null }, ): ServiceOuterClass.BroadcastTxResponse = baseRequest( txBody = txBody,