Skip to content
Merged
60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Welcome to the official home repository for [Documentation][docs] for the [Stell
- [Using Markdown](#using-markdown)
- [Markdown Basics](#markdown-basics)
- [Custom Markdown](#custom-markdown)
- [Alert](#alert)
- [Code Example](#code-example)

## Contributing

Expand Down Expand Up @@ -151,44 +149,39 @@ Our repository uses some custom React components that can be used inside the
**Make sure that there is an empty line within the wrapper.** For example,

```text
<Alert>
<CodeExample>
<!-- EMPTY LINE AFTER THE COMPONENT'S OPENING TAG IS REQUIRED -->

Note: the testnet is reset every three months, so when building on it, make sure you have a plan to recreate necessary accounts and other data. For more info, check out the [best practices for using the testnet](../../learn/fundamentals/networks.mdx).

<!-- EMPTY LINE BEFORE THE COMPONENT'S CLOSING TAG IS REQUIRED -->
</Alert>
```javascript
console.log("hello world");
```

#### Alert

![Testnet reset alert](./readme-imgs/alert.png)

`<Alert />` is used to convey hints, warnings, etc. For example,
[Build a SEP-31 Anchor on Testnet][alert-example]

```markdown
import { Alert } from "@site/src/components/Alert";

<Alert>

Note: the testnet is reset every three months, so when building on it, make sure you have a plan to recreate necessary accounts and other data. For more info, check out the [best practices for using the testnet](../../fundamentals-and-concepts/testnet-and-pubnet).
```python
print("hello world")
```

</Alert>
<!-- EMPTY LINE BEFORE THE COMPONENT'S CLOSING TAG IS REQUIRED -->
</CodeExample>
```

#### Code Example

![Create account code example](./readme-imgs/code-example.png)

`<CodeExample />` is a code snippet component. You can include snippets for more
than one language. See an example including a snippet for `JavaScript` and
`Python` below. It is using [Prism React Renderer][prism] for syntax
highlighting.
`<CodeExample />` is a code snippet component. You can use this component when
you want to include snippets for more than one language. See an example
including a snippet for `JavaScript` and `Python` below. It is using [Prism
React Renderer][prism] for syntax highlighting. If you're only making a code
snippet for a _single programming language_, you should just stick with a
"normal" markdown code fence using backticks.

````markdown
import { CodeExample } from "@site/src/components/CodeExample";
> [!NOTE]
> The `CodeExample` component has been added to the list of globally available
> components, in `/src/theme/MDXComponents.ts`. This means it's not required to
> `import { CodeExample } ...` in a page if you're planning to use it. It's just
> always available in MDX file.

````markdown
<CodeExample>

```js
Expand Down Expand Up @@ -222,21 +215,30 @@ Languages that are currently being used in Documentation and API Reference are
below:

```js
// https://github.com/stellar/stellar-docs/blob/main/src/components/CodeExample.js
// https://github.com/stellar/stellar-docs/blob/main/config/constants.ts

const CODE_LANGS = {
export const CODE_LANGS = {
bash: 'bash',
cpp: 'C++',
curl: 'cURL',
dart: 'Flutter',
flutter: 'Flutter',
swift: 'Swift',
docker: 'Dockerfile',
go: 'Go',
html: 'html',
kotlin: 'Kotlin',
kt: 'Kotlin',
java: 'Java',
javascript: 'JavaScript',
js: 'JavaScript',
json: 'JSON',
json5: 'JSON5',
python: 'Python',
scss: 'SCSS',
sql: 'SQL',
rust: 'Rust',
php: 'PHP',
toml: 'TOML',
ts: 'TypeScript',
tsx: 'TSX',
Expand Down
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/dart/configClient.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { CodeExample } from "@site/src/components/CodeExample";

### Configuring the Client

The Flutter Wallet SDK uses the standard Client from the [http package](https://pub.dev/packages/http) for all network requests (excluding Horizon, where the Flutter Stellar SDK's HTTP client is used).
Expand All @@ -8,8 +6,6 @@ Optionally, you can set your own client from [http package](https://pub.dev/pack

The client can be globally configured:

<CodeExample>

```dart
import 'package:http/http.dart';
// ...
Expand All @@ -22,6 +18,4 @@ var appConfig = ApplicationConfiguration(defaultClient: myClient);
var walletCustomClient = Wallet(StellarConfiguration.testNet, applicationConfiguration: appConfig);
```

</CodeExample>

Some [test cases](https://github.com/Soneso/stellar_wallet_flutter_sdk/tree/main/test) of this SDK use for example the `MockClient`.
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/dart/install.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { CodeExample } from "@site/src/components/CodeExample";

<CodeExample>

```dart
// pubspec.yaml
stellar_wallet_flutter_sdk: ^1.0.6
stellar_flutter_sdk: ^2.1.3
```

</CodeExample>

You can get the latest available version on the [project GitHub page](https://github.com/Soneso/stellar_wallet_flutter_sdk)
14 changes: 0 additions & 14 deletions docs/build/apps/wallet/component/kt/configClient.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { CodeExample } from "@site/src/components/CodeExample";

### Configuring the Client

The Kotlin wallet SDK uses the [ktor client](https://ktor.io/docs/getting-started-ktor-client.html) for all network requests (excluding Horizon, where the Stellar SDK's HTTP client is used). Currently, the okhttp engine is configured to be used with the client. You can read more about how to configure the ktor client [here](https://ktor.io/docs/create-client.html#configure-client).

For example, the client can be globally configured:

<CodeExample>

```kotlin
val walletCustomClient =
Wallet(
Expand All @@ -24,33 +20,23 @@ val walletCustomClient =
)
```

</CodeExample>

This Kotlin code will set the connect timeout to ten seconds via the [okhttp configuration](https://ktor.io/docs/http-client-engines.html#okhttp) and also installs the [retry plugin](https://ktor.io/docs/client-retry.html). You can also specify client configuration for specific wallet SDK classes.

For example, to change connect timeout when connecting to some anchor server:

<CodeExample>

```kotlin
val anchorCustomClient =
walletCustomClient.anchor("example.com") {
engine { this.config { this.connectTimeout(Duration.ofSeconds(30)) } }
}
```

</CodeExample>

### Closing Resources

After the wallet class is no longer used, it's necessary to close all clients used by it. While in some applications it may not be required (e.g. the wallet lives for the whole lifetime of the application), in other cases it can be required. If your wallet class is short-lived, it's recommended to close client resources using a close function:

<CodeExample>

```kotlin
fun closeWallet() {
wallet.close()
}
```

</CodeExample>
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/kt/globalSigner.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { CodeExample } from "@site/src/components/CodeExample";

Finally, with the approach above we define the signer and client domain per request. If you want to define it once and use it for every authentication call your application is making, you can do so via changing the configuration:

<CodeExample>

```kotlin
val appCfg = ApplicationConfiguration(WalletSigner.DomainSigner("https://my-domain.com/sign"), "my-domain.com")
```

</CodeExample>

This is particularly useful for integrating with multiple anchors.
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/kt/httpConfig.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { CodeExample } from "@site/src/components/CodeExample";

There is one more available configuration for a wallet that allows it to configure internal logic of the SDK. For example, to test with local servers on an HTTP protocol, HTTP can be manually enabled.

<CodeExample>

```kotlin
val walletCustom = Wallet(
StellarConfiguration.Testnet,
ApplicationConfiguration { defaultRequest { url { protocol = URLProtocol.HTTP } } }
)
```

</CodeExample>
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/kt/install.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { CodeExample } from "@site/src/components/CodeExample";

<CodeExample>

```kotlin
// gradle.kts
implementation("org.stellar:wallet-sdk:[version]")
```

</CodeExample>

You can get the latest available version on the [project GitHub page](https://github.com/stellar/kotlin-wallet-sdk)
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/kt/watcher.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { CodeExample } from "@site/src/components/CodeExample";

Next, let's get the channel provided by `WatcherResult` to receive events.

<CodeExample>

```kt
do {
val event = result.channel.receive()
Expand All @@ -16,8 +12,6 @@ do {
} while (event !is ChannelClosed)
```

</CodeExample>

This code example will consume all events coming from the channel until it's closed. There are three types of events:

- `StatusChange`: indicates that transaction status has changed.
Expand Down
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/swift/globalSigner.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { CodeExample } from "@site/src/components/CodeExample";

Finally, with the approach above we define the signer and client domain per request. If you want to define it once and use it for every authentication call your application is making, you can do so via changing the configuration:

<CodeExample>

```swift
let appCfg = AppConfig(defaultSigner: try DomainSigner(url: "https://my-domain.com/sign"),
defaultClientDomain: "my-domain.com")
```

</CodeExample>

This is particularly useful for integrating with multiple anchors.
2 changes: 0 additions & 2 deletions docs/build/apps/wallet/component/swift/install.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { CodeExample } from "@site/src/components/CodeExample";

Add the repository (https://github.com/Soneso/stellar-swift-wallet-sdk) as a Package Dependency in your XCode project. Two new Package dependencies will appear: "stellar-wallet-sdk" and "stellarsdk".
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/ts/allowHttpInfo.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { CodeExample } from "@site/src/components/CodeExample";

:::info

If the anchor home domain uses http, then you need to set the `allowHttp` flag when creating the anchor:

<CodeExample>

```typescript
let anchor = wallet.anchor({ homeDomain: "example.com", allowHttp: true });
```

</CodeExample>

This can only be used on Testnet.

:::
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/ts/configClient.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { CodeExample } from "@site/src/components/CodeExample";

### Configuring the Client

The Typescript wallet SDK uses the [axios client](https://axios-http.com/docs/intro) for all network requests. You can read more about how to configure the axios client [here](https://axios-http.com/docs/instance).

For example, we can configure our axios client to be globally configured with a timeout:

<CodeExample>

```typescript
const customClient: AxiosInstance = axios.create({
timeout: 1000,
Expand All @@ -19,6 +15,4 @@ let wal = new Wallet({
});
```

</CodeExample>

You can find more [configure options here.](https://axios-http.com/docs/req_config)
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/ts/createKeypairInfo.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { CodeExample } from "@site/src/components/CodeExample";

:::info

If using react-native, `createKeypair` won't work. Instead use the helper method `createKeypairFromRandom` like this:

<CodeExample>

```typescript
import * as Random from "expo-crypto";
const rand = Random.randomBytes(32);
const kp = account.createKeypairFromRandom(Buffer.from(rand));
```

</CodeExample>

:::
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/ts/globalSigner.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { CodeExample } from "@site/src/components/CodeExample";

Finally, with the approach above we define the signer and client domain per request. If you want to define it once and use it for every authentication call your application is making, you can do so via changing the configuration:

<CodeExample>

```typescript
const appCfg = new ApplicationConfiguration(
new DomainSigner("https://my-domain.com/sign", { ...headers }),
Expand All @@ -12,6 +8,4 @@ const appCfg = new ApplicationConfiguration(
);
```

</CodeExample>

This is particularly useful for integrating with multiple anchors.
6 changes: 0 additions & 6 deletions docs/build/apps/wallet/component/ts/install.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import { CodeExample } from "@site/src/components/CodeExample";

<CodeExample>

```bash
yarn add @stellar/typescript-wallet-sdk
```

</CodeExample>
Loading