Document all languages

This commit is contained in:
Roei Erez
2023-10-18 13:14:43 +03:00
committed by Erdem Yerebasmaz
parent f717da5915
commit f6dcd33c2e

View File

@@ -8,7 +8,10 @@ Once you have outbound liquidity you can start sending payments too.
```rust,ignore ```rust,ignore
let bolt11 = "..."; let bolt11 = "...";
sdk.send_payment(bolt11.into(), None).await?; // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
let amount_msat: Option<u64> = None;
sdk.send_payment(bolt11.into(), amount_msat).await?;
``` ```
</section> </section>
@@ -20,7 +23,7 @@ let bolt11 = "...";
do { do {
// The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'. // The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
let payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000) let payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000000)
} catch { } catch {
// handle error // handle error
} }
@@ -33,7 +36,10 @@ do {
```kotlin,ignore ```kotlin,ignore
val bolt11 = "..." val bolt11 = "..."
try { try {
val payment = sdk.sendPayment(bolt11, 3000L.toULong()) // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
var amount_msat = 3000000L.toULong()
val payment = sdk.sendPayment(bolt11, amount_msat)
} catch (e: Exception) { } catch (e: Exception) {
// handle error // handle error
} }
@@ -46,7 +52,10 @@ try {
```typescript ```typescript
const bolt11 = "..." const bolt11 = "..."
try { try {
const payment = await sendPayment(bolt11, 3000) // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
const amount_msat = 3000000
const payment = await sendPayment(bolt11, amount_msat)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
@@ -59,6 +68,8 @@ try {
```dart ```dart
String bolt11 = "..."; String bolt11 = "...";
try { try {
// The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
Payment payment = await sendPayment( Payment payment = await sendPayment(
bolt11: bolt11, bolt11: bolt11,
amount_msat: 3000, amount_msat: 3000,
@@ -88,7 +99,9 @@ except Exception as error:
```go ```go
bolt11 := "bolt11 invoice" bolt11 := "bolt11 invoice"
amount_msat := uint64(3000) // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
amount_msat := uint64(3000000)
if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil { if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil {
log.Printf("%#v", payment) log.Printf("%#v", payment)
} }
@@ -102,7 +115,10 @@ if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil {
var bolt11 = "..."; var bolt11 = "...";
try try
{ {
var payment = sdk.SendPayment(bolt11, 3000); // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
var amount_msat = 3000000;
var payment = sdk.SendPayment(bolt11, amount_msat);
} }
catch (Exception) catch (Exception)
{ {