From 47b95a0ea046f640960d4ab43ebd4bebf4edce65 Mon Sep 17 00:00:00 2001
From: Tom Kirkpatrick <tkp@kirkdesigns.co.uk>
Date: Wed, 29 Aug 2018 23:22:02 +0200
Subject: [PATCH] fix(grpc): use Numbers to represent long values

Configure gRPC to use Numbers to represent long values instead of
Strings. This ensures that we can do accurate handling of numerical
values.

Fix #727
---
 app/lib/lnd/lightning.js      | 2 +-
 app/lib/lnd/walletUnlocker.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/lib/lnd/lightning.js b/app/lib/lnd/lightning.js
index 170a3816..7c24defd 100644
--- a/app/lib/lnd/lightning.js
+++ b/app/lib/lnd/lightning.js
@@ -71,7 +71,7 @@ class Lightning {
       // See https://github.com/grpc/grpc-node/blob/master/packages/grpc-protobufjs/README.md
       const options = {
         keepCase: true,
-        longs: String,
+        longs: Number,
         enums: String,
         defaults: true,
         oneofs: true
diff --git a/app/lib/lnd/walletUnlocker.js b/app/lib/lnd/walletUnlocker.js
index 537f3250..ae8b1979 100644
--- a/app/lib/lnd/walletUnlocker.js
+++ b/app/lib/lnd/walletUnlocker.js
@@ -21,7 +21,7 @@ export const walletUnlocker = lndConfig => {
   // See https://github.com/grpc/grpc-node/blob/master/packages/grpc-protobufjs/README.md
   const options = {
     keepCase: true,
-    longs: String,
+    longs: Number,
     enums: String,
     defaults: true,
     oneofs: true