mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Also minor implementation changes to TypeScript sample for better consistency between implementations. Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
30 lines
993 B
Java
30 lines
993 B
Java
/*
|
|
* Copyright IBM Corp. All Rights Reserved.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import java.io.IOException;
|
|
import java.security.InvalidKeyException;
|
|
import java.security.cert.CertificateException;
|
|
|
|
import io.grpc.Channel;
|
|
import org.hyperledger.fabric.client.Contract;
|
|
import org.hyperledger.fabric.client.Gateway;
|
|
import org.hyperledger.fabric.client.Network;
|
|
|
|
public final class Transact implements Command {
|
|
@Override
|
|
public void run(final Channel grpcChannel)
|
|
throws CertificateException, IOException, InvalidKeyException {
|
|
try (Gateway gateway = Connections.newGatewayBuilder(grpcChannel).connect()) {
|
|
Network network = gateway.getNetwork(Connections.CHANNEL_NAME);
|
|
Contract contract = network.getContract(Connections.CHAINCODE_NAME);
|
|
|
|
AssetTransferBasic smartContract = new AssetTransferBasic(contract);
|
|
|
|
TransactApp app = new TransactApp(smartContract);
|
|
app.run();
|
|
}
|
|
}
|
|
}
|