Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Add Java code example to Channels Glossary #476

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions content/docs/glossary/channels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,22 @@ transaction.sign(baseAccountKey); // base account must sign to approve the payme
transaction.sign(channelKeys[channelIndex]); // channel must sign to approve it being the source of the transaction
```

```java
// channelAccounts[] is an array of accountIDs, one for each channel
// channelKeys[] is an array of secret keys, one for each channel
// channelIndex is the channel you want to send this transaction over

// create payment from baseAccount to customerAddress
Transaction transaction = new Transaction.Builder(channelAccounts[channelIndex])
.addOperation(new PaymentOperation.Builder(customerAddress, new AssetTypeNative(), amountToSend)
.setSourceAccount(baseAccount.address())
.build())
// Wait a maximum of three minutes for the transaction
.setTimeout(180)
.build();

transaction.sign(baseAccountKey); // base account must sign to approve the payment
transaction.sign(channelKeys[channelIndex]); // channel must sign to approve it being the source of the transaction
```

</CodeExample>