Skip to content

Commit

Permalink
remove unnecessary pubkey checks on helius api
Browse files Browse the repository at this point in the history
  • Loading branch information
armaniferrante committed Feb 10, 2023
1 parent 2c2f01f commit 69b7b1c
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions backend/native/backpack-api/src/routes/v1/tx-parsing.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
import express from "express";

import { ensureHasPubkeyAccess, extractUserId } from "../../auth/middleware";
import { HELIUS_API_KEY } from "../../config";

const router = express.Router();

const HELIUS_API_URL = "https://api.helius.xyz/v0";

router.get(
"/transactions",
extractUserId,
ensureHasPubkeyAccess,
async (req, res) => {
try {
const publicKey = req.query.publicKey;
const url = `${HELIUS_API_URL}/addresses/${publicKey}/transactions?api-key=${HELIUS_API_KEY}`;
router.get("/transactions", async (req, res) => {
try {
const publicKey = req.query.publicKey;
const url = `${HELIUS_API_URL}/addresses/${publicKey}/transactions?api-key=${HELIUS_API_KEY}`;

const response = await fetch(url);
const json = await response.json();
const response = await fetch(url);
const json = await response.json();

res.json({
transactions: json,
});
} catch (err) {
res.json({
transactions: [],
});
}
res.json({
transactions: json,
});
} catch (err) {
res.json({
transactions: [],
});
}
);
});

router.get("/nftMetadata", async (req, res) => {
try {
Expand Down

1 comment on commit 69b7b1c

@vercel
Copy link

@vercel vercel bot commented on 69b7b1c Feb 10, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.