Skip to content

Commit

Permalink
Merge pull request #382 from stellar/msfeldstein-patch-4
Browse files Browse the repository at this point in the history
[SEP6] Show example postMessage syntax
  • Loading branch information
msfeldstein committed Aug 28, 2019
2 parents 97fe3d6 + 2ef73f4 commit 47e9c04
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ecosystem/sep-0006.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,22 @@ If the wallet wants to be notified that the user has completed the anchor's inte

In either case, the JSON message should be identical to the response format for the [/transaction](#single-historical-transaction) endpoint.

```javascript
// Example postMessage callback at the end of an interactive withdraw, indicating that the anchor is waiting for the wallet to send a payment in the amount of 80 of the asset in question.
const target = window.opener || window.parent;
target.postMessage({
transaction: {
id: "anchors_identifier_for_this_transaction",
status: "pending_user_transfer_start",
withdraw_anchor_account: "ANCHORS_STELLAR_ACCOUNT_ID",
withdraw_memo: "MEMO_ANCHOR_EXPECTS_TO_SEE",
withdraw_memo_type: "text|hash|id",
amount_in: "80"
// ... Any other values from the /transaction endpoint may be passed as well
}
}, "*");
```

As an alternative to using the `callback` parameter, the wallet can poll the transaction endpoint [`/transaction`](#single-historical-transaction) with the request `id` to check the status of the request.

**`jwt` details**
Expand Down

0 comments on commit 47e9c04

Please sign in to comment.