Browse Source

Merge pull request #4 from LN-Zap/feature/lnd-ipcRenderer

Feature/lnd ipc renderer
renovate/lint-staged-8.x
jackmallers 8 years ago
committed by GitHub
parent
commit
31cc8de425
  1. 34
      app/api/index.js
  2. 9
      app/lnd/config/index.js
  3. 690
      app/lnd/config/rpc.proto
  4. 7
      app/lnd/index.js
  5. 14
      app/lnd/lib/lightning.js
  6. 10
      app/lnd/methods/channelbalance.js
  7. 10
      app/lnd/methods/channels.js
  8. 10
      app/lnd/methods/connectpeer.js
  9. 10
      app/lnd/methods/createinvoice.js
  10. 10
      app/lnd/methods/disconnectpeer.js
  11. 115
      app/lnd/methods/index.js
  12. 10
      app/lnd/methods/info.js
  13. 12
      app/lnd/methods/invoice.js
  14. 10
      app/lnd/methods/invoices.js
  15. 19
      app/lnd/methods/openchannel.js
  16. 10
      app/lnd/methods/payinvoice.js
  17. 10
      app/lnd/methods/payments.js
  18. 10
      app/lnd/methods/peers.js
  19. 10
      app/lnd/methods/pendingchannels.js
  20. 10
      app/lnd/methods/walletbalance.js
  21. 16
      app/lnd/push/channel.js
  22. 38
      app/lnd/utils/index.js
  23. 8
      app/main.dev.js
  24. 54
      app/reducers/activity.js
  25. 19
      app/reducers/balance.js
  26. 53
      app/reducers/channels.js
  27. 4
      app/reducers/index.js
  28. 16
      app/reducers/info.js
  29. 69
      app/reducers/invoice.js
  30. 36
      app/reducers/ipc.js
  31. 41
      app/reducers/payment.js
  32. 68
      app/reducers/peers.js
  33. 2
      app/reducers/ticker.js
  34. 10
      app/routes/app/components/App.js
  35. 8
      app/routes/app/components/components/Form/Form.js
  36. 20
      app/routes/app/components/components/Socket.js
  37. 5
      app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js
  38. 5
      app/routes/wallet/components/components/Peers/components/PeerForm/PeerForm.js
  39. 7
      app/routes/wallet/components/components/Peers/components/PeerModal/PeerModal.js
  40. 15
      app/store/configureStore.dev.js
  41. 7
      package.json
  42. 55
      test/api/index.spec.js
  43. 175
      yarn.lock

34
app/api/index.js

