From e627d92f870d7a67483e3e260fc38ff474ac2fe4 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar <48001923+nikhilkumar1612@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:57:23 +0530 Subject: [PATCH] ft: adding default bundler key for /saveKey endpoint (#146) --- backend/package.json | 2 +- backend/src/plugins/config.ts | 7 +++++-- backend/src/routes/admin-routes.ts | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/package.json b/backend/package.json index 05aebe2..a496b66 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "arka", - "version": "1.6.5", + "version": "1.6.6", "description": "ARKA - (Albanian for Cashier's case) is the first open source Paymaster as a service software", "type": "module", "directories": { diff --git a/backend/src/plugins/config.ts b/backend/src/plugins/config.ts index 71097af..c0a7d87 100644 --- a/backend/src/plugins/config.ts +++ b/backend/src/plugins/config.ts @@ -31,7 +31,8 @@ const ConfigSchema = Type.Strict( EPV_07: Type.Array(Type.String()) || ['0x0000000071727De22E5E9d8BAf0edAc6f37da032'], DELETE_KEY_RECOVER_WINDOW: Type.Number(), KMS_KEY_ID: Type.String() || undefined, - USE_KMS: Type.Boolean() || false + USE_KMS: Type.Boolean() || false, + DEFAULT_BUNDLER_API_KEY: Type.String() }) ); @@ -68,6 +69,7 @@ const configPlugin: FastifyPluginAsync = async (server) => { DELETE_KEY_RECOVER_WINDOW: process.env.DELETE_KEY_RECOVER_WINDOW, KMS_KEY_ID: process.env.KMS_KEY_ID, USE_KMS: process.env.USE_KMS, + DEFAULT_BUNDLER_API_KEY: process.env.DEFAULT_BUNDLER_API_KEY } const valid = validate(envVar); @@ -99,7 +101,8 @@ const configPlugin: FastifyPluginAsync = async (server) => { EPV_07: process.env.EPV_07?.split(',') ?? ['0x0000000071727De22E5E9d8BAf0edAc6f37da032'], DELETE_KEY_RECOVER_WINDOW: parseInt(process.env.DELETE_KEY_RECOVER_WINDOW || '7'), KMS_KEY_ID: process.env.KMS_KEY_ID ?? '', - USE_KMS: process.env.USE_KMS === 'true' + USE_KMS: process.env.USE_KMS === 'true', + DEFAULT_BUNDLER_API_KEY: process.env.DEFAULT_BUNDLER_API_KEY ?? '' } server.log.info(config, "config:"); diff --git a/backend/src/routes/admin-routes.ts b/backend/src/routes/admin-routes.ts index 83a7528..b4e775b 100644 --- a/backend/src/routes/admin-routes.ts +++ b/backend/src/routes/admin-routes.ts @@ -127,7 +127,8 @@ const adminRoutes: FastifyPluginAsync = async (server) => { SecretString: JSON.stringify({ PRIVATE_KEY: privateKey, PUBLIC_ADDRESS: publicAddress, - MNEMONIC: mnemonic + MNEMONIC: mnemonic, + BUNDLER_API_KEY: server.config.DEFAULT_BUNDLER_API_KEY }), });