Skip to content
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
14 changes: 14 additions & 0 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,25 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test
env:
CI: true

- name: Install pkg globally
run: npm install -g pkg

- name: Build Next.js
run: npm run build
env:
NODE_ENV: production
# 84532 = Base Sepolia testnet chain ID
NEXT_PUBLIC_CHAIN_ID: ${{ secrets.NEXT_PUBLIC_CHAIN_ID || '84532' }}
NEXT_PUBLIC_CHAIN_NAME: ${{ secrets.NEXT_PUBLIC_CHAIN_NAME || 'Base Sepolia' }}
NEXT_PUBLIC_WALLET_CONNECT_ID: ${{ secrets.NEXT_PUBLIC_WALLET_CONNECT_ID || '' }}
NEXT_PUBLIC_LIRA_TOKEN: ${{ secrets.NEXT_PUBLIC_LIRA_TOKEN || '' }}
NEXT_PUBLIC_FACTORY: ${{ secrets.NEXT_PUBLIC_FACTORY || '' }}
DATABASE_URL: ${{ secrets.DATABASE_URL || 'postgresql://placeholder:placeholder@localhost:5432/lira' }}

- name: Create admin executable
run: |
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions src/pages/api/admin/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default async function handler(
]);

// Group events by day
const eventsByDay = events.reduce((acc, event) => {
const eventsByDay = events.reduce<Record<string, { date: string; count: number }>>((acc, event) => {
const day = event.createdAt.toISOString().split('T')[0];
if (!acc[day]) acc[day] = { date: day, count: 0 };
acc[day].count += 1;
return acc;
}, {} as Record<string, { date: string; count: number }>);
}, {});

res.status(200).json({
token,
Expand Down
8 changes: 4 additions & 4 deletions src/pages/api/admin/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default async function handler(
sum + parseFloat(fee.amount.toString()), 0
);

const feesByToken = feeCollections.reduce((acc, fee) => {
const feesByToken = feeCollections.reduce<Record<string, { tokenAddress: string; tokenName: string; tokenSymbol: string; totalFees: number; transactionCount: number }>>((acc, fee) => {
const addr = fee.tokenAddress;
if (!acc[addr]) {
acc[addr] = {
Expand All @@ -66,10 +66,10 @@ export default async function handler(
acc[addr].totalFees += parseFloat(fee.amount.toString());
acc[addr].transactionCount += 1;
return acc;
}, {} as Record<string, { tokenAddress: string; tokenName: string; tokenSymbol: string; totalFees: number; transactionCount: number }>);
}, {});

// Group by day for charts
const feesByDay = feeCollections.reduce((acc, fee) => {
const feesByDay = feeCollections.reduce<Record<string, { date: string; fees: number; transactions: number }>>((acc, fee) => {
const day = fee.collectedAt.toISOString().split('T')[0];
if (!acc[day]) {
acc[day] = {
Expand All @@ -81,7 +81,7 @@ export default async function handler(
acc[day].fees += parseFloat(fee.amount.toString());
acc[day].transactions += 1;
return acc;
}, {} as Record<string, { date: string; fees: number; transactions: number }>);
}, {});

const chartData = Object.values(feesByDay).sort((a, b) =>
a.date.localeCompare(b.date)
Expand Down
Loading