Skip to content

Commit

Permalink
feat: updated getBlockStats. (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz authored Sep 12, 2023
1 parent 6139a74 commit 7e2b9ff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 55 deletions.
7 changes: 7 additions & 0 deletions .changeset/silly-mugs-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@moralisweb3/common-evm-utils': patch
'@moralisweb3/evm-api': patch
'moralis': patch
---

Updated the response of the `getBlockStats` endpoint.
11 changes: 0 additions & 11 deletions packages/common/evmUtils/src/generated/types/EvmBlockTokenStat.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import { EvmBlockTokenStatTransactions, EvmBlockTokenStatTransactionsInput, EvmBlockTokenStatTransactionsJSON } from '../types/EvmBlockTokenStatTransactions';
import { EvmBlockTokenStatNftTransfers, EvmBlockTokenStatNftTransfersInput, EvmBlockTokenStatNftTransfersJSON } from '../types/EvmBlockTokenStatNftTransfers';
import { EvmBlockTokenStatTokenTransfers, EvmBlockTokenStatTokenTransfersInput, EvmBlockTokenStatTokenTransfersJSON } from '../types/EvmBlockTokenStatTokenTransfers';

// $ref: #/components/schemas/blockTokenStat
// type: blockTokenStat
// properties:
// - transactions ($ref: #/components/schemas/blockTokenStat/properties/transactions)
// - nft_transfers ($ref: #/components/schemas/blockTokenStat/properties/nft_transfers)
// - token_transfers ($ref: #/components/schemas/blockTokenStat/properties/token_transfers)

export interface EvmBlockTokenStatJSON {
readonly transactions: EvmBlockTokenStatTransactionsJSON;
readonly nft_transfers: EvmBlockTokenStatNftTransfersJSON;
readonly token_transfers: EvmBlockTokenStatTokenTransfersJSON;
}

export interface EvmBlockTokenStatInput {
readonly transactions: EvmBlockTokenStatTransactionsInput | EvmBlockTokenStatTransactions;
readonly nftTransfers: EvmBlockTokenStatNftTransfersInput | EvmBlockTokenStatNftTransfers;
readonly tokenTransfers: EvmBlockTokenStatTokenTransfersInput | EvmBlockTokenStatTokenTransfers;
}

export class EvmBlockTokenStat {
Expand All @@ -33,7 +29,6 @@ export class EvmBlockTokenStat {
const input: EvmBlockTokenStatInput = {
transactions: EvmBlockTokenStatTransactions.fromJSON(json.transactions),
nftTransfers: EvmBlockTokenStatNftTransfers.fromJSON(json.nft_transfers),
tokenTransfers: EvmBlockTokenStatTokenTransfers.fromJSON(json.token_transfers),
};
return EvmBlockTokenStat.create(input);
}
Expand All @@ -46,22 +41,16 @@ export class EvmBlockTokenStat {
* @description NFT transfer stats
*/
public readonly nftTransfers: EvmBlockTokenStatNftTransfers;
/**
* @description Token transfer stats
*/
public readonly tokenTransfers: EvmBlockTokenStatTokenTransfers;

private constructor(input: EvmBlockTokenStatInput) {
this.transactions = EvmBlockTokenStatTransactions.create(input.transactions);
this.nftTransfers = EvmBlockTokenStatNftTransfers.create(input.nftTransfers);
this.tokenTransfers = EvmBlockTokenStatTokenTransfers.create(input.tokenTransfers);
}

public toJSON(): EvmBlockTokenStatJSON {
return {
transactions: this.transactions.toJSON(),
nft_transfers: this.nftTransfers.toJSON(),
token_transfers: this.tokenTransfers.toJSON(),
}
}
}

This file was deleted.

1 change: 0 additions & 1 deletion packages/common/evmUtils/src/generated/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ export * from './EvmNftTokenStatTransfers';
export * from './EvmErc20TokenStatTransfers';
export * from './EvmBlockTokenStatTransactions';
export * from './EvmBlockTokenStatNftTransfers';
export * from './EvmBlockTokenStatTokenTransfers';
export * from './EvmTransactionTimestamp';

1 comment on commit 7e2b9ff

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage

Title Lines Statements Branches Functions
api-utils Coverage: 20%
20.6% (61/296) 20.48% (17/83) 19.04% (12/63)
auth Coverage: 89%
92.45% (98/106) 83.33% (20/24) 86.66% (26/30)
evm-api Coverage: 91%
91.83% (90/98) 66.66% (6/9) 87.5% (56/64)
common-aptos-utils Coverage: 4%
4.56% (151/3306) 4.49% (25/556) 5.53% (45/813)
common-evm-utils Coverage: 64%
65.23% (1642/2517) 25% (186/744) 43.91% (415/945)
sol-api Coverage: 100%
100% (40/40) 66.66% (6/9) 100% (15/15)
common-sol-utils Coverage: 69%
69.04% (203/294) 51.42% (18/35) 55.67% (54/97)
common-streams-utils Coverage: 90%
90.73% (1204/1327) 73.63% (363/493) 82.07% (444/541)
streams Coverage: 91%
90.54% (603/666) 72.34% (68/94) 90.97% (131/144)

Please sign in to comment.