diff --git a/docs/building-apps/wallet/component/dart/install.mdx b/docs/building-apps/wallet/component/dart/install.mdx index fbe2c97df..20810b95c 100644 --- a/docs/building-apps/wallet/component/dart/install.mdx +++ b/docs/building-apps/wallet/component/dart/install.mdx @@ -4,8 +4,8 @@ import { CodeExample } from "@site/src/components/CodeExample"; ```dart // pubspec.yaml -stellar_wallet_flutter_sdk: ^0.1.0 -stellar_flutter_sdk: ^1.7.1 +stellar_wallet_flutter_sdk: ^0.2.0 +stellar_flutter_sdk: ^1.7.4 ``` diff --git a/docs/building-apps/wallet/sep38.mdx b/docs/building-apps/wallet/sep38.mdx index 004d2364f..ef05a8c49 100644 --- a/docs/building-apps/wallet/sep38.mdx +++ b/docs/building-apps/wallet/sep38.mdx @@ -8,7 +8,7 @@ import { LanguageSpecific } from "@site/src/components/LanguageSpecific"; import { WalletCodeExample as CodeExample } from "@site/src/components/WalletCodeExample"; import Header from "./component/header.mdx"; -
+
The [SEP-38] standard defines a way for anchors to provide quotes for the exchange of an off-chain asset and a different on-chain asset, and vice versa. Quotes may be [indicative](https://www.investopedia.com/terms/i/indicativequote.asp) or [firm](https://www.investopedia.com/terms/f/firmquote.asp) ones. When either is used is explained in the sections below. @@ -28,6 +28,14 @@ const authToken = await auth.authenticate({ accountKp }); const sep38 = anchor.sep38(authToken); ``` +```dart +var accountKp = ... // our account keypair + +var auth = await anchor.sep10(); +var authToken = await auth.authenticate(accountKp); +var sep38 = anchor.sep38(authToken: authToken); +``` + ## Get Anchor Information @@ -40,6 +48,10 @@ First, let's get information about the anchor's support for [SEP-38]. The respon const resp = await sep38.info(); ``` +```dart +var resp = await sep38.info(); +``` + For example a response will look like this. The asset identifiers are described below in [Asset Identification Format](#asset-identification-format). @@ -99,6 +111,13 @@ const resp = await sep38.prices({ }); ``` +```dart +var resp = await sep38.prices( + sellAsset: "iso4217:USD", + sellAmount: "5", +); +``` + The response gives the asset prices for exchanging the requested sell asset. For example, a response look like this: @@ -135,6 +154,16 @@ const resp = await sep38.price({ }); ``` +```dart +var resp = await sep38.price( + sellAsset: "iso4217:USD", + buyAsset: + "stellar:SRT:GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B", + sellAmount: "5", + context: "sep6", +); +``` + The response gives information for exchanging these assets. For example, a response will look like this: @@ -161,6 +190,16 @@ const requestResp = await sep38.requestQuote({ }); ``` +```dart +var requestResp = await sep38.requestQuote( + sellAsset: "iso4217:USD", + buyAsset: + "stellar:SRT:GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B", + sellAmount: "5", + context: "sep6", +); +``` + However now the response gives an `id` that we can use to identify the quote. The `expires_at` field tells us how long the anchor will wait to receive funds for this quote. @@ -190,6 +229,11 @@ const quoteId = requestResp.id; const getResp = await sep38.getQuote(quoteId); ``` +```dart +var quoteId = requestResp.id; +var getResp = await sep38.getQuote(quoteId); +``` + The response should match the one given from `.requestQuote()` we made earlier.