mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
Merge remote-tracking branch 'origin/master' into feat/glalby
This commit is contained in:
commit
c611f1f73d
19 changed files with 5989 additions and 25 deletions
|
|
@ -49,4 +49,7 @@ COPY --from=builder /build/libbreez_sdk_bindings.so /usr/lib/nwc/
|
|||
COPY --from=builder /build/libglalby_bindings.so /usr/lib/nwc/
|
||||
COPY --from=builder /build/main /bin/
|
||||
|
||||
# Temporary LDK bindings
|
||||
COPY ldk_node ./ldk_node
|
||||
|
||||
ENTRYPOINT [ "/bin/main" ]
|
||||
|
|
|
|||
|
|
@ -259,4 +259,6 @@ Run NWC on your own node!
|
|||
|
||||
### Docker
|
||||
|
||||
(TBC)
|
||||
`docker build . -t nwc-local --progress=plain`
|
||||
|
||||
`docker run --env-file .env -p 8080:8080 nwc-local`
|
||||
|
|
|
|||
6
cgo.go
Normal file
6
cgo.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package main
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lldk_node_bindings -Wl,-rpath,./ldk_node -L./ldk_node
|
||||
*/
|
||||
import "C"
|
||||
|
|
@ -14,6 +14,7 @@ import (
|
|||
const (
|
||||
LNDBackendType = "LND"
|
||||
GreenlightBackendType = "GREENLIGHT"
|
||||
LDKBackendType = "LDK"
|
||||
BreezBackendType = "BREEZ"
|
||||
SessionCookieName = "session"
|
||||
SessionCookieAuthKey = "authenticated"
|
||||
|
|
|
|||
|
|
@ -33,17 +33,19 @@ function Navbar() {
|
|||
>
|
||||
Apps
|
||||
</Link>
|
||||
{info?.running && info.backendType === "GREENLIGHT" && (
|
||||
<Link
|
||||
className={`${linkStyles} ${
|
||||
location.pathname.startsWith("/channels") &&
|
||||
selectedLinkStyles
|
||||
}`}
|
||||
to="/channels"
|
||||
>
|
||||
Channels
|
||||
</Link>
|
||||
)}
|
||||
{info?.running &&
|
||||
(info.backendType === "GREENLIGHT" ||
|
||||
info.backendType === "LDK") && (
|
||||
<Link
|
||||
className={`${linkStyles} ${
|
||||
location.pathname.startsWith("/channels") &&
|
||||
selectedLinkStyles
|
||||
}`}
|
||||
to="/channels"
|
||||
>
|
||||
Channels
|
||||
</Link>
|
||||
)}
|
||||
{!info?.running && (
|
||||
<Link
|
||||
className={`${linkStyles} ${
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { useChannels } from "src/hooks/useChannels";
|
||||
import { useInfo } from "src/hooks/useInfo";
|
||||
import { useOnchainBalance } from "src/hooks/useOnchainBalance";
|
||||
import { Node } from "src/types";
|
||||
|
||||
|
|
@ -8,6 +9,15 @@ export default function Channels() {
|
|||
const { data: channels } = useChannels();
|
||||
const { data: onchainBalance } = useOnchainBalance();
|
||||
const [nodes, setNodes] = React.useState<Node[]>([]);
|
||||
const { data: info } = useInfo();
|
||||
const navigate = useNavigate();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!info || info.running) {
|
||||
return;
|
||||
}
|
||||
navigate("/");
|
||||
}, [info, navigate]);
|
||||
|
||||
const loadNodeStats = React.useCallback(async () => {
|
||||
if (!channels) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export default function NewBlocktankChannel() {
|
|||
}
|
||||
}
|
||||
|
||||
const connectionString = `${connectionInfo.pubkey}@${connectionInfo.address}:${connectionInfo.port}`;
|
||||
const connectionString = connectionInfo.pubkey; //`${connectionInfo.pubkey}@${connectionInfo.address}:${connectionInfo.port}`;
|
||||
|
||||
// TODO: replace with https://github.com/synonymdev/blocktank-client
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ export default function NewCustomChannel() {
|
|||
const [loading, setLoading] = React.useState(false);
|
||||
const [localAmount, setLocalAmount] = React.useState("");
|
||||
const [nodeDetails, setNodeDetails] = React.useState<Node | undefined>();
|
||||
const [isPublic, setPublic] = React.useState(true);
|
||||
|
||||
const [searchParams] = useSearchParams();
|
||||
const [pubkey, setPubkey] = React.useState(searchParams.get("pubkey") || "");
|
||||
const [host, setHost] = React.useState(searchParams.get("host") || "");
|
||||
const { data: csrf } = useCSRF();
|
||||
|
||||
const fetchNodeDetails = React.useCallback(async () => {
|
||||
|
|
@ -37,11 +39,11 @@ export default function NewCustomChannel() {
|
|||
if (!csrf) {
|
||||
throw new Error("csrf not loaded");
|
||||
}
|
||||
if (!nodeDetails) {
|
||||
if (!nodeDetails && !host) {
|
||||
throw new Error("node details not found");
|
||||
}
|
||||
const host = nodeDetails.sockets.split(",")[0];
|
||||
const [address, port] = host.split(":");
|
||||
const _host = nodeDetails ? nodeDetails.sockets.split(",")[0] : host;
|
||||
const [address, port] = _host.split(":");
|
||||
if (!address || !port) {
|
||||
throw new Error("host not found");
|
||||
}
|
||||
|
|
@ -59,19 +61,16 @@ export default function NewCustomChannel() {
|
|||
},
|
||||
body: JSON.stringify(connectPeerRequest),
|
||||
});
|
||||
}, [csrf, nodeDetails, pubkey]);
|
||||
}, [csrf, nodeDetails, pubkey, host]);
|
||||
|
||||
async function openChannel() {
|
||||
try {
|
||||
if (!csrf) {
|
||||
throw new Error("csrf not loaded");
|
||||
}
|
||||
if (!nodeDetails) {
|
||||
throw new Error("node details not found");
|
||||
}
|
||||
if (
|
||||
!confirm(
|
||||
`Are you sure you want to open a ${localAmount} sat channel to ${nodeDetails.alias}?`
|
||||
`Are you sure you want to peer with ${nodeDetails?.alias || pubkey}?`
|
||||
)
|
||||
) {
|
||||
return;
|
||||
|
|
@ -81,11 +80,23 @@ export default function NewCustomChannel() {
|
|||
|
||||
await connectPeer();
|
||||
|
||||
if (
|
||||
!confirm(
|
||||
`Are you sure you want to open a ${localAmount} sat channel to ${
|
||||
nodeDetails?.alias || pubkey
|
||||
}?`
|
||||
)
|
||||
) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`🎬 Opening channel with ${pubkey}`);
|
||||
|
||||
const openChannelRequest: OpenChannelRequest = {
|
||||
pubkey,
|
||||
amount: +localAmount,
|
||||
public: isPublic,
|
||||
};
|
||||
const openChannelResponse = await request<OpenChannelResponse>(
|
||||
"/api/channels",
|
||||
|
|
@ -160,6 +171,25 @@ export default function NewCustomChannel() {
|
|||
}}
|
||||
/>
|
||||
</div>
|
||||
{!nodeDetails && pubkey && (
|
||||
<div className="w-full px-3 mb-6 md:mb-0">
|
||||
<label
|
||||
className="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
|
||||
htmlFor="grid-first-name"
|
||||
>
|
||||
Host:Port
|
||||
</label>
|
||||
<input
|
||||
className="appearance-none block w-full bg-gray-200 text-gray-700 border rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white"
|
||||
type="text"
|
||||
value={host}
|
||||
placeholder="0.0.0.0:9735"
|
||||
onChange={(e) => {
|
||||
setHost(e.target.value.trim());
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap -mx-3 mt-6">
|
||||
|
|
@ -181,6 +211,18 @@ export default function NewCustomChannel() {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-full my-6">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
defaultChecked={isPublic}
|
||||
onChange={(e) => setPublic(e.target.checked)}
|
||||
className="mr-2"
|
||||
/>
|
||||
Public Channel
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="mt-2">
|
||||
<button
|
||||
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ export function SetupNode() {
|
|||
...data,
|
||||
});
|
||||
navigate(
|
||||
backendType === "BREEZ" || backendType === "GREENLIGHT"
|
||||
backendType === "BREEZ" ||
|
||||
backendType === "GREENLIGHT" ||
|
||||
backendType === "LDK"
|
||||
? `/setup/mnemonic${isNew ? "?wallet=new" : ""}`
|
||||
: `/setup/finish`
|
||||
);
|
||||
|
|
@ -52,12 +54,14 @@ export function SetupNode() {
|
|||
>
|
||||
<option value={"BREEZ"}>Breez</option>
|
||||
<option value={"GREENLIGHT"}>Greenlight</option>
|
||||
<option value={"LDK"}>LDK</option>
|
||||
{!isNew && <option value={"LND"}>LND</option>}
|
||||
</select>
|
||||
{backendType === "BREEZ" && <BreezForm handleSubmit={handleSubmit} />}
|
||||
{backendType === "GREENLIGHT" && (
|
||||
<GreenlightForm handleSubmit={handleSubmit} />
|
||||
)}
|
||||
{backendType === "LDK" && <LDKForm handleSubmit={handleSubmit} />}
|
||||
{backendType === "LND" && <LNDForm handleSubmit={handleSubmit} />}
|
||||
</div>
|
||||
</Container>
|
||||
|
|
@ -165,6 +169,19 @@ function GreenlightForm({ handleSubmit }: SetupFormProps) {
|
|||
);
|
||||
}
|
||||
|
||||
function LDKForm({ handleSubmit }: SetupFormProps) {
|
||||
function onSubmit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
handleSubmit({});
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={onSubmit} className="w-full">
|
||||
<ConnectButton isConnecting={false} submitText="Next" />
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function LNDForm({ handleSubmit }: SetupFormProps) {
|
||||
const setupStore = useSetupStore();
|
||||
const [lndAddress, setLndAddress] = React.useState<string>(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export const NIP_47_MAKE_INVOICE_METHOD = "make_invoice";
|
|||
export const NIP_47_LOOKUP_INVOICE_METHOD = "lookup_invoice";
|
||||
export const NIP_47_LIST_TRANSACTIONS_METHOD = "list_transactions";
|
||||
|
||||
export type BackendType = "LND" | "BREEZ" | "GREENLIGHT";
|
||||
export type BackendType = "LND" | "BREEZ" | "GREENLIGHT" | "LDK";
|
||||
|
||||
export type RequestMethodType =
|
||||
| "pay_invoice"
|
||||
|
|
@ -111,6 +111,7 @@ export type ConnectPeerRequest = {
|
|||
export type OpenChannelRequest = {
|
||||
pubkey: string;
|
||||
amount: number;
|
||||
public: boolean;
|
||||
};
|
||||
|
||||
export type OpenChannelResponse = {
|
||||
|
|
|
|||
452
ldk.go
Normal file
452
ldk.go
Normal file
|
|
@ -0,0 +1,452 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/getAlby/nostr-wallet-connect/ldk_node" // TODO: include this from an external library
|
||||
"github.com/getAlby/nostr-wallet-connect/models/lnclient"
|
||||
decodepay "github.com/nbd-wtf/ln-decodepay"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type LDKService struct {
|
||||
svc *Service
|
||||
workdir string
|
||||
node *ldk_node.LdkNode
|
||||
cancelLdkEventListenerCtx context.CancelFunc
|
||||
subscribeLdkEvents func() chan ldk_node.Event
|
||||
unsubscribeLdkEvents func(chan ldk_node.Event)
|
||||
}
|
||||
|
||||
func NewLDKService(svc *Service, mnemonic, workDir string) (result lnclient.LNClient, err error) {
|
||||
if mnemonic == "" || workDir == "" {
|
||||
return nil, errors.New("one or more required LDK configuration are missing")
|
||||
}
|
||||
|
||||
//create dir if not exists
|
||||
newpath := filepath.Join(".", workDir)
|
||||
err = os.MkdirAll(newpath, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Printf("Failed to create LDK working dir: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logDirPath := filepath.Join(newpath, "./logs")
|
||||
config := ldk_node.DefaultConfig()
|
||||
listeningAddresses := []string{
|
||||
"0.0.0.0:9735",
|
||||
}
|
||||
config.ListeningAddresses = &listeningAddresses
|
||||
config.LogDirPath = &logDirPath
|
||||
builder := ldk_node.BuilderFromConfig(config)
|
||||
builder.SetEntropyBip39Mnemonic(mnemonic, nil)
|
||||
builder.SetNetwork("bitcoin")
|
||||
builder.SetEsploraServer("https://blockstream.info/api")
|
||||
builder.SetGossipSourceRgs("https://rapidsync.lightningdevkit.org/snapshot")
|
||||
builder.SetStorageDirPath(filepath.Join(newpath, "./storage"))
|
||||
//builder.SetLogDirPath (filepath.Join(newpath, "./logs")); // missing?
|
||||
node, err := builder.Build()
|
||||
|
||||
if err != nil {
|
||||
svc.Logger.Errorf("Failed to create LDK node: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = node.Start()
|
||||
if err != nil {
|
||||
svc.Logger.Errorf("Failed to start LDK node: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: move this event handler code
|
||||
ldkEventListenerCtx, cancelLdkEventListenerCtx := context.WithCancel(context.Background())
|
||||
ldkEventHandlers := []chan ldk_node.Event{}
|
||||
var ldkEventHandlersMutex sync.Mutex
|
||||
|
||||
subscribeLdkEvents := func() chan ldk_node.Event {
|
||||
ldkEventHandler := make(chan ldk_node.Event)
|
||||
ldkEventHandlersMutex.Lock()
|
||||
ldkEventHandlers = append(ldkEventHandlers, ldkEventHandler)
|
||||
ldkEventHandlersMutex.Unlock()
|
||||
return ldkEventHandler
|
||||
}
|
||||
|
||||
unsubscribeLdkEvents := func(eventHandler chan ldk_node.Event) {
|
||||
ldkEventHandlersMutex.Lock()
|
||||
for i := 0; i < len(ldkEventHandlers); i++ {
|
||||
if eventHandler == ldkEventHandlers[i] {
|
||||
// Replace the element to be removed with the last element of the slice
|
||||
ldkEventHandlers[i] = ldkEventHandlers[len(ldkEventHandlers)-1]
|
||||
// Slice off the last element
|
||||
ldkEventHandlers = ldkEventHandlers[:len(ldkEventHandlers)-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
ldkEventHandlersMutex.Unlock()
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-ldkEventListenerCtx.Done():
|
||||
return
|
||||
default:
|
||||
event := node.WaitNextEvent()
|
||||
ldkEventHandlersMutex.Lock()
|
||||
svc.Logger.Infof("Received LDK event %+v (%d listeners)", event, len(ldkEventHandlers))
|
||||
for _, eventHandler := range ldkEventHandlers {
|
||||
eventHandler <- event
|
||||
}
|
||||
ldkEventHandlersMutex.Unlock()
|
||||
|
||||
node.EventHandled()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
gs := LDKService{
|
||||
workdir: newpath,
|
||||
node: node,
|
||||
//listener: &listener,
|
||||
svc: svc,
|
||||
cancelLdkEventListenerCtx: cancelLdkEventListenerCtx,
|
||||
subscribeLdkEvents: subscribeLdkEvents,
|
||||
unsubscribeLdkEvents: unsubscribeLdkEvents,
|
||||
}
|
||||
|
||||
nodeId := node.NodeId()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Printf("Connected to node ID: %v", nodeId)
|
||||
|
||||
return &gs, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) Shutdown() error {
|
||||
gs.svc.Logger.Infof("shutting down LDK client")
|
||||
gs.cancelLdkEventListenerCtx()
|
||||
gs.node.Destroy()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) SendPaymentSync(ctx context.Context, payReq string) (preimage string, err error) {
|
||||
paymentHash, err := gs.node.SendPayment(payReq)
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("SendPayment failed: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
eventListener := gs.subscribeLdkEvents()
|
||||
defer gs.unsubscribeLdkEvents(eventListener)
|
||||
for start := time.Now(); time.Since(start) < time.Second*60; {
|
||||
event := <-eventListener
|
||||
|
||||
eventPaymentSuccessful, isEventPaymentSuccessfulEvent := event.(ldk_node.EventPaymentSuccessful)
|
||||
eventPaymentFailed, isEventPaymentFailedEvent := event.(ldk_node.EventPaymentFailed)
|
||||
|
||||
if isEventPaymentSuccessfulEvent && eventPaymentSuccessful.PaymentHash == paymentHash {
|
||||
gs.svc.Logger.Infof("Got payment success event")
|
||||
payment := gs.node.Payment(paymentHash)
|
||||
if payment == nil {
|
||||
gs.svc.Logger.Errorf("Couldn't find payment by payment hash: %v", paymentHash)
|
||||
return "", errors.New("Payment not found")
|
||||
}
|
||||
|
||||
if payment.Secret == nil {
|
||||
gs.svc.Logger.Errorf("No payment secret for payment hash: %v", paymentHash)
|
||||
return "", errors.New("Payment secret not found")
|
||||
}
|
||||
preimage = *payment.Secret
|
||||
break
|
||||
}
|
||||
if isEventPaymentFailedEvent && eventPaymentFailed.PaymentHash == paymentHash {
|
||||
// TODO: is there a way to get a failure reason / error message?
|
||||
gs.svc.Logger.Errorf("Payment failed: %v", paymentHash)
|
||||
return "", errors.New("Payment failed")
|
||||
}
|
||||
}
|
||||
if preimage == "" {
|
||||
return "", errors.New("Payment timed out")
|
||||
}
|
||||
|
||||
return preimage, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) SendKeysend(ctx context.Context, amount int64, destination, preimage string, custom_records []lnclient.TLVRecord) (preImage string, err error) {
|
||||
|
||||
if len(custom_records) > 0 {
|
||||
log.Printf("FIXME: TLVs not supported")
|
||||
}
|
||||
|
||||
paymentHash, err := gs.node.SendSpontaneousPayment(uint64(amount), destination)
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("Keysend failed: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
payment := gs.node.Payment(paymentHash)
|
||||
if payment == nil {
|
||||
gs.svc.Logger.Errorf("Couldn't find payment by payment hash: %v", paymentHash)
|
||||
return "", errors.New("Payment not found")
|
||||
}
|
||||
|
||||
if payment.Preimage == nil {
|
||||
gs.svc.Logger.Errorf("No payment preimage found for payment hash: %v", paymentHash)
|
||||
return "", errors.New("no preimage in payment")
|
||||
}
|
||||
|
||||
return *payment.Preimage, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) GetBalance(ctx context.Context) (balance int64, err error) {
|
||||
channels := gs.node.ListChannels()
|
||||
|
||||
balance = 0
|
||||
for _, channel := range channels {
|
||||
balance += int64(channel.BalanceMsat)
|
||||
}
|
||||
|
||||
return balance, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) MakeInvoice(ctx context.Context, amount int64, description string, descriptionHash string, expiry int64) (transaction *Nip47Transaction, err error) {
|
||||
if expiry == 0 {
|
||||
expiry = 86400
|
||||
}
|
||||
invoice, err := gs.node.ReceivePayment(uint64(amount),
|
||||
description,
|
||||
uint32(expiry))
|
||||
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("MakeInvoice failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var expiresAt *int64
|
||||
paymentRequest, err := decodepay.Decodepay(invoice)
|
||||
if err != nil {
|
||||
gs.svc.Logger.WithFields(logrus.Fields{
|
||||
"bolt11": invoice,
|
||||
}).Errorf("Failed to decode bolt11 invoice: %v", err)
|
||||
|
||||
return nil, err
|
||||
}
|
||||
expiresAtUnix := time.UnixMilli(int64(paymentRequest.CreatedAt) * 1000).Add(time.Duration(paymentRequest.Expiry) * time.Second).Unix()
|
||||
expiresAt = &expiresAtUnix
|
||||
description = paymentRequest.Description
|
||||
descriptionHash = paymentRequest.DescriptionHash
|
||||
|
||||
transaction = &Nip47Transaction{
|
||||
Type: "incoming",
|
||||
Invoice: invoice,
|
||||
PaymentHash: paymentRequest.PaymentHash,
|
||||
Amount: amount,
|
||||
CreatedAt: time.Now().Unix(),
|
||||
ExpiresAt: expiresAt,
|
||||
Description: description,
|
||||
DescriptionHash: descriptionHash,
|
||||
}
|
||||
|
||||
return transaction, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) LookupInvoice(ctx context.Context, paymentHash string) (transaction *Nip47Transaction, err error) {
|
||||
|
||||
payment := gs.node.Payment(paymentHash)
|
||||
if payment == nil {
|
||||
gs.svc.Logger.Errorf("Couldn't find payment by payment hash: %v", paymentHash)
|
||||
return nil, errors.New("Payment not found")
|
||||
}
|
||||
|
||||
transaction = ldkPaymentToTransaction(payment)
|
||||
|
||||
return transaction, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) ListTransactions(ctx context.Context, from, until, limit, offset uint64, unpaid bool, invoiceType string) (transactions []Nip47Transaction, err error) {
|
||||
transactions = []Nip47Transaction{}
|
||||
|
||||
payments := gs.node.ListPayments()
|
||||
|
||||
for _, payment := range payments {
|
||||
if payment.Status == ldk_node.PaymentStatusSucceeded {
|
||||
transactions = append(transactions, *ldkPaymentToTransaction(&payment))
|
||||
}
|
||||
}
|
||||
|
||||
// sort by created date descending
|
||||
/*sort.SliceStable(transactions, func(i, j int) bool {
|
||||
return transactions[i].CreatedAt > transactions[j].CreatedAt
|
||||
})*/
|
||||
|
||||
return transactions, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) GetInfo(ctx context.Context) (info *lnclient.NodeInfo, err error) {
|
||||
return &lnclient.NodeInfo{
|
||||
// Alias: nodeInfo.Alias,
|
||||
// Color: nodeInfo.Color,
|
||||
Pubkey: gs.node.NodeId(),
|
||||
// Network: nodeInfo.Network,
|
||||
// BlockHeight: nodeInfo.BlockHeight,
|
||||
BlockHash: "",
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) ListChannels(ctx context.Context) ([]lnclient.Channel, error) {
|
||||
|
||||
ldkChannels := gs.node.ListChannels()
|
||||
channels := []lnclient.Channel{}
|
||||
|
||||
for _, ldkChannel := range ldkChannels {
|
||||
channels = append(channels, lnclient.Channel{
|
||||
LocalBalance: int64(ldkChannel.OutboundCapacityMsat),
|
||||
RemoteBalance: int64(ldkChannel.InboundCapacityMsat),
|
||||
RemotePubkey: ldkChannel.CounterpartyNodeId,
|
||||
Id: ldkChannel.ChannelId,
|
||||
Active: ldkChannel.IsChannelReady && ldkChannel.IsUsable, // TODO: confirm
|
||||
})
|
||||
}
|
||||
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) GetNodeConnectionInfo(ctx context.Context) (nodeConnectionInfo *lnclient.NodeConnectionInfo, err error) {
|
||||
/*addresses := gs.node.ListeningAddresses()
|
||||
if addresses == nil || len(*addresses) < 1 {
|
||||
return nil, errors.New("no available listening addresses")
|
||||
}
|
||||
firstAddress := (*addresses)[0]
|
||||
parts := strings.Split(firstAddress, ":")
|
||||
if len(parts) != 2 {
|
||||
return nil, errors.New(fmt.Sprintf("invalid address %v", firstAddress))
|
||||
}
|
||||
port, err := strconv.Atoi(parts[1])
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("ConnectPeer failed: %v", err)
|
||||
return nil, err
|
||||
}*/
|
||||
|
||||
return &lnclient.NodeConnectionInfo{
|
||||
Pubkey: gs.node.NodeId(),
|
||||
//Address: parts[0],
|
||||
//Port: port,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient.ConnectPeerRequest) error {
|
||||
err := gs.node.Connect(connectPeerRequest.Pubkey, connectPeerRequest.Address+":"+strconv.Itoa(connectPeerRequest.Port), true)
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("ConnectPeer failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error) {
|
||||
peers := gs.node.ListPeers()
|
||||
var foundPeer *ldk_node.PeerDetails
|
||||
for _, peer := range peers {
|
||||
if peer.NodeId == openChannelRequest.Pubkey {
|
||||
|
||||
foundPeer = &peer
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if foundPeer == nil {
|
||||
return nil, errors.New("node is not peered yet")
|
||||
}
|
||||
|
||||
gs.svc.Logger.Infof("Opening channel with: %v", foundPeer.NodeId)
|
||||
err := gs.node.ConnectOpenChannel(foundPeer.NodeId, foundPeer.Address, uint64(openChannelRequest.Amount), nil, nil, openChannelRequest.Public)
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("OpenChannel failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
eventListener := gs.subscribeLdkEvents()
|
||||
defer gs.unsubscribeLdkEvents(eventListener)
|
||||
for start := time.Now(); time.Since(start) < time.Second*60; {
|
||||
event := <-eventListener
|
||||
|
||||
channelPendingEvent, isChannelPendingEvent := event.(ldk_node.EventChannelPending)
|
||||
|
||||
if !isChannelPendingEvent {
|
||||
continue
|
||||
}
|
||||
|
||||
return &lnclient.OpenChannelResponse{
|
||||
FundingTxId: channelPendingEvent.FundingTxo.Txid,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return nil, errors.New("open channel timeout")
|
||||
}
|
||||
|
||||
func (gs *LDKService) GetNewOnchainAddress(ctx context.Context) (string, error) {
|
||||
address, err := gs.node.NewOnchainAddress()
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("NewOnchainAddress failed: %v", err)
|
||||
return "", err
|
||||
}
|
||||
return address, nil
|
||||
}
|
||||
|
||||
func (gs *LDKService) GetOnchainBalance(ctx context.Context) (int64, error) {
|
||||
balance, err := gs.node.SpendableOnchainBalanceSats()
|
||||
gs.svc.Logger.Infof("SpendableOnchainBalanceSats: %v", balance)
|
||||
if err != nil {
|
||||
gs.svc.Logger.Errorf("SpendableOnchainBalanceSats failed: %v", err)
|
||||
return 0, err
|
||||
}
|
||||
return int64(balance), nil
|
||||
}
|
||||
|
||||
func ldkPaymentToTransaction(payment *ldk_node.PaymentDetails) *Nip47Transaction {
|
||||
transactionType := "incoming"
|
||||
if payment.Direction == ldk_node.PaymentDirectionOutbound {
|
||||
transactionType = "outgoing"
|
||||
}
|
||||
|
||||
preimage := ""
|
||||
var settledAt *int64
|
||||
if payment.Status == ldk_node.PaymentStatusSucceeded {
|
||||
if payment.Preimage != nil {
|
||||
|
||||
preimage = *payment.Preimage
|
||||
} else if payment.Secret != nil {
|
||||
preimage = *payment.Secret
|
||||
}
|
||||
// TODO: use payment settle time
|
||||
now := time.Now().Unix()
|
||||
settledAt = &now
|
||||
}
|
||||
|
||||
var amount uint64 = 0
|
||||
if payment.AmountMsat != nil {
|
||||
amount = *payment.AmountMsat
|
||||
}
|
||||
|
||||
return &Nip47Transaction{
|
||||
Type: transactionType,
|
||||
// TODO: get bolt11 invoice from payment
|
||||
//Invoice: payment.,
|
||||
Preimage: preimage,
|
||||
PaymentHash: payment.Hash,
|
||||
SettledAt: settledAt,
|
||||
Amount: int64(amount),
|
||||
}
|
||||
}
|
||||
3
ldk_node/TODO.txt
Normal file
3
ldk_node/TODO.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Delete this folder and properly consume ldk-node go bindings
|
||||
|
||||
This will only work with Linux amd64!
|
||||
8
ldk_node/ldk_node.c
Normal file
8
ldk_node/ldk_node.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include <ldk_node.h>
|
||||
|
||||
// This file exists beacause of
|
||||
// https://github.com/golang/go/issues/11263
|
||||
|
||||
void cgo_rust_task_callback_bridge_ldk_node(RustTaskCallback cb, const void * taskData, int8_t status) {
|
||||
cb(taskData, status);
|
||||
}
|
||||
4421
ldk_node/ldk_node.go
Normal file
4421
ldk_node/ldk_node.go
Normal file
File diff suppressed because it is too large
Load diff
990
ldk_node/ldk_node.h
Normal file
990
ldk_node/ldk_node.h
Normal file
|
|
@ -0,0 +1,990 @@
|
|||
|
||||
|
||||
// This file was autogenerated by some hot garbage in the `uniffi` crate.
|
||||
// Trust me, you don't want to mess with it!
|
||||
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// The following structs are used to implement the lowest level
|
||||
// of the FFI, and thus useful to multiple uniffied crates.
|
||||
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
|
||||
#ifdef UNIFFI_SHARED_H
|
||||
// We also try to prevent mixing versions of shared uniffi header structs.
|
||||
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V6
|
||||
#ifndef UNIFFI_SHARED_HEADER_V6
|
||||
#error Combining helper code from multiple versions of uniffi is not supported
|
||||
#endif // ndef UNIFFI_SHARED_HEADER_V6
|
||||
#else
|
||||
#define UNIFFI_SHARED_H
|
||||
#define UNIFFI_SHARED_HEADER_V6
|
||||
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
|
||||
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️
|
||||
|
||||
typedef struct RustBuffer {
|
||||
int32_t capacity;
|
||||
int32_t len;
|
||||
uint8_t *data;
|
||||
} RustBuffer;
|
||||
|
||||
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, uint8_t *, int32_t, RustBuffer *);
|
||||
|
||||
// Task defined in Rust that Go executes
|
||||
typedef void (*RustTaskCallback)(const void *, int8_t);
|
||||
|
||||
// Callback to execute Rust tasks using a Go routine
|
||||
//
|
||||
// Args:
|
||||
// executor: ForeignExecutor lowered into a uint64_t value
|
||||
// delay: Delay in MS
|
||||
// task: RustTaskCallback to call
|
||||
// task_data: data to pass the task callback
|
||||
typedef int8_t (*ForeignExecutorCallback)(uint64_t, uint32_t, RustTaskCallback, void *);
|
||||
|
||||
typedef struct ForeignBytes {
|
||||
int32_t len;
|
||||
const uint8_t *data;
|
||||
} ForeignBytes;
|
||||
|
||||
// Error definitions
|
||||
typedef struct RustCallStatus {
|
||||
int8_t code;
|
||||
RustBuffer errorBuf;
|
||||
} RustCallStatus;
|
||||
|
||||
// Continuation callback for UniFFI Futures
|
||||
typedef void (*RustFutureContinuation)(void * , int8_t);
|
||||
|
||||
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
|
||||
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️
|
||||
#endif // def UNIFFI_SHARED_H
|
||||
|
||||
// Needed because we can't execute the callback directly from go.
|
||||
void cgo_rust_task_callback_bridge_ldk_node(RustTaskCallback, const void *, int8_t);
|
||||
|
||||
int8_t uniffiForeignExecutorCallbackldk_node(uint64_t, uint32_t, RustTaskCallback, void*);
|
||||
|
||||
void uniffiFutureContinuationCallbackldk_node(void*, int8_t);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_free_builder(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void* uniffi_ldk_node_bindings_fn_constructor_builder_from_config(
|
||||
RustBuffer config,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void* uniffi_ldk_node_bindings_fn_constructor_builder_new(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void* uniffi_ldk_node_bindings_fn_method_builder_build(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_entropy_bip39_mnemonic(
|
||||
void* ptr,
|
||||
RustBuffer mnemonic,
|
||||
RustBuffer passphrase,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_entropy_seed_bytes(
|
||||
void* ptr,
|
||||
RustBuffer seed_bytes,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_entropy_seed_path(
|
||||
void* ptr,
|
||||
RustBuffer seed_path,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_esplora_server(
|
||||
void* ptr,
|
||||
RustBuffer esplora_server_url,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_gossip_source_p2p(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_gossip_source_rgs(
|
||||
void* ptr,
|
||||
RustBuffer rgs_server_url,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_listening_addresses(
|
||||
void* ptr,
|
||||
RustBuffer listening_addresses,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_network(
|
||||
void* ptr,
|
||||
RustBuffer network,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_builder_set_storage_dir_path(
|
||||
void* ptr,
|
||||
RustBuffer storage_dir_path,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_free_channelconfig(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void* uniffi_ldk_node_bindings_fn_constructor_channelconfig_new(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
int8_t uniffi_ldk_node_bindings_fn_method_channelconfig_accept_underpaying_htlcs(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_fn_method_channelconfig_cltv_expiry_delta(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint64_t uniffi_ldk_node_bindings_fn_method_channelconfig_force_close_avoidance_max_fee_satoshis(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint32_t uniffi_ldk_node_bindings_fn_method_channelconfig_forwarding_fee_base_msat(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint32_t uniffi_ldk_node_bindings_fn_method_channelconfig_forwarding_fee_proportional_millionths(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_channelconfig_set_accept_underpaying_htlcs(
|
||||
void* ptr,
|
||||
int8_t value,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_channelconfig_set_cltv_expiry_delta(
|
||||
void* ptr,
|
||||
uint16_t value,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_channelconfig_set_force_close_avoidance_max_fee_satoshis(
|
||||
void* ptr,
|
||||
uint64_t value_sat,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_channelconfig_set_forwarding_fee_base_msat(
|
||||
void* ptr,
|
||||
uint32_t fee_msat,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_channelconfig_set_forwarding_fee_proportional_millionths(
|
||||
void* ptr,
|
||||
uint32_t value,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_channelconfig_set_max_dust_htlc_exposure_from_fee_rate_multiplier(
|
||||
void* ptr,
|
||||
uint64_t multiplier,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_channelconfig_set_max_dust_htlc_exposure_from_fixed_limit(
|
||||
void* ptr,
|
||||
uint64_t limit_msat,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_free_ldknode(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_close_channel(
|
||||
void* ptr,
|
||||
RustBuffer channel_id,
|
||||
RustBuffer counterparty_node_id,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_connect(
|
||||
void* ptr,
|
||||
RustBuffer node_id,
|
||||
RustBuffer address,
|
||||
int8_t persist,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_connect_open_channel(
|
||||
void* ptr,
|
||||
RustBuffer node_id,
|
||||
RustBuffer address,
|
||||
uint64_t channel_amount_sats,
|
||||
RustBuffer push_to_counterparty_msat,
|
||||
RustBuffer channel_config,
|
||||
int8_t announce_channel,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_disconnect(
|
||||
void* ptr,
|
||||
RustBuffer node_id,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_event_handled(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
int8_t uniffi_ldk_node_bindings_fn_method_ldknode_is_running(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_list_channels(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_list_payments(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_list_peers(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_listening_addresses(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_new_onchain_address(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_next_event(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_node_id(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_payment(
|
||||
void* ptr,
|
||||
RustBuffer payment_hash,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_receive_payment(
|
||||
void* ptr,
|
||||
uint64_t amount_msat,
|
||||
RustBuffer description,
|
||||
uint32_t expiry_secs,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_receive_variable_amount_payment(
|
||||
void* ptr,
|
||||
RustBuffer description,
|
||||
uint32_t expiry_secs,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_remove_payment(
|
||||
void* ptr,
|
||||
RustBuffer payment_hash,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_send_all_to_onchain_address(
|
||||
void* ptr,
|
||||
RustBuffer address,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_send_payment(
|
||||
void* ptr,
|
||||
RustBuffer invoice,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_send_payment_probes(
|
||||
void* ptr,
|
||||
RustBuffer invoice,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_send_payment_probes_using_amount(
|
||||
void* ptr,
|
||||
RustBuffer invoice,
|
||||
uint64_t amount_msat,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_send_payment_using_amount(
|
||||
void* ptr,
|
||||
RustBuffer invoice,
|
||||
uint64_t amount_msat,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_send_spontaneous_payment(
|
||||
void* ptr,
|
||||
uint64_t amount_msat,
|
||||
RustBuffer node_id,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_send_spontaneous_payment_probes(
|
||||
void* ptr,
|
||||
uint64_t amount_msat,
|
||||
RustBuffer node_id,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_send_to_onchain_address(
|
||||
void* ptr,
|
||||
RustBuffer address,
|
||||
uint64_t amount_msat,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_sign_message(
|
||||
void* ptr,
|
||||
RustBuffer msg,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint64_t uniffi_ldk_node_bindings_fn_method_ldknode_spendable_onchain_balance_sats(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_start(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_stop(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_sync_wallets(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint64_t uniffi_ldk_node_bindings_fn_method_ldknode_total_onchain_balance_sats(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void uniffi_ldk_node_bindings_fn_method_ldknode_update_channel_config(
|
||||
void* ptr,
|
||||
RustBuffer channel_id,
|
||||
RustBuffer counterparty_node_id,
|
||||
void* channel_config,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
int8_t uniffi_ldk_node_bindings_fn_method_ldknode_verify_signature(
|
||||
void* ptr,
|
||||
RustBuffer msg,
|
||||
RustBuffer sig,
|
||||
RustBuffer pkey,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_method_ldknode_wait_next_event(
|
||||
void* ptr,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_func_default_config(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer uniffi_ldk_node_bindings_fn_func_generate_entropy_mnemonic(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer ffi_ldk_node_bindings_rustbuffer_alloc(
|
||||
int32_t size,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer ffi_ldk_node_bindings_rustbuffer_from_bytes(
|
||||
ForeignBytes bytes,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rustbuffer_free(
|
||||
RustBuffer buf,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer ffi_ldk_node_bindings_rustbuffer_reserve(
|
||||
RustBuffer buf,
|
||||
int32_t additional,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_continuation_callback_set(
|
||||
RustFutureContinuation callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_u8(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_u8(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_u8(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint8_t ffi_ldk_node_bindings_rust_future_complete_u8(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_i8(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_i8(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_i8(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
int8_t ffi_ldk_node_bindings_rust_future_complete_i8(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_u16(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_u16(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_u16(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t ffi_ldk_node_bindings_rust_future_complete_u16(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_i16(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_i16(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_i16(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
int16_t ffi_ldk_node_bindings_rust_future_complete_i16(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_u32(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_u32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_u32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint32_t ffi_ldk_node_bindings_rust_future_complete_u32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_i32(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_i32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_i32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
int32_t ffi_ldk_node_bindings_rust_future_complete_i32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_u64(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_u64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_u64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint64_t ffi_ldk_node_bindings_rust_future_complete_u64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_i64(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_i64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_i64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
int64_t ffi_ldk_node_bindings_rust_future_complete_i64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_f32(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_f32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_f32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
float ffi_ldk_node_bindings_rust_future_complete_f32(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_f64(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_f64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_f64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
double ffi_ldk_node_bindings_rust_future_complete_f64(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_pointer(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_pointer(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_pointer(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void* ffi_ldk_node_bindings_rust_future_complete_pointer(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_rust_buffer(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_rust_buffer(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_rust_buffer(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
RustBuffer ffi_ldk_node_bindings_rust_future_complete_rust_buffer(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_poll_void(
|
||||
void* handle,
|
||||
void* uniffi_callback,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_cancel_void(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_free_void(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
void ffi_ldk_node_bindings_rust_future_complete_void(
|
||||
void* handle,
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_func_default_config(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_func_generate_entropy_mnemonic(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_build(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_entropy_bip39_mnemonic(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_entropy_seed_bytes(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_entropy_seed_path(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_esplora_server(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_gossip_source_p2p(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_gossip_source_rgs(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_listening_addresses(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_network(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_builder_set_storage_dir_path(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_accept_underpaying_htlcs(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_cltv_expiry_delta(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_force_close_avoidance_max_fee_satoshis(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_forwarding_fee_base_msat(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_forwarding_fee_proportional_millionths(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_set_accept_underpaying_htlcs(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_set_cltv_expiry_delta(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_set_force_close_avoidance_max_fee_satoshis(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_set_forwarding_fee_base_msat(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_set_forwarding_fee_proportional_millionths(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_set_max_dust_htlc_exposure_from_fee_rate_multiplier(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_channelconfig_set_max_dust_htlc_exposure_from_fixed_limit(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_close_channel(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_connect(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_connect_open_channel(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_disconnect(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_event_handled(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_is_running(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_list_channels(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_list_payments(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_list_peers(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_listening_addresses(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_new_onchain_address(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_next_event(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_node_id(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_payment(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_receive_payment(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_receive_variable_amount_payment(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_remove_payment(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_all_to_onchain_address(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_payment(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_payment_probes(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_payment_probes_using_amount(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_payment_using_amount(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_spontaneous_payment(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_spontaneous_payment_probes(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_send_to_onchain_address(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_sign_message(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_spendable_onchain_balance_sats(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_start(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_stop(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_sync_wallets(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_total_onchain_balance_sats(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_update_channel_config(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_verify_signature(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_method_ldknode_wait_next_event(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_constructor_builder_from_config(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_constructor_builder_new(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint16_t uniffi_ldk_node_bindings_checksum_constructor_channelconfig_new(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
uint32_t ffi_ldk_node_bindings_uniffi_contract_version(
|
||||
RustCallStatus* out_status
|
||||
);
|
||||
|
||||
|
||||
|
||||
BIN
ldk_node/libldk_node_bindings.so
Executable file
BIN
ldk_node/libldk_node_bindings.so
Executable file
Binary file not shown.
|
|
@ -28,7 +28,7 @@ const (
|
|||
NIP_47_ERROR_EXPIRED = "EXPIRED"
|
||||
NIP_47_ERROR_RESTRICTED = "RESTRICTED"
|
||||
NIP_47_OTHER = "OTHER"
|
||||
NIP_47_CAPABILITIES = "pay_invoice,pay_keysend,get_balance,get_info,make_invoice,lookup_invoice,list_transactions,multi_pay_invoice,multi_pay_keysend"
|
||||
NIP_47_CAPABILITIES = "pay_invoice pay_keysend get_balance get_info make_invoice lookup_invoice list_transactions multi_pay_invoice multi_pay_keysend"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ type ConnectPeerRequest struct {
|
|||
type OpenChannelRequest struct {
|
||||
Pubkey string `json:"pubkey"`
|
||||
Amount int64 `json:"amount"`
|
||||
Public bool `json:"public"`
|
||||
}
|
||||
|
||||
type OpenChannelResponse struct {
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ func (svc *Service) launchLNBackend(encryptionKey string) error {
|
|||
LNDCertHex, _ := svc.cfg.Get("LNDCertHex", encryptionKey)
|
||||
LNDMacaroonHex, _ := svc.cfg.Get("LNDMacaroonHex", encryptionKey)
|
||||
lnClient, err = NewLNDService(svc, LNDAddress, LNDCertHex, LNDMacaroonHex)
|
||||
case LDKBackendType:
|
||||
Mnemonic, _ := svc.cfg.Get("Mnemonic", encryptionKey)
|
||||
LDKWorkdir := path.Join(svc.cfg.Env.Workdir, "ldk")
|
||||
|
||||
lnClient, err = NewLDKService(svc, Mnemonic, LDKWorkdir)
|
||||
case GreenlightBackendType:
|
||||
Mnemonic, _ := svc.cfg.Get("Mnemonic", encryptionKey)
|
||||
GreenlightInviteCode, _ := svc.cfg.Get("GreenlightInviteCode", encryptionKey)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue