Skip to content

Commit

Permalink
Merge branch 'master' into PRO-2862-Coingecko-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vignesha22 authored Jan 6, 2025
2 parents be701d0 + ccacb0b commit 754206f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion backend/src/paymaster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ export class Paymaster {
throw new Error(ErrorMessage.ERROR_ON_SUBMITTING_TXN);
}
}

async deployVp(
privateKey: string,
bundlerRpcUrl: string,
Expand Down
7 changes: 4 additions & 3 deletions backend/src/routes/metadata-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
const vpContract = new Contract(verifyingPaymaster, verifyingPaymasterAbi ,provider);
verifyingPaymasterDeposit = await vpContract.getDeposit();
}

const chainsSupported: { chainId: number, entryPoint: string }[] = [];
if (supportedNetworks) {
const buffer = Buffer.from(supportedNetworks, 'base64');
Expand Down Expand Up @@ -200,7 +199,6 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
//get native balance of the sponsor in the EtherSpotPaymaster-contract
const paymasterContract = new Contract(networkConfig.contracts.etherspotPaymasterAddress, EtherspotAbi.default, provider);
const sponsorBalance = await paymasterContract.getDeposit();

const chainsSupported: { chainId: number, entryPoint: string }[] = [];
if (supportedNetworks) {
const buffer = Buffer.from(supportedNetworks, 'base64');
Expand All @@ -224,7 +222,10 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
chainsSupported: chainsSupported,
tokenPaymasters: tokenPaymasterAddresses,
multiTokenPaymasters,
sponsorDetails: { name: sponsorName, icon: sponsorImage }
sponsorDetails: { name: sponsorName, icon: sponsorImage },
verifyingPaymaster: { address: verifyingPaymaster, deposit: verifyingPaymasterDeposit },
verifyingPaymasters: apiKeyEntity.verifyingPaymasters ? JSON.parse(apiKeyEntity.verifyingPaymasters) : undefined,
verifyingPaymastersV2: apiKeyEntity.verifyingPaymastersV2 ? JSON.parse(apiKeyEntity.verifyingPaymastersV2) : undefined,
})
} catch (err: any) {
request.log.error(err);
Expand Down
6 changes: 6 additions & 0 deletions backend/src/routes/whitelist-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,12 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => {
);
const secrets = JSON.parse(AWSresponse.SecretString ?? '{}');
if (!secrets['PRIVATE_KEY']) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY })
if (secrets['BUNDLER_API_KEY']) bundlerApiKey = secrets['BUNDLER_API_KEY'];
privateKey = secrets['PRIVATE_KEY'];
} else {
if (apiKeyEntity.bundlerApiKey) {
bundlerApiKey = apiKeyEntity.bundlerApiKey;
}
privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET);
}
if (!privateKey) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY })
Expand Down Expand Up @@ -252,8 +256,10 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => {
);
const secrets = JSON.parse(AWSresponse.SecretString ?? '{}');
if (!secrets['PRIVATE_KEY']) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY })
if (secrets['BUNDLER_API_KEY']) bundlerApiKey = secrets['BUNDLER_API_KEY'];
privateKey = secrets['PRIVATE_KEY'];
} else {
if (apiKeyEntity.bundlerApiKey) bundlerApiKey = apiKeyEntity.bundlerApiKey;
privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET);
}
if (apiKeyEntity.bundlerApiKey) bundlerApiKey = apiKeyEntity.bundlerApiKey;
Expand Down
8 changes: 3 additions & 5 deletions backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ const initializeServer = async (): Promise<void> => {
healthcheckUrl: "/healthcheck",
logLevel: "warn"
});

// Register the sequelizePlugin
await server.register(sequelizePlugin);

// Synchronize all models
await server.sequelize.sync();

server.log.info('registered sequelizePlugin...')

const paymaster = new Paymaster(server.config.FEE_MARKUP, server.config.MULTI_TOKEN_MARKUP, server.config.EP7_TOKEN_VGL, server.config.EP7_TOKEN_PGL, server.sequelize);

Expand All @@ -79,8 +81,6 @@ const initializeServer = async (): Promise<void> => {

await server.register(sponsorshipPolicyRoutes);

server.log.info('registered sequelizePlugin...')

const arkaConfigRepository = new ArkaConfigRepository(server.sequelize);

await server.register(fastifyCron, {
Expand Down Expand Up @@ -337,8 +337,6 @@ const initializeServer = async (): Promise<void> => {
name: 'updateTokenOracleData',
cronTime: process.env.TOKEN_ORACLE_UPDATE_CRON_EXP || '*/7 * * * *', // every 7 mins.
onTick: async () => {
if (!server.config.MULTI_TOKEN_PAYMASTERS && !server.config.MULTI_TOKEN_ORACLES)
return;
let buffer = Buffer.from(server.config.MULTI_TOKEN_PAYMASTERS, 'base64');
const multiTokenPaymasters = JSON.parse(buffer.toString());

Expand Down

0 comments on commit 754206f

Please sign in to comment.