Skip to content

Commit deb1900

Browse files
authored
Merge pull request #12 from kryptokrauts/feat/v-1.0.15
feat: add Zulu to block timestamp, new param EOSIO_IRREVERSIBLE_BLOCK…
2 parents c959481 + b11eda4 commit deb1900

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

.env_template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ EOSIO_FETCH_TRACES=true
1818
EOSIO_FETCH_DELTAS=true
1919
# number of blocks until tx is final
2020
EOSIO_NUM_BLOCKS_TO_FINALITY=360
21+
# fetch irreversible blocks only true/false
22+
EOSIO_IRREVERSIBLE_BLOCKS_ONLY=false
2123

2224
# unique client_id for interacting with Kafka
2325
KAFKA_CLIENT_ID=

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kryptokrauts/event-processor-node-lib",
3-
"version": "1.0.14",
3+
"version": "1.0.15",
44
"description": "Wrapper for ease listening on antelope blockchain based on @blockmatic/antelope-ship-reader",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/common/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const EOSIO_CONFIG = {
1717
fetch_traces: process.env.EOSIO_FETCH_TRACES !== 'false',
1818
fetch_deltas: process.env.EOSIO_FETCH_DELTAS !== 'false',
1919
num_blocks_to_finality: Number(process.env.EOSIO_NUM_BLOCKS_TO_FINALITY || 360),
20+
irreversible_blocks_only: process.env.EOSIO_IRREVERSIBLE_BLOCKS_ONLY === 'true',
2021
};
2122

2223
export const KAFKA_CONFIG: KafkaConfig = {

src/common/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export interface ShipReaderWrapperConfig {
4343
message_header_prefix: string;
4444
table_rows_whitelist: () => EosioReaderTableRowFilter[];
4545
actions_whitelist: () => EosioReaderActionFilter[];
46-
only_irreversible_blocks: boolean;
4746
emit_current_blocknum: boolean;
4847
}
4948

src/eosio/ship-reader-wrapper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export class ShipReaderWrapper {
195195
if (result && result.msg) {
196196
const msg = JSON.stringify({
197197
blocknum: block.block_num,
198-
timestamp: new Date(block.timestamp).getTime(),
198+
timestamp: new Date(block.timestamp + 'Z').getTime(),
199199
type: action.name,
200200
transaction_id: action.transaction_id,
201201
data: result.msg,
@@ -257,7 +257,7 @@ export class ShipReaderWrapper {
257257
* @returns
258258
*/
259259
private async getShipReader() {
260-
if (this.config.only_irreversible_blocks) {
260+
if (EOSIO_CONFIG.irreversible_blocks_only) {
261261
logger.info(`Configuration is set to fetch irreversible blocks only`);
262262
}
263263

@@ -288,7 +288,7 @@ export class ShipReaderWrapper {
288288
end_block_num: 0xffffffff,
289289
max_messages_in_flight: EOSIO_CONFIG.max_messages_in_flight,
290290
have_positions: [],
291-
irreversible_only: this.config.only_irreversible_blocks,
291+
irreversible_only: EOSIO_CONFIG.irreversible_blocks_only,
292292
fetch_block: EOSIO_CONFIG.fetch_block,
293293
fetch_traces: EOSIO_CONFIG.fetch_traces,
294294
fetch_deltas: EOSIO_CONFIG.fetch_deltas,

0 commit comments

Comments
 (0)