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

PRO-2723 - Standardisation #162

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# Changelog
## [2.1.1] - 2025-01-09
### Breaking Changes
- changed `pimlicoAddress` endpoint name to `tokenPaymasterAddress` the functionality remains the same
- Changed the following endpoint names to be camelCases:-
- `/policy/wallet-address/:walletAddress` to `/policy/walletAddress/:walletAddress`
- `/policy/wallet-address/:walletAddress/ep-version/:epVersion` to `/policy/walletAddress/:walletAddress/epVersion/:epVersion`
- `/policy/wallet-address/:walletAddress/ep-version/:epVersion/chain-id/:chainId` to `/policy/walletAddress/:walletAddress/epVersion/:epVersion/chainId/:chainId`
- `/policy/wallet-address/:walletAddress/latest` to `/policy/walletAddress/:walletAddress/latest`
- `/policy/wallet-address/:walletAddress/chain-id/:chainId/latest` to `/policy/walletAddress/:walletAddress/chainId/:chainId/latest`
- `/policy/wallet-address/:walletAddress/ep-version/:epVersion/latest` to `/policy/walletAddress/:walletAddress/epVersion/:epVersion/latest`
- `/policy/wallet-address/:walletAddress/ep-version/:epVersion/chainId/:chain-id/latest` to `/policy/walletAddress/:walletAddress/epVersion/:epVersion/chainId/:chainId/latest`
- `/add-policy` to `/addPolicy`
- `/delete-policy/:id` to `/deletePolicy/:id`
- `/update-policy` to `/updatePolicy`
- `/enable-policy/:id` to `/enablePolicy/:id`
- `/disable-policy/:id` to `/disablePolicy/:id`

## [1.8.0] - 2024-12-25
### Breaking changes
- removed `/whitelist/v1`, `/removeWhitelist/v1`, `/checkWhitelist/v1` endpoints.
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arka",
"version": "2.0.0",
"version": "2.1.1",
"description": "ARKA - (Albanian for Cashier's case) is the first open source Paymaster as a service software",
"type": "module",
"directories": {
Expand Down
6 changes: 3 additions & 3 deletions backend/src/routes/pimlico-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const pimlicoRoutes: FastifyPluginAsync = async (server) => {
}
}

