Skip to content

Commit 4890e8b

Browse files
author
Conor Okus
authored
Merge pull request #139 from lightningdevkit/upgrade-theme
Upgrade theme
2 parents 14b86f3 + 75879be commit 4890e8b

File tree

12 files changed

+8043
-3466
lines changed

12 files changed

+8043
-3466
lines changed

docs/.vuepress/config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const themeConfig = require('squarecrypto-vuepress-devkit-theme/config')
44
const title = 'Lightning Dev Kit Documentation'
55
const baseUrl = 'https://lightningdevkit.org'
66
const githubUrl = 'https://github.com/lightningdevkit'
7-
const slackUrl = 'https://join.slack.com/t/lightningdevkit/shared_invite/zt-tte36cb7-r5f41MDn3ObFtDu~N9dCrQ'
87
const discordUrl = 'https://discord.gg/5AcknnMfBw'
98
const themeColor = '#ffffff'
109

@@ -217,12 +216,12 @@ module.exports = {
217216
text: 'Twitter',
218217
link: "https://twitter.com/lightningdevkit",
219218
rel: 'noopener noreferrer'
220-
},
219+
},
221220
{
222221
text: 'Chat on Discord',
223222
link: discordUrl,
224223
rel: 'noopener noreferrer'
225-
},
224+
},
226225
]
227226
},
228227
{

docs/.vuepress/styles/palette.styl

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/blockchain_data/block_source.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Block Source
1+
# Block Source
22

33
Implementing the `BlockSource` interface requires defining methods for fetching
44
headers, blocks, and the best block hash.
55

6-
:::: tabs
7-
::: tab "Rust"
6+
7+
<CodeSwitcher :languages="{rust:'Rust'}">
8+
<template v-slot:rust>
89

910
```rust
1011
impl BlockSource for Blockchain {
@@ -22,10 +23,13 @@ impl BlockSource for Blockchain {
2223
}
2324
```
2425

26+
</template>
27+
</CodeSwitcher>
28+
2529
<!-- ADD JAVA EXAMPLE -->
2630

2731
For instance, you may implement this interface by querying Bitcoin Core's JSON
2832
RPC interface, which happens to be a sample implementation provided by
2933
`lightning-block-sync`.
3034

31-
Let's walk through the use case where LDK receives full blocks.
35+
Let's walk through the use case where LDK receives full blocks.

docs/blockchain_data/pre_filtered_blocks.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ if a block contains relevant transactions before fetching it.
1212
So how does this work in practice? `ChainMonitor` is parameterized by an
1313
optional type that implements `chain::Filter`:
1414

15-
:::: tabs
16-
::: tab "Rust"
15+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
16+
<template v-slot:rust>
1717

1818
```rust
1919
impl chain::Filter for Blockchain {
@@ -32,8 +32,8 @@ impl chain::Filter for Blockchain {
3232
}
3333
```
3434

35-
:::
36-
::: tab "Java"
35+
</template>
36+
<template v-slot:java>
3737

3838
```java
3939
Filter tx_filter = Filter.new_impl(new Filter.FilterInterface() {
@@ -54,11 +54,11 @@ Filter tx_filter = Filter.new_impl(new Filter.FilterInterface() {
5454
});
5555
```
5656

57-
:::
58-
::::
57+
</template>
58+
</CodeSwitcher>
5959

6060
When this is provided, `ChainMonitor` will call back to the filter as channels
6161
are opened and blocks connected. This gives the opportunity for the source to
6262
pre-filter blocks as desired.
6363

64-
Regardless, when a block is connected, its header must be processed by LDK.
64+
Regardless, when a block is connected, its header must be processed by LDK.

docs/payments/connecting_peers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ of another node that you want as a peer. Once the connection is established and
66
the handshake is complete, `PeerManager` will show the peer's pubkey in its list
77
of peers.
88

9-
:::: tabs
10-
::: tab "Rust"
9+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
10+
<template v-slot:rust>
1111

1212
```rust
1313
match lightning_net_tokio::connect_outbound(Arc::clone(&peer_manager), pubkey, address).await {
@@ -33,8 +33,8 @@ match lightning_net_tokio::connect_outbound(Arc::clone(&peer_manager), pubkey, a
3333
}
3434
```
3535

36-
:::
37-
::: tab "Java"
36+
</template>
37+
<template v-slot:java>
3838

3939
```java
4040
try {
@@ -51,5 +51,5 @@ catch (java.io.IOException e) {
5151
}
5252
```
5353

54-
:::
55-
::::
54+
</template>
55+
</CodeSwitcher>

docs/payments/managing_channels.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ Now that you have a peer, you can open a channel with them using
1717
Channels can be announced to the network or can remain private, which is
1818
controlled via `UserConfig::announced_channel`.
1919

20-
:::: tabs
21-
::: tab "Rust"
20+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
21+
<template v-slot:rust>
2222

2323
```rust
2424
let amount = 10_000;
2525
let push_msat = 1_000;
2626
let user_id = 42;
2727
let config = UserConfig {
28-
channel_options: ChannelConfig { announced_channel: true, ..Default::default() },
29-
..Default::default()
28+
channel_options: ChannelConfig { announced_channel: true, ..Default::default() },
29+
..Default::default()
3030
};
3131
match channel_manager.create_channel(pubkey, amount, push_msat, user_id, Some(config)) {
32-
Ok(_) => println!("EVENT: initiated channel with peer {}", pubkey),
33-
Err(e) => panic!("ERROR: failed to open channel: {:?}", e),
32+
Ok(_) => println!("EVENT: initiated channel with peer {}", pubkey),
33+
Err(e) => panic!("ERROR: failed to open channel: {:?}", e),
3434
}
3535
```
3636

37-
:::
38-
::: tab "Java"
37+
</template>
38+
<template v-slot:java>
3939

4040
```java
4141
long amount = 10_000L;
@@ -49,8 +49,8 @@ Result_NoneAPIErrorZ create_channel_result = channel_manager.create_channel(
4949
assert create_channel_result instanceof Result_NoneAPIErrorZ.Result_NoneAPIErrorZ_OK;
5050
```
5151

52-
:::
53-
::::
52+
</template>
53+
</CodeSwitcher>
5454

5555
At this point, an outbound channel has been initiated with your peer and it will
5656
appear in `ChannelManager::list_channels`. However, the channel is not yet
@@ -59,8 +59,8 @@ funded. Once your peer accepts the channel, you will be notified with a
5959
funding transaction and pass it to `ChannelManager`, which will broadcast it
6060
once it receives your channel counterparty's signature.
6161

62-
:::: tabs
63-
::: tab "Rust"
62+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
63+
<template v-slot:rust>
6464

6565
```rust
6666
// In the event handler passed to BackgroundProcessor::start
@@ -99,8 +99,8 @@ match event {
9999
}
100100
```
101101

102-
:::
103-
::: tab "Java"
102+
</template>
103+
<template v-slot:java>
104104

105105
```java
106106
// After the peer responds with an `accept_channel` message, an
@@ -143,8 +143,8 @@ if (e instanceof Event.FundingGenerationReady) {
143143
}
144144
```
145145

146-
:::
147-
::::
146+
</template>
147+
</CodeSwitcher>
148148

149149
After `ChannelManager` has broadcast the funding transaction, the channel will
150150
become usable once the transaction has enough confirmations and will appear in
@@ -162,8 +162,8 @@ unilaterally. The cooperative case makes for lower fees and immediate access to
162162
funds while the unilateral case does not. The latter may be necessary if your
163163
peer isn't behaving properly or has gone offline.
164164

165-
:::: tabs
166-
::: tab "Rust"
165+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
166+
<template v-slot:rust>
167167

168168
```rust
169169
let channel_id = channel_manager
@@ -180,8 +180,8 @@ channel_manager.close_channel(&channel_id).expect("ERROR: Failed to close channe
180180
channel_manager.force_close_channel(&channel_id).expect("ERROR: Failed to close channel");
181181
```
182182

183-
:::
184-
::: tab "Java"
183+
</template>
184+
<template v-slot:java>
185185

186186
```java
187187
// Example: Cooperative close (assuming 1 open channel)
@@ -195,7 +195,7 @@ byte[] channel_id = channel_manager.list_channels()[0].get_channel_id();
195195
Result_NoneAPIErrorZ channel_manager.force_close_channel(channel_id);
196196
```
197197

198-
:::
199-
::::
198+
</template>
199+
</CodeSwitcher>
200200

201-
Now that we know how to manage channels, let's put our new channel to use!
201+
Now that we know how to manage channels, let's put our new channel to use!

docs/payments/receiving_payments.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ amount and description. `ChannelManager` contains the remaining information
55
needed for the invoice. Use the provided utility to generate an invoice and
66
register a pending payment in `ChannelManager`.
77

8-
:::: tabs
9-
::: tab "Rust"
8+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
9+
<template v-slot:rust>
1010

1111
```rust
1212
let amt_msat = 10_000;
@@ -21,8 +21,8 @@ let invoice = match utils::create_invoice_from_channelmanager(
2121
let encoded_invoice = invoice.to_string();
2222
```
2323

24-
:::
25-
::: tab "Java"
24+
</template>
25+
<template v-slot:java>
2626

2727
```java
2828
String description = "coffee";
@@ -36,8 +36,8 @@ Invoice invoice = ((Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreat
3636
String encoded_invoice = invoice.to_str();
3737
```
3838

39-
:::
40-
::::
39+
</template>
40+
</CodeSwitcher>
4141

4242
While it is possible to create an invoice without using the utility,
4343
`ChannelManager` will reject any incoming HTLCs for unregistered payments to
@@ -49,8 +49,8 @@ As with sending a payment, LDK will generate an event once a payment is
4949
received. It is your responsibility to handle the `PaymentReceived` event by
5050
using `ChannelManager` to release the preimage and claim the funds.
5151

52-
:::: tabs
53-
::: tab "Rust"
52+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
53+
<template v-slot:rust>
5454

5555
```rust
5656
// In the event handler passed to BackgroundProcessor::start
@@ -66,8 +66,8 @@ match event {
6666
}
6767
```
6868

69-
:::
70-
::: tab "Java"
69+
</template>
70+
<template v-slot:java>
7171

7272
```java
7373
// In the `handle_event` method of ChannelManagerPersister implementation
@@ -80,8 +80,8 @@ else if (e instanceof Event.PaymentReceived) {
8080
}
8181
```
8282

83-
:::
84-
::::
83+
</template>
84+
</CodeSwitcher>
8585

8686
So there you have it! Those are the basics of using LDK. As you can see, LDK
8787
offers a ton of flexibility for building Lightning-enabled wallets and apps.

docs/payments/sending_payments.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ string in accordance with BOLT 11. After parsing the invoice, you'll need to
55
find a route from your node to the recipient and then make the payment using
66
`ChannelManager`.
77

8-
:::: tabs
9-
::: tab "Rust"
8+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
9+
<template v-slot:rust>
1010

1111
```rust
1212
// Parse the invoice.
@@ -38,8 +38,8 @@ channel_manager.send_payment(&route, payment_hash, &payment_secret)
3838
.expect("ERROR: failed to send payment");
3939
```
4040

41-
:::
42-
::: tab "Java"
41+
</template>
42+
<template v-slot:java>
4343

4444
```java
4545
String invoice_str = // get an invoice from the payee
@@ -73,16 +73,16 @@ if (parsed_invoice instanceof Result_InvoiceNoneZ.Result_InvoiceNoneZ_OK) {
7373
}
7474
```
7575

76-
:::
77-
::::
76+
</template>
77+
</CodeSwitcher>
7878

7979
An event is generated once a payment has completed. Successful payments result
8080
in a `PaymentSent` event with the preimage of the payment hash. Be sure to look
8181
out for a `PaymentFailed` event, if the payment fails for some reason, and act
8282
accordingly.
8383

84-
:::: tabs
85-
::: tab "Rust"
84+
<CodeSwitcher :languages="{rust:'Rust', java:'Java'}">
85+
<template v-slot:rust>
8686

8787
```rust
8888
// In the event handler passed to BackgroundProcessor::start
@@ -97,8 +97,8 @@ match event {
9797
}
9898
```
9999

100-
:::
101-
::: tab "Java"
100+
</template>
101+
<template v-slot:java>
102102

103103
```java
104104
// In the `handle_event` method of ChannelManagerPersister implementation
@@ -112,5 +112,5 @@ else if (e instanceof Event.PaymentFailed) {
112112
}
113113
```
114114

115-
:::
116-
::::
115+
</template>
116+
</CodeSwitcher>

0 commit comments

Comments
 (0)