Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SEP6] Show example postMessage syntax #382

Merged
merged 4 commits into from
Aug 28, 2019
Merged
Changes from 2 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
14 changes: 14 additions & 0 deletions ecosystem/sep-0006.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ 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: {
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"
}
msfeldstein marked this conversation as resolved.
Show resolved Hide resolved
}, "*");
```

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