[mining] send pool unique id in /pools API

This commit is contained in:
nymkappa 2023-07-31 11:06:52 +09:00
parent f8faccd502
commit d236d89717
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
4 changed files with 5 additions and 1 deletions

View File

@ -107,6 +107,7 @@ class Mining {
slug: poolInfo.slug, slug: poolInfo.slug,
avgMatchRate: poolInfo.avgMatchRate !== null ? Math.round(100 * poolInfo.avgMatchRate) / 100 : null, avgMatchRate: poolInfo.avgMatchRate !== null ? Math.round(100 * poolInfo.avgMatchRate) / 100 : null,
avgFeeDelta: poolInfo.avgFeeDelta, avgFeeDelta: poolInfo.avgFeeDelta,
poolUniqueId: poolInfo.poolUniqueId
}; };
poolsStats.push(poolStat); poolsStats.push(poolStat);
}); });

View File

@ -20,6 +20,7 @@ export interface PoolInfo {
slug: string; slug: string;
avgMatchRate: number | null; avgMatchRate: number | null;
avgFeeDelta: number | null; avgFeeDelta: number | null;
poolUniqueId: number;
} }
export interface PoolStats extends PoolInfo { export interface PoolStats extends PoolInfo {

View File

@ -40,7 +40,8 @@ class PoolsRepository {
pools.link AS link, pools.link AS link,
slug, slug,
AVG(blocks_audits.match_rate) AS avgMatchRate, AVG(blocks_audits.match_rate) AS avgMatchRate,
AVG((CAST(blocks.fees as SIGNED) - CAST(blocks_audits.expected_fees as SIGNED)) / NULLIF(CAST(blocks_audits.expected_fees as SIGNED), 0)) AS avgFeeDelta AVG((CAST(blocks.fees as SIGNED) - CAST(blocks_audits.expected_fees as SIGNED)) / NULLIF(CAST(blocks_audits.expected_fees as SIGNED), 0)) AS avgFeeDelta,
unique_id as poolUniqueId
FROM blocks FROM blocks
JOIN pools on pools.id = pool_id JOIN pools on pools.id = pool_id
LEFT JOIN blocks_audits ON blocks_audits.height = blocks.height LEFT JOIN blocks_audits ON blocks_audits.height = blocks.height

View File

@ -111,6 +111,7 @@ export interface PoolInfo {
regexes: string; // JSON array regexes: string; // JSON array
addresses: string; // JSON array addresses: string; // JSON array
emptyBlocks: number; emptyBlocks: number;
poolUniqueId: number;
} }
export interface PoolStat { export interface PoolStat {
pool: PoolInfo; pool: PoolInfo;