chore: small changes

This commit is contained in:
AP 2019-11-21 06:49:43 +01:00
parent 86152341b2
commit 5c56dd51c7
4 changed files with 34 additions and 40 deletions

View file

@ -31,7 +31,7 @@ export const ChannelType = new GraphQLObjectType({
localBalance: { type: GraphQLInt },
localReserve: { type: GraphQLInt },
partnerPublicKey: { type: GraphQLString },
recieved: { type: GraphQLInt },
received: { type: GraphQLInt },
remoteBalance: { type: GraphQLInt },
remoteReserve: { type: GraphQLInt },
sent: { type: GraphQLInt },

View file

@ -5,45 +5,24 @@ import {
GraphQLList
} from "graphql";
import { GraphQLInt } from "graphql";
import { PartnerNodeType } from "./channels";
// TODO: INCOMPLETE TYPE
export const PendingChannelType = new GraphQLObjectType({
name: "pendingChannelType",
fields: () => {
return {
closeTransactionId: {
type: GraphQLString
},
isActive: {
type: GraphQLBoolean
},
isClosing: {
type: GraphQLBoolean
},
isOpening: {
type: GraphQLBoolean
},
localBalance: {
type: GraphQLInt
},
localReserve: {
type: GraphQLInt
},
partnerPublicKey: {
type: GraphQLString
},
received: {
type: GraphQLInt
},
remoteBalance: {
type: GraphQLInt
},
remoteReserve: {
type: GraphQLInt
},
sent: {
type: GraphQLInt
}
isActive: { type: GraphQLBoolean },
isClosing: { type: GraphQLBoolean },
isOpening: { type: GraphQLBoolean },
localBalance: { type: GraphQLInt },
localReserve: { type: GraphQLInt },
partnerPublicKey: { type: GraphQLString },
received: { type: GraphQLInt },
remoteBalance: { type: GraphQLInt },
remoteReserve: { type: GraphQLInt },
sent: { type: GraphQLInt },
partnerNodeInfo: { type: PartnerNodeType }
};
}
});

View file

@ -60,13 +60,13 @@ export const getChannels = {
isActive: channel.is_active,
isClosing: channel.is_closing,
isOpening: channel.is_opening,
isPartnerInitiated: channel.is_partner_initiated,
isPartnerInitiated: !channel.is_partner_initiated,
isPrivate: channel.is_private,
isStaticRemoteKey: channel.is_static_remote_key,
localBalance: channel.local_balance,
localReserve: channel.local_reserve,
partnerPublicKey: channel.partner_public_key,
recieved: channel.received,
received: channel.received,
remoteBalance: channel.remote_balance,
remoteReserve: channel.remote_reserve,
sent: channel.sent,

View file

@ -1,4 +1,7 @@
import { getPendingChannels as getLnPendingChannels } from "ln-service";
import {
getPendingChannels as getLnPendingChannels,
getNode
} from "ln-service";
import { logger } from "../../../helpers/logger";
import { PendingChannelType } from "../../../schemaTypes/query/info/pendingChannels";
import { GraphQLList } from "graphql";
@ -35,9 +38,14 @@ export const getPendingChannels = {
}
);
const channels = pendingChannels.pending_channels.map(channel => {
const channels = pendingChannels.pending_channels.map(async channel => {
const nodeInfo = await getNode({
lnd,
is_omitting_channels: true,
public_key: channel.partner_public_key
});
return {
closeTransactionId: channel.close_transaction_id,
isActive: channel.is_active,
isClosing: channel.is_closing,
isOpening: channel.is_opening,
@ -47,7 +55,14 @@ export const getPendingChannels = {
received: channel.received,
remoteBalance: channel.remote_balance,
remoteReserve: channel.remote_reserve,
sent: channel.sent
sent: channel.sent,
partnerNodeInfo: {
alias: nodeInfo.alias,
capacity: nodeInfo.capacity,
channelCount: nodeInfo.channel_count,
color: nodeInfo.color,
lastUpdate: nodeInfo.updated_at
}
};
});
return channels;