Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* Call built in MoveNonFungibleTokens to move token to other party.
public static class MoveEvolvableTokenFlow extends FlowLogic<SignedTransaction>{
private final String evolvableTokenId;
private final Party recipient;
public MoveEvolvableTokenFlow(String evolvableTokenId, Party recipient) {
this.evolvableTokenId = evolvableTokenId;
this.recipient = recipient;
public SignedTransaction call() throws FlowException {
// uuid column in vault_linear_states contains the uuid of the created asset on ledger
UUID uuid = UUID.fromString(evolvableTokenId);
// construct queryCriteria to get the created asset on ledger by using LinearStateCriteria
// get all the unconsumed states from vault_linear_states having uuid
QueryCriteria queryCriteria = new QueryCriteria.LinearStateQueryCriteria(null, ImmutableList.of(uuid), null,
Vault.StateStatus.UNCONSUMED, null);
// use vaultservice to hit the vault using the query criteria
StateAndRef<RealEstateEvolvableTokenType> stateAndRef = getServiceHub().getVaultService().
queryBy(RealEstateEvolvableTokenType.class, queryCriteria).getStates().get(0);
// get the state from StateAndRef returned by the query
RealEstateEvolvableTokenType evolvableTokenType = stateAndRef.getState().getData();
LinearPointer linearPointer = new LinearPointer(evolvableTokenType.getLinearId(), RealEstateEvolvableTokenType.class);
// token pointer is a linear pointer to created real estate asset
TokenPointer token = new TokenPointer(linearPointer, evolvableTokenType.getFractionDigits());
PartyAndToken partyAndToken = new PartyAndToken(recipient, token);
// specify which party (recipient) to move the token to
return (SignedTransaction) subFlow(new MoveNonFungibleTokens(partyAndToken));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.