serum-vial
Advanced tools
Comparing version 1.4.8 to 1.4.9
@@ -46,3 +46,3 @@ "use strict"; | ||
const serumProducerWorker = new worker_threads_1.Worker(path_1.default.resolve(__dirname, 'serum_producer.js'), { | ||
workerData: { marketName: market.name, nodeEndpoint, markets, commitment, wsEndpointPort } | ||
workerData: { market, nodeEndpoint, commitment, wsEndpointPort } | ||
}); | ||
@@ -49,0 +49,0 @@ serumProducerWorker.on('error', (err) => { |
@@ -377,3 +377,3 @@ "use strict"; | ||
this._receivedMessagesCount = 0; | ||
}, 120 * 1000); | ||
}, 30 * 1000); | ||
} | ||
@@ -380,0 +380,0 @@ _sendMessage(ws, message) { |
@@ -8,5 +8,4 @@ import { MessageType } from './consts'; | ||
wsEndpointPort: number | undefined; | ||
marketName: string; | ||
market: SerumMarket; | ||
commitment: string; | ||
markets: SerumMarket[]; | ||
}); | ||
@@ -13,0 +12,0 @@ run(onData: OnDataCallback): Promise<void>; |
@@ -29,4 +29,3 @@ "use strict"; | ||
let started = false; | ||
logger_1.logger.log('info', `Serum producer starting for ${this._options.marketName} market...`); | ||
const marketMeta = this._options.markets.find((m) => m.name == this._options.marketName); | ||
logger_1.logger.log('info', `Serum producer starting for ${this._options.market.name} market...`); | ||
// don't use Solana web3.js Connection but custom rpcClient so we have more control and insight what is going on | ||
@@ -38,7 +37,7 @@ const rpcClient = new rpc_client_1.RPCClient({ | ||
}); | ||
const market = await serum_1.Market.load(rpcClient, new web3_js_1.PublicKey(marketMeta.address), undefined, new web3_js_1.PublicKey(marketMeta.programId)); | ||
const market = await serum_1.Market.load(rpcClient, new web3_js_1.PublicKey(this._options.market.address), undefined, new web3_js_1.PublicKey(this._options.market.programId)); | ||
const priceDecimalPlaces = (0, helpers_1.decimalPlaces)(market.tickSize); | ||
const sizeDecimalPlaces = (0, helpers_1.decimalPlaces)(market.minOrderSize); | ||
const dataMapper = new data_mapper_1.DataMapper({ | ||
symbol: this._options.marketName, | ||
symbol: this._options.market.name, | ||
market, | ||
@@ -58,3 +57,3 @@ priceDecimalPlaces, | ||
logger_1.logger.log('info', `Event loop blocked for ${Math.round(n)} ms.`, { | ||
market: this._options.marketName | ||
market: this._options.market.name | ||
}); | ||
@@ -64,5 +63,5 @@ } | ||
}, interval).unref(); | ||
for await (const notification of rpcClient.streamAccountsNotification(market, this._options.marketName)) { | ||
for await (const notification of rpcClient.streamAccountsNotification(market, this._options.market.name)) { | ||
if (started === false) { | ||
logger_1.logger.log('info', `Serum producer started for ${this._options.marketName} market...`); | ||
logger_1.logger.log('info', `Serum producer started for ${this._options.market.name} market...`); | ||
started = true; | ||
@@ -69,0 +68,0 @@ helpers_1.serumProducerReadyChannel.postMessage('ready'); |
{ | ||
"name": "serum-vial", | ||
"version": "1.4.8", | ||
"version": "1.4.9", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=15" |
@@ -63,3 +63,3 @@ import os from 'os' | ||
const serumProducerWorker = new Worker(path.resolve(__dirname, 'serum_producer.js'), { | ||
workerData: { marketName: market.name, nodeEndpoint, markets, commitment, wsEndpointPort } | ||
workerData: { market, nodeEndpoint, commitment, wsEndpointPort } | ||
}) | ||
@@ -66,0 +66,0 @@ |
@@ -494,3 +494,3 @@ import { Market } from '@project-serum/serum' | ||
this._receivedMessagesCount = 0 | ||
}, 120 * 1000) | ||
}, 30 * 1000) | ||
} | ||
@@ -497,0 +497,0 @@ |
@@ -31,5 +31,4 @@ import { Market } from '@project-serum/serum' | ||
wsEndpointPort: number | undefined | ||
marketName: string | ||
market: SerumMarket | ||
commitment: string | ||
markets: SerumMarket[] | ||
} | ||
@@ -40,6 +39,4 @@ ) {} | ||
let started = false | ||
logger.log('info', `Serum producer starting for ${this._options.marketName} market...`) | ||
logger.log('info', `Serum producer starting for ${this._options.market.name} market...`) | ||
const marketMeta = this._options.markets.find((m) => m.name == this._options.marketName)! | ||
// don't use Solana web3.js Connection but custom rpcClient so we have more control and insight what is going on | ||
@@ -54,5 +51,5 @@ const rpcClient = new RPCClient({ | ||
rpcClient as any, | ||
new PublicKey(marketMeta.address), | ||
new PublicKey(this._options.market.address), | ||
undefined, | ||
new PublicKey(marketMeta.programId) | ||
new PublicKey(this._options.market.programId) | ||
) | ||
@@ -64,3 +61,3 @@ | ||
const dataMapper = new DataMapper({ | ||
symbol: this._options.marketName, | ||
symbol: this._options.market.name, | ||
market, | ||
@@ -83,3 +80,3 @@ priceDecimalPlaces, | ||
logger.log('info', `Event loop blocked for ${Math.round(n)} ms.`, { | ||
market: this._options.marketName | ||
market: this._options.market.name | ||
}) | ||
@@ -91,5 +88,5 @@ } | ||
for await (const notification of rpcClient.streamAccountsNotification(market, this._options.marketName)) { | ||
for await (const notification of rpcClient.streamAccountsNotification(market, this._options.market.name)) { | ||
if (started === false) { | ||
logger.log('info', `Serum producer started for ${this._options.marketName} market...`) | ||
logger.log('info', `Serum producer started for ${this._options.market.name} market...`) | ||
started = true | ||
@@ -96,0 +93,0 @@ serumProducerReadyChannel.postMessage('ready') |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
303972
4478