Skip to content

Commit

Permalink
format react with linter
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Nov 13, 2023
1 parent a846153 commit cd7c753
Show file tree
Hide file tree
Showing 14 changed files with 228 additions and 228 deletions.
16 changes: 8 additions & 8 deletions snippets/react-native/buy_btc.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
buyBitcoin,
BuyBitcoinProvider
} from "@breeztech/react-native-breez-sdk"
buyBitcoin,
BuyBitcoinProvider
} from '@breeztech/react-native-breez-sdk'

const exampleBuyBtc = async () => {
// ANCHOR: buy-btc
const buyBitcoinResponse = await buyBitcoin({
provider: BuyBitcoinProvider.MOONPAY
})
// ANCHOR_END: buy-btc
// ANCHOR: buy-btc
const buyBitcoinResponse = await buyBitcoin({
provider: BuyBitcoinProvider.MOONPAY
})
// ANCHOR_END: buy-btc
}
18 changes: 9 additions & 9 deletions snippets/react-native/connecting_lsp.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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
const id = await lspId()
const info = await lspInfo()
// ANCHOR_END: get-lsp-info
// ANCHOR: get-lsp-info
const id = await lspId()
const info = await lspInfo()
// ANCHOR_END: get-lsp-info
}

const exampleManualConnect = async () => {
// ANCHOR: connect-lsp
const id = "your selected lsp id"
await connectLsp(id)
// ANCHOR_END: connect-lsp
// ANCHOR: connect-lsp
const id = 'your selected lsp id'
await connectLsp(id)
// ANCHOR_END: connect-lsp
}
24 changes: 12 additions & 12 deletions snippets/react-native/fiat_currencies.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import {
listFiatCurrencies,
fetchFiatRates
} from "@breeztech/react-native-breez-sdk"
listFiatCurrencies,
fetchFiatRates
} from '@breeztech/react-native-breez-sdk'

const exampleListCurrencies = async () => {
// ANCHOR: list-fiat-currencies
const fiatCurrencies = await listFiatCurrencies()
// ANCHOR_END: list-fiat-currencies
// ANCHOR: list-fiat-currencies
const fiatCurrencies = await listFiatCurrencies()
// ANCHOR_END: list-fiat-currencies
}

const exampleFetchRates = async () => {
// ANCHOR: fetch-fiat-rates
const fiatRates = await fetchFiatRates()
// ANCHOR_END: fetch-fiat-rates
// ANCHOR: fetch-fiat-rates
const fiatRates = await fetchFiatRates()
// ANCHOR_END: fetch-fiat-rates
}

const exampleListCurrenciesAndRates = async () => {
// ANCHOR: get-fiat-currencies-and-rates
// TODO
// ANCHOR_END: get-fiat-currencies-and-rates
// ANCHOR: get-fiat-currencies-and-rates
// TODO
// ANCHOR_END: get-fiat-currencies-and-rates
}
72 changes: 36 additions & 36 deletions snippets/react-native/getting_started.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import {
BreezEvent,
connect,
defaultConfig,
EnvironmentType,
mnemonicToSeed,
NodeConfig,
NodeConfigVariant,
nodeInfo
} from "@breeztech/react-native-breez-sdk"
type BreezEvent,
connect,
defaultConfig,
EnvironmentType,
mnemonicToSeed,
type NodeConfig,
NodeConfigVariant,
nodeInfo
} from '@breeztech/react-native-breez-sdk'

const exampleGettingStarted = async () => {
// ANCHOR: init-sdk
// SDK events listener
const onBreezEvent = (e: BreezEvent) => {
console.log(`Received event ${e.type}`)
}
// ANCHOR: init-sdk
// SDK events listener
const onBreezEvent = (e: BreezEvent) => {
console.log(`Received event ${e.type}`)
}

// Create the default config
const seed = await mnemonicToSeed("<mnemonics words>")
const inviteCode = "<invite code>"
const apiKey = "<api key>"
const nodeConfig: NodeConfig = {
type: NodeConfigVariant.GREENLIGHT,
config: {
inviteCode
}
// Create the default config
const seed = await mnemonicToSeed('<mnemonics words>')
const inviteCode = '<invite code>'
const apiKey = '<api key>'
const nodeConfig: NodeConfig = {
type: NodeConfigVariant.GREENLIGHT,
config: {
inviteCode
}
}

const config = await defaultConfig(
EnvironmentType.PRODUCTION,
apiKey,
nodeConfig
)
const config = await defaultConfig(
EnvironmentType.PRODUCTION,
apiKey,
nodeConfig
)

// Connect to the Breez SDK make it ready for use
await connect(config, seed, onBreezEvent)
// ANCHOR_END: init-sdk
// Connect to the Breez SDK make it ready for use
await connect(config, seed, onBreezEvent)
// ANCHOR_END: init-sdk
}

const exampleFetchNodeInfo = async () => {
// ANCHOR: fetch-balance
const nodeState = await nodeInfo()
const balanceLn = nodeState.channelsBalanceMsat
const balanceOnchain = nodeState.onchainBalanceMsat
// ANCHOR_END: fetch-balance
// ANCHOR: fetch-balance
const nodeState = await nodeInfo()
const balanceLn = nodeState.channelsBalanceMsat
const balanceOnchain = nodeState.onchainBalanceMsat
// ANCHOR_END: fetch-balance
}
26 changes: 13 additions & 13 deletions snippets/react-native/list_payments.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import {
listPayments,
PaymentTypeFilter
} from "@breeztech/react-native-breez-sdk"
listPayments,
PaymentTypeFilter
} from '@breeztech/react-native-breez-sdk'

