Monday, January 30, 2023
HomeBitcoinlightning community - LND Relaxation API in Django

lightning community – LND Relaxation API in Django

On the lookout for some assist right here. I’m attempting to create a Django Relaxation API for funds utilizing an LND node. I’m following the documentation of the Lnd REST API (https://api.lightning.group/#v1-balance-blockchain), however as I’m fairly new in each, I’m combating how to connect with the node via the API. I’m guessing we have to override the queryset with a view to entry the regionally operating node. However I’m not with the ability to determine how.That is the data to entry my node and examine.py:

from rest_framework.response import Response
from rest_framework import standing
from rest_framework.response import Response
import os
import base64, codecs, json, requests


@api_view(["GET", "POST"])
def WalletBalance(self, r, *args, **kwargs):
    url = "https://localhost:8080/v1/stability/blockchain"
    cert_path = "~/Library/Utility Help/Lnd/tls.cert"
    macaroon = codecs.encode(
        open(
            "$HOME/Library/Utility Help/Lnd/knowledge/chain/bitcoin/testnet/admin.macaroon",
            "rb",
        ).learn(),
        "hex",
    )
    headers = {"Grpc-Metadata-macaroon": macaroon}
    r = requests.get(url, headers=headers, confirm=cert_path)
    return self.listing(r, *args, **kwargs)
    queryset = Class.objects.all()
    # serializer_class = ClassesSerializer

And that is the fashions.py:

from pydoc import describe
from unittest.util import _MAX_LENGTH
from django.db import fashions


class WalletBalance(fashions.Mannequin):
    total_balance = fashions.CharField(max_length=200)
    confirmed_balance = fashions.CharField(max_length=200)
    unconfirmed_balance = fashions.CharField(max_length=200)
    locked_balance = fashions.CharField(max_length=200)
    reserved_balance_anchor_chan = fashions.CharField(max_length=200)
    confirm_balance = fashions.CharField(max_length=200)
    uncomfirm_balance = fashions.CharField(max_length=200)

I’d admire in the event you may assist me.
Thanks quite a bit prematurely.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments