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:
prathamesh0
2023-07-20 17:22:48 +05:30
committed by GitHub
parent 11930c0107
commit eec1965980
18 changed files with 369 additions and 34 deletions
+5 -1
View File
@@ -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 })