Skip to content

Commit

Permalink
added multiTokenPaymaster metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
vignesha22 committed Apr 9, 2024
1 parent e76b24a commit 022094d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/src/routes/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
if (!chainId)
return reply.code(ReturnCode.FAILURE).send({error: ErrorMessage.INVALID_DATA})
let customPaymasters = [];
let multiTokenPaymasters = [];
let multiTokenOracles = [];
let privateKey = '';
let supportedNetworks;
if (!unsafeMode) {
Expand All @@ -50,6 +52,10 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
const buffer = Buffer.from(secrets['ERC20_PAYMASTERS'], 'base64');
customPaymasters = JSON.parse(buffer.toString());
}
if (secrets['MULTI_TOKEN_PAYMASTERS']) {
const buffer = Buffer.from(secrets['MULTI_TOKEN_PAYMASTERS'], 'base64');
multiTokenPaymasters = JSON.parse(buffer.toString());
}
privateKey = secrets['PRIVATE_KEY'];
supportedNetworks = secrets['SUPPORTED_NETWORKS'];
} else {
Expand All @@ -62,6 +68,10 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
const buffer = Buffer.from(record['ERC20_PAYMASTERS'], 'base64');
customPaymasters = JSON.parse(buffer.toString());
}
if (record['MULTI_TOKEN_PAYMASTERS']) {
const buffer = Buffer.from(record['MULTI_TOKEN_PAYMASTERS'], 'base64');
multiTokenPaymasters = JSON.parse(buffer.toString());
}
privateKey = decode(record['PRIVATE_KEY']);
supportedNetworks = record['SUPPORTED_NETWORKS'];
}
Expand Down Expand Up @@ -95,6 +105,7 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
sponsorWalletBalance: balance,
chainsSupported: chainsSupported,
tokenPaymasters: tokenPaymasterAddresses,
multiTokenPaymasters,
})
} catch (err: any) {
request.log.error(err);
Expand Down

0 comments on commit 022094d

Please sign in to comment.