Skip to content
Open
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,150 changes: 603 additions & 547 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/common/entities/query.pagination.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { BadRequestException } from "@nestjs/common";

export class QueryPagination {
constructor(init?: Partial<QueryPagination>) {
Object.assign(this, init);

if (this.searchAfter !== undefined && this.from !== 0) {
throw new BadRequestException("'from' must be 0 when 'searchAfter' is provided.");
}
}

from: number = 0;
size: number = 25;

before?: number;
after?: number;
searchAfter?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ 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[]> {
return this.withCircuitBreaker(() => this.elasticService.getList(index, id, query, undefined, searchAfter));
}

// eslint-disable-next-line require-await
Expand Down
281 changes: 209 additions & 72 deletions src/common/indexer/elastic/elastic.indexer.service.ts

Large diffs are not rendered by default.

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;
}
1 change: 1 addition & 0 deletions src/common/indexer/entities/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export class Events {
order: number = 0;
timestamp: number = 0;
timestampMs?: number;
searchAfter?: string;
}
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
5 changes: 4 additions & 1 deletion src/common/indexer/entities/round.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
export interface Round {
import { ElasticSortable } from "./elastic.sortable";

export interface Round extends ElasticSortable {
round: number,
signersIndexes: number[],
blockWasProposed: boolean,
shardId: number,
epoch: number,
timestamp: number,
timestampMs?: number,
searchAfter?: string,
}
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
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