@ -1,38 +1,6 @@
import axios from 'axios' import axios from 'axios'
export function callApi(endpoint, method = 'get', data = null) { export default function requestTicker() {
const BASE_URL = 'http://localhost:3000/api/'
let payload
if (data) {
payload = {
headers: {
'Content-Type': 'application/json'
},
method,
data,
url: `${BASE_URL}${endpoint}`
}
} else {
payload = {
headers: {
'Content-Type': 'application/json'
},
method,
url: `${BASE_URL}${endpoint}`
}
}
return axios(payload)
.then(response => response.data)
.catch(error => error)
}
export function callApis(endpoints) {
return axios.all(endpoints.map(endpoint => callApi(endpoint)))
}
export function requestTicker() {
const BASE_URL = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/' const BASE_URL = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/'
return axios({ return axios({
method: 'get', method: 'get',

9
app/lnd/config/index.js

@ -0,0 +1,9 @@
// Cert will be located depending on your machine
// Mac OS X: /Users/user/Library/Application Support/Lnd/tls.cert
// Linux: ~/.lnd/tls.cert
// Windows: TODO find out where cert is located for windows machine
export default {
lightningRpc: `${__dirname}/rpc.proto`,
lightningHost: 'localhost:10009',
cert: '/Users/jmow/Library/Application Support/Lnd/tls.cert'
}

690
app/lnd/config/rpc.proto

@ -0,0 +1,690 @@
syntax = "proto3";
//import "google/api/annotations.proto";
package lnrpc;
service Lightning {
rpc WalletBalance (WalletBalanceRequest) returns (WalletBalanceResponse) {
option (google.api.http) = {
get: "/v1/balance/blockchain"
};
}
rpc ChannelBalance (ChannelBalanceRequest) returns (ChannelBalanceResponse) {
option (google.api.http) = {
get: "/v1/balance/channels"
};
}
rpc GetTransactions (GetTransactionsRequest) returns (TransactionDetails) {
option (google.api.http) = {
get: "/v1/transactions"
};
}
rpc SendCoins (SendCoinsRequest) returns (SendCoinsResponse) {
option (google.api.http) = {
post: "/v1/transactions"
body: "*"
};
}
rpc SubscribeTransactions (GetTransactionsRequest) returns (stream Transaction);
rpc SendMany (SendManyRequest) returns (SendManyResponse);
rpc NewAddress (NewAddressRequest) returns (NewAddressResponse);
rpc NewWitnessAddress (NewWitnessAddressRequest) returns (NewAddressResponse) {
option (google.api.http) = {
get: "/v1/newaddress"
};
}
rpc SignMessage (SignMessageRequest) returns (SignMessageResponse);
rpc VerifyMessage (VerifyMessageRequest) returns (VerifyMessageResponse);
rpc ConnectPeer (ConnectPeerRequest) returns (ConnectPeerResponse) {
option (google.api.http) = {
post: "/v1/peers"
body: "*"
};
}
rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse) {
option (google.api.http) = {
delete: "/v1/peers/{pub_key}"
};
}
rpc ListPeers (ListPeersRequest) returns (ListPeersResponse) {
option (google.api.http) = {
get: "/v1/peers"
};
}
rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) {
option (google.api.http) = {
get: "/v1/getinfo"
};
}
// TODO(roasbeef): merge with below with bool?
rpc PendingChannels (PendingChannelRequest) returns (PendingChannelResponse) {
option (google.api.http) = {
get: "/v1/channels/pending"
};
}
rpc ListChannels (ListChannelsRequest) returns (ListChannelsResponse) {
option (google.api.http) = {
get: "/v1/channels"
};
}
rpc OpenChannelSync (OpenChannelRequest) returns (ChannelPoint) {
option (google.api.http) = {
post: "/v1/channels"
body: "*"
};
}
rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate);
rpc CloseChannel (CloseChannelRequest) returns (stream CloseStatusUpdate) {
option (google.api.http) = {
delete: "/v1/channels/{channel_point.funding_txid}/{channel_point.output_index}/{force}"
};
}
rpc SendPayment (stream SendRequest) returns (stream SendResponse);
rpc SendPaymentSync (SendRequest) returns (SendResponse) {
option (google.api.http) = {
post: "/v1/channels/transactions"
body: "*"
};
}
rpc AddInvoice (Invoice) returns (AddInvoiceResponse) {
option (google.api.http) = {
post: "/v1/invoices"
body: "*"
};
}
rpc ListInvoices (ListInvoiceRequest) returns (ListInvoiceResponse) {
option (google.api.http) = {
get: "/v1/invoices/{pending_only}"
};
}
rpc LookupInvoice (PaymentHash) returns (Invoice) {
option (google.api.http) = {
get: "/v1/invoices/{r_hash_str}"
};
}
rpc SubscribeInvoices (InvoiceSubscription) returns (stream Invoice) {
option (google.api.http) = {
get: "/v1/invoices/subscribe"
};
}
rpc DecodePayReq (PayReqString) returns (PayReq) {
option (google.api.http) = {
get: "/v1/payreq/{pay_req}"
};
}
rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse) {
option (google.api.http) = {
get: "/v1/payments"
};
};
rpc DeleteAllPayments (DeleteAllPaymentsRequest) returns (DeleteAllPaymentsResponse) {
option (google.api.http) = {
delete: "/v1/payments"
};
};
rpc DescribeGraph (ChannelGraphRequest) returns (ChannelGraph) {
option (google.api.http) = {
get: "/v1/graph"
};
}
rpc GetChanInfo (ChanInfoRequest) returns (ChannelEdge) {
option (google.api.http) = {
get: "/v1/graph/edge/{chan_id}"
};
}
rpc GetNodeInfo (NodeInfoRequest) returns (NodeInfo) {
option (google.api.http) = {
get: "/v1/graph/node/{pub_key}"
};
}
rpc QueryRoutes(QueryRoutesRequest) returns (QueryRoutesResponse) {
option (google.api.http) = {
get: "/v1/graph/routes/{pub_key}/{amt}"
};
}
rpc GetNetworkInfo (NetworkInfoRequest) returns (NetworkInfo) {
option (google.api.http) = {
get: "/v1/graph/info"
};
}
rpc StopDaemon(StopRequest) returns (StopResponse);
rpc SubscribeChannelGraph(GraphTopologySubscription) returns (stream GraphTopologyUpdate);
rpc SetAlias(SetAliasRequest) returns (SetAliasResponse);
rpc DebugLevel (DebugLevelRequest) returns (DebugLevelResponse);
}
message Transaction {
string tx_hash = 1 [ json_name = "tx_hash" ];
int64 amount = 2 [ json_name = "amount" ];
int32 num_confirmations = 3 [ json_name = "num_confirmations" ];
string block_hash = 4 [ json_name = "block_hash" ];
int32 block_height = 5 [ json_name = "block_height" ];
int64 time_stamp = 6 [ json_name = "time_stamp" ];
int64 total_fees = 7 [ json_name = "total_fees" ];
}
message GetTransactionsRequest {
}
message TransactionDetails {
repeated Transaction transactions = 1 [json_name = "transactions"];
}
message SendRequest {
bytes dest = 1;
string dest_string = 2;
int64 amt = 3;
bytes payment_hash = 4;
string payment_hash_string = 5;
string payment_request = 6;
}
message SendResponse {
string payment_error = 1 [json_name = "payment_error"];
bytes payment_preimage = 2 [json_name = "payment_preimage"];
Route payment_route = 3 [json_name = "payment_route"];
}
message ChannelPoint {
// TODO(roasbeef): make str vs bytes into a oneof
bytes funding_txid = 1 [ json_name = "funding_txid" ];
string funding_txid_str = 2 [ json_name = "funding_txid_str" ];
uint32 output_index = 3 [ json_name = "output_index" ];
}
message LightningAddress {
string pubkey = 1 [json_name = "pubkey"];
string host = 2 [json_name = "host"];
}
message SendManyRequest {
map<string, int64> AddrToAmount = 1;
}
message SendManyResponse {
string txid = 1 [json_name = "txid"];
}
message SendCoinsRequest {
string addr = 1;
int64 amount = 2;
}
message SendCoinsResponse {
string txid = 1 [json_name = "txid"];
}
message NewAddressRequest {
enum AddressType {
WITNESS_PUBKEY_HASH = 0;
NESTED_PUBKEY_HASH = 1;
PUBKEY_HASH = 2;
}
AddressType type = 1;
}
message NewWitnessAddressRequest {
}
message NewAddressResponse {
string address = 1 [json_name = "address"];
}
message SignMessageRequest {
bytes msg = 1 [ json_name = "msg" ];
}
message SignMessageResponse {
string signature = 1 [ json_name = "signature" ];
}
message VerifyMessageRequest {
bytes msg = 1 [ json_name = "msg" ];
string signature = 2 [ json_name = "signature" ];
}
message VerifyMessageResponse {
bool valid = 1 [ json_name = "valid" ];
string pubkey = 2 [ json_name = "pubkey" ];
}
message ConnectPeerRequest {
LightningAddress addr = 1;
bool perm = 2;
}
message ConnectPeerResponse {
int32 peer_id = 1 [json_name = "peer_id"];
}
message DisconnectPeerRequest {
string pub_key = 1 [json_name = "pub_key"];
}
message DisconnectPeerResponse {
}
message HTLC {
bool incoming = 1 [json_name = "incoming"];
int64 amount = 2 [json_name = "amount"];
bytes hash_lock = 3 [json_name = "hash_lock"];
uint32 expiration_height = 4 [json_name = "expiration_height"];
uint32 revocation_delay = 5 [json_name = "revocation_delay"];
}
message ActiveChannel {
bool active = 1 [json_name = "active"];
string remote_pubkey = 2 [json_name = "remote_pubkey"];
string channel_point = 3 [json_name = "channel_point"];
uint64 chan_id = 4 [json_name = "chan_id"];
int64 capacity = 5 [json_name = "capacity"];
int64 local_balance = 6 [json_name = "local_balance"];
int64 remote_balance = 7 [json_name = "remote_balance"];
int64 commit_fee = 8 [json_name = "commit_fee"];
int64 commit_weight = 9 [ json_name = "commit_weight" ];
int64 fee_per_kw = 10 [json_name = "fee_per_kw"];
int64 unsettled_balance = 11 [json_name = "unsettled_balance"];
int64 total_satoshis_sent = 12 [json_name = "total_satoshis_sent"];
int64 total_satoshis_received = 13 [json_name = "total_satoshis_received"];
uint64 num_updates = 14 [json_name = "num_updates"];
repeated HTLC pending_htlcs = 15 [json_name = "pending_htlcs"];
}
message ListChannelsRequest {
}
message ListChannelsResponse {
repeated ActiveChannel channels = 11 [json_name = "channels"];
}
message Peer {
string pub_key = 1 [json_name = "pub_key"];
int32 peer_id = 2 [json_name = "peer_id"];
string address = 3 [json_name = "address"];
uint64 bytes_sent = 4 [json_name = "bytes_sent"];
uint64 bytes_recv = 5 [json_name = "bytes_recv"];
int64 sat_sent = 6 [json_name = "sat_sent"];
int64 sat_recv = 7 [json_name = "sat_recv"];
bool inbound = 8 [json_name = "inbound"];
int64 ping_time = 9 [json_name = "ping_time"];
}
message ListPeersRequest {
}
message ListPeersResponse {
repeated Peer peers = 1 [json_name = "peers"];
}
message GetInfoRequest {
}
message GetInfoResponse {
string identity_pubkey = 1 [json_name = "identity_pubkey"];
string alias = 2 [json_name = "alias"];
uint32 num_pending_channels = 3 [json_name = "num_pending_channels"];
uint32 num_active_channels = 4 [json_name = "num_active_channels"];
uint32 num_peers = 5 [json_name = "num_peers"];
uint32 block_height = 6 [json_name = "block_height"];
string block_hash = 8 [json_name = "block_hash"];
bool synced_to_chain = 9 [ json_name = "synced_to_chain" ];
bool testnet = 10 [ json_name = "testnet" ];
repeated string chains = 11 [ json_name = "chains" ];
}
message ConfirmationUpdate {
bytes block_sha = 1;
int32 block_height = 2;
uint32 num_confs_left = 3;
}
message ChannelOpenUpdate {
ChannelPoint channel_point = 1 [json_name = "channel_point"];
}
message ChannelCloseUpdate {
bytes closing_txid = 1 [json_name = "closing_txid"];
bool success = 2 [json_name = "success"];
}
message CloseChannelRequest {
ChannelPoint channel_point = 1;
int64 time_limit = 2;
bool force = 3;
}
message CloseStatusUpdate {
oneof update {
PendingUpdate close_pending = 1 [json_name = "close_pending"];
ConfirmationUpdate confirmation = 2 [json_name = "confirmation"];
ChannelCloseUpdate chan_close = 3 [json_name = "chan_close"];
}
}
message PendingUpdate {
bytes txid = 1 [json_name = "txid"];
uint32 output_index = 2 [json_name = "output_index"];
}
message OpenChannelRequest {
int32 target_peer_id = 1 [json_name = "target_peer_id"];
bytes node_pubkey = 2 [json_name = "node_pubkey"];
string node_pubkey_string = 3 [json_name = "node_pubkey_string"];
int64 local_funding_amount = 4 [json_name = "local_funding_amount"];
int64 push_sat = 5 [json_name = "push_sat"];
uint32 num_confs = 6 [json_name = "num_confs"];
}
message OpenStatusUpdate {
oneof update {
PendingUpdate chan_pending = 1 [json_name = "chan_pending"];
ConfirmationUpdate confirmation = 2 [json_name = "confirmation"];
ChannelOpenUpdate chan_open = 3 [json_name = "chan_open"];
}
}
message PendingChannelRequest {}
message PendingChannelResponse {
message PendingChannel {
string remote_node_pub = 1 [ json_name = "remote_node_pub" ];
string channel_point = 2 [ json_name = "channel_point" ];
int64 capacity = 3 [ json_name = "capacity" ];
int64 local_balance = 4 [ json_name = "local_balance" ];
int64 remote_balance = 5 [ json_name = "remote_balance" ];
}
message PendingOpenChannel {
PendingChannel channel = 1 [ json_name = "channel" ];
uint32 confirmation_height = 2 [ json_name = "confirmation_height" ];
uint32 blocks_till_open = 3 [ json_name = "blocks_till_open" ];
int64 commit_fee = 4 [json_name = "commit_fee" ];
int64 commit_weight = 5 [ json_name = "commit_weight" ];
int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ];
}
message ClosedChannel {
PendingChannel channel = 1;
string closing_txid = 2 [ json_name = "closing_txid" ];
}
message ForceClosedChannel {
PendingChannel channel = 1 [ json_name = "channel" ];
// TODO(roasbeef): HTLC's as well?
string closing_txid = 2 [ json_name = "closing_txid" ];
int64 limbo_balance = 3 [ json_name = "limbo_balance" ];
uint32 maturity_height = 4 [ json_name = "maturity_height" ];
uint32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
}
int64 total_limbo_balance = 1 [ json_name = "total_limbo_balance" ];
repeated PendingOpenChannel pending_open_channels = 2 [ json_name = "pending_open_channels" ];
repeated ClosedChannel pending_closing_channels = 3 [ json_name = "pending_closing_channels" ];
repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ];
}
message WalletBalanceRequest {
bool witness_only = 1;
}
message WalletBalanceResponse {
int64 balance = 1 [json_name = "balance"];
}
message ChannelBalanceRequest {
}
message ChannelBalanceResponse {
int64 balance = 1 [json_name = "balance"];
}
message QueryRoutesRequest {
string pub_key = 1;
int64 amt = 2;
}
message QueryRoutesResponse {
repeated Route routes = 1 [ json_name = "routes"];
}
message Hop {
uint64 chan_id = 1 [json_name = "chan_id"];
int64 chan_capacity = 2 [json_name = "chan_capacity"];
int64 amt_to_forward = 3 [json_name = "amt_to_forward"];
int64 fee = 4 [json_name = "fee"];
}
message Route {
uint32 total_time_lock = 1 [json_name = "total_time_lock"];
int64 total_fees = 2 [json_name = "total_fees"];
int64 total_amt = 3 [json_name = "total_amt"];
repeated Hop hops = 4 [json_name = "hops"];
}
message NodeInfoRequest {
string pub_key = 1;
}
message NodeInfo {
LightningNode node = 1 [json_name = "node"];
uint32 num_channels = 2 [json_name = "num_channels"];
int64 total_capacity = 3 [json_name = "total_capacity"];
}
message LightningNode {
uint32 last_update = 1 [ json_name = "last_update" ];
string pub_key = 2 [ json_name = "pub_key" ];
string alias = 3 [ json_name = "alias" ];
repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
}
message NodeAddress {
string network = 1 [ json_name = "network" ];
string addr = 2 [ json_name = "addr" ];
}
message RoutingPolicy {
uint32 time_lock_delta = 1 [json_name = "time_lock_delta"];
int64 min_htlc = 2 [json_name = "min_htlc"];
int64 fee_base_msat = 3 [json_name = "fee_base_msat"];
int64 fee_rate_milli_msat = 4 [json_name = "fee_rate_milli_msat"];
}
message ChannelEdge {
uint64 channel_id = 1 [json_name = "channel_id"];
string chan_point = 2 [json_name = "chan_point"];
uint32 last_update = 3 [json_name = "last_update"];
string node1_pub = 4 [json_name = "node1_pub"];
string node2_pub = 5 [json_name = "node2_pub"];
int64 capacity = 6 [json_name = "capacity"];
RoutingPolicy node1_policy = 7 [json_name = "node1_policy"];
RoutingPolicy node2_policy = 8 [json_name = "node2_policy"];
}
message ChannelGraphRequest {
}
message ChannelGraph {
repeated LightningNode nodes = 1 [json_name = "nodes"];
repeated ChannelEdge edges = 2 [json_name = "edges"];
}
message ChanInfoRequest {
uint64 chan_id = 1;
}
message NetworkInfoRequest {
}
message NetworkInfo {
uint32 graph_diameter = 1 [json_name = "graph_diameter"];
double avg_out_degree = 2 [json_name = "avg_out_degree"];
uint32 max_out_degree = 3 [json_name = "max_out_degree"];
uint32 num_nodes = 4 [json_name = "num_nodes"];
uint32 num_channels = 5 [json_name = "num_channels"];
int64 total_network_capacity = 6 [json_name = "total_network_capacity"];
double avg_channel_size = 7 [json_name = "avg_channel_size"];
int64 min_channel_size = 8 [json_name = "min_channel_size"];
int64 max_channel_size = 9 [json_name = "max_channel_size"];
// TODO(roasbeef): fee rate info, expiry
// * also additional RPC for tracking fee info once in
}
message StopRequest{}
message StopResponse{}
message GraphTopologySubscription {}
message GraphTopologyUpdate {
repeated NodeUpdate node_updates = 1;
repeated ChannelEdgeUpdate channel_updates = 2;
repeated ClosedChannelUpdate closed_chans = 3;
}
message NodeUpdate {
repeated string addresses = 1;
string identity_key = 2;
bytes global_features = 3;
string alias = 4;
}
message ChannelEdgeUpdate {
uint64 chan_id = 1;
ChannelPoint chan_point = 2;
int64 capacity = 3;
RoutingPolicy routing_policy = 4;
string advertising_node = 5;
string connecting_node = 6;
}
message ClosedChannelUpdate {
uint64 chan_id = 1;
int64 capacity = 2;
uint32 closed_height = 3;
ChannelPoint chan_point = 4;
}
message SetAliasRequest {
string new_alias = 1;
}
message SetAliasResponse {
}
message Invoice {
string memo = 1 [json_name = "memo"];
bytes receipt = 2 [json_name = "receipt"];
bytes r_preimage = 3 [json_name = "r_preimage"];
bytes r_hash = 4 [json_name = "r_hash"];
int64 value = 5 [json_name = "value"];
bool settled = 6 [json_name = "settled"];
int64 creation_date = 7 [json_name = "creation_date"];
int64 settle_date = 8 [json_name = "settle_date"];
string payment_request = 9 [json_name = "payment_request"];
}
message AddInvoiceResponse {
bytes r_hash = 1 [json_name = "r_hash"];
string payment_request = 2 [json_name = "payment_request"];
}
message PaymentHash {
string r_hash_str = 1 [json_name = "r_hash_str"];
bytes r_hash = 2 [json_name = "r_hash"];
}
message ListInvoiceRequest {
bool pending_only = 1;
}
message ListInvoiceResponse {
repeated Invoice invoices = 1 [json_name = "invoices"];
}
message InvoiceSubscription {
}
message Payment {
string payment_hash = 1 [json_name = "payment_hash"];
int64 value = 2 [json_name = "value"];
int64 creation_date = 3 [json_name = "creation_date"];
repeated string path = 4 [ json_name = "path" ];
int64 fee = 5 [json_name = "fee"];
}
message ListPaymentsRequest {
}
message ListPaymentsResponse {
repeated Payment payments = 1 [json_name = "payments"];
}
message DeleteAllPaymentsRequest {
}
message DeleteAllPaymentsResponse {
}
message DebugLevelRequest {
bool show = 1;
string level_spec = 2;
}
message DebugLevelResponse {
string sub_systems = 1 [json_name = "sub_systems"];
}
message PayReqString {
string pay_req = 1;
}
message PayReq {
string destination = 1 [json_name = "destination"];
string payment_hash = 2 [json_name = "payment_hash"];
int64 num_satoshis = 3 [json_name = "num_satoshis"];
}

