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
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>
@@ -20,7 +23,7 @@ let bolt11 = "...";
do {
// 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 payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000)
let payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000000)
} catch {
// handle error
}
@@ -33,7 +36,10 @@ do {
```kotlin,ignore
val bolt11 = "..."
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) {
// handle error
}
@@ -46,7 +52,10 @@ try {
```typescript
const bolt11 = "..."
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) {
console.log(error)
}
@@ -59,6 +68,8 @@ try {
```dart
String bolt11 = "...";
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(
bolt11: bolt11,
amount_msat: 3000,
@@ -88,7 +99,9 @@ except Exception as error:
```go
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 {
log.Printf("%#v", payment)
}
@@ -102,7 +115,10 @@ if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil {
var bolt11 = "...";
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)
{