mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-12 18:47:30 +00:00
Add a payments plugin to GQL server (#391)
* Add a custom payments plugin in server process * Fix voucher channel read in voucher subscription * Use voucher hash and signature for payment authentication * Use a LRU hash map for storing received vouchers * Avoid hoisting level types to resolve build errors * Upgrade ts-nitro packages * Add payments related logs * Upgrade package versions * Always allow latestBlock query * Upgrade ts-nitro packages
This commit is contained in:
@@ -14,6 +14,7 @@ import { makeExecutableSchema } from '@graphql-tools/schema';
|
||||
|
||||
import { DEFAULT_MAX_GQL_CACHE_SIZE } from './constants';
|
||||
import { ServerConfig } from './config';
|
||||
import { PaymentsManager, paymentsPlugin } from './payments';
|
||||
|
||||
const log = debug('vulcanize:server');
|
||||
|
||||
@@ -21,7 +22,8 @@ export const createAndStartServer = async (
|
||||
app: Application,
|
||||
typeDefs: TypeSource,
|
||||
resolvers: any,
|
||||
serverConfig: ServerConfig
|
||||
serverConfig: ServerConfig,
|
||||
paymentsManager?: PaymentsManager
|
||||
): Promise<ApolloServer> => {
|
||||
const { host, port, gqlCache: gqlCacheConfig, maxSimultaneousRequests, maxRequestQueueLimit } = serverConfig;
|
||||
|
||||
@@ -64,6 +66,8 @@ export const createAndStartServer = async (
|
||||
};
|
||||
}
|
||||
},
|
||||
// Custom payments plugin
|
||||
paymentsPlugin(paymentsManager),
|
||||
// GQL response cache plugin
|
||||
responseCachePlugin(),
|
||||
ApolloServerPluginLandingPageLocalDefault({ embed: true })
|
||||
|
||||
Reference in New Issue
Block a user