You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirm who owns the [FungibleToken](https://training.corda.net/libraries/tokens-sdk/#fungibletoken) (cash) and [NonFungibleToken](https://training.corda.net/libraries/tokens-sdk/#nonfungibletoken) (ticket) again by running this on Dealer1's node.
125
125
126
126
127
+
## Transfer tokens from one account to other
128
+
129
+
For someone who is looking into how to only transfer tokens from one account to other use below steps.
Run the above flow on the Dealer1 node. This will create the agent1, buyer1 and buyer2 accounts on the Dealer1 node and share this account info with BCCI, Bank, and Dealer2 node respecticely.
139
+
140
+
Then let's go to the Dealer2 node and create buyer3 account:
Run the below query to confirm if accounts are created on Dealer1 node. Also run the above query on Bank and BCCI node to confirm if account info is shared with these nodes.
146
+
147
+
run vaultQuery contractStateType : com.r3.corda.lib.accounts.contracts.states.AccountInfo
Run the above command on the Bank node, which will issue 77 USD to buyer1 account.
157
+
158
+
### Step 3
159
+
```
160
+
flow start QuerybyAccount whoAmI: buyer1
161
+
```
162
+
You can check balance of buyer1 account at Dealer1's node
163
+
[Option] You can also run the below command to confirm if 20 USD fungible tokens are stored at Dealer1's node. The current holder field in the output will be an AnonymousParty which specifies an account.
164
+
```
165
+
run vaultQuery contractStateType : com.r3.corda.lib.tokens.contracts.states.FungibleToken
AnonymousPartysellerAccount = subFlow(newRequestKeyForAccount(sellerAccountInfo));//mappiing requested from counterparty. does the counterparty save i dont think so
60
+
61
+
//buyer will create generate a move tokens state and send this state with new holder(seller) to seller
List<Object> sum = getServiceHub().getVaultService().queryBy(FungibleToken.class, queryCriteria).component5();
67
+
if(sum.size() == 0)
68
+
thrownewFlowException(buyerAccountName + " has 0 token balance. Please ask the Bank to issue some cash.");
69
+
else {
70
+
LongtokenBalance = (Long) sum.get(0);
71
+
if(tokenBalance < costOfTicket)
72
+
thrownewFlowException("Available token balance of " + buyerAccountName+ " is less than the cost of the ticket. Please ask the Bank to issue some cash if you wish to buy the ticket ");
73
+
}
74
+
75
+
//the tokens to move to new account which is the seller account
0 commit comments