@axxel/event-bus 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/consumers/index.d.ts +1 -0
- package/dist/consumers/index.d.ts.map +1 -1
- package/dist/consumers/index.js +1 -0
- package/dist/consumers/poolCreatedConsumer.d.ts +8 -0
- package/dist/consumers/poolCreatedConsumer.d.ts.map +1 -0
- package/dist/consumers/poolCreatedConsumer.js +27 -0
- package/dist/producers/index.d.ts +1 -0
- package/dist/producers/index.d.ts.map +1 -1
- package/dist/producers/index.js +1 -0
- package/dist/producers/poolCreatedProducer.d.ts +3 -0
- package/dist/producers/poolCreatedProducer.d.ts.map +1 -0
- package/dist/producers/poolCreatedProducer.js +21 -0
- package/dist/topics.d.ts +1 -0
- package/dist/topics.d.ts.map +1 -1
- package/dist/topics.js +1 -0
- package/dist/types/PoolCreatedEvent.d.ts +17 -0
- package/dist/types/PoolCreatedEvent.d.ts.map +1 -0
- package/dist/types/PoolCreatedEvent.js +2 -0
- package/dist/types/TradeExecutionEvent.d.ts +20 -2
- package/dist/types/TradeExecutionEvent.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/package.json +6 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consumers/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consumers/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
|
package/dist/consumers/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./tokenPriceConsumer"), exports);
|
|
18
18
|
__exportStar(require("./walletTransactionConsumer"), exports);
|
|
19
19
|
__exportStar(require("./tradeExecutionConsumer"), exports);
|
|
20
|
+
__exportStar(require("./poolCreatedConsumer"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PoolCreatedEvent } from '../types/PoolCreatedEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Start consuming pool created events.
|
|
4
|
+
* @param groupId - unique consumer group ID
|
|
5
|
+
* @param handler - function to handle each pool created event
|
|
6
|
+
*/
|
|
7
|
+
export declare function startPoolCreatedConsumer(groupId: string, handler: (event: PoolCreatedEvent) => Promise<void> | void): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=poolCreatedConsumer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poolCreatedConsumer.d.ts","sourceRoot":"","sources":["../../src/consumers/poolCreatedConsumer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,iBAuB3D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startPoolCreatedConsumer = startPoolCreatedConsumer;
|
|
4
|
+
const kafka_1 = require("../config/kafka");
|
|
5
|
+
const topics_1 = require("../topics");
|
|
6
|
+
/**
|
|
7
|
+
* Start consuming pool created events.
|
|
8
|
+
* @param groupId - unique consumer group ID
|
|
9
|
+
* @param handler - function to handle each pool created event
|
|
10
|
+
*/
|
|
11
|
+
async function startPoolCreatedConsumer(groupId, handler) {
|
|
12
|
+
const consumer = kafka_1.kafka.consumer({ groupId });
|
|
13
|
+
await consumer.connect();
|
|
14
|
+
await consumer.subscribe({
|
|
15
|
+
topic: topics_1.TOPICS.POOL_CREATED,
|
|
16
|
+
fromBeginning: false,
|
|
17
|
+
});
|
|
18
|
+
await consumer.run({
|
|
19
|
+
eachMessage: async ({ message }) => {
|
|
20
|
+
if (!message.value)
|
|
21
|
+
return;
|
|
22
|
+
const event = JSON.parse(message.value.toString());
|
|
23
|
+
await handler(event);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
console.log(`📡 Listening for pool created events (consumer group: ${groupId})`);
|
|
27
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/producers/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/producers/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
|
package/dist/producers/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./tokenPriceProducer"), exports);
|
|
18
18
|
__exportStar(require("./walletTransactionProducer"), exports);
|
|
19
19
|
__exportStar(require("./tradeExecutionProducer"), exports);
|
|
20
|
+
__exportStar(require("./poolCreatedProducer"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poolCreatedProducer.d.ts","sourceRoot":"","sources":["../../src/producers/poolCreatedProducer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,iBAqB/D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.producePoolCreated = producePoolCreated;
|
|
4
|
+
const kafka_1 = require("../config/kafka");
|
|
5
|
+
const topics_1 = require("../topics");
|
|
6
|
+
async function producePoolCreated(event) {
|
|
7
|
+
const producer = kafka_1.kafka.producer();
|
|
8
|
+
await producer.connect();
|
|
9
|
+
const key = `${event.chainId}:${event.factoryAddress}`;
|
|
10
|
+
await producer.send({
|
|
11
|
+
topic: topics_1.TOPICS.POOL_CREATED,
|
|
12
|
+
messages: [
|
|
13
|
+
{
|
|
14
|
+
key,
|
|
15
|
+
value: JSON.stringify(event),
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
await producer.disconnect();
|
|
20
|
+
console.log(`✅ Pool created event published | chain=${event.chainId} | pool=${event.address}`);
|
|
21
|
+
}
|
package/dist/topics.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const TOPICS: {
|
|
|
2
2
|
readonly TOKEN_PRICES: "token-prices";
|
|
3
3
|
readonly WALLET_TRANSACTIONS: "wallet-transactions";
|
|
4
4
|
readonly TRADE_EXECUTION: "trade-execution";
|
|
5
|
+
readonly POOL_CREATED: "pool-created";
|
|
5
6
|
};
|
|
6
7
|
export type Topic = (typeof TOPICS)[keyof typeof TOPICS];
|
|
7
8
|
//# sourceMappingURL=topics.d.ts.map
|
package/dist/topics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topics.d.ts","sourceRoot":"","sources":["../src/topics.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"topics.d.ts","sourceRoot":"","sources":["../src/topics.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;CAKT,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/topics.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type PoolCreatedEvent = {
|
|
2
|
+
address: string;
|
|
3
|
+
createdBlock: number | null;
|
|
4
|
+
chainId: number;
|
|
5
|
+
factoryAddress: string;
|
|
6
|
+
exchangeName: string;
|
|
7
|
+
protocol: string;
|
|
8
|
+
token0Address: string;
|
|
9
|
+
token0Symbol: string;
|
|
10
|
+
token0Decimals: number;
|
|
11
|
+
token1Address: string;
|
|
12
|
+
token1Symbol: string;
|
|
13
|
+
token1Decimals: number;
|
|
14
|
+
fee: string | null;
|
|
15
|
+
tickSpacing: number | null;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=PoolCreatedEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PoolCreatedEvent.d.ts","sourceRoot":"","sources":["../../src/types/PoolCreatedEvent.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IAEjB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IAEvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IAEvB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC"}
|
|
@@ -8,8 +8,26 @@ export type TradeExecutionEvent = {
|
|
|
8
8
|
slippage: string;
|
|
9
9
|
mev: boolean;
|
|
10
10
|
totalFee: string;
|
|
11
|
+
/**
|
|
12
|
+
* Execution side (buy | sell)
|
|
13
|
+
* For sniper orders, this represents only buy
|
|
14
|
+
*/
|
|
11
15
|
type: string;
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* USD execution price.
|
|
18
|
+
* Present for limit and trailing orders.
|
|
19
|
+
* Undefined for sniper orders.
|
|
20
|
+
*/
|
|
21
|
+
executionPriceUsd?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Pool address used for execution.
|
|
24
|
+
* Present for sniper orders.
|
|
25
|
+
* Undefined for limit and trailing orders.
|
|
26
|
+
*/
|
|
27
|
+
poolAddress?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Order category driving execution semantics.
|
|
30
|
+
*/
|
|
31
|
+
orderType: 'limit' | 'trailing' | 'sniper';
|
|
14
32
|
};
|
|
15
33
|
//# sourceMappingURL=TradeExecutionEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TradeExecutionEvent.d.ts","sourceRoot":"","sources":["../../src/types/TradeExecutionEvent.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TradeExecutionEvent.d.ts","sourceRoot":"","sources":["../../src/types/TradeExecutionEvent.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,EAAE,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;CAC5C,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./TokenPriceEvent"), exports);
|
|
18
18
|
__exportStar(require("./WalletTransactionEvent"), exports);
|
|
19
19
|
__exportStar(require("./TradeExecutionEvent"), exports);
|
|
20
|
+
__exportStar(require("./PoolCreatedEvent"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axxel/event-bus",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Axxel Kafka Event Bus SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
"prepublishOnly": "npm run build",
|
|
21
21
|
"test": "echo \"No tests yet\" && exit 0",
|
|
22
22
|
"publish:public": "npm publish --access public",
|
|
23
|
-
"publish:private": "npm publish"
|
|
23
|
+
"publish:private": "npm publish",
|
|
24
|
+
"release:patch": "npm version patch && npm publish --access public",
|
|
25
|
+
"release:minor": "npm version minor && npm publish --access public",
|
|
26
|
+
"release:major": "npm version major && npm publish --access public"
|
|
24
27
|
},
|
|
25
28
|
"keywords": [],
|
|
26
29
|
"author": "",
|
|
@@ -36,4 +39,4 @@
|
|
|
36
39
|
"tsx": "^4.20.6",
|
|
37
40
|
"typescript": "^5.9.3"
|
|
38
41
|
}
|
|
39
|
-
}
|
|
42
|
+
}
|