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

doc: create readme for simulator #250

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 4 additions & 15 deletions apps/docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,16 @@
"title": "Core",
"type": "page"
},
"simulator": {
"title": "Simulator",
"type": "page"
},
"examples": {
"title": "Examples",
"type": "page"
},
"appendix": {
"title": "Appendix",
"type": "page"
},
"react-link": {
"title": "React",
"href": "/react",
"display": "hidden"
},
"core-link": {
"title": "Core",
"href": "/core",
"display": "hidden"
},
"examples-link": {
"title": "Examples & Tutorials",
"href": "/examples",
"display": "hidden"
}
}
2 changes: 1 addition & 1 deletion apps/docs/pages/appendix/working-with-ledger-live.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This page documents how to link the local packages of the wallet-api monorepo in

First you want to start the dev server to have every packages built and ready to be used by the application but also to have the watcher in place whenever we make changes in the Wallet-API.

```bash
```sh
pnpm dev
```

Expand Down
50 changes: 24 additions & 26 deletions apps/docs/pages/core/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
<div>
# Getting Started with Ledger's Wallet API
# Getting Started with Ledger's Wallet API

Welcome to the getting started guide for Ledger's Wallet API. We are excited to have you onboard and look forward to
seeing what you'll create.
Welcome to the getting started guide for Ledger's Wallet API. We are excited to have you onboard and look forward to
seeing what you'll create.

Ledger's Wallet API can be integrated with both client and server-side applications, offering you flexibility and
enabling diverse use-cases.
Ledger's Wallet API can be integrated with both client and server-side applications, offering you flexibility and
enabling diverse use-cases.

## Installation
## Installation

Let's begin by installing the base package.
Let's begin by installing the base package.

You can use your favorite package manager, npm, yarn or pnpm, to install the `@ledgerhq/wallet-api-client` package.
You can use your favorite package manager, npm, yarn or pnpm, to install the `@ledgerhq/wallet-api-client` package.

With npm:
With npm:

```bash
npm install @ledgerhq/wallet-api-client
```
```sh
npm install @ledgerhq/wallet-api-client
```

With yarn:
With yarn:

```bash
yarn add @ledgerhq/wallet-api-client
```
```sh
yarn add @ledgerhq/wallet-api-client
```

Or with pnpm:
Or with pnpm:

```bash
pnpm add @ledgerhq/wallet-api-client
```
```sh
pnpm add @ledgerhq/wallet-api-client
```

---
---

Now that you've successfully installed the necessary packages, you're ready to start crafting with Ledger's Wallet
API. In the next page, we'll guide you through the process of setting up and configuring the Wallet API in your
application.
</div>
Now that you've successfully installed the necessary packages, you're ready to start crafting with Ledger's Wallet
API. In the next page, we'll guide you through the process of setting up and configuring the Wallet API in your
application.
12 changes: 6 additions & 6 deletions apps/docs/pages/core/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { Callout } from "nextra/components";
This library serves as a cornerstone for integrating applications within Ledger Live, dubbed as Live Apps, in a framework-agnostic manner. By leveraging the Wallet API Client, your Live App can interact with Ledger hardware wallets through Ledger Live.

<Callout emoji="💡">
**Migration from Platform SDK:** If you are migrating from Platform SDK, please refer to [this
section](/appendix/migration-guide) that will
guide you through the process.
**Migration from Platform SDK:** If you are migrating from Platform SDK,
please refer to [this section](/appendix/migration-guide) that will guide you
through the process.
</Callout>

## Target Audience
Expand All @@ -34,8 +34,8 @@ The Wallet API Client library empowers your Live App to:

This documentation is structured to provide you with a clear understanding of the various features and utilities available in the Ledger Wallet API Client library.

- **Getting Started**: If you’re new to this library, the [Getting Started](./getting-started.md) section is the perfect launchpad. It navigates you through the installation and initial setup.
- **Getting Started**: If you'e new to this library, the [Getting Started](/core/getting-started) section is the perfect launchpad. It navigates you through the installation and initial setup.

- **Configuration**: The [Configuration](./configuration.md) section imparts insights on how to integrate your application with Ledger Live.
- **Configuration**: The [Configuration](/core/configuration.mdx) section imparts insights on how to integrate your application with Ledger Live.

- **Modules and Utilities**: Acquaint yourself with various modules and utilities for account management, message signing, transaction handling, and more in dedicated sections. Each section elucidates explanations, parameters, and practical applications.
- **Modules and Utilities**: Acquaint yourself with various modules and utilities for account management, message signing, transaction handling, and more in dedicated sections. Each section elucidates explanations, parameters, and practical applications.
3 changes: 3 additions & 0 deletions apps/docs/pages/examples/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"live-app-creation": {
"title": "Build a live app from scratch"
},
"use-live-app": {
"title": "Use your live app"
},
"test-live-app": {
"title": "Test your live app"
}
Expand Down
4 changes: 1 addition & 3 deletions apps/docs/pages/examples/test-live-app/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"prerequisites": "Prerequisites",
"manifest": "Create a manifest",
"import": "Import your manifest",
"interact": "Interact with Developer tools"
"testing": "Testing"
}
8 changes: 4 additions & 4 deletions apps/docs/pages/examples/test-live-app/prerequisites.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Prerequisites

This tutorial assumes that you already have your dapp using the wallet-api package.
This tutorial assumes that you already have your Live App using the Wallet-API package.

To start will need at least :

- a [Ledger Device](https://shop.ledger.com/pages/hardware-wallets-comparison) (Nano S or X). You will need one to access Ledger Live.
To start we'll need at least:

- To setup the simulator as shown in the [documentation](/simulator/configuration)
- And have a test environment in place like jest or vitest
17 changes: 17 additions & 0 deletions apps/docs/pages/examples/test-live-app/testing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Callout } from "nextra/components";

# Automated testing

<Callout type="warning" emoji="⚠️">
Docs for this is under construction.
</Callout>

In order to test your Live App in an automated way, you will first need to create a test file.

Here is a simple example of a test file written for a Live App:

```ts
describe("List accounts", () => {
test("It should show the list of accounts when clicking the button", () => {});
});
```
6 changes: 6 additions & 0 deletions apps/docs/pages/examples/use-live-app/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"prerequisites": "Prerequisites",
"manifest": "Create a manifest",
"import": "Import your manifest",
"interact": "Interact with Developer tools"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ You also need your Ledger Device (Nano S or X) in order to access Ledger Live.

In order to add a local manifest to Ledger Live and run a not yet available Live App, you must enable the Developer mode.

To activate the Developer mode in Ledger Live, go to :
To activate the Developer mode in Ledger Live, go to :

1) **Settings** -> **About**
2) Click ten times on the Ledger Live version.
1. **Settings** -> **About**
2. Click ten times on the Ledger Live version.

You will then see a new **Developer** section in the settings menu.

Expand All @@ -19,14 +19,14 @@ Once done, make sure to turn on **Enable platform dev tools** as it will allow y

![dev-tools](./assets/3-2-dev-tools.png)

Then click on **Browse** next to **Add a local app** and select the manifest you created in the [previous section](./2-manifest.md).
Then click on **Browse** next to **Add a local app** and select the manifest you created in the [previous section](/examples/use-live-app/manifest.mdx).

![browse](./assets/3-3-browse.png)

You will then see a new row in the menu with the name of your Live App.

![local-app](./assets/3-4-local-app.png)

Now that you have added your Live App in your local Ledger Live application, it’s time to open it and test it.
Now that you have added your Live App in your local Ledger Live application, it’s time to open it and test it.

We’ll see this in the next section.
7 changes: 7 additions & 0 deletions apps/docs/pages/examples/use-live-app/prerequisites.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Prerequisites

This tutorial assumes that you already have your dapp using the wallet-api package.

To start will need at least :

- a [Ledger Device](https://shop.ledger.com/pages/hardware-wallets-comparison) (Nano S or X). You will need one to access Ledger Live.
6 changes: 0 additions & 6 deletions apps/docs/pages/react/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,5 @@
"toc": true
}
},
"simulator": {
"title": "Simulator",
"theme": {
"toc": true
}
},
"hooks": "Hooks"
}
2 changes: 1 addition & 1 deletion apps/docs/pages/react/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(

With this setup, the entire application can access Ledger's Wallet API and communicate with it via the `TransportProvider`.

You are now almost ready to use the wallet API's functionalities. The last step is to make your Live App ready to be registered by creating your manifest. You can head to this section to learn about [how to create your manifest](/examples-and-tutorials/test-live-app/manifest)
You are now almost ready to use the wallet API's functionalities. The last step is to make your Live App ready to be registered by creating your manifest. You can head to this section to learn about [how to create your manifest](/examples/use-live-app/manifest)
116 changes: 57 additions & 59 deletions apps/docs/pages/react/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -1,90 +1,88 @@
<div>
# Getting Started with Ledger's Wallet API
# Getting Started with Ledger's Wallet API

Welcome to the getting started guide for Ledger's Wallet API. We are excited to have you onboard and look forward to
seeing what you'll create.
Welcome to the getting started guide for Ledger's Wallet API. We are excited to have you onboard and look forward to
seeing what you'll create.

Ledger's Wallet API can be integrated with both client and server-side applications, offering you flexibility and
enabling diverse use-cases.
Ledger's Wallet API can be integrated with both client and server-side applications, offering you flexibility and
enabling diverse use-cases.

## Installation
## Installation

Let's begin by installing the base package.
Let's begin by installing the base package.

You can use your favorite package manager, npm, yarn or pnpm, to install the `@ledgerhq/wallet-api-client` package.
You can use your favorite package manager, npm, yarn or pnpm, to install the `@ledgerhq/wallet-api-client` package.

With npm:
With npm:

```bash
npm install @ledgerhq/wallet-api-client
```
```sh
npm install @ledgerhq/wallet-api-client
```

With yarn:
With yarn:

```bash
yarn add @ledgerhq/wallet-api-client
```
```sh
yarn add @ledgerhq/wallet-api-client
```

Or with pnpm:
Or with pnpm:

```bash
pnpm add @ledgerhq/wallet-api-client
```
```sh
pnpm add @ledgerhq/wallet-api-client
```

### Using Ledger's Wallet API with React
### Using Ledger's Wallet API with React

For those working with a React project, we offer a specific package to facilitate easy integration of the Wallet API:
`@ledgerhq/wallet-api-client-react`.
For those working with a React project, we offer a specific package to facilitate easy integration of the Wallet API:
`@ledgerhq/wallet-api-client-react`.

To install it using npm:
To install it using npm:

```bash
npm install @ledgerhq/wallet-api-client-react
```
```sh
npm install @ledgerhq/wallet-api-client-react
```

With yarn:
With yarn:

```bash
yarn add @ledgerhq/wallet-api-client-react
```
```sh
yarn add @ledgerhq/wallet-api-client-react
```

Or with pnpm:
Or with pnpm:

```bash
pnpm add @ledgerhq/wallet-api-client-react
```
```sh
pnpm add @ledgerhq/wallet-api-client-react
```

This package provides handy React hooks to interact with Ledger's Wallet API.
This package provides handy React hooks to interact with Ledger's Wallet API.

### Testing with Simulator
### Testing with Simulator

To test the Wallet API without connecting to the Ledger Live App directly, you can use the
`@ledgerhq/wallet-api-simulator` package.
To test the Wallet API without connecting to the Ledger Live App directly, you can use the
`@ledgerhq/wallet-api-simulator` package.

Install it using npm:
Install it using npm:

```bash
npm install @ledgerhq/wallet-api-simulator
```
```sh
npm install @ledgerhq/wallet-api-simulator
```

With yarn:
With yarn:

```bash
yarn add @ledgerhq/wallet-api-simulator
```
```sh
yarn add @ledgerhq/wallet-api-simulator
```

Or with pnpm:
Or with pnpm:

```bash
pnpm add @ledgerhq/wallet-api-simulator
```
```sh
pnpm add @ledgerhq/wallet-api-simulator
```

Remember, this package currently only functions with server-side applications due to a dependency requiring the usage
of `process`.
Remember, this package currently only functions with server-side applications due to a dependency requiring the usage
of `process`.

---
---

Now that you've successfully installed the necessary packages, you're ready to start crafting with Ledger's Wallet
API. In the next page, we'll guide you through the process of setting up and configuring the Wallet API in your
application.
</div>
Now that you've successfully installed the necessary packages, you're ready to start crafting with Ledger's Wallet
API. In the next page, we'll guide you through the process of setting up and configuring the Wallet API in your
application.
Loading