Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serum-vial

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serum-vial - npm Package Compare versions

Comparing version 0.9.8 to 0.9.9

8

bin/serum-vial.js

@@ -28,2 +28,9 @@ #!/usr/bin/env node

.option('ws-endpoint-port', {
type: 'number',
describe:
'Optional Solana RPC WS node endpoint port that serum-vial uses as a data source (if different than REST endpoint port)',
default: undefined
})
.option('log-level', {

@@ -90,2 +97,3 @@ type: 'string',

nodeEndpoint: argv['endpoint'],
wsEndpointPort: argv['ws-endpoint-port'],
validateL3Diffs: argv['validate-l3-diffs'],

@@ -92,0 +100,0 @@ minionsCount: argv['minions-count'],

3

dist/boot_server.d.ts
import { SerumMarket } from './types';
export declare function bootServer({ port, nodeEndpoint, validateL3Diffs, minionsCount, markets, commitment }: BootOptions): Promise<void>;
export declare function bootServer({ port, nodeEndpoint, wsEndpointPort, validateL3Diffs, minionsCount, markets, commitment }: BootOptions): Promise<void>;
export declare function stopServer(): Promise<void>;

@@ -7,2 +7,3 @@ declare type BootOptions = {

nodeEndpoint: string;
wsEndpointPort: number | undefined;
validateL3Diffs: boolean;

@@ -9,0 +10,0 @@ minionsCount: number;

@@ -12,3 +12,3 @@ "use strict";

const logger_1 = require("./logger");
async function bootServer({ port, nodeEndpoint, validateL3Diffs, minionsCount, markets, commitment }) {
async function bootServer({ port, nodeEndpoint, wsEndpointPort, validateL3Diffs, minionsCount, markets, commitment }) {
// multi core support is linux only feature which allows multiple threads to bind to the same port

@@ -47,3 +47,3 @@ // see https://github.com/uNetworking/uWebSockets.js/issues/304 and https://lwn.net/Articles/542629/

const serumProducerWorker = new worker_threads_1.Worker(path_1.default.resolve(__dirname, 'serum_producer.js'), {
workerData: { marketName: market.name, nodeEndpoint, validateL3Diffs, markets, commitment }
workerData: { marketName: market.name, nodeEndpoint, validateL3Diffs, markets, commitment, wsEndpointPort }
});

@@ -50,0 +50,0 @@ serumProducerWorker.on('error', (err) => {

@@ -8,2 +8,3 @@ /// <reference types="node" />

readonly nodeEndpoint: string;
readonly wsEndpointPort: number | undefined;
readonly commitment: string;

@@ -10,0 +11,0 @@ });

@@ -22,2 +22,5 @@ "use strict";

wsEndpoint.protocol = this._options.nodeEndpoint.startsWith('https') ? 'wss' : 'ws';
if (this._options.wsEndpointPort !== undefined) {
wsEndpoint.port = this._options.wsEndpointPort.toString();
}
const notificationsStream = new stream_1.PassThrough({

@@ -27,3 +30,3 @@ objectMode: true,

});
var accountsNotifications = new AccountsChangeNotifications(market, {
const options = {
nodeWsEndpoint: wsEndpoint.toString(),

@@ -33,3 +36,5 @@ nodeRestEndpoint: this._options.nodeEndpoint,

commitment: this._options.commitment
});
};
const accountsNotifications = new AccountsChangeNotifications(market, options);
logger_1.logger.log('info', 'Starting RPC client', options);
accountsNotifications.onAccountsChange = (notification) => {

@@ -36,0 +41,0 @@ notificationsStream.write(notification);

@@ -7,2 +7,3 @@ import { MessageType } from './consts';

nodeEndpoint: string;
wsEndpointPort: number | undefined;
validateL3Diffs: boolean;

@@ -9,0 +10,0 @@ marketName: string;

@@ -31,3 +31,7 @@ "use strict";

// don't use Solana web3.js Connection but custom rpcClient so we have more control and insight what is going on
const rpcClient = new rpc_client_1.RPCClient({ nodeEndpoint: this._options.nodeEndpoint, commitment: this._options.commitment });
const rpcClient = new rpc_client_1.RPCClient({
nodeEndpoint: this._options.nodeEndpoint,
commitment: this._options.commitment,
wsEndpointPort: this._options.wsEndpointPort
});
const market = await serum_1.Market.load(rpcClient, new web3_js_1.PublicKey(marketMeta.address), undefined, new web3_js_1.PublicKey(marketMeta.programId));

@@ -34,0 +38,0 @@ const priceDecimalPlaces = helpers_1.decimalPlaces(market.tickSize);

{
"name": "serum-vial",
"version": "0.9.8",
"version": "0.9.9",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=15"

@@ -11,2 +11,3 @@ import os from 'os'

nodeEndpoint,
wsEndpointPort,
validateL3Diffs,

@@ -63,3 +64,3 @@ minionsCount,

const serumProducerWorker = new Worker(path.resolve(__dirname, 'serum_producer.js'), {
workerData: { marketName: market.name, nodeEndpoint, validateL3Diffs, markets, commitment }
workerData: { marketName: market.name, nodeEndpoint, validateL3Diffs, markets, commitment, wsEndpointPort }
})

@@ -104,2 +105,3 @@

nodeEndpoint: string
wsEndpointPort: number | undefined
validateL3Diffs: boolean

@@ -106,0 +108,0 @@ minionsCount: number

@@ -12,3 +12,9 @@ import { Market } from '@project-serum/serum'

export class RPCClient {
constructor(private readonly _options: { readonly nodeEndpoint: string; readonly commitment: string }) {}
constructor(
private readonly _options: {
readonly nodeEndpoint: string
readonly wsEndpointPort: number | undefined
readonly commitment: string
}
) {}

@@ -19,2 +25,6 @@ public async *streamAccountsNotification(market: Market, marketName: string): AsyncIterable<AccountsNotification> {

if (this._options.wsEndpointPort !== undefined) {
wsEndpoint.port = this._options.wsEndpointPort.toString()
}
const notificationsStream = new PassThrough({

@@ -25,3 +35,3 @@ objectMode: true,

var accountsNotifications = new AccountsChangeNotifications(market, {
const options = {
nodeWsEndpoint: wsEndpoint.toString(),

@@ -31,4 +41,8 @@ nodeRestEndpoint: this._options.nodeEndpoint,

commitment: this._options.commitment
})
}
const accountsNotifications = new AccountsChangeNotifications(market, options)
logger.log('info', 'Starting RPC client', options)
accountsNotifications.onAccountsChange = (notification) => {

@@ -35,0 +49,0 @@ notificationsStream.write(notification)

@@ -30,2 +30,3 @@ import { Market } from '@project-serum/serum'

nodeEndpoint: string
wsEndpointPort: number | undefined
validateL3Diffs: boolean

@@ -45,3 +46,7 @@ marketName: string

// don't use Solana web3.js Connection but custom rpcClient so we have more control and insight what is going on
const rpcClient = new RPCClient({ nodeEndpoint: this._options.nodeEndpoint, commitment: this._options.commitment })
const rpcClient = new RPCClient({
nodeEndpoint: this._options.nodeEndpoint,
commitment: this._options.commitment,
wsEndpointPort: this._options.wsEndpointPort
})

@@ -48,0 +53,0 @@ const market = await Market.load(

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc