chore: more info for pending channels

This commit is contained in:
AP 2019-12-07 18:13:29 +01:00
parent a03a13a062
commit 406d830063
3 changed files with 35 additions and 25 deletions

View file

@ -40,7 +40,7 @@ export const getAuthLnd = (auth: string) => {
// const macaroon = base64url.toBase64(encodedMacaroon);
// const cert = base64url.toBase64(encodedCert);
const macaroon = base64url.toBase64(encodedMacaroon);
const macaroon = base64url.toBase64(encodedMacaroon).replace('==', '');
// console.log(encodedCert);
@ -61,7 +61,7 @@ export const getAuthLnd = (auth: string) => {
export const getErrorMsg = (error: any[]): string => {
const code = error[0];
const msg = error[1];
const details = error.length > 2 ? error[2].details : '';
const details = error.length > 2 ? error[2].err.details : '';
return JSON.stringify({ code, msg, details });
};

View file

@ -1,28 +1,31 @@
import {
GraphQLObjectType,
GraphQLBoolean,
GraphQLString,
GraphQLList
} from "graphql";
import { GraphQLInt } from "graphql";
import { PartnerNodeType } from "./channels";
GraphQLObjectType,
GraphQLBoolean,
GraphQLString,
} from 'graphql';
import { GraphQLInt } from 'graphql';
import { PartnerNodeType } from './channels';
// TODO: INCOMPLETE TYPE
export const PendingChannelType = new GraphQLObjectType({
name: "pendingChannelType",
fields: () => {
return {
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 }
};
}
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 },
partnerNodeInfo: { type: PartnerNodeType },
transactionFee: { type: GraphQLInt },
transactionId: { type: GraphQLString },
transactionVout: { type: GraphQLInt },
};
},
});

View file

@ -24,6 +24,9 @@ interface PendingChannelProps {
remote_balance: number;
remote_reserve: number;
sent: number;
transaction_fee: number;
transaction_id: string;
transaction_vout: number;
}
export const getPendingChannels = {
@ -50,6 +53,7 @@ export const getPendingChannels = {
});
return {
closeTransactionId: channel.close_transaction_id,
isActive: channel.is_active,
isClosing: channel.is_closing,
isOpening: channel.is_opening,
@ -60,6 +64,9 @@ export const getPendingChannels = {
remoteBalance: channel.remote_balance,
remoteReserve: channel.remote_reserve,
sent: channel.sent,
transactionFee: channel.transaction_fee,
transactionId: channel.transaction_id,
transactionVout: channel.transaction_vout,
partnerNodeInfo: {
alias: nodeInfo.alias,
capacity: nodeInfo.capacity,