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