Skip to content

Adds getting started installation instructions #133

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

Merged
merged 6 commits into from
Jul 19, 2022
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
3 changes: 2 additions & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const tutorialSidebar = [
title: 'Tutorials',
collapsable: false,
children: [
'/tutorials/getting-started',
'/tutorials/build_a_node_in_java',
'/tutorials/build_a_node_in_rust'
],
Expand Down Expand Up @@ -146,7 +147,7 @@ module.exports = {
},
{
text: 'Tutorials',
link: '/tutorials/build_a_node_in_java'
link: '/tutorials/getting-started'
},
{
text: 'Blog',
Expand Down
118 changes: 118 additions & 0 deletions docs/tutorials/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Getting started

Welcome to the Lightning Development Kit documentation!

If you have any questions about anything related to LDK, feel free to ask our community on [GitHub Discussions](https://github.com/orgs/lightningdevkit/discussions) or join us on [Discord](https://discord.gg/5AcknnMfBw).

## System Requirements
MacOS, Windows and Linux are supported.
## Installation
To add LDK to a project, run:

<CodeSwitcher :languages="{rust:'Rust', java:'Java', kotlin:'Kotlin', javascript:'JavaScript'}">
<template v-slot:rust>

```toml
Comment on lines +12 to +15
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation levels seem inconsistent across the first CodeSwitcher block, FWIW. The second block seems fine though with two spaces and one within the formatted language blocks.

# Add the following dependencies to your cargo.toml and replace {VERSION} with the version number you want to use.

[dependencies]
lightning = { version = {VERSION}, features = ["max_level_trace"] }
lightning-block-sync = { version = {VERSION}, features = [ "rpc-client" ] }
lightning-invoice = { version = {VERSION} }
lightning-net-tokio = { version = {VERSION} }
lightning-persister = { version = {VERSION} }
lightning-background-processor = { version = {VERSION} }
lightning-rapid-gossip-sync = { version = {VERSION} }
```

</template>
<template v-slot:java>

```xml
<!--
For Maven, add the following dependency to your POM and replace {VERSION} with the
version number you want to use.
-->

<dependency>
<groupId>org.lightningdevkit</groupId>
<artifactId>ldk-java</artifactId>
<version>{VERSION}</version>
</dependency>
```

```kotlin
/*
For Gradle, add the following dependency to your build.gradle and replace {VERSION} with
the version number you want to use.
*/

dependencies {
// ...
implementation 'org.lightningdevkit:ldk-java:{VERSION}'
// ...
}
```

</template>
<template v-slot:kotlin>

```kotlin
/* To include the LDK Kotlin bindings in an Android project download the latest binary from https://github.com/lightningdevkit/ldk-garbagecollected/releases and place it in your libs directory.
Then add to your build.gradle file:
*/

dependencies {
// ...
implementation fileTree(include: ['*.aar'], dir: 'libs')
// ...
}
```

</template>
<template v-slot:javascript>

```javascript
npm i lightningdevkit --save
```

</template>
</CodeSwitcher>

Example usage after installation is complete:

<CodeSwitcher :languages="{rust:'Rust', java:'Java', kotlin:'Kotlin', javascript:'JavaScript'}">
<template v-slot:rust>

```rust
use lightning::chain::chaininterface::FeeEstimator;
```

</template>
<template v-slot:java>

```java
import org.ldk.structs.FeeEstimator
```

</template>
<template v-slot:kotlin>

```kotlin
import org.ldk.structs.FeeEstimator
```

</template>
<template v-slot:javascript>

```javascript
import { FeeEstimator } from "lightningdevkit";
import * as fs from "fs";
import { strict as assert } from "assert";

const wasm_file = fs.readFileSync("node_modules/lightningdevkit/liblightningjs.wasm");
await ldk.initializeWasmFromBinary(wasm_file);
```

</template>
</CodeSwitcher>