Skip to content

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecot committed Dec 12, 2024
1 parent 33ebefa commit 324fa00
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
3 changes: 2 additions & 1 deletion src/indexer/lavarpc_agregators/SupplyProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ async function getPoolsAmount(client: LavaClient): Promise<bigint> {

let totalAmount = 0n;

// check why iprpc pools are missin
pools.pools.forEach((pool: any) => {
if (["validators_rewards_distribution_pool", "validators_rewards_allocation_pool", "providers_rewards_distribution_pool", "providers_rewards_allocation_pool"].includes(pool.name)) {
totalAmount += BigInt(pool.balance[0].amount);
}
});
})

return totalAmount;
}
Expand Down
2 changes: 1 addition & 1 deletion src/query/handlers/ajax/listProvidersHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const ListProvidersRawHandlerOpts: RouteShorthandOptions = {
addons: { type: 'string' },
extensions: { type: 'string' },
delegateCommission: { type: 'string' },
delegateLimit: { type: 'string' },
// delegateLimit: { type: 'string' },
delegateTotal: { type: 'string' },
},
required: ['spec', 'moniker']
Expand Down
18 changes: 9 additions & 9 deletions src/query/handlers/provider/providerStakesHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { queryJsinfo } from '@jsinfo/utils/db';

