Skip to content

Commit

Permalink
Fix function name case in Kotlin snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 committed Apr 29, 2024
1 parent e084005 commit a392b75
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.example.kotlinmpplib
import breez_sdk.*

class BuyBtc {
fun buy_btc(sdk: BlockingBreezServices) {
fun buyBtc(sdk: BlockingBreezServices) {
// ANCHOR: buy-btc
try {
// Choose your provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class CommunicatingFees {
fun get_fee_info_before_invoice_created(sdk: BlockingBreezServices) {
fun getFeeInfoBeforeInvoiceCreated(sdk: BlockingBreezServices) {
// ANCHOR: get-fee-info-before-receiving-payment
val inboundLiquidityMsat = sdk.nodeInfo()?.inboundLiquidityMsats ?: 0u
val inboundLiquiditySat = inboundLiquidityMsat / 1_000u
Expand All @@ -21,14 +21,14 @@ class CommunicatingFees {
// ANCHOR_END: get-fee-info-before-receiving-payment
}

fun get_fee_info_after_invoice_created(receivePaymentResponse: ReceivePaymentResponse) {
fun getFeeInfoAfterInvoiceCreated(receivePaymentResponse: ReceivePaymentResponse) {
// ANCHOR: get-fee-info-after-invoice-created
val openingFeeSat = receivePaymentResponse.openingFeeMsat?.let{ it.div(1000UL).toULong() } ?: run { 0UL }
// Log.v("Breez", "A setup fee of ${openingFeeSat} sats is applied to this invoice.")
// ANCHOR_END: get-fee-info-after-invoice-created
}

fun get_fee_info_receive_onchain(sdk: BlockingBreezServices) {
fun getFeeInfoReceiveOnchain(sdk: BlockingBreezServices) {
// ANCHOR: get-fee-info-receive-onchain
val swapInfo = sdk.receiveOnchain(ReceiveOnchainRequest())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class ConnectingLsp {
fun get_lsp_info(sdk: BlockingBreezServices) {
fun getLspInfo(sdk: BlockingBreezServices) {
// ANCHOR: get-lsp-info
try {
val lspId = sdk.lspId()
Expand All @@ -17,7 +17,7 @@ class ConnectingLsp {
// ANCHOR_END: get-lsp-info
}

fun list_lsps(sdk: BlockingBreezServices) {
fun listLsps(sdk: BlockingBreezServices) {
// ANCHOR: list-lsps
try {
val availableLsps = sdk.listLsps()
Expand All @@ -26,7 +26,7 @@ class ConnectingLsp {
}
// ANCHOR_END: list-lsps
}
fun connect_lsp(sdk: BlockingBreezServices, lspId: String) {
fun connectLsp(sdk: BlockingBreezServices, lspId: String) {
// ANCHOR: connect-lsp
try {
sdk.connectLsp(lspId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.example.kotlinmpplib
import breez_sdk.*

class FiatCurrencies {
fun list_fiat_currencies(sdk: BlockingBreezServices) {
fun listFiatCurrencies(sdk: BlockingBreezServices) {
// ANCHOR: list-fiat-currencies
try {
val fiatCurrencyList = sdk.listFiatCurrencies()
Expand All @@ -13,7 +13,7 @@ class FiatCurrencies {
// ANCHOR_END: list-fiat-currencies
}

fun fetch_fiat_rates(sdk: BlockingBreezServices) {
fun fetchFiatRates(sdk: BlockingBreezServices) {
// ANCHOR: fetch-fiat-rates
try {
val fiatRatesMap = sdk.fetchFiatRates()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GettingStarted {
// ANCHOR_END: init-sdk
}

fun start_restore_only(config: Config, seed: List<UByte>) {
fun startRestoreOnly(config: Config, seed: List<UByte>) {
class SDKListener : EventListener {
override fun onEvent(e: BreezEvent) {}
}
Expand All @@ -49,7 +49,7 @@ class GettingStarted {
}
}

fun fetch_balance(sdk: BlockingBreezServices) {
fun fetchBalance(sdk: BlockingBreezServices) {
// ANCHOR: fetch-balance
try {
val nodeInfo = sdk.nodeInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class ListPayments {
fun list_payments(sdk: BlockingBreezServices) {
fun listPayments(sdk: BlockingBreezServices) {
// ANCHOR: list-payments
try {
val payments = sdk.listPayments(ListPaymentsRequest())
Expand All @@ -12,7 +12,7 @@ class ListPayments {
// ANCHOR_END: list-payments
}

fun list_payments_filtered(sdk: BlockingBreezServices) {
fun listPaymentsFiltered(sdk: BlockingBreezServices) {
// ANCHOR: list-payments-filtered
try {
val payments = sdk.listPayments(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class LnurlAuth {
fun lnurl_auth(sdk: BlockingBreezServices) {
fun lnurlAuth(sdk: BlockingBreezServices) {
// ANCHOR: lnurl-auth
// Endpoint can also be of the form:
// keyauth://domain.com/auth?key=val
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class LnurlPay {
fun lnurl_pay(sdk: BlockingBreezServices) {
fun lnurlPay(sdk: BlockingBreezServices) {
// ANCHOR: lnurl-pay
// Endpoint can also be of the form:
// lnurlp://domain.com/lnurl-pay?key=val
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class LnurlWithdraw {
fun lnurl_withdraw(sdk: BlockingBreezServices) {
fun lnurlWithdraw(sdk: BlockingBreezServices) {
// ANCHOR: lnurl-withdraw
// Endpoint can also be of the form:
// lnurlw://domain.com/lnurl-withdraw?key=val
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class Metadata {
fun SetPaymentMetadata(sdk: BlockingBreezServices) {
fun setPaymentMetadata(sdk: BlockingBreezServices) {
// ANCHOR: set-payment-metadata
try {
sdk.setPaymentMetadata("target-payment-hash", """{"myCustomValue":true}""")
Expand All @@ -12,7 +12,7 @@ class Metadata {
// ANCHOR_END: set-payment-metadata
}

fun FilterPaymentMetadata(sdk: BlockingBreezServices) {
fun filterPaymentMetadata(sdk: BlockingBreezServices) {
// ANCHOR: filter-payment-metadata
val metadataFilters = listOf(MetadataFilter(
jsonPath = "myCustomValue",
Expand All @@ -30,7 +30,7 @@ class Metadata {
// ANCHOR_END: filter-payment-metadata
}

fun FilterPaymentMetadataString(sdk: BlockingBreezServices) {
fun filterPaymentMetadataString(sdk: BlockingBreezServices) {
// ANCHOR: filter-payment-metadata-string
val metadataFilters = listOf(MetadataFilter(
jsonPath = "customerName",
Expand All @@ -39,7 +39,7 @@ class Metadata {
// ANCHOR_END: filter-payment-metadata-string
}

fun FilterPaymentMetadataObject(sdk: BlockingBreezServices) {
fun filterPaymentMetadataObject(sdk: BlockingBreezServices) {
// ANCHOR: filter-payment-metadata-object
// This will *NOT* work
val _metadataFilters = listOf(MetadataFilter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class ReceiveOnchain {
fun generate_receive_onchain_address(sdk: BlockingBreezServices) {
fun generateReceiveOnchainAddress(sdk: BlockingBreezServices) {
// ANCHOR: generate-receive-onchain-address
try {
val swapInfo = sdk.receiveOnchain(ReceiveOnchainRequest())
Expand All @@ -16,7 +16,7 @@ class ReceiveOnchain {
// ANCHOR_END: generate-receive-onchain-address
}

fun in_progress_swap(sdk: BlockingBreezServices) {
fun inProgressSwap(sdk: BlockingBreezServices) {
// ANCHOR: in-progress-swap
try {
val swapInfo = sdk.inProgressSwap()
Expand All @@ -26,7 +26,7 @@ class ReceiveOnchain {
// ANCHOR_END: in-progress-swap
}

fun list_refundables(sdk: BlockingBreezServices) {
fun listRefundables(sdk: BlockingBreezServices) {
// ANCHOR: list-refundables
try {
val refundables = sdk.listRefundables()
Expand All @@ -36,7 +36,7 @@ class ReceiveOnchain {
// ANCHOR_END: list-refundables
}

fun execute_refund(sdk: BlockingBreezServices) {
fun executeRefund(sdk: BlockingBreezServices) {
// ANCHOR: execute-refund
val swapAddress = "..."
val toAddress = "..."
Expand All @@ -49,7 +49,7 @@ class ReceiveOnchain {
// ANCHOR_END: execute-refund
}

fun get_channel_opening_fees(sdk: BlockingBreezServices) {
fun getChannelOpeningFees(sdk: BlockingBreezServices) {
// ANCHOR: get-channel-opening-fees
try {
val amountMsat = 5_000.toULong();
Expand All @@ -60,7 +60,7 @@ class ReceiveOnchain {
// ANCHOR_END: get-channel-opening-fees
}

fun rescan_swaps(sdk: BlockingBreezServices) {
fun rescanSwaps(sdk: BlockingBreezServices) {
// ANCHOR: rescan-swaps
try {
sdk.rescanSwaps()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class ReceivePayment {
fun receive_payment(sdk: BlockingBreezServices) {
fun receivePayment(sdk: BlockingBreezServices) {
// ANCHOR: receive-payment
try {
val receivePaymentResponse = sdk.receivePayment(ReceivePaymentRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class SendOnchain {
fun get_current_rev_swap_limits(sdk: BlockingBreezServices) {
fun getCurrentRevSwapLimits(sdk: BlockingBreezServices) {
// ANCHOR: get-current-reverse-swap-limits
try {
val currentLimits = sdk.onchainPaymentLimits()
Expand All @@ -14,7 +14,7 @@ class SendOnchain {
// ANCHOR_END: get-current-reverse-swap-limits
}

fun prepare_pay_onchain(sdk: BlockingBreezServices, currentLimits: OnchainPaymentLimitsResponse) {
fun preparePayOnchain(sdk: BlockingBreezServices, currentLimits: OnchainPaymentLimitsResponse) {
// ANCHOR: prepare-pay-onchain
val amountSat = currentLimits.minSat
val satPerVbyte = 10.toUInt()
Expand All @@ -30,7 +30,7 @@ class SendOnchain {
// ANCHOR_END: prepare-pay-onchain
}

fun start_reverse_swap(sdk: BlockingBreezServices, prepareRes: PrepareOnchainPaymentResponse) {
fun startReverseSwap(sdk: BlockingBreezServices, prepareRes: PrepareOnchainPaymentResponse) {
// ANCHOR: start-reverse-swap
val address = "bc1.."
try {
Expand All @@ -41,7 +41,7 @@ class SendOnchain {
// ANCHOR_END: start-reverse-swap
}

fun check_rev_swap_status(sdk: BlockingBreezServices) {
fun checkRevSwapStatus(sdk: BlockingBreezServices) {
// ANCHOR: check-reverse-swaps-status
for (rs in sdk.inProgressOnchainPayments()) {
// Log.v("Breez", "Onchain payment ${rs.id} in progress, status is ${rs.status}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class SendPayment {
fun send_payment(sdk: BlockingBreezServices) {
fun sendPayment(sdk: BlockingBreezServices) {
// ANCHOR: send-payment
val bolt11 = "..."
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class SendSpontaneousPayment {
fun send_spontaneous_payment(sdk: BlockingBreezServices) {
fun sendSpontaneousPayment(sdk: BlockingBreezServices) {
// ANCHOR: send-spontaneous-payment
val nodeId = "..."
val amountMsat = 3_000_000.toULong()
Expand All @@ -16,7 +16,7 @@ class SendSpontaneousPayment {
// ANCHOR_END: send-spontaneous-payment
}

fun send_spontaneous_payment_with_tlvs(sdk: BlockingBreezServices) {
fun sendSpontaneousPaymentWithTlvs(sdk: BlockingBreezServices) {
// ANCHOR: send-spontaneous-payment-with-tlvs
val nodeId = "..."
val amountMsat = 3_000_000.toULong()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class ServiceStatus {
fun HealthCheckStatus(sdk: BlockingBreezServices) {
fun healthCheckStatus(sdk: BlockingBreezServices) {
// ANCHOR: health-check-status
try {
val healthCheck = serviceHealthCheck("<api key>")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.kotlinmpplib

import breez_sdk.*
class Webhooks {
fun Webhook(sdk: BlockingBreezServices) {
fun webhook(sdk: BlockingBreezServices) {
// ANCHOR: register-webook
try {
sdk.registerWebhook("https://yourapplication.com")
Expand Down

0 comments on commit a392b75

Please sign in to comment.