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

View file

@ -1,28 +1,31 @@
import { import {
GraphQLObjectType, GraphQLObjectType,
GraphQLBoolean, GraphQLBoolean,
GraphQLString, GraphQLString,
GraphQLList } from 'graphql';
} from "graphql"; import { GraphQLInt } from 'graphql';
import { GraphQLInt } from "graphql"; import { PartnerNodeType } from './channels';
import { PartnerNodeType } from "./channels";
// TODO: INCOMPLETE TYPE // TODO: INCOMPLETE TYPE
export const PendingChannelType = new GraphQLObjectType({ export const PendingChannelType = new GraphQLObjectType({
name: "pendingChannelType", name: 'pendingChannelType',
fields: () => { fields: () => {
return { return {
isActive: { type: GraphQLBoolean }, closeTransactionId: { type: GraphQLString },
isClosing: { type: GraphQLBoolean }, isActive: { type: GraphQLBoolean },
isOpening: { type: GraphQLBoolean }, isClosing: { type: GraphQLBoolean },
localBalance: { type: GraphQLInt }, isOpening: { type: GraphQLBoolean },
localReserve: { type: GraphQLInt }, localBalance: { type: GraphQLInt },
partnerPublicKey: { type: GraphQLString }, localReserve: { type: GraphQLInt },
received: { type: GraphQLInt }, partnerPublicKey: { type: GraphQLString },
remoteBalance: { type: GraphQLInt }, received: { type: GraphQLInt },
remoteReserve: { type: GraphQLInt }, remoteBalance: { type: GraphQLInt },
sent: { type: GraphQLInt }, remoteReserve: { type: GraphQLInt },
partnerNodeInfo: { type: PartnerNodeType } 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_balance: number;
remote_reserve: number; remote_reserve: number;
sent: number; sent: number;
transaction_fee: number;
transaction_id: string;
transaction_vout: number;
} }
export const getPendingChannels = { export const getPendingChannels = {
@ -50,6 +53,7 @@ export const getPendingChannels = {
}); });
return { return {
closeTransactionId: channel.close_transaction_id,
isActive: channel.is_active, isActive: channel.is_active,
isClosing: channel.is_closing, isClosing: channel.is_closing,
isOpening: channel.is_opening, isOpening: channel.is_opening,
@ -60,6 +64,9 @@ export const getPendingChannels = {
remoteBalance: channel.remote_balance, remoteBalance: channel.remote_balance,
remoteReserve: channel.remote_reserve, remoteReserve: channel.remote_reserve,
sent: channel.sent, sent: channel.sent,
transactionFee: channel.transaction_fee,
transactionId: channel.transaction_id,
transactionVout: channel.transaction_vout,
partnerNodeInfo: { partnerNodeInfo: {
alias: nodeInfo.alias, alias: nodeInfo.alias,
capacity: nodeInfo.capacity, capacity: nodeInfo.capacity,