Update TransactionLedgerClient
This commit is contained in:
parent
bc6332c13e
commit
94f0da99f9
@ -2,6 +2,7 @@ package bdchain.api;
|
|||||||
|
|
||||||
import bdchain.api.grpc.*;
|
import bdchain.api.grpc.*;
|
||||||
import bdchain.api.grpc.TransactionLedgerGrpc.TransactionLedgerBlockingStub;
|
import bdchain.api.grpc.TransactionLedgerGrpc.TransactionLedgerBlockingStub;
|
||||||
|
import com.google.protobuf.ByteString;
|
||||||
import com.google.protobuf.Empty;
|
import com.google.protobuf.Empty;
|
||||||
import io.grpc.ManagedChannel;
|
import io.grpc.ManagedChannel;
|
||||||
import io.grpc.ManagedChannelBuilder;
|
import io.grpc.ManagedChannelBuilder;
|
||||||
@ -64,12 +65,22 @@ public class TransactionLedgerClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SendTransactionResponse sendTransaction(
|
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 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 {
|
try {
|
||||||
return blockingStub.sendTransaction(request);
|
return blockingStub.sendTransaction(request);
|
||||||
|
Loading…
Reference in New Issue
Block a user