Skip to content
Draft
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
1 change: 1 addition & 0 deletions src/common/entities/query.pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export class QueryPagination {

before?: number;
after?: number;
searchAfter?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ export class EsCircuitBreakerProxy {
}

// eslint-disable-next-line require-await
async getList(index: string, id: string, query: ElasticQuery): Promise<any[]> {
return this.withCircuitBreaker(() => this.elasticService.getList(index, id, query));
async getList(index: string, id: string, query: ElasticQuery, searchAfter?: string): Promise<any[]> {
//TODO: update package
// @ts-ignore
return this.withCircuitBreaker(() => this.elasticService.getList(index, id, query, undefined, searchAfter));
}

// eslint-disable-next-line require-await
Expand Down
6 changes: 3 additions & 3 deletions src/common/indexer/elastic/elastic.indexer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class ElasticIndexerService implements IndexerInterface {

query = this.buildTokenFilter(query, filter);

return await this.elasticService.getList('accountsesdt', 'token', query);
return await this.elasticService.getList('accountsesdt', 'token', query, queryPagination.searchAfter);
}

async getTokenAccountsCount(identifier: string): Promise<number | undefined> {
Expand Down Expand Up @@ -294,7 +294,7 @@ export class ElasticIndexerService implements IndexerInterface {
.withPagination({ from: pagination.from, size: pagination.size })
.withSort([timestamp, nonce]);

const elasticOperations = await this.elasticService.getList('operations', 'txHash', elasticQuery);
const elasticOperations = await this.elasticService.getList('operations', 'txHash', elasticQuery, pagination.searchAfter);

this.bulkProcessTransactions(elasticOperations);

Expand Down Expand Up @@ -559,7 +559,7 @@ export class ElasticIndexerService implements IndexerInterface {
.withPagination({ from: pagination.from, size: pagination.size })
.withSort([timestamp, nonce]);

const transactions = await this.elasticService.getList('operations', 'txHash', elasticQuery);
const transactions = await this.elasticService.getList('operations', 'txHash', elasticQuery, pagination.searchAfter);

this.bulkProcessTransactions(transactions);

Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/account.history.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface AccountHistory {
import { ElasticSortable } from "./elastic.sortable";

export interface AccountHistory extends ElasticSortable {
address: string;
timestamp: number;
balance: string;
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/account.token.history.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface AccountTokenHistory {
import { ElasticSortable } from "./elastic.sortable";

export interface AccountTokenHistory extends ElasticSortable {
address: string;
timestamp: number;
balance: string;
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/account.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface Account {
import { ElasticSortable } from "./elastic.sortable";

export interface Account extends ElasticSortable {
address: string;
nonce: number;
timestampMs: number;
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface Block {
import { ElasticSortable } from "./elastic.sortable";

export interface Block extends ElasticSortable {
hash: string;
nonce: number;
round: number;
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/collection.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ElasticSortable } from "./elastic.sortable";

export interface CollectionProperties {
canMint?: boolean;
canBurn?: boolean;
Expand All @@ -11,7 +13,7 @@ export interface CollectionProperties {
canCreateMultiShard?: boolean;
}

export interface Collection {
export interface Collection extends ElasticSortable {
_id: string;
name: string;
ticker: string;
Expand Down
3 changes: 3 additions & 0 deletions src/common/indexer/entities/elastic.sortable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ElasticSortable {
searchAfter?: string;
}

Check failure on line 3 in src/common/indexer/entities/elastic.sortable.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Newline required at end of file but not found
1 change: 1 addition & 0 deletions src/common/indexer/entities/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export class Events {
searchAfter?: string;
_id: string = '';
logAddress: string = '';
identifier: string = '';
Expand Down
1 change: 1 addition & 0 deletions src/common/indexer/entities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export { TokenAccount, TokenType } from './token.account';
export { Transaction } from './transaction';
export { TransactionLog, TransactionLogEvent, ElasticTransactionLogEvent } from './transaction.log';
export { TransactionReceipt } from './transaction.receipt';
export { ElasticSortable } from './elastic.sortable';
4 changes: 3 additions & 1 deletion src/common/indexer/entities/miniblock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface MiniBlock {
import { ElasticSortable } from "./elastic.sortable";

export interface MiniBlock extends ElasticSortable {
miniBlockHash: string;
senderShard: number;
receiverShard: number;
Expand Down
1 change: 1 addition & 0 deletions src/common/indexer/entities/provider.delegators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export class ProviderDelegators {
searchAfter?: string;
contract: string = '';
address: string = '';
activeStake: string = '';
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/round.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface Round {
import { ElasticSortable } from "./elastic.sortable";

export interface Round extends ElasticSortable {
round: number,
signersIndexes: number[],
blockWasProposed: boolean,
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/sc.deploy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface ScDeploy {
import { ElasticSortable } from "./elastic.sortable";

export interface ScDeploy extends ElasticSortable {
address: string;
contract: string;
deployTxHash: string;
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/sc.result.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface ScResult {
import { ElasticSortable } from "./elastic.sortable";

export interface ScResult extends ElasticSortable {
scHash: string
nonce: number;
gasLimit: string;
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/tag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface Tag {
import { ElasticSortable } from "./elastic.sortable";

export interface Tag extends ElasticSortable {
count: number;
tag: string;
}
3 changes: 2 additions & 1 deletion src/common/indexer/entities/token.account.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { registerEnumType } from "@nestjs/graphql";
import { ElasticSortable } from "./elastic.sortable";

export interface TokenAccount {
export interface TokenAccount extends ElasticSortable {
identifier: string;
address: string;
balance: string;
Expand Down
6 changes: 4 additions & 2 deletions src/common/indexer/entities/transaction.log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface TransactionLog {
import { ElasticSortable } from "./elastic.sortable";

export interface TransactionLog extends ElasticSortable {
id: string;
originalTxHash: string;
address: string;
Expand All @@ -14,7 +16,7 @@ export interface TransactionLogEvent {
order: number;
}

export interface ElasticTransactionLogEvent {
export interface ElasticTransactionLogEvent extends ElasticSortable {
address: string;
identifier: string;
topics: string[];
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/transaction.receipt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface TransactionReceipt {
import { ElasticSortable } from "./elastic.sortable";

export interface TransactionReceipt extends ElasticSortable {
receiptHash: string;
value: string;
sender: string;
Expand Down
4 changes: 3 additions & 1 deletion src/common/indexer/entities/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface Transaction {
import { ElasticSortable } from "./elastic.sortable";

export interface Transaction extends ElasticSortable {
hash: string;
miniBlockHash: string;
nonce: number;
Expand Down
Loading
Loading