From 603dcacd027ed74419f4458168d6db8b1260d8ff Mon Sep 17 00:00:00 2001 From: apotdevin Date: Sun, 24 Jan 2021 18:25:22 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20chain=20balance=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/schema/chain/__snapshots__/chain.test.ts.snap | 4 ++-- server/schema/chain/resolvers.ts | 4 ++-- server/schema/types.ts | 4 ++-- src/graphql/mutations/__generated__/bosPay.generated.tsx | 2 +- .../mutations/__generated__/bosRebalance.generated.tsx | 2 +- .../mutations/__generated__/createThunderPoints.generated.tsx | 2 +- .../mutations/__generated__/updateMultipleFees.generated.tsx | 2 +- .../queries/__generated__/getBoltzSwapStatus.generated.tsx | 2 +- .../queries/__tests__/__snapshots__/queryTests.ts.snap | 4 ++-- src/graphql/types.ts | 4 ++-- src/hooks/UseNodeInfo.tsx | 4 ++-- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/schema/chain/__snapshots__/chain.test.ts.snap b/server/schema/chain/__snapshots__/chain.test.ts.snap index 48ad444a..08e98df6 100644 --- a/server/schema/chain/__snapshots__/chain.test.ts.snap +++ b/server/schema/chain/__snapshots__/chain.test.ts.snap @@ -3,7 +3,7 @@ exports[`Chain Resolvers getChainBalance 1`] = ` Object { "data": Object { - "getChainBalance": 1000000, + "getChainBalance": "1000000", }, "errors": undefined, "extensions": undefined, @@ -18,7 +18,7 @@ Object { exports[`Chain Resolvers getPendingChainBalance 1`] = ` Object { "data": Object { - "getPendingChainBalance": 1000000, + "getPendingChainBalance": "1000000", }, "errors": undefined, "extensions": undefined, diff --git a/server/schema/chain/resolvers.ts b/server/schema/chain/resolvers.ts index 7f7be488..9c1b95d1 100644 --- a/server/schema/chain/resolvers.ts +++ b/server/schema/chain/resolvers.ts @@ -44,7 +44,7 @@ export const chainResolvers = { lnd, }) ); - return value.chain_balance; + return value.chain_balance || 0; }, getPendingChainBalance: async ( _: undefined, @@ -60,7 +60,7 @@ export const chainResolvers = { lnd, }) ); - return pendingValue.pending_chain_balance; + return pendingValue.pending_chain_balance || 0; }, getChainTransactions: async ( _: undefined, diff --git a/server/schema/types.ts b/server/schema/types.ts index a07437d4..dbcc8ab6 100644 --- a/server/schema/types.ts +++ b/server/schema/types.ts @@ -79,8 +79,8 @@ export const queryTypes = gql` getPeers: [peerType] signMessage(message: String!): String verifyMessage(message: String!, signature: String!): String - getChainBalance: Int - getPendingChainBalance: Int + getChainBalance: String! + getPendingChainBalance: String! getChainTransactions: [getTransactionsType] getUtxos: [getUtxosType] getMessages( diff --git a/src/graphql/mutations/__generated__/bosPay.generated.tsx b/src/graphql/mutations/__generated__/bosPay.generated.tsx index 148c4fa9..26760db3 100644 --- a/src/graphql/mutations/__generated__/bosPay.generated.tsx +++ b/src/graphql/mutations/__generated__/bosPay.generated.tsx @@ -7,7 +7,7 @@ export type BosPayMutationVariables = Types.Exact<{ max_fee: Types.Scalars['Int']; max_paths: Types.Scalars['Int']; message?: Types.Maybe; - out?: Types.Maybe>>; + out?: Types.Maybe> | Types.Maybe>; request: Types.Scalars['String']; }>; diff --git a/src/graphql/mutations/__generated__/bosRebalance.generated.tsx b/src/graphql/mutations/__generated__/bosRebalance.generated.tsx index 01d7d21c..ee642db8 100644 --- a/src/graphql/mutations/__generated__/bosRebalance.generated.tsx +++ b/src/graphql/mutations/__generated__/bosRebalance.generated.tsx @@ -4,7 +4,7 @@ import * as Types from '../../types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; export type BosRebalanceMutationVariables = Types.Exact<{ - avoid?: Types.Maybe>>; + avoid?: Types.Maybe> | Types.Maybe>; in_through?: Types.Maybe; is_avoiding_high_inbound?: Types.Maybe; max_fee?: Types.Maybe; diff --git a/src/graphql/mutations/__generated__/createThunderPoints.generated.tsx b/src/graphql/mutations/__generated__/createThunderPoints.generated.tsx index 2eafc4a4..228ff76c 100644 --- a/src/graphql/mutations/__generated__/createThunderPoints.generated.tsx +++ b/src/graphql/mutations/__generated__/createThunderPoints.generated.tsx @@ -6,7 +6,7 @@ import * as Apollo from '@apollo/client'; export type CreateThunderPointsMutationVariables = Types.Exact<{ id: Types.Scalars['String']; alias: Types.Scalars['String']; - uris: Array; + uris: Array | Types.Scalars['String']; public_key: Types.Scalars['String']; }>; diff --git a/src/graphql/mutations/__generated__/updateMultipleFees.generated.tsx b/src/graphql/mutations/__generated__/updateMultipleFees.generated.tsx index 76f64887..6ec9a6e3 100644 --- a/src/graphql/mutations/__generated__/updateMultipleFees.generated.tsx +++ b/src/graphql/mutations/__generated__/updateMultipleFees.generated.tsx @@ -4,7 +4,7 @@ import * as Types from '../../types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; export type UpdateMultipleFeesMutationVariables = Types.Exact<{ - channels: Array; + channels: Array | Types.ChannelDetailInput; }>; diff --git a/src/graphql/queries/__generated__/getBoltzSwapStatus.generated.tsx b/src/graphql/queries/__generated__/getBoltzSwapStatus.generated.tsx index 675a6801..9f2d4a3e 100644 --- a/src/graphql/queries/__generated__/getBoltzSwapStatus.generated.tsx +++ b/src/graphql/queries/__generated__/getBoltzSwapStatus.generated.tsx @@ -4,7 +4,7 @@ import * as Types from '../../types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; export type GetBoltzSwapStatusQueryVariables = Types.Exact<{ - ids: Array>; + ids: Array> | Types.Maybe; }>; diff --git a/src/graphql/queries/__tests__/__snapshots__/queryTests.ts.snap b/src/graphql/queries/__tests__/__snapshots__/queryTests.ts.snap index 7f1fa900..bc7170c3 100644 --- a/src/graphql/queries/__tests__/__snapshots__/queryTests.ts.snap +++ b/src/graphql/queries/__tests__/__snapshots__/queryTests.ts.snap @@ -752,7 +752,7 @@ Object { exports[`Query tests "GET_NODE_INFO" matches snapshot 1`] = ` Object { "data": Object { - "getChainBalance": 1000000, + "getChainBalance": "1000000", "getChannelBalance": Object { "confirmedBalance": 1000000, "pendingBalance": 50000, @@ -771,7 +771,7 @@ Object { "pending_channels_count": 2, "version": "version", }, - "getPendingChainBalance": 1000000, + "getPendingChainBalance": "1000000", }, "errors": undefined, "extensions": undefined, diff --git a/src/graphql/types.ts b/src/graphql/types.ts index cbaba4d5..a527d244 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -83,8 +83,8 @@ export type Query = { getPeers?: Maybe>>; signMessage?: Maybe; verifyMessage?: Maybe; - getChainBalance?: Maybe; - getPendingChainBalance?: Maybe; + getChainBalance: Scalars['String']; + getPendingChainBalance: Scalars['String']; getChainTransactions?: Maybe>>; getUtxos?: Maybe>>; getMessages?: Maybe; diff --git a/src/hooks/UseNodeInfo.tsx b/src/hooks/UseNodeInfo.tsx index bec8f189..f10f85d3 100644 --- a/src/hooks/UseNodeInfo.tsx +++ b/src/hooks/UseNodeInfo.tsx @@ -83,8 +83,8 @@ export const useNodeInfo = (): StatusState => { mayorVersion: mayor, minorVersion: minor, revision: revision, - chainBalance: getChainBalance || 0, - chainPending: getPendingChainBalance || 0, + chainBalance: Number(getChainBalance) || 0, + chainPending: Number(getPendingChainBalance) || 0, channelBalance: confirmedBalance, channelPending: pendingBalance, activeChannelCount: active_channels_count,