Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: PRO-2399 sponsorBalance property added to metadata API #106

Merged
merged 7 commits into from
Jun 7, 2024

Conversation

kanthgithub
Copy link
Contributor

@kanthgithub kanthgithub commented Jun 1, 2024

sponsorBalance property added to metadata API

Description

  • Sponsor will deposit the native to entryPoint contract via function-call depositFunds on EtherspotPaymaster
  • This will update the sponsor balance entry for the sponsor-address in EtherspotPaymaster

Types of changes

API Change

  • Metadata API will query sponsor balance of the sponsor via view function call getSponsorBalance on EtherspotPaymaster

  • Metadata API must include the sponsorBalance in the response

  • [ X] Other : add new property in API response for metadata

Testing:

  • Deposit on backend API testing with Polygon Amoy testnet
image image

Copy link

linear bot commented Jun 1, 2024

@kanthgithub kanthgithub self-assigned this Jun 1, 2024
@kanthgithub kanthgithub added the enhancement New feature or request label Jun 1, 2024
Copy link

cloudflare-workers-and-pages bot commented Jun 1, 2024

Deploying arka with  Cloudflare Pages  Cloudflare Pages

Latest commit: 513330a
Status: ✅  Deploy successful!
Preview URL: https://849ee98b.arka-3qg.pages.dev
Branch Preview URL: https://pro-2399-sponsorbalanceinpay.arka-3qg.pages.dev

View logs

@kanthgithub kanthgithub changed the title feat: PRO-2399 query sponsorBalance from EtherspotPaymaster for metad… feat: PRO-2399 sponsorBalance property added to metadata API Jun 1, 2024
@kanthgithub kanthgithub requested a review from vignesha22 June 1, 2024 14:58
@kanthgithub kanthgithub marked this pull request as ready for review June 1, 2024 15:06
@@ -86,8 +86,10 @@ const adminRoutes: FastifyPluginAsync = async (server) => {
resolve(row);
})
})
if (result && result.length > 0)
if (result && result.length > 0){
console.log(`Duplicate record found: ${JSON.stringify(result)}`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls use a logger instead of console.log.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wil be adding logger and update existing console logging to use logger

@@ -127,6 +129,7 @@ const adminRoutes: FastifyPluginAsync = async (server) => {
server.post('/updateKey', async function (request, reply) {
try {
const body: any = JSON.parse(request.body as string);
console.log(`Body: ${JSON.stringify(body)}`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Pls remove or use a logger.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wil be adding logger and update existing console logging to use logger

@@ -101,7 +103,7 @@ const adminRoutes: FastifyPluginAsync = async (server) => {
MULTI_TOKEN_ORACLES, \
TRANSACTION_LIMIT, \
NO_OF_TRANSACTIONS_IN_A_MONTH, \
INDEXER_ENDPOINT) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", [
INDEXER_ENDPOINT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider using an orm instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ch4r10t33r yeap.

@vignesha22
for fastify the orm tool compatible would be objection.js which is built on top of Knex.js
the other ones can be sequelize, prisma

pls share your feedback for orm tool

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will include replacing the native sql to ORM based in a separate feature branch
incrementally with sponsorship policy enhancement (admin backend service to save/query sponsorship policies)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ch4r10t33r yeap.

@vignesha22 for fastify the orm tool compatible would be objection.js which is built on top of Knex.js the other ones can be sequelize, prisma

pls share your feedback for orm tool

Please pick the best one for the job. Whichever has a smaller build size.

@kanthgithub kanthgithub requested a review from ch4r10t33r June 6, 2024 12:54
console.log(body, server.config.ADMIN_WALLET_ADDRESS)
if (ethers.utils.getAddress(body.WALLET_ADDRESS) === server.config.ADMIN_WALLET_ADDRESS) return reply.code(ReturnCode.SUCCESS).send({error: null, message: "Successfully Logged in"});
return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_USER });
if (ethers.utils.getAddress(body.WALLET_ADDRESS) === ethers.utils.getAddress(server.config.ADMIN_WALLET_ADDRESS)) return reply.code(ReturnCode.SUCCESS).send({error: null, message: "Successfully Logged in"}); return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_USER });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls do indentation on this part

Copy link
Contributor

@vignesha22 vignesha22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one indentation part which was missing other than LGTM pls change that and then merge this PR

@kanthgithub kanthgithub merged commit ecb5515 into master Jun 7, 2024
4 checks passed
@kanthgithub kanthgithub deleted the PRO-2399-SponsorBalanceInPaymaster branch June 7, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants