diff --git a/src/main/java/bdchain/api/TransactionLedgerClient.java b/src/main/java/bdchain/api/TransactionLedgerClient.java index d333942..49175f9 100644 --- a/src/main/java/bdchain/api/TransactionLedgerClient.java +++ b/src/main/java/bdchain/api/TransactionLedgerClient.java @@ -2,6 +2,7 @@ package bdchain.api; import bdchain.api.grpc.*; import bdchain.api.grpc.TransactionLedgerGrpc.TransactionLedgerBlockingStub; +import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; @@ -64,12 +65,22 @@ public class TransactionLedgerClient { } public SendTransactionResponse sendTransaction( - String ledger, SendTransactionRequest.Transaction transaction) { + String ledger, TransactionType type, String from, String to, byte[] data) { - info("*** sendTransaction: ledger={0} transaction={1}", ledger, transaction); + info( + "*** sendTransaction: ledger={0} type={1} from={2} to={3} data={4}", + ledger, type, from, to, data); SendTransactionRequest request = - SendTransactionRequest.newBuilder().setLedger(ledger).setTransaction(transaction).build(); + SendTransactionRequest.newBuilder() + .setLedger(ledger) + .setTransaction( + SendTransactionRequest.Transaction.newBuilder() + .setType(type) + .setFrom(ByteString.copyFrom(Utils.hexStringToByteArray(from))) + .setTo(ByteString.copyFrom(Utils.hexStringToByteArray(from))) + .setData(ByteString.copyFrom(data))) + .build(); try { return blockingStub.sendTransaction(request);