From 8cf55b73060fa4683feffc9bd57cec6d9b30a8a6 Mon Sep 17 00:00:00 2001 From: Ross Savage Date: Sun, 2 Jul 2023 22:09:28 +0200 Subject: [PATCH] Remove sdkServices as its managed by the native module --- src/guide/getting_started.md | 4 ++-- src/guide/lnurl_auth.md | 2 +- src/guide/lnurl_pay.md | 2 +- src/guide/lnurl_withdraw.md | 2 +- src/guide/payments.md | 6 +++--- src/guide/recieve_onchain.md | 8 ++++---- src/guide/send_onchain.md | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/guide/getting_started.md b/src/guide/getting_started.md index 44d86ff..a369914 100644 --- a/src/guide/getting_started.md +++ b/src/guide/getting_started.md @@ -177,7 +177,7 @@ config.workingDir = "path to an existing directory"; try { const sdkServices = await initServices(config, credentials.deviceKey, credentials.deviceCert, seed); - await sdkServices.start(); + await start(); } catch (error) { console.log(error); } @@ -187,7 +187,7 @@ At any point we can fetch our balance from the Greenlight node: ```typescript try { - const nodeInfo = await sdkServices.nodeInfo(); + const nodeInfo = await nodeInfo(); const lnBalance = nodeInfo.channelsBalanceMsat; const onchainBalance = nodeInfo.onchainBalanceMsat; } catch (error) { diff --git a/src/guide/lnurl_auth.md b/src/guide/lnurl_auth.md index af4bca2..7d3c27d 100644 --- a/src/guide/lnurl_auth.md +++ b/src/guide/lnurl_auth.md @@ -61,7 +61,7 @@ let lnurlAuthUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0 try { const input = await parseInput(lnurlAuthUrl) if (input.type === InputType.LNURL_AUTH) { - const result = await sdkServices.lnurlAuth(input.data) + const result = await lnurlAuth(input.data) if (result.status === "ok") { print("Successfully authenticated") } else { diff --git a/src/guide/lnurl_pay.md b/src/guide/lnurl_pay.md index 3fef874..1dada0e 100644 --- a/src/guide/lnurl_pay.md +++ b/src/guide/lnurl_pay.md @@ -54,7 +54,7 @@ try { const input = await parseInput(lnurlAuthUrl) if (input.type === InputType.LNURL_PAY) { const amountSats = input.minSendable; - const result = await sdkServices.payLnurl(input.data, amountSats, "comment") + const result = await payLnurl(input.data, amountSats, "comment") } } catch (error) { console.log(error) diff --git a/src/guide/lnurl_withdraw.md b/src/guide/lnurl_withdraw.md index 5c8addb..da7332f 100644 --- a/src/guide/lnurl_withdraw.md +++ b/src/guide/lnurl_withdraw.md @@ -54,7 +54,7 @@ try { const input = await parseInput(lnurlAuthUrl) if (input.type === InputType.LNURL_WITHDRAW) { const amountSats = input.minWithdrawable; - const result = await sdkServices.withdrawLnurl(input.data, amountSats, "comment") + const result = await withdrawLnurl(input.data, amountSats, "comment") } } catch (error) { console.log(error) diff --git a/src/guide/payments.md b/src/guide/payments.md index 6b40d9a..73167af 100644 --- a/src/guide/payments.md +++ b/src/guide/payments.md @@ -66,7 +66,7 @@ Breez SDK automatically connects your node to the LSP peer and you can now recei ```typescript try { - const invoice = await sdkServices.receivePayment(3000, "Invoice for 3000 sats") + const invoice = await receivePayment(3000, "Invoice for 3000 sats") } catch (error) { console.log(error) } @@ -76,7 +76,7 @@ try { ```typescript const bolt11 = "..."; try { - const payment = await sdkServices.sendPayment(bolt11, 3000) + const payment = await sendPayment(bolt11, 3000) } catch (error) { console.log(error) } @@ -86,7 +86,7 @@ try { ```typescript const nodeId = "..."; try { - const payment = await sdkServices.sendSpontaneousPayment(nodeId, 3000) + const payment = await sendSpontaneousPayment(nodeId, 3000) } catch (error) { console.log(error) } diff --git a/src/guide/recieve_onchain.md b/src/guide/recieve_onchain.md index 7a35c5a..dd554fb 100644 --- a/src/guide/recieve_onchain.md +++ b/src/guide/recieve_onchain.md @@ -95,7 +95,7 @@ do { ```typescript try { - const swapInfo = await sdkServices.receiveOnchain(); + const swapInfo = await receiveOnchain(); // Send your funds to the below bitcoin address const address = swapInfo.bitcoinAddress; @@ -108,7 +108,7 @@ Once you've sent the funds to the above address, the SDK will monitor this addre ```typescript try { - const swapInfo = await sdkServices.inProgressSwap() + const swapInfo = await inProgressSwap() } catch (error) { console.log(error) } @@ -123,7 +123,7 @@ In order to execute a refund, you need to supply an on-chain address to where th ```typescript try { - const refundables = await sdkServices.listRefundables() + const refundables = await listRefundables() } catch (error) { console.log(error) } @@ -135,7 +135,7 @@ Once you have a refundable swap in hand, use the follwing code to execute a refu const destinationAddress = "..." const satPerVbyte = try { - const result = await sdkServices.refund(refundable.bitcoinAddress, destinationAddress, satPerVbyte) + const result = await refund(refundable.bitcoinAddress, destinationAddress, satPerVbyte) } catch (error) { console.log(error) } diff --git a/src/guide/send_onchain.md b/src/guide/send_onchain.md index 9dd8341..ce1a4f9 100644 --- a/src/guide/send_onchain.md +++ b/src/guide/send_onchain.md @@ -104,7 +104,7 @@ for rs in sdk.inProgressReverseSwaps() { ```typescript try { - const currentFees = await sdkServices.fetchReverseSwapFees() + const currentFees = await fetchReverseSwapFees() console.log(`Percentage fee for the reverse swap service: ${currentFees.feesPercentage}`); console.log(`Estimated miner fees in sats for locking up funds: ${currentFees.feesLockup}`); @@ -132,7 +132,7 @@ const destinationAddress = "bc1.."; const amountSat = currentFees.min; const satPerVbyte = try { - const reverseSwapInfo = sdkServices.sendOnchain(amountSat, destinationAddress, currentFees.feesHash, satPerVbyte) + const reverseSwapInfo = sendOnchain(amountSat, destinationAddress, currentFees.feesHash, satPerVbyte) } catch (error) { console.log(error) } @@ -146,7 +146,7 @@ You can check its status with: ```typescript try { - const swaps = await sdk.inProgressReverseSwaps() + const swaps = await inProgressReverseSwaps() for (const swap in swaps) { println(`Reverse swap ${swap.id} in progress, status is ${swap.breezStatus}`); }