type ProviderStakesResponse = {
stake: string | null;
delegateLimit: string | null;
// delegateLimit: string | null;
delegateTotal: string | null;
delegateCommission: string | null;
totalStake: string | null;
Expand Down Expand Up @@ -44,9 +44,9 @@ export const ProviderStakesPaginatedHandlerOpts: RouteShorthandOptions = {
stake: {
type: ['string', 'null']
},
delegateLimit: {
type: ['string', 'null']
},
// delegateLimit: {
// type: ['string', 'null']
// },
delegateTotal: {
type: ['string', 'null']
},
Expand Down Expand Up @@ -110,7 +110,7 @@ class ProviderStakesData extends RequestHandlerBase<ProviderStakesResponse> {
let stakesRes = await queryJsinfo(
async (db) => await db.select({
stake: JsinfoSchema.providerStakes.stake,
delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
// delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
delegateTotal: JsinfoSchema.providerStakes.delegateTotal,
delegateCommission: JsinfoSchema.providerStakes.delegateCommission,
appliedHeight: JsinfoSchema.providerStakes.appliedHeight,
Expand All @@ -134,7 +134,7 @@ class ProviderStakesData extends RequestHandlerBase<ProviderStakesResponse> {
const processedRes = stakesRes.map(item => ({
...item,
stake: BigIntIsZero(item.stake) ? "0" : item.stake?.toString() ?? "0",
delegateLimit: BigIntIsZero(item.delegateLimit) ? "0" : item.delegateLimit?.toString() ?? "0",
// delegateLimit: BigIntIsZero(item.delegateLimit) ? "0" : item.delegateLimit?.toString() ?? "0",
delegateTotal: BigIntIsZero(item.delegateTotal) ? "0" : item.delegateTotal?.toString() ?? "0",
delegateCommission: BigIntIsZero(item.delegateCommission) ? "0" : item.delegateCommission?.toString() ?? "0",
totalStake: BigIntIsZero(item.totalStake) ? "0" : item.totalStake?.toString() ?? "0",
Expand Down Expand Up @@ -179,7 +179,7 @@ class ProviderStakesData extends RequestHandlerBase<ProviderStakesResponse> {
addons: JsinfoSchema.providerStakes.addons,
extensions: JsinfoSchema.providerStakes.extensions,
stake: JsinfoSchema.providerStakes.stake,
delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
// delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
delegateTotal: JsinfoSchema.providerStakes.delegateTotal,
delegateCommission: JsinfoSchema.providerStakes.delegateCommission,
totalStake: sql`totalStake`
Expand All @@ -200,7 +200,7 @@ class ProviderStakesData extends RequestHandlerBase<ProviderStakesResponse> {
const stakesRes = await queryJsinfo(
async (db) => await db.select({
stake: JsinfoSchema.providerStakes.stake,
delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
// delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
delegateTotal: JsinfoSchema.providerStakes.delegateTotal,
delegateCommission: JsinfoSchema.providerStakes.delegateCommission,
appliedHeight: JsinfoSchema.providerStakes.appliedHeight,
Expand All @@ -224,7 +224,7 @@ class ProviderStakesData extends RequestHandlerBase<ProviderStakesResponse> {
const processedRes = stakesRes.map(item => ({
...item,
stake: BigIntIsZero(item.stake) ? "0" : item.stake?.toString() ?? "0",
delegateLimit: BigIntIsZero(item.delegateLimit) ? "0" : item.delegateLimit?.toString() ?? "0",
// delegateLimit: BigIntIsZero(item.delegateLimit) ? "0" : item.delegateLimit?.toString() ?? "0",
delegateTotal: BigIntIsZero(item.delegateTotal) ? "0" : item.delegateTotal?.toString() ?? "0",
delegateCommission: BigIntIsZero(item.delegateCommission) ? "0" : item.delegateCommission?.toString() ?? "0",
totalStake: BigIntIsZero(item.totalStake) ? "0" : item.totalStake?.toString() ?? "0",
Expand Down
12 changes: 6 additions & 6 deletions src/query/handlers/spec/specStakesHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { queryJsinfo } from '@jsinfo/utils/db';

export type SpecSpecsResponse = {
stake: string;
delegateLimit: string;
// delegateLimit: string;
delegateTotal: string;
delegateCommission: string;
totalStake: string;
Expand Down Expand Up @@ -47,9 +47,9 @@ export const SpecStakesPaginatedHandlerOpts: RouteShorthandOptions = {
stake: {
type: ['string', 'null']
},
delegateLimit: {
type: ['string', 'null']
},
// delegateLimit: {
// type: ['string', 'null']
// },
delegateTotal: {
type: ['string', 'null']
},
Expand Down Expand Up @@ -117,7 +117,7 @@ export async function SpecStakesPaginatedHandler(request: FastifyRequest, reply:
const [stakesRes, aggRes90Days, aggRes30Days] = await Promise.all([
queryJsinfo(db => db.select({
stake: JsinfoSchema.providerStakes.stake,
delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
// delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
delegateTotal: JsinfoSchema.providerStakes.delegateTotal,
delegateCommission: JsinfoSchema.providerStakes.delegateCommission,
totalStake: sql<bigint>`( ${JsinfoSchema.providerStakes.stake} + ${JsinfoSchema.providerStakes.delegateTotal} ) as totalStake`,
Expand Down Expand Up @@ -185,7 +185,7 @@ export async function SpecStakesPaginatedHandler(request: FastifyRequest, reply:
return {
...itemStakesRes,
stake: BigIntIsZero(itemStakesRes.stake) ? "0" : itemStakesRes.stake?.toString() ?? "0",
delegateLimit: BigIntIsZero(itemStakesRes.delegateLimit) ? "0" : itemStakesRes.delegateLimit?.toString() ?? "0",
// delegateLimit: BigIntIsZero(itemStakesRes.delegateLimit) ? "0" : itemStakesRes.delegateLimit?.toString() ?? "0",
delegateTotal: BigIntIsZero(itemStakesRes.delegateTotal) ? "0" : itemStakesRes.delegateTotal?.toString() ?? "0",
delegateCommission: BigIntIsZero(itemStakesRes.delegateCommission) ? "0" : itemStakesRes.delegateCommission?.toString() ?? "0",
totalStake: BigIntIsZero(itemStakesRes.totalStake) ? "0" : itemStakesRes.totalStake?.toString() ?? "0",
Expand Down
1 change: 0 additions & 1 deletion src/redis/classes/RedisResourceBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export abstract class RedisResourceBase<T, A extends BaseArgs = BaseArgs> {
RedisResourceBase.activeFetches.set(key, fetchPromise);

return await fetchPromise;

}

private async orchestrateFetch(args: A | undefined, key: string): Promise<T | null> {
Expand Down
8 changes: 4 additions & 4 deletions src/redis/resources/ajax/AllProviderAprResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ export class AllProviderAPRResource extends RedisResourceBase<AllAprProviderData

if (curr.type.toLowerCase().trim() === 'restaking') {
if (!addressAndAprDataRestakingById[address]) {
addressAndAprDataRestakingById[address] = []; // Initialize as an empty array if not present
addressAndAprDataRestakingById[address] = [];
}
addressAndAprDataRestakingById[address].push(curr.apr); // Store the APR in the array
addressAndAprDataRestakingById[address].push(curr.apr);
} else if (curr.type.toLowerCase().trim() in ['stacking', 'staking']) {
if (!addressAndAprDataStackingById[address]) {
addressAndAprDataStackingById[address] = []; // Initialize as an empty array if not present
addressAndAprDataStackingById[address] = [];
}
addressAndAprDataStackingById[address].push(curr.apr); // Store the APR in the array
addressAndAprDataStackingById[address].push(curr.apr);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/redis/resources/ajax/ListProvidersResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ProviderEntry {
addons: string | null;
extensions: string | null;
delegateCommission: string | null;
delegateLimit: string | null;
// delegateLimit: string | null;
delegateTotal: string | null;
moniker: string;
}[];
Expand Down Expand Up @@ -146,7 +146,7 @@ export class ListProvidersResource extends RedisResourceBase<ProvidersData, {}>
addons: JsinfoSchema.providerStakes.addons,
extensions: JsinfoSchema.providerStakes.extensions,
delegateCommission: JsinfoSchema.providerStakes.delegateCommission,
delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
// delegateLimit: JsinfoSchema.providerStakes.delegateLimit,
delegateTotal: JsinfoSchema.providerStakes.delegateTotal,
}).from(JsinfoSchema.providerStakes),
'ListProvidersResource_fetchFromSource'
Expand All @@ -169,7 +169,7 @@ export class ListProvidersResource extends RedisResourceBase<ProvidersData, {}>
addons: stake.addons || '',
extensions: stake.extensions || '',
delegateCommission: stake.delegateCommission?.toString() ?? '',
delegateLimit: stake.delegateLimit?.toString() ?? '',
// delegateLimit: stake.delegateLimit?.toString() ?? '',
delegateTotal: stake.delegateTotal?.toString() ?? '',
moniker: monikers[index],
};
Expand Down
4 changes: 2 additions & 2 deletions src/redis/resources/ajax/TotalValueLockedResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class TotalValueLockedResource extends RedisResourceBase<TotalValueLocked
return sum;
}, 0n);
result.push({
key: 'LavaEmptyProviderDelegation',
key: 'LavaEmptyProviderDelegatorsThatDidNotUseLavaApi',
ulavaValue: Number(emptyProviderDelegationsSum),
USDValue: Number(emptyProviderDelegationsSum / 1000000n) * currentLavaUSDPrice
});
Expand Down Expand Up @@ -138,7 +138,7 @@ export class TotalValueLockedResource extends RedisResourceBase<TotalValueLocked
USDValue: Number(BigInt(stakesSum) / 1000000n) * currentLavaUSDPrice
});
result.push({
key: 'LavaTotalProviderDelegation',
key: 'LavaTotalDelegationsToProvider',
ulavaValue: Number(delegationSum),
USDValue: Number(BigInt(delegationSum) / 1000000n) * currentLavaUSDPrice
});
Expand Down
2 changes: 1 addition & 1 deletion tests/query_endpoints/tests/provider_tabs_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_provider_stakes(self):
continue
data = response.json()['data'][0]
assert 'stake' in data
assert 'delegateLimit' in data
# assert 'delegateLimit' in data
assert 'delegateTotal' in data
assert 'delegateCommission' in data
assert 'totalStake' in data
Expand Down
2 changes: 1 addition & 1 deletion tests/query_endpoints/tests/spec_page_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_specStakes_endpoint_content(self):
self.assertIsInstance(data['data'], list)
for item in data['data']:
self.assertIn('stake', item)
self.assertIn('delegateLimit', item)
# self.assertIn('delegateLimit', item)
self.assertIn('delegateTotal', item)
self.assertIn('delegateCommission', item)
self.assertIn('totalStake', item)
Expand Down

0 comments on commit 324fa00

Please sign in to comment.