7
app/lnd/index.js

@ -0,0 +1,7 @@
import config from './config'
import lightning from './lib/lightning'
import methods from './methods'
const lnd = lightning(config.lightningRpc, config.lightningHost)
export default (event, msg, data) => methods(lnd, event, msg, data)

14
app/lnd/lib/lightning.js

@ -0,0 +1,14 @@
import fs from 'fs'
import grpc from 'grpc'
import config from '../config'
module.exports = (path, host) => {
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA'
const rpc = grpc.load(path)
const lndCert = fs.readFileSync(config.cert)
const credentials = grpc.credentials.createSsl(lndCert)
return new rpc.lnrpc.Lightning(host, credentials)
}

10
app/lnd/methods/channelbalance.js

@ -0,0 +1,10 @@
// LND Get Channel Balance
export default function channelbalance(lnd) {
return new Promise((resolve, reject) => {
lnd.channelBalance({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/channels.js

@ -0,0 +1,10 @@
// LND List Channels
export default function channels(lnd) {
return new Promise((resolve, reject) => {
lnd.listChannels({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/connectpeer.js

@ -0,0 +1,10 @@
// LND Connect to a peer
export default function connectpeer(lnd, { pubkey, host }) {
return new Promise((resolve, reject) => {
lnd.connectPeer({ addr: { pubkey, host }, perm: true }, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/createinvoice.js

@ -0,0 +1,10 @@
// LND Create an invoice
export default function createInvoice(lnd, { memo, value }) {
return new Promise((resolve, reject) => {
lnd.addInvoice({ memo, value }, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/disconnectpeer.js

@ -0,0 +1,10 @@
// LND Disconnect from a peer
export default function disconnectpeer(lnd, { pubkey }) {
return new Promise((resolve, reject) => {
lnd.disconnectPeer({ pub_key: pubkey }, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

115
app/lnd/methods/index.js

@ -0,0 +1,115 @@
/* eslint no-console: 0 */ // --> OFF
import channelbalance from './channelbalance'
import channels from './channels'
import connectpeer from './connectpeer'
import createinvoice from './createinvoice'
import disconnectpeer from './disconnectpeer'
import info from './info'
import invoice from './invoice'
import invoices from './invoices'
import openchannel from './openchannel'
import payinvoice from './payinvoice'
import payments from './payments'
import peers from './peers'
import pendingchannels from './pendingchannels'
import walletbalance from './walletbalance'
export default function (lnd, event, msg, data) {
switch (msg) {
case 'info':
info(lnd)
.then(infoData => event.sender.send('receiveInfo', infoData))
.catch(error => console.log('info error: ', error))
break
case 'peers':
// Data looks like { peers: [] }
peers(lnd)
.then(peersData => event.sender.send('receivePeers', peersData))
.catch(error => console.log('peers error: ', error))
break
case 'channels':
// Data looks like
// [ { channels: [] }, { total_limbo_balance: 0, pending_open_channels: [], pending_closing_channels: [], pending_force_closing_channels: [] } ]
Promise.all([channels, pendingchannels].map(func => func(lnd)))
.then(channelsData =>
event.sender.send('receiveChannels', { channels: channelsData[0].channels, pendingChannels: channelsData[1] })
)
.catch(error => console.log('channels error: ', error))
break
case 'payments':
// Data looks like { payments: [] }
payments(lnd)
.then(paymentsData => event.sender.send('receivePayments', paymentsData))
.catch(error => console.log('payments error: ', error))
break
case 'invoices':
// Data looks like { invoices: [] }
invoices(lnd)
.then(invoicesData => event.sender.send('receiveInvoices', invoicesData))
.catch(error => console.log('invoices error: ', error))
break
case 'invoice':
// Data looks like { invoices: [] }
invoice(data.payreq)
.then(invoiceData => event.sender.send('receiveInvoice', invoiceData))
.catch(error => console.log('invoice error: ', error))
break
case 'balance':
// Balance looks like [ { balance: '129477456' }, { balance: '243914' } ]
Promise.all([walletbalance, channelbalance].map(func => func(lnd)))
.then(balance => event.sender.send('receiveBalance', { walletBalance: balance[0].balance, channelBalance: balance[1].balance }))
.catch(error => console.log('balance error: ', error))
break
case 'createInvoice':
// Invoice looks like { r_hash: Buffer, payment_request: '' }
// { memo, value } = data
createinvoice(lnd, data)
.then(newinvoice =>
event.sender.send(
'createdInvoice',
Object.assign(newinvoice, { memo: data.memo, value: data.value, r_hash: new Buffer(newinvoice.r_hash, 'hex').toString('hex') })
)
)
.catch(error => console.log('createInvoice error: ', error))
break
case 'sendPayment':
// Payment looks like { payment_preimage: Buffer, payment_route: Object }
// { paymentRequest } = data
payinvoice(lnd, data)
.then(({ payment_route }) => event.sender.send('paymentSuccessful', Object.assign(data, { payment_route })))
.catch(error => console.log('payinvoice error: ', error))
break
case 'openChannel':
// Response is empty. Streaming updates on channel status and updates
// { pubkey, localamt, pushamt } = data
openchannel(lnd, event, data)
.then((channel) => {
console.log('CHANNEL: ', channel)
event.sender.send('channelSuccessful', { channel })
})
.catch(error => console.log('openChannel error: ', error))
break
case 'connectPeer':
// Returns a peer_id. Pass the pubkey, host and peer_id so we can add a new peer to the list
// { pubkey, host } = data
connectpeer(lnd, data)
.then(({ peer_id }) => {
console.log('peer_id: ', peer_id)
event.sender.send('connectSuccess', { pub_key: data.pubkey, address: data.host, peer_id })
})
.catch(error => console.log('connectPeer error: ', error))
break
case 'disconnectPeer':
// Empty response. Pass back pubkey on success to remove it from the peers list
// { pubkey } = data
disconnectpeer(lnd, data)
.then(() => {
console.log('pubkey: ', data.pubkey)
event.sender.send('disconnectSuccess', { pubkey: data.pubkey })
})
.catch(error => console.log('disconnectPeer error: ', error))
break
default:
}
}

10
app/lnd/methods/info.js

@ -0,0 +1,10 @@
// LND Get Info
export default function info(lnd) {
return new Promise((resolve, reject) => {
lnd.getInfo({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

12
app/lnd/methods/invoice.js

@ -0,0 +1,12 @@
import { decodeInvoice } from '../utils'
// LND Get Invoice
export default function invoice(payreq) {
return new Promise((resolve, reject) => {
try {
resolve(decodeInvoice(payreq))
} catch (error) {
reject(error)
}
})
}

10
app/lnd/methods/invoices.js

@ -0,0 +1,10 @@
// LND Get Invoices
export default function invoices(lnd) {
return new Promise((resolve, reject) => {
lnd.listInvoices({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

19
app/lnd/methods/openchannel.js

@ -0,0 +1,19 @@
import bitcore from 'bitcore-lib'
import pushchannel from '../push/channel'
const BufferUtil = bitcore.util.buffer
export default function openchannel(lnd, event, payload) {
const { pubkey, localamt, pushamt } = payload
const res = {
node_pubkey: BufferUtil.hexToBuffer(pubkey),
local_funding_amount: Number(localamt),
push_sat: Number(pushamt)
}
return new Promise((resolve, reject) =>
pushchannel(lnd, event, res)
.then(data => resolve(data))
.catch(error => reject(error))
)
}

10
app/lnd/methods/payinvoice.js

@ -0,0 +1,10 @@
// LND Pay an invoice
export default function payinvoice(lnd, { paymentRequest }) {
return new Promise((resolve, reject) => {
lnd.sendPaymentSync({ payment_request: paymentRequest }, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/payments.js

@ -0,0 +1,10 @@
// LND Get Payments
export default function payments(lnd) {
return new Promise((resolve, reject) => {
lnd.listPayments({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/peers.js

@ -0,0 +1,10 @@
// LND List Peers
export default function peers(lnd) {
return new Promise((resolve, reject) => {
lnd.listPeers({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/pendingchannels.js

@ -0,0 +1,10 @@
// LND Get Pending Channels
export default function channels(lnd) {
return new Promise((resolve, reject) => {
lnd.pendingChannels({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

10
app/lnd/methods/walletbalance.js

@ -0,0 +1,10 @@
// LND Get Wallet Balance
export default function walletbalance(lnd) {
return new Promise((resolve, reject) => {
lnd.walletBalance({}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}

16
app/lnd/push/channel.js

@ -0,0 +1,16 @@
export default function pushchannel(lnd, event, payload) {
return new Promise((resolve, reject) => {
try {
const call = lnd.openChannel(payload)
call.on('data', data => event.sender.send('pushchannelupdated', { data }))
call.on('end', () => event.sender.send('pushchannelend'))
call.on('error', error => event.sender.send('pushchannelerror', { error }))
call.on('status', status => event.sender.send('pushchannelstatus', { status }))
resolve(null, payload)
} catch (error) {
reject(error, null)
}
})
}

38
app/lnd/utils/index.js

@ -0,0 +1,38 @@
import zbase32 from 'zbase32'
function convertBigEndianBufferToLong(longBuffer) {
let longValue = 0
const byteArray = Buffer.from(longBuffer).swap64()
for (let i = byteArray.length - 1; i >= 0; i -= 1) {
longValue = (longValue * 256) + byteArray[i]
}
return longValue
}
export function decodeInvoice(payreq) {
const payreqBase32 = zbase32.decode(payreq)
const bufferHexRotated = Buffer.from(payreqBase32).toString('hex')
const bufferHex = bufferHexRotated.substr(bufferHexRotated.length - 1, bufferHexRotated.length)
+ bufferHexRotated.substr(0, bufferHexRotated.length - 1)
const buffer = Buffer.from(bufferHex, 'hex')
const paymentHashBuffer = buffer.slice(33, 65)
const paymentHashHex = paymentHashBuffer.toString('hex')
const valueBuffer = buffer.slice(65, 73)
const amount = convertBigEndianBufferToLong(valueBuffer)
return {
payreq,
amount,
r_hash: paymentHashHex
}
}
export default {
decodeInvoice
}

8
app/main.dev.js

@ -11,8 +11,9 @@
* *
* @flow * @flow
*/ */
import { app, BrowserWindow } from 'electron' import { app, BrowserWindow, ipcMain } from 'electron'
import MenuBuilder from './menu' import MenuBuilder from './menu'
import lnd from './lnd'
let mainWindow = null; let mainWindow = null;
@ -90,3 +91,8 @@ app.on('ready', async () => {
const menuBuilder = new MenuBuilder(mainWindow); const menuBuilder = new MenuBuilder(mainWindow);
menuBuilder.buildMenu(); menuBuilder.buildMenu();
}); });
ipcMain.on('lnd', (event, { msg, data }) => {
lnd(event, msg, data)
})

54
app/reducers/activity.js

@ -1,54 +0,0 @@
import { callApis } from '../api'
// ------------------------------------
// Constants
// ------------------------------------
export const GET_ACTIVITY = 'GET_ACTIVITY'
export const RECEIVE_ACTIVITY = 'RECEIVE_ACTIVITY'
// ------------------------------------
// Actions
// ------------------------------------
export function getActivity() {
return {
type: GET_ACTIVITY
}
}
export function receiveActvity(data) {
return {
type: RECEIVE_ACTIVITY,
payments: data[0].data.payments.reverse(),
invoices: data[1].data.invoices.reverse()
}
}
export const fetchActivity = () => async (dispatch) => {
dispatch(getActivity())
const activity = await callApis(['payments', 'invoices'])
dispatch(receiveActvity(activity))
}
// ------------------------------------
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
[GET_ACTIVITY]: state => ({ ...state, activityLoading: true }),
[RECEIVE_ACTIVITY]: (state, { payments, invoices }) => (
{ ...state, activityLoading: false, payments, invoices }
)
}
// ------------------------------------
// Reducer
// ------------------------------------
const initialState = {
activityLoading: false,
payments: [],
invoices: []
}
export default function activityReducer(state = initialState, action) {
const handler = ACTION_HANDLERS[action.type]
return handler ? handler(state, action) : state
}

19
app/reducers/balance.js

@ -1,4 +1,4 @@
import { callApis } from '../api' import { ipcRenderer } from 'electron'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------
@ -14,20 +14,17 @@ export function getBalance() {
} }
} }
export function receiveBalance(data) { // Send IPC event for balance
return {
type: RECEIVE_BALANCE,
walletBalance: data[0].data.balance,
channelBalance: data[1].data.balance
}
}
export const fetchBalance = () => async (dispatch) => { export const fetchBalance = () => async (dispatch) => {
dispatch(getBalance()) dispatch(getBalance())
const balance = await callApis(['wallet_balance', 'channel_balance']) ipcRenderer.send('lnd', { msg: 'balance' })
dispatch(receiveBalance(balance))
} }
// Receive IPC event for balance
export const receiveBalance = (event, { walletBalance, channelBalance }) => dispatch => (
dispatch({ type: RECEIVE_BALANCE, walletBalance, channelBalance })
)
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers
// ------------------------------------ // ------------------------------------

53
app/reducers/channels.js

@ -1,5 +1,5 @@
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import { callApi, callApis } from '../api' import { ipcRenderer } from 'electron'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------
@ -38,14 +38,6 @@ export function getChannels() {
} }
} }
export function receiveChannels(channels) {
return {
type: RECEIVE_CHANNELS,
channels: channels[0].data.channels,
pendingChannels: channels[1].data
}
}
export function openingChannel() { export function openingChannel() {
return { return {
type: OPENING_CHANNEL type: OPENING_CHANNEL
@ -64,24 +56,45 @@ export function openingFailure() {
} }
} }
// Send IPC event for peers
export const fetchChannels = () => async (dispatch) => { export const fetchChannels = () => async (dispatch) => {
dispatch(getChannels()) dispatch(getChannels())
const channels = await callApis(['channels', 'pending_channels']) ipcRenderer.send('lnd', { msg: 'channels' })
dispatch(receiveChannels(channels))
} }
export const openChannel = ({ pubkey, localamt, pushamt }) => async (dispatch) => { // Receive IPC event for channels
const payload = { pubkey, localamt, pushamt } export const receiveChannels = (event, { channels, pendingChannels }) => dispatch => dispatch({ type: RECEIVE_CHANNELS, channels, pendingChannels })
// Send IPC event for opening a channel
export const openChannel = ({ pubkey, localamt, pushamt }) => (dispatch) => {
dispatch(openingChannel()) dispatch(openingChannel())
const channel = await callApi('addchannel', 'post', payload) ipcRenderer.send('lnd', { msg: 'openChannel', data: { pubkey, localamt, pushamt } })
}
if (channel.data) { // TODO: Decide how to handle streamed updates for channels
dispatch(openingSuccessful()) // Receive IPC event for openChannel
} else { export const channelSuccessful = () => (dispatch) => {
dispatch(openingFailure()) dispatch(fetchChannels())
} }
// Receive IPC event for updated channel
export const pushchannelupdated = () => (dispatch) => {
dispatch(fetchChannels())
}
// Receive IPC event for channel end
export const pushchannelend = () => (dispatch) => {
dispatch(fetchChannels())
}
// Receive IPC event for channel error
export const pushchannelerror = () => (dispatch) => {
dispatch(fetchChannels())
}
return channel // Receive IPC event for channel status
export const pushchannelstatus = () => (dispatch) => {
dispatch(fetchChannels())
} }
// ------------------------------------ // ------------------------------------

4
app/reducers/index.js

@ -9,7 +9,6 @@ import peers from './peers'
import channels from './channels' import channels from './channels'
import form from './form' import form from './form'
import invoice from './invoice' import invoice from './invoice'
import activity from './activity'
const rootReducer = combineReducers({ const rootReducer = combineReducers({
router, router,
@ -20,8 +19,7 @@ const rootReducer = combineReducers({
peers, peers,
channels, channels,
form, form,
invoice, invoice
activity
}) })
export default rootReducer export default rootReducer

16
app/reducers/info.js

@ -1,4 +1,4 @@
import { callApi } from '../api' import { ipcRenderer } from 'electron'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------
@ -14,19 +14,15 @@ export function getInfo() {
} }
} }
export function receiveInfo(data) { // Send IPC event for getinfo
return {
type: RECEIVE_INFO,
data
}
}
export const fetchInfo = () => async (dispatch) => { export const fetchInfo = () => async (dispatch) => {
dispatch(getInfo()) dispatch(getInfo())
const info = await callApi('info') ipcRenderer.send('lnd', { msg: 'info' })
dispatch(receiveInfo(info.data))
} }
// Receive IPC event for info
export const receiveInfo = (event, data) => dispatch => dispatch({ type: RECEIVE_INFO, data })
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers
// ------------------------------------ // ------------------------------------

69
app/reducers/invoice.js

@ -1,5 +1,5 @@
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import { callApi } from '../api' import { ipcRenderer } from 'electron'
import { btc, usd } from '../utils' import { btc, usd } from '../utils'
// ------------------------------------ // ------------------------------------
// Constants // Constants
@ -50,82 +50,51 @@ export function receiveInvoice(invoice) {
} }
} }
export function receiveFormInvoice(formInvoice) {
return {
type: RECEIVE_FORM_INVOICE,
formInvoice
}
}
export function getInvoices() { export function getInvoices() {
return { return {
type: GET_INVOICES type: GET_INVOICES
} }
} }
export function receiveInvoices(data) {
return {
type: RECEIVE_INVOICES,
invoices: data.invoices.reverse()
}
}
export function sendInvoice() { export function sendInvoice() {
return { return {
type: SEND_INVOICE type: SEND_INVOICE
} }
} }
export function invoiceSuccessful(invoice) {
return {
type: INVOICE_SUCCESSFUL,
invoice
}
}
export function invoiceFailed() { export function invoiceFailed() {
return { return {
type: INVOICE_FAILED type: INVOICE_FAILED
} }
} }
export const fetchInvoice = payreq => async (dispatch) => { // Send IPC event for a specific invoice
export const fetchInvoice = payreq => (dispatch) => {
dispatch(getInvoice()) dispatch(getInvoice())
const invoice = await callApi(`invoice/${payreq}`, 'get') ipcRenderer.send('lnd', { msg: 'invoice', data: { payreq } })
if (invoice) {
dispatch(receiveFormInvoice(invoice.data))
return true
}
dispatch(invoiceFailed())
return false
} }
export const fetchInvoices = () => async (dispatch) => { // Receive IPC event for form invoice
dispatch(getInvoice()) export const receiveFormInvoice = (event, formInvoice) => dispatch => dispatch({ type: RECEIVE_FORM_INVOICE, formInvoice })
const invoices = await callApi('invoices')
if (invoices) {
dispatch(receiveInvoices(invoices.data))
} else {
dispatch(invoiceFailed())
}
return invoices // Send IPC event for invoices
export const fetchInvoices = () => (dispatch) => {
dispatch(getInvoices())
ipcRenderer.send('lnd', { msg: 'invoices' })
} }
export const createInvoice = (amount, memo, currency, rate) => async (dispatch) => { // Receive IPC event for invoices
const value = currency === 'btc' ? btc.btcToSatoshis(amount) : btc.btcToSatoshis(usd.usdToBtc(amount, rate)) export const receiveInvoices = (event, { invoices }) => dispatch => dispatch({ type: RECEIVE_INVOICES, invoices })
// Send IPC event for creating an invoice
export const createInvoice = (amount, memo, currency, rate) => (dispatch) => {
const value = currency === 'btc' ? btc.btcToSatoshis(amount) : btc.btcToSatoshis(usd.usdToBtc(amount, rate))
dispatch(sendInvoice()) dispatch(sendInvoice())
const invoice = await callApi('addinvoice', 'post', { value, memo }) ipcRenderer.send('lnd', { msg: 'createInvoice', data: { value, memo } })
if (invoice) {
dispatch(invoiceSuccessful({ memo, value, payment_request: invoice.data.payment_request }))
} else {
dispatch(invoiceFailed())
}
return invoice
} }
// Receive IPC event for newly created invoice
export const createdInvoice = (event, invoice) => dispatch => dispatch({ type: INVOICE_SUCCESSFUL, invoice })
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers
// ------------------------------------ // ------------------------------------

36
app/reducers/ipc.js

@ -0,0 +1,36 @@
import createIpc from 'redux-electron-ipc'
import { receiveInfo } from './info'
import { receivePeers, connectSuccess, disconnectSuccess } from './peers'
import {
receiveChannels,
channelSuccessful,
pushchannelupdated,
pushchannelend,
pushchannelerror,
pushchannelstatus
} from './channels'
import { receivePayments, paymentSuccessful } from './payment'
import { receiveInvoices, createdInvoice, receiveFormInvoice } from './invoice'
import { receiveBalance } from './balance'
// Import all receiving IPC event handlers and pass them into createIpc
const ipc = createIpc({
receiveInfo,
receivePeers,
receiveChannels,
receivePayments,
receiveInvoices,
receiveInvoice: receiveFormInvoice,
receiveBalance,
createdInvoice,
paymentSuccessful,
channelSuccessful,
pushchannelupdated,
pushchannelend,
pushchannelerror,
pushchannelstatus,
connectSuccess,
disconnectSuccess
})
export default ipc

41
app/reducers/payment.js

@ -1,5 +1,5 @@
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import { callApi } from '../api' import { ipcRenderer } from 'electron'
// ------------------------------------ // ------------------------------------
// Constants // Constants
@ -29,13 +29,6 @@ export function getPayments() {
} }
} }
export function receivePayments(data) {
return {
type: RECEIVE_PAYMENTS,
payments: data.payments.reverse()
}
}
export function sendPayment() { export function sendPayment() {
return { return {
type: SEND_PAYMENT type: SEND_PAYMENT
@ -55,32 +48,24 @@ export function paymentFailed() {
} }
} }
export const fetchPayments = () => async (dispatch) => { // Send IPC event for payments
export const fetchPayments = () => (dispatch) => {
dispatch(getPayments()) dispatch(getPayments())
const payments = await callApi('payments') ipcRenderer.send('lnd', { msg: 'payments' })
if (payments) {
dispatch(receivePayments(payments.data))
} else {
dispatch(paymentFailed())
}
return payments
} }
export const payInvoice = payment_request => async (dispatch) => { // Receive IPC event for payments
dispatch(sendPayment()) export const receivePayments = (event, { payments }) => dispatch => dispatch({ type: RECEIVE_PAYMENTS, payments })
const payment = await callApi('sendpayment', 'post', { payment_request })
if (payment) {
dispatch(fetchPayments())
} else {
dispatch(paymentFailed())
}
return payment export const payInvoice = paymentRequest => (dispatch) => {
dispatch(sendPayment())
ipcRenderer.send('lnd', { msg: 'sendPayment', data: { paymentRequest } })
} }
// Receive IPC event for successful payment
// TODO: Add payment to state, not a total re-fetch
export const paymentSuccessful = () => fetchPayments()
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers

68
app/reducers/peers.js

@ -1,5 +1,5 @@
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import { callApi } from '../api' import { ipcRenderer } from 'electron'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------
@ -27,13 +27,6 @@ export function connectPeer() {
} }
} }
export function connectSuccess(peer) {
return {
type: CONNECT_SUCCESS,
peer
}
}
export function connectFailure() { export function connectFailure() {
return { return {
type: CONNECT_FAILURE type: CONNECT_FAILURE
@ -46,13 +39,6 @@ export function disconnectPeer() {
} }
} }
export function disconnectSuccess(pubkey) {
return {
type: DISCONNECT_SUCCESS,
pubkey
}
}
export function disconnectFailure() { export function disconnectFailure() {
return { return {
type: DISCONNECT_FAILURE type: DISCONNECT_FAILURE
@ -79,53 +65,47 @@ export function getPeers() {
} }
} }
export function receivePeers({ peers }) { // Send IPC event for peers
return {
type: RECEIVE_PEERS,
peers
}
}
export const fetchPeers = () => async (dispatch) => { export const fetchPeers = () => async (dispatch) => {
dispatch(getPeers()) dispatch(getPeers())
const peers = await callApi('peers') ipcRenderer.send('lnd', { msg: 'peers' })
dispatch(receivePeers(peers.data))
} }
export const connectRequest = ({ pubkey, host }) => async (dispatch) => { // Receive IPC event for peers
dispatch(connectPeer()) export const receivePeers = (event, { peers }) => dispatch => dispatch({ type: RECEIVE_PEERS, peers })
const success = await callApi('connect', 'post', { pubkey, host })
if (success.data) {
dispatch(connectSuccess({ pub_key: pubkey, address: host, peer_id: success.data.peer_id }))
} else {
dispatch(connectFailure())
}
return success // Send IPC event for connecting to a peer
export const connectRequest = ({ pubkey, host }) => (dispatch) => {
dispatch(connectPeer())
ipcRenderer.send('lnd', { msg: 'connectPeer', data: { pubkey, host } })
} }
export const disconnectRequest = ({ pubkey }) => async (dispatch) => { // Send IPC receive for successfully connecting to a peer
dispatch(disconnectPeer()) export const connectSuccess = (event, peer) => dispatch => dispatch({ type: CONNECT_SUCCESS, peer })
const success = await callApi('disconnect', 'post', { pubkey })
if (success) {
dispatch(disconnectSuccess(pubkey))
} else {
dispatch(disconnectFailure())
}
return success // Send IPC send for disconnecting from a peer
export const disconnectRequest = ({ pubkey }) => (dispatch) => {
dispatch(disconnectPeer())
ipcRenderer.send('lnd', { msg: 'disconnectPeer', data: { pubkey } })
} }
// Send IPC receive for successfully disconnecting from a peer
export const disconnectSuccess = (event, { pubkey }) => dispatch => dispatch({ type: DISCONNECT_SUCCESS, pubkey })
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers
// ------------------------------------ // ------------------------------------
const ACTION_HANDLERS = { const ACTION_HANDLERS = {
[DISCONNECT_PEER]: state => ({ ...state, disconnecting: true }), [DISCONNECT_PEER]: state => ({ ...state, disconnecting: true }),
[DISCONNECT_SUCCESS]: (state, { pubkey }) => ({ ...state, disconnecting: false, peers: state.peers.filter(peer => peer.pub_key !== pubkey) }), [DISCONNECT_SUCCESS]: (state, { pubkey }) => (
{ ...state, disconnecting: false, peer: null, peers: state.peers.filter(peer => peer.pub_key !== pubkey) }
),
[DISCONNECT_FAILURE]: state => ({ ...state, disconnecting: false }), [DISCONNECT_FAILURE]: state => ({ ...state, disconnecting: false }),
[CONNECT_PEER]: state => ({ ...state, connecting: true }), [CONNECT_PEER]: state => ({ ...state, connecting: true }),
[CONNECT_SUCCESS]: (state, { peer }) => ({ ...state, connecting: false, peers: [...state.peers, peer] }), [CONNECT_SUCCESS]: (state, { peer }) => (
{ ...state, connecting: false, peerForm: { pubkey: '', host: '', isOpen: false }, peers: [...state.peers, peer] }
),
[CONNECT_FAILURE]: state => ({ ...state, connecting: false }), [CONNECT_FAILURE]: state => ({ ...state, connecting: false }),
[SET_PEER_FORM]: (state, { form }) => ({ ...state, peerForm: Object.assign({}, state.peerForm, form) }), [SET_PEER_FORM]: (state, { form }) => ({ ...state, peerForm: Object.assign({}, state.peerForm, form) }),

2
app/reducers/ticker.js

@ -1,4 +1,4 @@
import { requestTicker } from '../api' import requestTicker from '../api'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------

10
app/routes/app/components/App.js

@ -2,14 +2,8 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Form from './components/Form' import Form from './components/Form'
import Nav from './components/Nav' import Nav from './components/Nav'
import Socket from './components/Socket'
import styles from './App.scss' import styles from './App.scss'
export const CHANNEL_DATA = 'CHANNEL_DATA'
export const CHANNEL_END = 'CHANNEL_END'
export const CHANNEL_ERROR = 'CHANNEL_ERROR'
export const CHANNEL_STATUS = 'CHANNEL_STATUS'
class App extends Component { class App extends Component {
componentWillMount() { componentWillMount() {
const { fetchTicker, fetchBalance } = this.props const { fetchTicker, fetchBalance } = this.props
@ -34,7 +28,6 @@ class App extends Component {
setForm, setForm,
createInvoice, createInvoice,
payInvoice, payInvoice,
fetchChannels,
fetchInvoice, fetchInvoice,
children children
} = this.props } = this.props
@ -66,8 +59,6 @@ class App extends Component {
<div className={styles.content}> <div className={styles.content}>
{children} {children}
</div> </div>
<Socket fetchChannels={fetchChannels} />
</div> </div>
) )
} }
@ -90,7 +81,6 @@ App.propTypes = {
setForm: PropTypes.func.isRequired, setForm: PropTypes.func.isRequired,
createInvoice: PropTypes.func.isRequired, createInvoice: PropTypes.func.isRequired,
payInvoice: PropTypes.func.isRequired, payInvoice: PropTypes.func.isRequired,
fetchChannels: PropTypes.func.isRequired,
fetchInvoice: PropTypes.func.isRequired, fetchInvoice: PropTypes.func.isRequired,
children: PropTypes.object.isRequired children: PropTypes.object.isRequired
} }

8
app/routes/app/components/components/Form/Form.js

@ -20,16 +20,12 @@ const Form = ({
}) => { }) => {
const requestClicked = () => { const requestClicked = () => {
createInvoice(amount, message, currency, btcTicker.price_usd) createInvoice(amount, message, currency, btcTicker.price_usd)
.then((success) => { close()
if (success) { close() }
})
} }
const payClicked = () => { const payClicked = () => {
payInvoice(payment_request) payInvoice(payment_request)
.then((success) => { close()
if (success) { close() }
})
} }
const paymentRequestOnChange = (payreq) => { const paymentRequestOnChange = (payreq) => {

20
app/routes/app/components/components/Socket.js

@ -1,20 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import Websocket from 'react-websocket'
const Socket = ({ fetchChannels }) => {
const onMessage = () => {
// TODO: Assumes only socket relationship is with channels. Actually flesh out socket logic
fetchChannels()
}
return (
<Websocket debug url='ws://localhost:3000/' onMessage={onMessage} />
)
}
Socket.propTypes = {
fetchChannels: PropTypes.func.isRequired
}
export default Socket

5
app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js

@ -12,9 +12,8 @@ const ChannelForm = ({ form, setForm, ticker, peers, openChannel }) => {
const localamt = ticker.currency === 'btc' ? btc.btcToSatoshis(local_amt) : btc.btcToSatoshis(usd.usdToBtc(local_amt, ticker.btcTicker.price_usd)) const localamt = ticker.currency === 'btc' ? btc.btcToSatoshis(local_amt) : btc.btcToSatoshis(usd.usdToBtc(local_amt, ticker.btcTicker.price_usd))
const pushamt = ticker.currency === 'btc' ? btc.btcToSatoshis(push_amt) : btc.btcToSatoshis(usd.usdToBtc(push_amt, ticker.btcTicker.price_usd)) const pushamt = ticker.currency === 'btc' ? btc.btcToSatoshis(push_amt) : btc.btcToSatoshis(usd.usdToBtc(push_amt, ticker.btcTicker.price_usd))
openChannel({ pubkey: node_key, localamt, pushamt }).then((channel) => { openChannel({ pubkey: node_key, localamt, pushamt })
if (channel.data) { setForm({ isOpen: false }) } setForm({ isOpen: false })
})
} }
const customStyles = { const customStyles = {

5
app/routes/wallet/components/components/Peers/components/PeerForm/PeerForm.js

@ -6,10 +6,7 @@ import styles from './PeerForm.scss'
const PeerForm = ({ form, setForm, connect }) => { const PeerForm = ({ form, setForm, connect }) => {
const submit = () => { const submit = () => {
const { pubkey, host } = form const { pubkey, host } = form
connect({ pubkey, host })
connect({ pubkey, host }).then((success) => {
if (success.data) { setForm({ isOpen: false }) }
})
} }
const customStyles = { const customStyles = {

7
app/routes/wallet/components/components/Peers/components/PeerModal/PeerModal.js

@ -4,11 +4,6 @@ import ReactModal from 'react-modal'
import styles from './PeerModal.scss' import styles from './PeerModal.scss'
const PeerModal = ({ isOpen, resetPeer, peer, disconnect }) => { const PeerModal = ({ isOpen, resetPeer, peer, disconnect }) => {
const disconnectClicked = () => {
disconnect({ pubkey: peer.pub_key })
.then(success => (success ? resetPeer(null) : null))
}
const customStyles = { const customStyles = {
overlay: { overlay: {
cursor: 'pointer', cursor: 'pointer',
@ -55,7 +50,7 @@ const PeerModal = ({ isOpen, resetPeer, peer, disconnect }) => {
<dd>{peer.bytes_sent}</dd> <dd>{peer.bytes_sent}</dd>
</dl> </dl>
</div> </div>
<div className={styles.close} onClick={disconnectClicked}> <div className={styles.close} onClick={() => disconnect({ pubkey: peer.pub_key })}>
<div>Disconnect peer</div> <div>Disconnect peer</div>
</div> </div>
</div> </div>

15
app/store/configureStore.dev.js

@ -1,9 +1,10 @@
import { createStore, applyMiddleware, compose } from 'redux'; import { createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'; import thunk from 'redux-thunk'
import { createHashHistory } from 'history'; import { createHashHistory } from 'history'
import { routerMiddleware, routerActions } from 'react-router-redux'; import { routerMiddleware, routerActions } from 'react-router-redux'
import { createLogger } from 'redux-logger'; import { createLogger } from 'redux-logger'
import rootReducer from '../reducers'; import rootReducer from '../reducers'
import ipc from '../reducers/ipc'
const history = createHashHistory(); const history = createHashHistory();
@ -41,7 +42,7 @@ const configureStore = (initialState?: counterStateType) => {
/* eslint-enable no-underscore-dangle */ /* eslint-enable no-underscore-dangle */
// Apply Middleware & Compose Enhancers // Apply Middleware & Compose Enhancers
enhancers.push(applyMiddleware(...middleware)); enhancers.push(applyMiddleware(...middleware, ipc));
const enhancer = composeEnhancers(...enhancers); const enhancer = composeEnhancers(...enhancers);
// Create Store // Create Store

7
package.json

@ -137,6 +137,7 @@
"electron": "^1.6.10", "electron": "^1.6.10",
"electron-builder": "^19.8.0", "electron-builder": "^19.8.0",
"electron-devtools-installer": "^2.2.0", "electron-devtools-installer": "^2.2.0",
"electron-rebuild": "^1.6.0",
"enzyme": "^2.9.1", "enzyme": "^2.9.1",
"enzyme-to-json": "^1.5.1", "enzyme-to-json": "^1.5.1",
"eslint": "^4.4.1", "eslint": "^4.4.1",
@ -183,9 +184,11 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.16.2", "axios": "^0.16.2",
"bitcore-lib": "^0.14.0",
"devtron": "^1.4.0", "devtron": "^1.4.0",
"electron-debug": "^1.2.0", "electron-debug": "^1.2.0",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"grpc": "^1.4.1",
"history": "^4.6.3", "history": "^4.6.3",
"moment-timezone": "^0.5.13", "moment-timezone": "^0.5.13",
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
@ -204,11 +207,13 @@
"react-svg-morph": "^0.1.10", "react-svg-morph": "^0.1.10",
"react-websocket": "^1.1.7", "react-websocket": "^1.1.7",
"redux": "^3.7.1", "redux": "^3.7.1",
"redux-electron-ipc": "^1.1.10",
"redux-thunk": "^2.2.0", "redux-thunk": "^2.2.0",
"reselect": "^3.0.1", "reselect": "^3.0.1",
"satoshi-bitcoin": "^1.0.4", "satoshi-bitcoin": "^1.0.4",
"source-map-support": "^0.4.15", "source-map-support": "^0.4.15",
"xtend": "^4.0.1" "xtend": "^4.0.1",
"zbase32": "^0.0.2"
}, },
"devEngines": { "devEngines": {
"node": ">=7.x", "node": ">=7.x",

55
test/api/index.spec.js

@ -1,55 +0,0 @@
import { callApi } from '../../app/api'
describe('API', () => {
describe('getinfo', () => {
it('is synced to the chain', async () => {
const info = await callApi('info')
expect(info.data.synced_to_chain).toEqual(true)
})
it('only supports 1 chain at a time', async () => {
const info = await callApi('info')
expect(info.data.chains.length).toEqual(1)
})
})
describe('balance', () => {
it('returns wallet balance', async () => {
const wallet_balances = await callApi('wallet_balance')
expect(typeof (wallet_balances.data.balance)).toEqual('string')
})
it('returns channel balance', async () => {
const channel_balances = await callApi('channel_balance')
expect(typeof (channel_balances.data.balance)).toEqual('string')
})
})
describe('peers', () => {
it('peers is an array', async () => {
const peers = await callApi('peers')
expect(Array.isArray(peers.data.peers)).toEqual(true)
})
})
describe('channels', () => {
it('channels is an array', async () => {
const channels = await callApi('channels')
expect(Array.isArray(channels.data.channels)).toEqual(true)
})
})
describe('invoices', () => {
it('invoices is an array', async () => {
const invoices = await callApi('invoices')
expect(Array.isArray(invoices.data.invoices)).toEqual(true)
})
})
describe('payments', () => {
it('payments is an array', async () => {
const payments = await callApi('payments')
expect(Array.isArray(payments.data.payments)).toEqual(true)
})
})
})

175
yarn.lock

@ -246,6 +246,10 @@ argparse@^1.0.7:
dependencies: dependencies:
sprintf-js "~1.0.2" sprintf-js "~1.0.2"
arguejs@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/arguejs/-/arguejs-0.2.3.tgz#b6f939f5fe0e3cd1f3f93e2aa9262424bf312af7"
aria-query@^0.7.0: aria-query@^0.7.0:
version "0.7.0" version "0.7.0"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.0.tgz#4af10a1e61573ddea0cf3b99b51c52c05b424d24" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.0.tgz#4af10a1e61573ddea0cf3b99b51c52c05b424d24"
@ -322,6 +326,13 @@ asar-integrity@0.1.1:
bluebird-lst "^1.0.2" bluebird-lst "^1.0.2"
fs-extra-p "^4.3.0" fs-extra-p "^4.3.0"
ascli@~1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/ascli/-/ascli-1.0.1.tgz#bcfa5974a62f18e81cabaeb49732ab4a88f906bc"
dependencies:
colour "~0.7.1"
optjs "~3.2.2"
asn1.js@^4.0.0: asn1.js@^4.0.0:
version "4.9.1" version "4.9.1"
resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40"
@ -1474,6 +1485,17 @@ binary-extensions@^1.0.0:
buffers "~0.1.1" buffers "~0.1.1"
chainsaw "~0.1.0" chainsaw "~0.1.0"
bitcore-lib@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/bitcore-lib/-/bitcore-lib-0.14.0.tgz#21cb2359fe7b997a3b7b773eb7d7275ae37d644e"
dependencies:
bn.js "=2.0.4"
bs58 "=2.0.0"
buffer-compare "=1.0.0"
elliptic "=3.0.3"
inherits "=2.0.1"
lodash "=3.10.1"
bl@^1.0.0: bl@^1.0.0:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.1.tgz#cac328f7bee45730d404b692203fcb590e172d5e" resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.1.tgz#cac328f7bee45730d404b692203fcb590e172d5e"
@ -1496,6 +1518,14 @@ bluebird@^3.0.5, bluebird@^3.4.7, bluebird@^3.5.0:
version "3.5.0" version "3.5.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c"
bn.js@=2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-2.0.4.tgz#220a7cd677f7f1bfa93627ff4193776fe7819480"
bn.js@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-2.2.0.tgz#12162bc2ae71fc40a5626c33438f3a875cd37625"
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
version "4.11.6" version "4.11.6"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215"
@ -1623,6 +1653,10 @@ browserslist@^1.1.1, browserslist@^1.1.3, browserslist@^1.3.6, browserslist@^1.5
caniuse-db "^1.0.30000639" caniuse-db "^1.0.30000639"
electron-to-chromium "^1.2.7" electron-to-chromium "^1.2.7"
bs58@=2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.0.tgz#72b713bed223a0ac518bbda0e3ce3f4817f39eb5"
bser@1.0.2: bser@1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/bser/-/bser-1.0.2.tgz#381116970b2a6deea5646dd15dd7278444b56169" resolved "https://registry.yarnpkg.com/bser/-/bser-1.0.2.tgz#381116970b2a6deea5646dd15dd7278444b56169"
@ -1635,6 +1669,10 @@ bser@^2.0.0:
dependencies: dependencies:
node-int64 "^0.4.0" node-int64 "^0.4.0"
buffer-compare@=1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/buffer-compare/-/buffer-compare-1.0.0.tgz#acaa7a966e98eee9fae14b31c39a5f158fb3c4a2"
buffer-crc32@^0.2.1: buffer-crc32@^0.2.1:
version "0.2.13" version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
@ -1667,6 +1705,12 @@ builtin-status-codes@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
bytebuffer@~5:
version "5.0.1"
resolved "https://registry.yarnpkg.com/bytebuffer/-/bytebuffer-5.0.1.tgz#582eea4b1a873b6d020a48d58df85f0bba6cfddd"
dependencies:
long "~3"
bytes@2.3.0: bytes@2.3.0:
version "2.3.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.3.0.tgz#d5b680a165b6201739acb611542aabc2d8ceb070" resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.3.0.tgz#d5b680a165b6201739acb611542aabc2d8ceb070"
@ -1703,7 +1747,7 @@ camelcase@^1.0.2:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
camelcase@^2.0.0: camelcase@^2.0.0, camelcase@^2.0.1:
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
@ -1873,6 +1917,10 @@ cli-cursor@^2.1.0:
dependencies: dependencies:
restore-cursor "^2.0.0" restore-cursor "^2.0.0"
cli-spinners@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.0.0.tgz#ef987ed3d48391ac3dab9180b406a742180d6e6a"
cli-width@^2.0.0: cli-width@^2.0.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a"
@ -1885,7 +1933,7 @@ cliui@^2.1.0:
right-align "^0.1.1" right-align "^0.1.1"
wordwrap "0.0.2" wordwrap "0.0.2"
cliui@^3.2.0: cliui@^3.0.3, cliui@^3.2.0:
version "3.2.0" version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
dependencies: dependencies:
@ -1990,6 +2038,10 @@ colors@^1.1.2, colors@~1.1.2:
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63"
colour@~0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/colour/-/colour-0.7.1.tgz#9cb169917ec5d12c0736d3e8685746df1cadf778"
combined-stream@^1.0.5, combined-stream@~1.0.5: combined-stream@^1.0.5, combined-stream@~1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009"
@ -2476,7 +2528,7 @@ debug@2.6.7:
dependencies: dependencies:
ms "2.0.0" ms "2.0.0"
debug@2.6.8, debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@^2.4.5, debug@^2.6.0, debug@^2.6.1, debug@^2.6.3, debug@^2.6.6, debug@^2.6.8: debug@2.6.8, debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@^2.4.5, debug@^2.5.1, debug@^2.6.0, debug@^2.6.1, debug@^2.6.3, debug@^2.6.6, debug@^2.6.8:
version "2.6.8" version "2.6.8"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
dependencies: dependencies:
@ -2918,6 +2970,20 @@ electron-publish@19.8.0:
fs-extra-p "^4.3.0" fs-extra-p "^4.3.0"
mime "^1.3.6" mime "^1.3.6"
electron-rebuild@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/electron-rebuild/-/electron-rebuild-1.6.0.tgz#e8d26f4d8e9fe5388df35864b3658e5cfd4dcb7e"
dependencies:
colors "^1.1.2"
debug "^2.6.3"
fs-extra "^3.0.1"
node-abi "^2.0.0"
node-gyp "^3.6.0"
ora "^1.2.0"
rimraf "^2.6.1"
spawn-rx "^2.0.10"
yargs "^7.0.2"
electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.11: electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.11:
version "1.3.14" version "1.3.14"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.14.tgz#64af0f9efd3c3c6acd57d71f83b49ca7ee9c4b43" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.14.tgz#64af0f9efd3c3c6acd57d71f83b49ca7ee9c4b43"
@ -2930,6 +2996,15 @@ electron@^1.6.10:
electron-download "^3.0.1" electron-download "^3.0.1"
extract-zip "^1.0.3" extract-zip "^1.0.3"
elliptic@=3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-3.0.3.tgz#865c9b420bfbe55006b9f969f97a0d2c44966595"
dependencies:
bn.js "^2.0.0"
brorand "^1.0.1"
hash.js "^1.0.0"
inherits "^2.0.1"
elliptic@^6.0.0: elliptic@^6.0.0:
version "6.4.0" version "6.4.0"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df"
@ -4024,6 +4099,16 @@ growly@^1.3.0:
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
grpc@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/grpc/-/grpc-1.4.1.tgz#3ee4a8346a613f2823928c9f8f99081b6368ec7c"
dependencies:
arguejs "^0.2.3"
lodash "^4.15.0"
nan "^2.0.0"
node-pre-gyp "^0.6.35"
protobufjs "^5.0.0"
gulp-util@^3.0.4: gulp-util@^3.0.4:
version "3.0.8" version "3.0.8"
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f"
@ -4393,7 +4478,7 @@ inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, i
version "2.0.3" version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
inherits@2.0.1: inherits@2.0.1, inherits@=2.0.1:
version "2.0.1" version "2.0.1"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1"
@ -5504,6 +5589,10 @@ lodash.uniq@^4.5.0:
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
lodash@=3.10.1:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
lodash@^4.0.0, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1, lodash@^4.6.1, lodash@^4.8.0, lodash@~4.17.4: lodash@^4.0.0, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1, lodash@^4.6.1, lodash@^4.8.0, lodash@~4.17.4:
version "4.17.4" version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
@ -5518,6 +5607,10 @@ lolex@^1.6.0:
version "1.6.0" version "1.6.0"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6"
long@~3:
version "3.2.0"
resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b"
longest@^1.0.1: longest@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
@ -5789,7 +5882,7 @@ mute-stream@0.0.7:
version "0.0.7" version "0.0.7"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
nan@^2.3.0, nan@^2.3.2: nan@^2.0.0, nan@^2.3.0, nan@^2.3.2:
version "2.6.2" version "2.6.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
@ -5821,6 +5914,10 @@ no-case@^2.2.0:
dependencies: dependencies:
lower-case "^1.1.1" lower-case "^1.1.1"
node-abi@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.1.0.tgz#50ad834affcf17440e12bfc5f9ba0946f572d10c"
node-emoji@^1.5.1: node-emoji@^1.5.1:
version "1.5.1" version "1.5.1"
resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.5.1.tgz#fd918e412769bf8c448051238233840b2aff16a1" resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.5.1.tgz#fd918e412769bf8c448051238233840b2aff16a1"
@ -5838,7 +5935,7 @@ node-forge@0.6.33:
version "0.6.33" version "0.6.33"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.6.33.tgz#463811879f573d45155ad6a9f43dc296e8e85ebc" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.6.33.tgz#463811879f573d45155ad6a9f43dc296e8e85ebc"
node-gyp@^3.3.1: node-gyp@^3.3.1, node-gyp@^3.6.0:
version "3.6.2" version "3.6.2"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.6.2.tgz#9bfbe54562286284838e750eac05295853fa1c60" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.6.2.tgz#9bfbe54562286284838e750eac05295853fa1c60"
dependencies: dependencies:
@ -5925,7 +6022,7 @@ node-notifier@^5.0.2:
shellwords "^0.1.0" shellwords "^0.1.0"
which "^1.2.12" which "^1.2.12"
node-pre-gyp@^0.6.29: node-pre-gyp@^0.6.29, node-pre-gyp@^0.6.35:
version "0.6.36" version "0.6.36"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz#db604112cb74e0d477554e9b505b17abddfab786" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz#db604112cb74e0d477554e9b505b17abddfab786"
dependencies: dependencies:
@ -6182,6 +6279,19 @@ optionator@^0.8.1, optionator@^0.8.2:
type-check "~0.3.2" type-check "~0.3.2"
wordwrap "~1.0.0" wordwrap "~1.0.0"
optjs@~3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/optjs/-/optjs-3.2.2.tgz#69a6ce89c442a44403141ad2f9b370bd5bb6f4ee"
ora@^1.2.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-1.3.0.tgz#80078dd2b92a934af66a3ad72a5b910694ede51a"
dependencies:
chalk "^1.1.1"
cli-cursor "^2.1.0"
cli-spinners "^1.0.0"
log-symbols "^1.0.2"
original@>=0.0.5: original@>=0.0.5:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/original/-/original-1.0.0.tgz#9147f93fa1696d04be61e01bd50baeaca656bd3b" resolved "https://registry.yarnpkg.com/original/-/original-1.0.0.tgz#9147f93fa1696d04be61e01bd50baeaca656bd3b"
@ -6828,6 +6938,15 @@ prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.8:
fbjs "^0.8.9" fbjs "^0.8.9"
loose-envify "^1.3.1" loose-envify "^1.3.1"
protobufjs@^5.0.0:
version "5.0.2"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-5.0.2.tgz#59748d7dcf03d2db22c13da9feb024e16ab80c91"
dependencies:
ascli "~1"
bytebuffer "~5"
glob "^7.0.5"
yargs "^3.10.0"
proxy-addr@~1.1.4: proxy-addr@~1.1.4:
version "1.1.4" version "1.1.4"
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-1.1.4.tgz#27e545f6960a44a627d9b44467e35c1b6b4ce2f3" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-1.1.4.tgz#27e545f6960a44a627d9b44467e35c1b6b4ce2f3"
@ -7210,6 +7329,10 @@ reduce-function-call@^1.0.1:
dependencies: dependencies:
balanced-match "^0.4.2" balanced-match "^0.4.2"
redux-electron-ipc@^1.1.10:
version "1.1.10"
resolved "https://registry.yarnpkg.com/redux-electron-ipc/-/redux-electron-ipc-1.1.10.tgz#0e4de0ae30eb8571209f24e75149007e965e65d1"
redux-logger@^3.0.6: redux-logger@^3.0.6:
version "3.0.6" version "3.0.6"
resolved "https://registry.yarnpkg.com/redux-logger/-/redux-logger-3.0.6.tgz#f7555966f3098f3c88604c449cf0baf5778274bf" resolved "https://registry.yarnpkg.com/redux-logger/-/redux-logger-3.0.6.tgz#f7555966f3098f3c88604c449cf0baf5778274bf"
@ -7479,6 +7602,12 @@ rx@^4.1.0:
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
rxjs@^5.1.1:
version "5.4.3"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.3.tgz#0758cddee6033d68e0fd53676f0f3596ce3d483f"
dependencies:
symbol-observable "^1.0.1"
safe-buffer@^5.0.1, safe-buffer@^5.1.0: safe-buffer@^5.0.1, safe-buffer@^5.1.0:
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.0.tgz#fe4c8460397f9eaaaa58e73be46273408a45e223" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.0.tgz#fe4c8460397f9eaaaa58e73be46273408a45e223"
@ -7793,6 +7922,14 @@ spawn-command@^0.0.2-1:
version "0.0.2" version "0.0.2"
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2.tgz#9544e1a43ca045f8531aac1a48cb29bdae62338e" resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2.tgz#9544e1a43ca045f8531aac1a48cb29bdae62338e"
spawn-rx@^2.0.10:
version "2.0.11"
resolved "https://registry.yarnpkg.com/spawn-rx/-/spawn-rx-2.0.11.tgz#65451ad65662801daea75549832a782de0048dbf"
dependencies:
debug "^2.5.1"
lodash.assign "^4.2.0"
rxjs "^5.1.1"
spdx-correct@~1.0.0: spdx-correct@~1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"
@ -8228,7 +8365,7 @@ svgpath@^2.1.0:
version "2.2.1" version "2.2.1"
resolved "https://registry.yarnpkg.com/svgpath/-/svgpath-2.2.1.tgz#0834bb67c89a76472b2bd06cc101fa7b517b222c" resolved "https://registry.yarnpkg.com/svgpath/-/svgpath-2.2.1.tgz#0834bb67c89a76472b2bd06cc101fa7b517b222c"
symbol-observable@^1.0.3: symbol-observable@^1.0.1, symbol-observable@^1.0.3:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
@ -8948,6 +9085,10 @@ window-size@0.1.0:
version "0.1.0" version "0.1.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
window-size@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
window-size@^0.2.0: window-size@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075"
@ -9033,7 +9174,7 @@ xtend@~2.1.1:
dependencies: dependencies:
object-keys "~0.4.0" object-keys "~0.4.0"
y18n@^3.2.1: y18n@^3.2.0, y18n@^3.2.1:
version "3.2.1" version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
@ -9070,6 +9211,18 @@ yargs@^1.2.6:
version "1.3.3" version "1.3.3"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-1.3.3.tgz#054de8b61f22eefdb7207059eaef9d6b83fb931a" resolved "https://registry.yarnpkg.com/yargs/-/yargs-1.3.3.tgz#054de8b61f22eefdb7207059eaef9d6b83fb931a"
yargs@^3.10.0:
version "3.32.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"
dependencies:
camelcase "^2.0.1"
cliui "^3.0.3"
decamelize "^1.1.1"
os-locale "^1.4.0"
string-width "^1.0.1"
window-size "^0.1.4"
y18n "^3.2.0"
yargs@^3.5.4, yargs@~3.10.0: yargs@^3.5.4, yargs@~3.10.0:
version "3.10.0" version "3.10.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"
@ -9158,6 +9311,10 @@ yauzl@2.4.1:
dependencies: dependencies:
fd-slicer "~1.0.1" fd-slicer "~1.0.1"
zbase32@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/zbase32/-/zbase32-0.0.2.tgz#169c6f2130a6c27a84247017538b56826a54b283"
zip-stream@^1.1.0: zip-stream@^1.1.0:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-1.1.1.tgz#5216b48bbb4d2651f64d5c6e6f09eb4a7399d557" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-1.1.1.tgz#5216b48bbb4d2651f64d5c6e6f09eb4a7399d557"

Loading…
Cancel
Save