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

chore(deps): bump the npm_and_yarn group with 2 updates #1159

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
95 changes: 79 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"react-i18next": "^12.3.1",
"react-redux": "^9.1.2",
"redis": "^4.7.0",
"redis-om": "^0.4.3"
"redis-om": "^0.4.7",
"ulid": "^2.3.0"
},
"devDependencies": {
"@etherisc/gif-interface": "2.0.0-rc.1-0",
Expand Down
9 changes: 3 additions & 6 deletions src/pages/api/feeless/restake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next";
import { getPendingRestakeRepository } from "../../../utils/feeless/pending_restake";
import { redisClient } from "../../../utils/redis";
import { EntityId } from "redis-om";
import { ulid } from "ulid";

export const STREAM_KEY = process.env.REDIS_QUEUE_STREAM_KEY ?? "feeless:signatures";

Expand Down Expand Up @@ -39,7 +40,8 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {

// store pending application in redis
const repo = await getPendingRestakeRepository();
const savedRestake = await repo.save({
const entityId = ulid();
await repo.save(entityId, {
owner: owner,
stakeNftId: stakeNftId,
targetNftId: targetNftId,
Expand All @@ -48,11 +50,6 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
transactionHash: null,
timestamp: new Date(),
});
const entityId = savedRestake[EntityId];
if (! entityId) {
res.status(500).send("Failed to save pending restake");
return;
}
console.log("created pending restake", signatureId, entityId);

// push message to stream (queue)
Expand Down
26 changes: 14 additions & 12 deletions src/pages/api/feeless/stake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next";
import { redisClient } from "../../../utils/redis";
import { getPendingStakeRepository } from "../../../utils/feeless/pending_stake";
import { EntityId } from "redis-om";
import { ulid } from "ulid";

export const STREAM_KEY = process.env.REDIS_QUEUE_STREAM_KEY ?? "feeless:signatures";

Expand All @@ -13,12 +14,17 @@ export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
if (process.env.NEXT_PUBLIC_FEATURE_GASLESS_TRANSACTION !== 'true') {
res.status(404).send('Unsupported feature');
} else if (req.method === 'POST') {
await handlePost(req, res);
} else {
res.status(405).send('Only POST requests allowed');
try {
if (process.env.NEXT_PUBLIC_FEATURE_GASLESS_TRANSACTION !== 'true') {
res.status(404).send('Unsupported feature');
} else if (req.method === 'POST') {
await handlePost(req, res);
} else {
res.status(405).send('Only POST requests allowed');
}
} catch (err) {
console.log(err);
throw err;
}
}

Expand All @@ -39,7 +45,8 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {

// store pending application in redis
const repo = await getPendingStakeRepository();
const savedStake = await repo.save({
const entityId = ulid();
await repo.save(entityId, {
owner: owner,
targetNftId: targetNftId,
dipAmount: dipAmount,
Expand All @@ -48,11 +55,6 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
transactionHash: null,
timestamp: new Date(),
});
const entityId = savedStake[EntityId];
if (! entityId) {
res.status(500).send("Failed to save pending stake");
return;
}
console.log("created pending stake", signatureId, entityId);

// push message to stream (queue)
Expand Down
Loading