Reputation: 411
When i run the flow i do get a done message but when i query the vault I dont see any transactions there. I cannot figure out what I am doing wrong. The same code was working last week properly. I am trying to send " Hello" to another node. similar to YO cordaAPP
Here is my flow class
package java_bootcamp;
import co.paralleluniverse.fibers.Suspendable;
import net.corda.core.flows.*;
import net.corda.core.identity.Party;
import net.corda.core.transactions.SignedTransaction;
import net.corda.core.transactions.TransactionBuilder;
import net.corda.core.utilities.ProgressTracker;
/* Our flow, automating the process of updating the ledger.
* See src/main/java/examples/IAmAFlowPair.java for an example. */
@InitiatingFlow
@StartableByRPC
public class TokenIssueFlow extends FlowLogic<SignedTransaction> {
private final ProgressTracker progressTracker = new ProgressTracker();
private final Party receiver;
private final String text;
public TokenIssueFlow(Party receiver, String text) {
this.receiver = receiver;
this.text = text;
}
@Override
public ProgressTracker getProgressTracker() {
return progressTracker;
}
@Suspendable
@Override
public SignedTransaction call() throws FlowException {
// We choose our transaction's notary (the notary prevents double-spends).
Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
// We get a reference to our own identity.
Party issuer = getOurIdentity();
/* ============================================================================
* TODO 1 - Create our TokenState to represent on-ledger tokens!
* ===========================================================================*/
// We create our new TokenState.
TokenState tokenState = new TokenState(issuer,receiver,text);
/* ============================================================================
* TODO 3 - Build our token issuance transaction to update the ledger!
* ===========================================================================*/
// We build our transaction.
TransactionBuilder transactionBuilder = new TransactionBuilder(notary);
transactionBuilder.addCommand(new TokenContract.Issue(),issuer.getOwningKey());
transactionBuilder.addOutputState(tokenState,TokenContract.ID);
/* ============================================================================
* TODO 2 - Write our TokenContract to control token issuance!
* ===========================================================================*/
// We check our transaction is valid based on its contracts.
transactionBuilder.verify(getServiceHub());
// We sign the transaction with our private key, making it immutable.
SignedTransaction signedTransaction = getServiceHub().signInitialTransaction(transactionBuilder);
// We get the transaction notarised and recorded automatically by the platform.
return subFlow(new FinalityFlow(signedTransaction));
}
}
Upvotes: 1
Views: 72
Reputation: 411
Apologies to everyone. I was not paying attention. While running the vaultQuery I was specifying the FLOW class instead to STATE class.
Previously run vaultQuery contractStateType: com.template.HelloFlow:
Correct Way: run vaultQuery contractStateType: java_bootcamp.TokenState
Upvotes: 1