Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions backend/src/routes/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ function normalizePriceUsdc(value) {
return normalized;
}

function annotateTtlWarning(service, currentLedger) {
if (currentLedger == null) return service;
const expiry = service.registered_at + SERVICE_MAX_TTL;
const warnAt = expiry - SERVICE_TTL_WARNING_LEDGERS;
return { ...service, ttl_warning: currentLedger >= warnAt };
}

function parsePositiveSafeInteger(value) {
if (typeof value === "number") {
return Number.isSafeInteger(value) && value > 0 ? value : null;
Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/RegistryPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function makeServices(count: number) {
provider: `G${'A'.repeat(55)}`,
reputation: 100,
active: true,

registered_at: 1000,
}));
}

Expand Down
11 changes: 11 additions & 0 deletions frontend/lib/sort.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import { sortServices, sortAgents, sortServicesWithTieBreaker, sortAgentsWithTieBreaker } from './sort';
import type { ServiceEntry, AgentEntry, SortOption, AgentSortOption } from './types';

function makeAgent(overrides: Partial<AgentEntry> = {}): AgentEntry {
return {
address: 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWFL',
score: 0,
total_payments: '0',
registered_at: '100',
active: true,
...overrides,
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

function makeService(overrides: Partial<ServiceEntry> = {}): ServiceEntry {
return {
id: 1,
Expand Down
Loading