Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Commit

Permalink
Df/update example readme (#431)
Browse files Browse the repository at this point in the history
* Fix STREAM README

Signed-off-by: David Fuelling <[email protected]>
  • Loading branch information
sappenin committed Feb 5, 2020
1 parent fec7025 commit 107ed76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
28 changes: 11 additions & 17 deletions examples-parent/send-money/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,9 @@ StreamConnectionDetails connectionDetails =

We can create a link using the following code:
```java
String sharedSecret = "some random secret you generated";
IlpOverHttpLinkSettings linkSettings = IlpOverHttpLinkSettings.builder()
.incomingLinkSettings(IncomingLinkSettings.builder()
.authType(IlpOverHttpLinkSettings.AuthType.SIMPLE)
.encryptedTokenSharedSecret(sharedSecret)
.build())
.outgoingLinkSettings(OutgoingLinkSettings.builder()
.authType(IlpOverHttpLinkSettings.AuthType.SIMPLE)
.tokenSubject(SENDER_ACCOUNT_USERNAME)
.url(HttpUrl.parse(TESTNET_URI + "/ilp"))
.encryptedTokenSharedSecret(sharedSecret)
.build())
.build();

Link link = new IlpOverHttpLink(
() -> SENDER_ADDRESS,
linkSettings,
HttpUrl.parse("https://example.com/accounts/peer/ilp"),
newHttpClient(),
new ObjectMapper(),
InterledgerCodecContextFactory.oer(),
Expand All @@ -86,8 +72,16 @@ SimpleStreamSender simpleStreamSender = new SimpleStreamSender(link);

Now, we can send a payment for 1000 millidrops from our source account to our destination account using the shared secret.
```java
SendMoneyResult result = simpleStreamSender.sendMoney(SharedSecret.of(connectionDetails.sharedSecret().value()),
SENDER_ADDRESS, connectionDetails.destinationAddress(), UnsignedLong.valueOf(1000)).get();

SendMoneyRequest sendMoneyRequest = SendMoneyRequest.builder()
.sourceAddress(InterledgerAddress.of(SPSP_SENDER))
.amount(UnsignedLong.valueOf(1000L))
.denomination(Denomination.builder().assetScale((short) 9).assetCode(XRP).build())
.destinationAddress(connectionDetails.destinationAddress())
.sharedSecret(connectionDetails.sharedSecret())
.build();

SendMoneyResult result = simpleStreamSender.sendMoney(sendMoneyRequest).get();
```

Finally, we can verify the account balance of the receiver using the Rust admin client:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.time.Duration;
import java.util.Optional;

import javax.annotation.Nullable;

@Immutable
Expand All @@ -18,7 +19,7 @@ static SendMoneyRequestBuilder builder() {
}

/**
* The shared secret, shared between only the sender and receiverd, required by IL-RFC-29 to encrypt stream frames so
* The shared secret, shared between only the sender and receiver, required by IL-RFC-29 to encrypt stream frames so
* that only the sender and receiver can decrypt them.
*
* @return A {@link SharedSecret} known only to the sender and receiver, negotiated using some higher-level protocol
Expand Down Expand Up @@ -48,10 +49,10 @@ static SendMoneyRequestBuilder builder() {
UnsignedLong amount();

/**
* @deprecated ascertained via the type of payment tracker used for sending.
* Returns the {@link SenderAmountMode} for this payment tracker.
*
* @return A {@link SenderAmountMode} that indicates the meaning of {@link #amount()}.
*
* @deprecated ascertained via the type of payment tracker used for sending. Returns the {@link SenderAmountMode} for
* this payment tracker.
*/
@Deprecated
@Nullable
Expand Down Expand Up @@ -84,9 +85,9 @@ static SendMoneyRequestBuilder builder() {
PaymentTracker<SenderAmountMode> paymentTracker();

/**
* @deprecated no longer performs a check on compatible SenderAmountMode since payment tracker is the authority
*
* @return this instance
*
* @deprecated no longer performs a check on compatible SenderAmountMode since payment tracker is the authority
*/
@Deprecated
default SendMoneyRequest check() {
Expand Down

0 comments on commit 107ed76

Please sign in to comment.