mirror of
https://github.com/corda/corda.git
synced 2025-06-23 01:19:00 +00:00
Updates tutorial to reflect template changes.
This commit is contained in:
@ -6,7 +6,7 @@ import net.corda.core.transactions.LedgerTransaction;
|
|||||||
|
|
||||||
public class TemplateContract implements Contract {
|
public class TemplateContract implements Contract {
|
||||||
// This is used to identify our contract when building a transaction.
|
// This is used to identify our contract when building a transaction.
|
||||||
public static final String TEMPLATE_CONTRACT_ID = "com.template.TemplateContract";
|
public static final String ID = "com.template.TemplateContract";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A transaction is considered valid if the verify() function of the contract of each of the transaction's input
|
* A transaction is considered valid if the verify() function of the contract of each of the transaction's input
|
||||||
|
@ -13,8 +13,6 @@ import net.corda.core.transactions.SignedTransaction;
|
|||||||
import net.corda.core.transactions.TransactionBuilder;
|
import net.corda.core.transactions.TransactionBuilder;
|
||||||
import net.corda.core.utilities.ProgressTracker;
|
import net.corda.core.utilities.ProgressTracker;
|
||||||
|
|
||||||
import static com.template.TemplateContract.TEMPLATE_CONTRACT_ID;
|
|
||||||
|
|
||||||
// Replace TemplateFlow's definition with:
|
// Replace TemplateFlow's definition with:
|
||||||
@InitiatingFlow
|
@InitiatingFlow
|
||||||
@StartableByRPC
|
@StartableByRPC
|
||||||
@ -53,7 +51,7 @@ public class IOUFlow extends FlowLogic<Void> {
|
|||||||
|
|
||||||
// We create a transaction builder and add the components.
|
// We create a transaction builder and add the components.
|
||||||
final TransactionBuilder txBuilder = new TransactionBuilder(notary)
|
final TransactionBuilder txBuilder = new TransactionBuilder(notary)
|
||||||
.addOutputState(outputState, TEMPLATE_CONTRACT_ID)
|
.addOutputState(outputState, TemplateContract.ID)
|
||||||
.addCommand(cmd);
|
.addCommand(cmd);
|
||||||
|
|
||||||
// Signing the transaction.
|
// Signing the transaction.
|
||||||
|
@ -18,7 +18,7 @@ import static net.corda.core.contracts.ContractsDSL.requireThat;
|
|||||||
|
|
||||||
// Replace TemplateContract's definition with:
|
// Replace TemplateContract's definition with:
|
||||||
public class IOUContract implements Contract {
|
public class IOUContract implements Contract {
|
||||||
public static final String IOU_CONTRACT_ID = "com.template.IOUContract";
|
public static final String ID = "com.template.IOUContract";
|
||||||
|
|
||||||
// Our Create command.
|
// Our Create command.
|
||||||
public static class Create implements CommandData {
|
public static class Create implements CommandData {
|
||||||
|
@ -52,7 +52,7 @@ public class IOUFlow extends FlowLogic<Void> {
|
|||||||
|
|
||||||
// We create the transaction components.
|
// We create the transaction components.
|
||||||
IOUState outputState = new IOUState(iouValue, getOurIdentity(), otherParty);
|
IOUState outputState = new IOUState(iouValue, getOurIdentity(), otherParty);
|
||||||
StateAndContract outputContractAndState = new StateAndContract(outputState, IOUContract.IOU_CONTRACT_ID);
|
StateAndContract outputContractAndState = new StateAndContract(outputState, IOUContract.ID);
|
||||||
List<PublicKey> requiredSigners = ImmutableList.of(getOurIdentity().getOwningKey(), otherParty.getOwningKey());
|
List<PublicKey> requiredSigners = ImmutableList.of(getOurIdentity().getOwningKey(), otherParty.getOwningKey());
|
||||||
Command cmd = new Command<>(new IOUContract.Create(), requiredSigners);
|
Command cmd = new Command<>(new IOUContract.Create(), requiredSigners);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user