Skip to content

Commit

Permalink
Merge pull request #12 from kryptokrauts/feat/v-1.0.15
Browse files Browse the repository at this point in the history
feat: add Zulu to block timestamp, new param EOSIO_IRREVERSIBLE_BLOCK…
  • Loading branch information
marc0olo authored Apr 17, 2024
2 parents c959481 + b11eda4 commit deb1900
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .env_template
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ EOSIO_FETCH_TRACES=true
EOSIO_FETCH_DELTAS=true
# number of blocks until tx is final
EOSIO_NUM_BLOCKS_TO_FINALITY=360
# fetch irreversible blocks only true/false
EOSIO_IRREVERSIBLE_BLOCKS_ONLY=false

# unique client_id for interacting with Kafka
KAFKA_CLIENT_ID=
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kryptokrauts/event-processor-node-lib",
"version": "1.0.14",
"version": "1.0.15",
"description": "Wrapper for ease listening on antelope blockchain based on @blockmatic/antelope-ship-reader",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const EOSIO_CONFIG = {
fetch_traces: process.env.EOSIO_FETCH_TRACES !== 'false',
fetch_deltas: process.env.EOSIO_FETCH_DELTAS !== 'false',
num_blocks_to_finality: Number(process.env.EOSIO_NUM_BLOCKS_TO_FINALITY || 360),
irreversible_blocks_only: process.env.EOSIO_IRREVERSIBLE_BLOCKS_ONLY === 'true',
};

export const KAFKA_CONFIG: KafkaConfig = {
Expand Down
1 change: 0 additions & 1 deletion src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export interface ShipReaderWrapperConfig {
message_header_prefix: string;
table_rows_whitelist: () => EosioReaderTableRowFilter[];
actions_whitelist: () => EosioReaderActionFilter[];
only_irreversible_blocks: boolean;
emit_current_blocknum: boolean;
}

Expand Down
6 changes: 3 additions & 3 deletions src/eosio/ship-reader-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class ShipReaderWrapper {
if (result && result.msg) {
const msg = JSON.stringify({
blocknum: block.block_num,
timestamp: new Date(block.timestamp).getTime(),
timestamp: new Date(block.timestamp + 'Z').getTime(),
type: action.name,
transaction_id: action.transaction_id,
data: result.msg,
Expand Down Expand Up @@ -257,7 +257,7 @@ export class ShipReaderWrapper {
* @returns
*/
private async getShipReader() {
if (this.config.only_irreversible_blocks) {
if (EOSIO_CONFIG.irreversible_blocks_only) {
logger.info(`Configuration is set to fetch irreversible blocks only`);
}

Expand Down Expand Up @@ -288,7 +288,7 @@ export class ShipReaderWrapper {
end_block_num: 0xffffffff,
max_messages_in_flight: EOSIO_CONFIG.max_messages_in_flight,
have_positions: [],
irreversible_only: this.config.only_irreversible_blocks,
irreversible_only: EOSIO_CONFIG.irreversible_blocks_only,
fetch_block: EOSIO_CONFIG.fetch_block,
fetch_traces: EOSIO_CONFIG.fetch_traces,
fetch_deltas: EOSIO_CONFIG.fetch_deltas,
Expand Down

0 comments on commit deb1900

Please sign in to comment.