thunderhub/server/schema/wallet/resolvers.ts
Anthony Potdevin f80492b80a
refactor: ♻️ server structure (#52)
* refactor: ♻️ change schema

* chore: 🔧 small changes

* chore: 🔧 cleanup

* chore: 🔧 cleanup types

* chore: 🔧 change to absolute imports

Co-authored-by: apotdevin <apotdevincab@gmail.com>
2020-06-01 08:36:33 +02:00

22 lines
650 B
TypeScript

import { getWalletVersion } from 'ln-service';
import { ContextType } from 'server/types/apiTypes';
import { to } from 'server/helpers/async';
import { requestLimiter } from 'server/helpers/rateLimiter';
import { getAuthLnd, getCorrectAuth } from 'server/helpers/helpers';
export const walletResolvers = {
Query: {
getWalletInfo: async (_: undefined, params: any, context: ContextType) => {
await requestLimiter(context.ip, 'getWalletInfo');
const auth = getCorrectAuth(params.auth, context);
const lnd = getAuthLnd(auth);
return await to(
getWalletVersion({
lnd,
})
);
},
},
};