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