This commit is contained in:
Reihan 2025-03-01 17:40:31 +07:00
parent 8f22a3881a
commit 94b3aa9c11
2 changed files with 9 additions and 8 deletions

4
.env.example Normal file
View File

@ -0,0 +1,4 @@
SUPABASE_URL=https://supabase.dev3vds1.link
SUPABASE_ANON_KEY=AnonKey
TOKEN_ADDRESS=TokenAddress
SOLSCAN_API_KEY=SolscanAPIKey

View File

@ -1,5 +1,5 @@
const path = require("path"); const path = require("path");
require("dotenv").config({ path: path.resolve(__dirname, "../.env") }); require("dotenv").config({ path: path.resolve(__dirname, ".env") });
const express = require("express"); const express = require("express");
const axios = require("axios"); const axios = require("axios");
@ -7,10 +7,7 @@ const cron = require("node-cron");
const { createClient } = require("@supabase/supabase-js"); const { createClient } = require("@supabase/supabase-js");
// Setup // Setup
const supabase = createClient( const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY);
"https://supabase.dev3vds1.link",
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTczODIyODg2MCwiZXhwIjo0ODkzOTAyNDYwLCJyb2xlIjoiYW5vbiJ9.QZCW7j6MD6RzJheDuDC8X2ecum97LH5fQKdPnyYFzL4"
);
const app = express(); const app = express();
app.use(express.json()); app.use(express.json());
// Setup end // Setup end
@ -21,14 +18,14 @@ const fetchSolscanTransactions = async (page = 1) => {
method: "get", method: "get",
url: "https://pro-api.solscan.io/v2.0/token/transfer", url: "https://pro-api.solscan.io/v2.0/token/transfer",
params: { params: {
address: "7D1iYWfhw2cr9yBZBFE6nZaaSUvXHqG5FizFFEZwpump", address: process.env.TOKEN_ADDRESS,
page, page,
page_size: "100", page_size: "100",
sort_by: "block_time", sort_by: "block_time",
sort_order: "desc", sort_order: "desc",
}, },
headers: { headers: {
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdGVkQXQiOjE3MzAwNDg4Njc1ODUsImVtYWlsIjoic2hpYWxvdGhAZ21haWwuY29tIiwiYWN0aW9uIjoidG9rZW4tYXBpIiwiYXBpVmVyc2lvbiI6InYyIiwiaWF0IjoxNzMwMDQ4ODY3fQ.JKKAyBvlfB68zMidRipBfXv2l-a_eEIA3gAU5wxusyQ", token: process.env.SOLSCAN_API_KEY,
}, },
}; };
@ -364,6 +361,6 @@ cron.schedule("*/1 * * * *", async () => {
// Start server // Start server
app.listen(3000, () => { app.listen(3000, () => {
console.log("Server running on port 3001"); console.log("Server running on port 3000");
}); });
// Start server end // Start server end