server.post("/pimlicoAddress",
server.post("/tokenPaymasterAddress",
ResponseSchema,
async function (request, reply) {
try {
printRequest("/pimlicoAddress", request, server.log);
printRequest("/tokenPaymasterAddress", request, server.log);
const query: any = request.query;
const body: any = request.body;
const entryPoint = body.params[0];
Expand Down Expand Up @@ -99,7 +99,7 @@ const pimlicoRoutes: FastifyPluginAsync = async (server) => {
if (!(PAYMASTER_ADDRESS[chainId] && PAYMASTER_ADDRESS[chainId][gasToken])) return reply.code(ReturnCode.FAILURE).send({ error: "Invalid network/token" })
result = { message: PAYMASTER_ADDRESS[chainId][gasToken] }
}
server.log.info(result, 'PimlicoAddress Response sent: ');
server.log.info(result, 'tokenPaymasterAddress Response sent: ');
if (body.jsonrpc)
return reply.code(ReturnCode.SUCCESS).send({ jsonrpc: body.jsonrpc, id: body.id, message: result.message, error: null })
return reply.code(ReturnCode.SUCCESS).send(result);
Expand Down
24 changes: 12 additions & 12 deletions backend/src/routes/sponsorship-policy-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// find all by walletAddress
server.get<{ Params: RouteParams }>("/policy/wallet-address/:walletAddress", async (request, reply) => {
server.get<{ Params: RouteParams }>("/policy/walletAddress/:walletAddress", async (request, reply) => {
try {
const walletAddress = request.params.walletAddress;

Expand All @@ -74,7 +74,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// find all by walletAddress And EPVersion
server.get<{ Params: RouteParams }>("/policy/wallet-address/:walletAddress/ep-version/:epVersion", async (request, reply) => {
server.get<{ Params: RouteParams }>("/policy/walletAddress/:walletAddress/epVersion/:epVersion", async (request, reply) => {
try {
const walletAddress = request.params.walletAddress;
const epVersion = request.params.epVersion;
Expand All @@ -96,7 +96,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// Get all policies for a given walletAddress, epVersion, and chainId
server.get<{ Params: RouteParams }>("/policy/wallet-address/:walletAddress/ep-version/:epVersion/chain-id/:chainId", async (request, reply) => {
server.get<{ Params: RouteParams }>("/policy/walletAddress/:walletAddress/epVersion/:epVersion/chainId/:chainId", async (request, reply) => {
try {
const walletAddress = request.params.walletAddress;
const epVersion = request.params.epVersion;
Expand All @@ -119,7 +119,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// find latest by walletAddress
server.get<{ Params: RouteParams }>("/policy/wallet-address/:walletAddress/latest", async (request, reply) => {
server.get<{ Params: RouteParams }>("/policy/walletAddress/:walletAddress/latest", async (request, reply) => {
try {
const walletAddress = request.params.walletAddress;

Expand All @@ -140,7 +140,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// find latest by walletAddress And chainId
server.get<{ Params: RouteParams }>("/policy/wallet-address/:walletAddress/chain-id/:chainId/latest", async (request, reply) => {
server.get<{ Params: RouteParams }>("/policy/walletAddress/:walletAddress/chainId/:chainId/latest", async (request, reply) => {
try {
const walletAddress = request.params.walletAddress;
const chainId = request.params.chainId;
Expand All @@ -162,7 +162,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// find latest By WalletAddress And EPVersion
server.get<{ Params: RouteParams }>("/policy/wallet-address/:walletAddress/ep-version/:epVersion/latest", async (request, reply) => {
server.get<{ Params: RouteParams }>("/policy/walletAddress/:walletAddress/epVersion/:epVersion/latest", async (request, reply) => {
try {
const walletAddress = request.params.walletAddress;
const epVersion = request.params.epVersion;
Expand All @@ -184,7 +184,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// find latest policy for a given walletAddress, epVersion, and chainId
server.get<{ Params: RouteParams }>("/policy/wallet-address/:walletAddress/ep-version/:epVersion/chain-id/:chainId/latest", async (request, reply) => {
server.get<{ Params: RouteParams }>("/policy/walletAddress/:walletAddress/epVersion/:epVersion/chainId/:chainId/latest", async (request, reply) => {
try {
const walletAddress = request.params.walletAddress;
const epVersion = request.params.epVersion;
Expand Down Expand Up @@ -236,7 +236,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
}

// create a new policy
server.post("/add-policy", async function (request, reply) {
server.post("/addPolicy", async function (request, reply) {
try {
// parse the request body as JSON
const sponsorshipPolicyDto: SponsorshipPolicyDto = JSON.parse(JSON.stringify(request.body)) as SponsorshipPolicyDto;
Expand Down Expand Up @@ -304,7 +304,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
})

// delete a policy
server.delete<{ Params: RouteParams }>("/delete-policy/:id", async (request, reply) => {
server.delete<{ Params: RouteParams }>("/deletePolicy/:id", async (request, reply) => {
try {
const id = Number(request.params.id);
if (isNaN(id)) {
Expand Down Expand Up @@ -341,7 +341,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
});

// update a policy
server.put<{ Body: SponsorshipPolicyDto }>("/update-policy", async (request, reply) => {
server.put<{ Body: SponsorshipPolicyDto }>("/updatePolicy", async (request, reply) => {
try {
const sponsorshipPolicyDto: SponsorshipPolicyDto = JSON.parse(JSON.stringify(request.body)) as SponsorshipPolicyDto;
const id = sponsorshipPolicyDto.id;
Expand Down Expand Up @@ -382,7 +382,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
});

// enable policy
server.put<{ Params: RouteParams }>("/enable-policy/:id", async (request, reply) => {
server.put<{ Params: RouteParams }>("/enablePolicy/:id", async (request, reply) => {
try {
const id = Number(request.params.id);
if (isNaN(id)) {
Expand Down Expand Up @@ -419,7 +419,7 @@ const sponsorshipPolicyRoutes: FastifyPluginAsync = async (server) => {
});

// disable policy
server.put<{ Params: RouteParams }>("/disable-policy/:id", async (request, reply) => {
server.put<{ Params: RouteParams }>("/disablePolicy/:id", async (request, reply) => {
try {
const id = Number(request.params.id);
if (isNaN(id)) {
Expand Down
Loading