Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fetch all blocks in a Slot #1443

Merged
merged 10 commits into from
Apr 26, 2024
5 changes: 0 additions & 5 deletions api/src/models/api/nova/chronicle/ISlotBlocksRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,4 @@ export interface ISlotBlocksRequest {
* The slot index to get the details for.
*/
slotIndex: string;

/**
* The cursor state for the request.
*/
cursor?: string;
}
8 changes: 2 additions & 6 deletions api/src/services/nova/chronicleService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ export class ChronicleService {

do {
try {
const params = {
cursor: request.cursor,
};
const params = { cursor };
const response = await FetchHelper.json<never, ISlotBlocksResponse>(
this.chronicleEndpoint,
`${CHRONICLE_ENDPOINTS.slotBlocks}${params ? `${FetchHelper.urlParams(params)}` : ""}`.replace(
Expand All @@ -69,9 +67,7 @@ export class ChronicleService {
),
"get",
);
// Hardcoded to null for now because chronicle always returns the same cursor: https://github.com/iotaledger/inx-chronicle/issues/1362
cursor = null;
// cursor = response.cursor;
cursor = response.cursor;

if (response.blocks) {
slotBlocks.push(...response.blocks);
Expand Down
2 changes: 1 addition & 1 deletion api/src/services/nova/influx/influxQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const BLOCK_STATS_QUERY = `
sum("candidacy_announcement_count") AS "candidacy",
sum("validation_count") AS "noPayload"
FROM "iota_block_activity"
WHERE time >= $from and time <= $to
WHERE time >= $from and time < $to
`;

export const TOKENS_HELD_BY_OUTPUTS_DAILY_QUERY = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/routes/nova/SlotPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function SlotPage({
<div className="section--data">
<div className="label">Commitment Id</div>
<div className="value code">
<TruncatedId id={slotCommitmentId ?? FALLBACK_STRING} />
<TruncatedId id={slotCommitmentId ?? FALLBACK_STRING} showCopyButton />
</div>
</div>
<div className="card-info-wrapper">
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/routes/nova/TransactionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const TransactionPage: React.FC<RouteComponentProps<TransactionPageProps>> = ({
<div className="section--data">
<div className="label">Slot Commitment</div>
<div className="value code">
<TruncatedId id={block.header.slotCommitmentId} />
<TruncatedId id={block.header.slotCommitmentId} showCopyButton />
</div>
</div>
{issuerAddress && (
Expand Down
5 changes: 0 additions & 5 deletions client/src/models/api/nova/ISlotBlocksRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,4 @@ export interface ISlotBlocksRequest {
* The slot index to get the details for.
*/
slotIndex: string;

/**
* The cursor state for the request.
*/
cursor?: string;
}
8 changes: 1 addition & 7 deletions client/src/services/nova/novaApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,7 @@ export class NovaApiClient extends ApiClient {
* @returns The response from the request.
*/
public async getSlotBlocks(request: ISlotBlocksRequest): Promise<ISlotBlocksResponse> {
const params = {
cursor: request.cursor,
};
return this.callApi<unknown, ISlotBlocksResponse>(
`nova/slot/blocks/chronicle/${request.network}/${request.slotIndex}${FetchHelper.urlParams(params)}`,
"get",
);
return this.callApi<unknown, ISlotBlocksResponse>(`nova/slot/blocks/chronicle/${request.network}/${request.slotIndex}`, "get");
}

/**
Expand Down
Loading