Joel
Joel

Reputation: 23140

In Corda, how to obtain the StateRef of the output states of the current transaction in a flow?

I am running a flow where I create a transaction with outputs and commit it to the ledger.

I now want to grab the input StateRefs corresponding to the outputs of the transaction I just created and commited to ledger.

How can I retrieve these StateRefs?

Upvotes: 1

Views: 501

Answers (1)

Joel
Joel

Reputation: 23140

You can easily construct the StateRefs manually.

For example, suppose you have a reference to the signed transaction you just created:

stx: SignedTransaction

And you want the input StateRef of the third output of that transaction. You'd create this as follows:

val stateRef: StateRef = StateRef(stx.id, 2)

Upvotes: 1

Related Questions