@axxel/event-bus 1.1.7 → 1.1.9
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/README.md +0 -0
- package/dist/config/kafka.d.ts +0 -0
- package/dist/config/kafka.d.ts.map +0 -0
- package/dist/config/kafka.js +0 -0
- package/dist/consumers/index.d.ts +0 -0
- package/dist/consumers/index.d.ts.map +0 -0
- package/dist/consumers/index.js +0 -0
- package/dist/consumers/liveTransactionConsumer.d.ts +0 -0
- package/dist/consumers/liveTransactionConsumer.d.ts.map +0 -0
- package/dist/consumers/liveTransactionConsumer.js +0 -0
- package/dist/consumers/poolCreatedConsumer.d.ts +0 -0
- package/dist/consumers/poolCreatedConsumer.d.ts.map +0 -0
- package/dist/consumers/poolCreatedConsumer.js +0 -0
- package/dist/consumers/tokenPriceConsumer.d.ts +0 -0
- package/dist/consumers/tokenPriceConsumer.d.ts.map +0 -0
- package/dist/consumers/tokenPriceConsumer.js +0 -0
- package/dist/consumers/tradeExecutionConsumer.d.ts +0 -0
- package/dist/consumers/tradeExecutionConsumer.d.ts.map +0 -0
- package/dist/consumers/tradeExecutionConsumer.js +0 -0
- package/dist/consumers/walletTransactionConsumer.d.ts +0 -0
- package/dist/consumers/walletTransactionConsumer.d.ts.map +0 -0
- package/dist/consumers/walletTransactionConsumer.js +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.d.ts.map +0 -0
- package/dist/index.js +0 -0
- package/dist/producers/index.d.ts +0 -0
- package/dist/producers/index.d.ts.map +0 -0
- package/dist/producers/index.js +0 -0
- package/dist/producers/liveTransactionProducer.d.ts +0 -0
- package/dist/producers/liveTransactionProducer.d.ts.map +0 -0
- package/dist/producers/liveTransactionProducer.js +0 -0
- package/dist/producers/poolCreatedProducer.d.ts +0 -0
- package/dist/producers/poolCreatedProducer.d.ts.map +0 -0
- package/dist/producers/poolCreatedProducer.js +0 -0
- package/dist/producers/tokenPriceProducer.d.ts +0 -3
- package/dist/producers/tokenPriceProducer.d.ts.map +1 -1
- package/dist/producers/tokenPriceProducer.js +22 -18
- package/dist/producers/tradeExecutionProducer.d.ts +0 -0
- package/dist/producers/tradeExecutionProducer.d.ts.map +0 -0
- package/dist/producers/tradeExecutionProducer.js +0 -0
- package/dist/producers/walletTransactionProducer.d.ts +0 -0
- package/dist/producers/walletTransactionProducer.d.ts.map +0 -0
- package/dist/producers/walletTransactionProducer.js +0 -0
- package/dist/topics.d.ts +0 -0
- package/dist/topics.d.ts.map +0 -0
- package/dist/topics.js +0 -0
- package/dist/types/LiveTransactionEvent.d.ts +0 -0
- package/dist/types/LiveTransactionEvent.d.ts.map +0 -0
- package/dist/types/LiveTransactionEvent.js +0 -0
- package/dist/types/PoolCreatedEvent.d.ts +0 -0
- package/dist/types/PoolCreatedEvent.d.ts.map +0 -0
- package/dist/types/PoolCreatedEvent.js +0 -0
- package/dist/types/TokenPriceEvent.d.ts +0 -0
- package/dist/types/TokenPriceEvent.d.ts.map +0 -0
- package/dist/types/TokenPriceEvent.js +0 -0
- package/dist/types/TradeExecutionEvent.d.ts +0 -0
- package/dist/types/TradeExecutionEvent.d.ts.map +0 -0
- package/dist/types/TradeExecutionEvent.js +0 -0
- package/dist/types/WalletTransactionEvent.d.ts +0 -0
- package/dist/types/WalletTransactionEvent.d.ts.map +0 -0
- package/dist/types/WalletTransactionEvent.js +0 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/index.d.ts.map +0 -0
- package/dist/types/index.js +0 -0
- package/dist/validation/common.d.ts +0 -0
- package/dist/validation/common.d.ts.map +0 -0
- package/dist/validation/common.js +0 -0
- package/dist/validation/liveTransactionEvent.schema.d.ts +0 -0
- package/dist/validation/liveTransactionEvent.schema.d.ts.map +0 -0
- package/dist/validation/liveTransactionEvent.schema.js +0 -0
- package/dist/validation/tokenPriceEvent.schema.d.ts +0 -0
- package/dist/validation/tokenPriceEvent.schema.d.ts.map +0 -0
- package/dist/validation/tokenPriceEvent.schema.js +0 -0
- package/dist/validation/walletTransactionEvent.schema.d.ts +0 -0
- package/dist/validation/walletTransactionEvent.schema.d.ts.map +0 -0
- package/dist/validation/walletTransactionEvent.schema.js +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
File without changes
|
package/dist/config/kafka.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/config/kafka.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/consumers/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.d.ts.map
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/producers/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { TokenPriceEvent } from '../types/TokenPriceEvent';
|
|
2
2
|
export declare function produceTokenPrice(event: TokenPriceEvent): Promise<void>;
|
|
3
|
-
/**
|
|
4
|
-
* Batch produce multiple token prices in a single Kafka send for optimal performance
|
|
5
|
-
*/
|
|
6
3
|
export declare function produceTokenPriceBatch(events: TokenPriceEvent[]): Promise<void>;
|
|
7
4
|
//# sourceMappingURL=tokenPriceProducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenPriceProducer.d.ts","sourceRoot":"","sources":["../../src/producers/tokenPriceProducer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA+B3E,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,eAAe,iBAwB7D;AAED
|
|
1
|
+
{"version":3,"file":"tokenPriceProducer.d.ts","sourceRoot":"","sources":["../../src/producers/tokenPriceProducer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA+B3E,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,eAAe,iBAwB7D;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,iBAiCrE"}
|
|
@@ -44,27 +44,31 @@ async function produceTokenPrice(event) {
|
|
|
44
44
|
});
|
|
45
45
|
console.log(`✅ Sent token price update for ${event.symbol ?? event.tokenAddress} (chain ${event.chainId})`);
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Batch produce multiple token prices in a single Kafka send for optimal performance
|
|
49
|
-
*/
|
|
50
47
|
async function produceTokenPriceBatch(events) {
|
|
51
48
|
if (events.length === 0)
|
|
52
49
|
return;
|
|
53
50
|
const producer = await getProducer();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
// group by (chainId + tokenAddress)
|
|
52
|
+
const byToken = new Map();
|
|
53
|
+
for (const e of events) {
|
|
54
|
+
const key = `${e.chainId}:${e.tokenAddress}`;
|
|
55
|
+
if (!byToken.has(key))
|
|
56
|
+
byToken.set(key, []);
|
|
57
|
+
byToken.get(key).push(e);
|
|
58
|
+
}
|
|
59
|
+
// send one ordered stream per token
|
|
60
|
+
for (const [key, tokenEvents] of byToken.entries()) {
|
|
61
|
+
const messages = tokenEvents.map((event) => ({
|
|
61
62
|
key,
|
|
62
|
-
value: JSON.stringify(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
value: JSON.stringify({
|
|
64
|
+
...event,
|
|
65
|
+
price: normalizePriceMap(event.price),
|
|
66
|
+
}),
|
|
67
|
+
}));
|
|
68
|
+
await producer.send({
|
|
69
|
+
topic: topics_1.TOPICS.TOKEN_PRICES,
|
|
70
|
+
messages,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
console.log(`✅ Sent ${events.length} token price updates across ${byToken.size} token streams`);
|
|
70
74
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/topics.d.ts
CHANGED
|
File without changes
|
package/dist/topics.d.ts.map
CHANGED
|
File without changes
|
package/dist/topics.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/types/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/types/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|