From e493f2284299506fafdd92f3d7b940a2b6f58f63 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Mon, 10 Jan 2022 10:47:16 -0800 Subject: [PATCH] add lnd grpc --- .gitignore | 2 ++ api/{lightning.py => lightning/node.py} | 5 +++-- api/logics.py | 2 +- api/views.py | 5 +++++ frontend/src/components/MakerPage.js | 1 - frontend/src/components/TradeBox.js | 19 ++++++++++++------- setup.md | 15 ++++++++++++--- 7 files changed, 35 insertions(+), 14 deletions(-) rename api/{lightning.py => lightning/node.py} (97%) diff --git a/.gitignore b/.gitignore index 2acb0130..bb835b12 100755 --- a/.gitignore +++ b/.gitignore @@ -641,3 +641,5 @@ frontend/static/frontend/main* # robosats frontend/static/assets/avatars* +api/lightning/lightning* +api/lightning/googleapis* diff --git a/api/lightning.py b/api/lightning/node.py similarity index 97% rename from api/lightning.py rename to api/lightning/node.py index 295a3085..324e250e 100644 --- a/api/lightning.py +++ b/api/lightning/node.py @@ -1,5 +1,6 @@ -# import codecs, grpc, os -# import lightning_pb2 as lnrpc, lightning_pb2_grpc as lightningstub +import codecs, grpc, os +from . import lightning_pb2 as ln +from . import lightning_pb2_grpc as lnrpc from datetime import timedelta from django.utils import timezone diff --git a/api/logics.py b/api/logics.py index 7cdc48d7..7b074a4e 100644 --- a/api/logics.py +++ b/api/logics.py @@ -1,6 +1,6 @@ from datetime import timedelta from django.utils import timezone -from .lightning import LNNode +from .lightning.node import LNNode from .models import Order, LNPayment, MarketTick, User from decouple import config diff --git a/api/views.py b/api/views.py index f92c5e7a..fcdf9865 100644 --- a/api/views.py +++ b/api/views.py @@ -22,6 +22,8 @@ from datetime import timedelta from django.utils import timezone from decouple import config +import ring + EXP_MAKER_BOND_INVOICE = int(config('EXP_MAKER_BOND_INVOICE')) FEE = float(config('FEE')) @@ -388,6 +390,9 @@ class BookView(ListAPIView): class InfoView(ListAPIView): + storage = {} + + @ring.dict(storage, expire=60) # keeps in cache for 60 seconds def get(self, request): context = {} diff --git a/frontend/src/components/MakerPage.js b/frontend/src/components/MakerPage.js index a89fd95f..2abc6e36 100644 --- a/frontend/src/components/MakerPage.js +++ b/frontend/src/components/MakerPage.js @@ -181,7 +181,6 @@ export default class MakerPage extends Component { onChange={this.handleAmountChange} />