add lightning

This commit is contained in:
keyan 2021-04-29 16:58:43 -05:00
parent 057bb0f10a
commit bf73e98425
5 changed files with 875 additions and 39 deletions

12
api/lnd/index.js Normal file
View File

@ -0,0 +1,12 @@
import lndService from 'ln-service'
if (!global.lnd) {
const { lnd } = lndService.authenticatedLndGrpc({
cert: process.env.LND_CERT,
macaroon: process.env.LND_MACAROON,
socket: process.env.LND_SOCKET
})
global.lnd = lnd
}
export default global.lnd

View File

@ -1,14 +1,7 @@
import { PrismaClient } from '@prisma/client'
let prisma
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient()
} else {
if (!global.prisma) {
global.prisma = new PrismaClient()
}
prisma = global.prisma
if (!global.prisma) {
global.prisma = new PrismaClient()
}
export default prisma
export default global.prisma

View File

@ -14,6 +14,7 @@
"bootstrap": "^4.6.0",
"formik": "^2.2.6",
"graphql": "^15.5.0",
"ln-service": "^51.7.0",
"next": "10.0.9",
"next-auth": "^3.13.3",
"react": "17.0.1",

View File

@ -1,6 +1,7 @@
import { ApolloServer } from 'apollo-server-micro'
import resolvers from '../../api/resolvers'
import models from '../../api/models'
import lnd from '../../api/lnd'
import typeDefs from '../../api/typeDefs'
import { getSession } from 'next-auth/client'
@ -12,6 +13,7 @@ const apolloServer = new ApolloServer({
const session = await getSession({ req })
return {
models,
lnd,
me: session ? session.user : null
}
}

886
yarn.lock

File diff suppressed because it is too large Load Diff