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

@waves.exchange/matcher-ws

Package Overview
Dependencies
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waves.exchange/matcher-ws - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

dist/addressUpdates.d.ts

2

dist/index.d.ts
export * from './orderbook';
export * from './addressUpdates';
export * from './ratesUpdates';
//# sourceMappingURL=index.d.ts.map

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

tslib_1.__exportStar(require("./orderbook"), exports);
tslib_1.__exportStar(require("./addressUpdates"), exports);
tslib_1.__exportStar(require("./ratesUpdates"), exports);
//# sourceMappingURL=index.js.map

@@ -0,1 +1,2 @@

/// <reference types="zen-observable" />
import { Observable, WebSocketSubject } from '@waves.exchange/reactive';

@@ -11,2 +12,3 @@ import { BigNumber } from '@waves/bignumber';

S: string;
U: number;
b?: RawOrderbookOrder[];

@@ -13,0 +15,0 @@ a?: RawOrderbookOrder[];

31

dist/orderbook.js

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

const bintrees_1 = require("bintrees");
const MatcherUpdateSequence_1 = require("./MatcherUpdateSequence");
class OrdersCache {

@@ -56,2 +57,3 @@ constructor(type) {

return new reactive_1.Observable((observer) => {
const matcherUpdateSequence = new MatcherUpdateSequence_1.MatcherUpdateSequence();
const asks = new OrdersCache('asks');

@@ -65,16 +67,21 @@ const bids = new OrdersCache('bids');

const subscription = ws.multiplex(() => ({ T: 'obs', S: symbol, d: depth }), () => ({ T: 'u', S: symbol }), (data) => data.T === 'ob' && data.S === symbol).subscribe((ob) => {
if (ob.a) {
asks.patch(ob.a);
if (matcherUpdateSequence.setAndValidate(ob.U)) {
if (ob.a) {
asks.patch(ob.a);
}
if (ob.b) {
bids.patch(ob.b);
}
if (ob.t) {
lastTrade = parseTrade(ob.t);
}
observer.next({
asks: asks.toArray(),
bids: bids.toArray(),
lastTrade: lastTrade,
});
}
if (ob.b) {
bids.patch(ob.b);
else {
observer.error(new Error('Matcher update id is not consistent'));
}
if (ob.t) {
lastTrade = parseTrade(ob.t);
}
observer.next({
asks: asks.toArray(),
bids: bids.toArray(),
lastTrade: lastTrade,
});
});

@@ -81,0 +88,0 @@ return () => {

{
"name": "@waves.exchange/matcher-ws",
"version": "0.0.4",
"version": "0.0.5",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts",

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