const exampleListPayments = async () => {
// ANCHOR: list-payments
const payments = listPayments({ filter: PaymentTypeFilter.ALL })
// ANCHOR_END: list-payments
// ANCHOR: list-payments
const payments = listPayments({ filter: PaymentTypeFilter.ALL })
// ANCHOR_END: list-payments
}

const exampleListPaymentsFiltered = async () => {
// ANCHOR: list-payments-filtered
const payments = listPayments({
filter: PaymentTypeFilter.SENT,
fromTimestamp: 1696880000,
includeFailures: true
})
// ANCHOR_END: list-payments-filtered
// ANCHOR: list-payments-filtered
const payments = listPayments({
filter: PaymentTypeFilter.SENT,
fromTimestamp: 1696880000,
includeFailures: true
})
// ANCHOR_END: list-payments-filtered
}
38 changes: 19 additions & 19 deletions snippets/react-native/lnurl_auth.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import {
InputTypeVariant,
lnurlAuth,
LnUrlCallbackStatusVariant,
parseInput
} from "@breeztech/react-native-breez-sdk"
InputTypeVariant,
lnurlAuth,
LnUrlCallbackStatusVariant,
parseInput
} 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"
// ANCHOR: lnurl-auth
// Endpoint can also be of the form:
// keyauth://domain.com/auth?key=val
const lnurlAuthUrl =
'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")
} else {
console.log("Failed to authenticate")
}
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')
} else {
console.log('Failed to authenticate')
}
// ANCHOR_END: lnurl-auth
}
// ANCHOR_END: lnurl-auth
}
38 changes: 19 additions & 19 deletions snippets/react-native/lnurl_pay.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import {
InputTypeVariant,
parseInput,
payLnurl
} from "@breeztech/react-native-breez-sdk"
InputTypeVariant,
parseInput,
payLnurl
} 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 = "[email protected]"
// ANCHOR: lnurl-pay
// Endpoint can also be of the
// lnurlp://domain.com/lnurl-pay?key=val
// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf
const lnurlPayUrl = '[email protected]'

const input = await parseInput(lnurlPayUrl)
if (input.type === InputTypeVariant.LN_URL_PAY) {
const amountMsat = input.data.minSendable
const lnUrlPayResult = await payLnurl({
data: input.data,
amountMsat,
comment: "comment"
})
}
// ANCHOR_END: lnurl-pay
const input = await parseInput(lnurlPayUrl)
if (input.type === InputTypeVariant.LN_URL_PAY) {
const amountMsat = input.data.minSendable
const lnUrlPayResult = await payLnurl({
data: input.data,
amountMsat,
comment: 'comment'
})
}
// ANCHOR_END: lnurl-pay
}
38 changes: 19 additions & 19 deletions snippets/react-native/lnurl_withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import {
InputTypeVariant,
parseInput,
withdrawLnurl
} from "@breeztech/react-native-breez-sdk"
InputTypeVariant,
parseInput,
withdrawLnurl
} 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"
// ANCHOR: lnurl-withdraw
// Endpoint can also be of the form:
// lnurlw://domain.com/lnurl-withdraw?key=val
const lnurlWithdrawUrl =
'lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk'

const input = await parseInput(lnurlWithdrawUrl)
if (input.type === InputTypeVariant.LN_URL_WITHDRAW) {
const amountMsat = input.data.minWithdrawable
const lnUrlWithdrawResult = await withdrawLnurl({
data: input.data,
amountMsat,
description: "comment"
})
}
// ANCHOR_END: lnurl-withdraw
const input = await parseInput(lnurlWithdrawUrl)
if (input.type === InputTypeVariant.LN_URL_WITHDRAW) {
const amountMsat = input.data.minWithdrawable
const lnUrlWithdrawResult = await withdrawLnurl({
data: input.data,
amountMsat,
description: 'comment'
})
}
// ANCHOR_END: lnurl-withdraw
}
Loading

0 comments on commit cd7c753

Please sign in to comment.