mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 22:04:21 +01:00
format react with linter
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
buyBitcoin,
|
||||
BuyBitcoinProvider
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleBuyBtc = async () => {
|
||||
// ANCHOR: buy-btc
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { connectLsp, lspId, lspInfo } from "@breeztech/react-native-breez-sdk"
|
||||
import { connectLsp, lspId, lspInfo } from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleAutoConnect = async () => {
|
||||
// ANCHOR: get-lsp-info
|
||||
@@ -9,7 +9,7 @@ const exampleAutoConnect = async () => {
|
||||
|
||||
const exampleManualConnect = async () => {
|
||||
// ANCHOR: connect-lsp
|
||||
const id = "your selected lsp id"
|
||||
const id = 'your selected lsp id'
|
||||
await connectLsp(id)
|
||||
// ANCHOR_END: connect-lsp
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
listFiatCurrencies,
|
||||
fetchFiatRates
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleListCurrencies = async () => {
|
||||
// ANCHOR: list-fiat-currencies
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {
|
||||
BreezEvent,
|
||||
type BreezEvent,
|
||||
connect,
|
||||
defaultConfig,
|
||||
EnvironmentType,
|
||||
mnemonicToSeed,
|
||||
NodeConfig,
|
||||
type NodeConfig,
|
||||
NodeConfigVariant,
|
||||
nodeInfo
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleGettingStarted = async () => {
|
||||
// ANCHOR: init-sdk
|
||||
@@ -17,9 +17,9 @@ const exampleGettingStarted = async () => {
|
||||
}
|
||||
|
||||
// Create the default config
|
||||
const seed = await mnemonicToSeed("<mnemonics words>")
|
||||
const inviteCode = "<invite code>"
|
||||
const apiKey = "<api key>"
|
||||
const seed = await mnemonicToSeed('<mnemonics words>')
|
||||
const inviteCode = '<invite code>'
|
||||
const apiKey = '<api key>'
|
||||
const nodeConfig: NodeConfig = {
|
||||
type: NodeConfigVariant.GREENLIGHT,
|
||||
config: {
|
||||
|
||||
@@ -3,22 +3,22 @@ import {
|
||||
lnurlAuth,
|
||||
LnUrlCallbackStatusVariant,
|
||||
parseInput
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleLnurlAuth = async () => {
|
||||
// ANCHOR: lnurl-auth
|
||||
// Endpoint can also be of the form:
|
||||
// keyauth://domain.com/auth?key=val
|
||||
const lnurlAuthUrl =
|
||||
"lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
|
||||
'lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu'
|
||||
|
||||
const input = await parseInput(lnurlAuthUrl)
|
||||
if (input.type === InputTypeVariant.LN_URL_AUTH) {
|
||||
const result = await lnurlAuth(input.data)
|
||||
if (result.type === LnUrlCallbackStatusVariant.OK) {
|
||||
console.log("Successfully authenticated")
|
||||
console.log('Successfully authenticated')
|
||||
} else {
|
||||
console.log("Failed to authenticate")
|
||||
console.log('Failed to authenticate')
|
||||
}
|
||||
}
|
||||
// ANCHOR_END: lnurl-auth
|
||||
|
||||
@@ -2,14 +2,14 @@ import {
|
||||
InputTypeVariant,
|
||||
parseInput,
|
||||
payLnurl
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleLnurlPay = async () => {
|
||||
// ANCHOR: lnurl-pay
|
||||
// Endpoint can also be of the
|
||||
// lnurlp://domain.com/lnurl-pay?key=val
|
||||
// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf
|
||||
const lnurlPayUrl = "lightning@address.com"
|
||||
const lnurlPayUrl = 'lightning@address.com'
|
||||
|
||||
const input = await parseInput(lnurlPayUrl)
|
||||
if (input.type === InputTypeVariant.LN_URL_PAY) {
|
||||
@@ -17,7 +17,7 @@ const exampleLnurlPay = async () => {
|
||||
const lnUrlPayResult = await payLnurl({
|
||||
data: input.data,
|
||||
amountMsat,
|
||||
comment: "comment"
|
||||
comment: 'comment'
|
||||
})
|
||||
}
|
||||
// ANCHOR_END: lnurl-pay
|
||||
|
||||
@@ -2,14 +2,14 @@ import {
|
||||
InputTypeVariant,
|
||||
parseInput,
|
||||
withdrawLnurl
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleLnurlWithdraw = async () => {
|
||||
// ANCHOR: lnurl-withdraw
|
||||
// Endpoint can also be of the form:
|
||||
// lnurlw://domain.com/lnurl-withdraw?key=val
|
||||
const lnurlWithdrawUrl =
|
||||
"lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
|
||||
'lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk'
|
||||
|
||||
const input = await parseInput(lnurlWithdrawUrl)
|
||||
if (input.type === InputTypeVariant.LN_URL_WITHDRAW) {
|
||||
@@ -17,7 +17,7 @@ const exampleLnurlWithdraw = async () => {
|
||||
const lnUrlWithdrawResult = await withdrawLnurl({
|
||||
data: input.data,
|
||||
amountMsat,
|
||||
description: "comment"
|
||||
description: 'comment'
|
||||
})
|
||||
}
|
||||
// ANCHOR_END: lnurl-withdraw
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
openChannelFee,
|
||||
receiveOnchain,
|
||||
refund
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleReceiveOnchain = async () => {
|
||||
// ANCHOR: generate-receive-onchain-address
|
||||
@@ -30,7 +30,7 @@ const exampleListRefundables = async () => {
|
||||
const exampleRefund = async () => {
|
||||
// ANCHOR: execute-refund
|
||||
const refundables = await listRefundables()
|
||||
const toAddress = "..."
|
||||
const toAddress = '...'
|
||||
const satPerVbyte = 5
|
||||
|
||||
const refundResponse = await refund({
|
||||
@@ -46,7 +46,7 @@ const exampleOpenChannelFee = async () => {
|
||||
const amountMsat = 10000
|
||||
|
||||
const openChannelFeeResponse = await openChannelFee({
|
||||
amountMsat: amountMsat
|
||||
amountMsat
|
||||
})
|
||||
// ANCHOR_END: get-channel-opening-fees
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { receivePayment } from "@breeztech/react-native-breez-sdk"
|
||||
import { receivePayment } from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleReceiveLightningPayment = async () => {
|
||||
// ANCHOR: receive-payment
|
||||
const invoice = await receivePayment({
|
||||
amountMsat: 3000000,
|
||||
description: "Invoice for 3000 sats"
|
||||
description: 'Invoice for 3000 sats'
|
||||
})
|
||||
// ANCHOR_END: receive-payment
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
ReverseSwapPairInfo,
|
||||
type ReverseSwapPairInfo,
|
||||
fetchReverseSwapFees,
|
||||
inProgressReverseSwaps,
|
||||
sendOnchain
|
||||
} from "@breeztech/react-native-breez-sdk"
|
||||
} from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleFetchReverseSwapFees = async () => {
|
||||
// ANCHOR: estimate-current-reverse-swap-total-fees
|
||||
@@ -24,7 +24,7 @@ const exampleListCurrentFees = (currentFees: ReverseSwapPairInfo) => {
|
||||
|
||||
const exampleSendOnchain = async (currentFees: ReverseSwapPairInfo) => {
|
||||
// ANCHOR: start-reverse-swap
|
||||
const onchainRecipientAddress = "bc1.."
|
||||
const onchainRecipientAddress = 'bc1..'
|
||||
const amountSat = currentFees.min
|
||||
const satPerVbyte = 5
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { sendSpontaneousPayment } from "@breeztech/react-native-breez-sdk"
|
||||
import { sendSpontaneousPayment } from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleSendSpontaneousPayment = async () => {
|
||||
// ANCHOR: send-spontaneous-payment
|
||||
const nodeId = "..."
|
||||
const nodeId = '...'
|
||||
|
||||
const sendPaymentResponse = await sendSpontaneousPayment({
|
||||
nodeId,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { staticBackup } from "@breeztech/react-native-breez-sdk"
|
||||
import { staticBackup } from '@breeztech/react-native-breez-sdk'
|
||||
|
||||
const exampleStaticBackup = async () => {
|
||||
// ANCHOR: static-channel-backup
|
||||
let backupData = await staticBackup({ workingDir: "<working directory>" })
|
||||
const backupData = await staticBackup({ workingDir: '<working directory>' })
|
||||
// ANCHOR_END: static-channel-backup
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user