Igor Nazarov
Igor Nazarov

Reputation: 36

How to access referenced object from RPC client in corda?

In the flow of creating some state I add reference state to some other object (some custom account in my case). So when I receive this state on the rpc client by trackBy() method I want to know what object it referencing. As I understand, reference exists in transaction, not in the state. What is the proper way to get transaction from state in RPC client?

Upvotes: 0

Views: 103

Answers (1)

Adel Rustum
Adel Rustum

Reputation: 2548

Not sure you can do that directly from the client, you'd probably need to write a flow that accepts a transaction Id and returns a list of the references.
So inside your flow you'd have something like:

SignedTransaction tx = this.getServiceHub().getValidatedTransactions()
                           .getTransaction(SecureHash.parse("Your Tx Id"));
ArrayList<StateRef> refs = tx.getReferences();

Upvotes: 1

Related Questions