Socket
Socket
Sign inDemoInstall

@0x/mesh-rpc-client

Package Overview
Dependencies
152
Maintainers
9
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.2.0 to 9.0.0-wss-support

lib/test/utils/chai_setup.d.ts

10

lib/src/ws_client.d.ts

@@ -38,6 +38,14 @@ import { SignedOrder } from '@0x/types';

* @param perPage number of signedOrders to fetch per paginated request
* @returns all orders, their hash and their fillableTakerAssetAmount
* @returns the snapshotID, snapshotTimestamp and all orders, their hashes and fillableTakerAssetAmounts
*/
getOrdersAsync(perPage?: number): Promise<GetOrdersResponse>;
/**
* Get page of 0x signed orders stored on the Mesh node at the specified snapshot
* @param page Page index at which to retrieve orders
* @param perPage number of signedOrders to fetch per paginated request
* @param snapshotID The DB snapshot at which to fetch orders. If omitted, a new snapshot is created
* @returns the snapshotID, snapshotTimestamp and all orders, their hashes and fillableTakerAssetAmounts
*/
getOrdersForPageAsync(page: number, perPage?: number, snapshotID?: string): Promise<GetOrdersResponse>;
/**
* Subscribe to the 'orders' topic and receive order events from Mesh. This method returns a

@@ -44,0 +52,0 @@ * subscriptionId that can be used to `unsubscribe()` from this subscription.

59

lib/src/ws_client.js

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

* @param perPage number of signedOrders to fetch per paginated request
* @returns all orders, their hash and their fillableTakerAssetAmount
* @returns the snapshotID, snapshotTimestamp and all orders, their hashes and fillableTakerAssetAmounts
*/

@@ -359,3 +359,3 @@ WSClient.prototype.getOrdersAsync = function (perPage) {

return __awaiter(this, void 0, void 0, function () {
var snapshotID, page, rawGetOrdersResponse, getOrdersResponse, rawOrdersInfos, allRawOrderInfos, orderInfos;
var snapshotID, page, getOrdersResponse, ordersInfos, allOrderInfos;
return __generator(this, function (_a) {

@@ -366,30 +366,25 @@ switch (_a.label) {

page = 0;
return [4 /*yield*/, this._wsProvider.send('mesh_getOrders', [
page,
perPage,
snapshotID,
])];
return [4 /*yield*/, this.getOrdersForPageAsync(page, perPage, snapshotID)];
case 1:
rawGetOrdersResponse = _a.sent();
getOrdersResponse = WSClient._convertRawGetOrdersResponse(rawGetOrdersResponse);
snapshotID = rawGetOrdersResponse.snapshotID;
rawOrdersInfos = rawGetOrdersResponse.ordersInfos;
allRawOrderInfos = [];
getOrdersResponse = _a.sent();
snapshotID = getOrdersResponse.snapshotID;
ordersInfos = getOrdersResponse.ordersInfos;
allOrderInfos = [];
_a.label = 2;
case 2:
allRawOrderInfos = __spread(allRawOrderInfos, rawOrdersInfos);
allOrderInfos = __spread(allOrderInfos, ordersInfos);
page++;
return [4 /*yield*/, this._wsProvider.send('mesh_getOrders', [page, perPage, snapshotID])];
return [4 /*yield*/, this.getOrdersForPageAsync(page, perPage, snapshotID)];
case 3:
rawOrdersInfos = (_a.sent()).ordersInfos;
getOrdersResponse = _a.sent();
ordersInfos = getOrdersResponse.ordersInfos;
_a.label = 4;
case 4:
if (rawOrdersInfos.length > 0) return [3 /*break*/, 2];
if (ordersInfos.length > 0) return [3 /*break*/, 2];
_a.label = 5;
case 5:
orderInfos = WSClient._convertRawOrderInfos(allRawOrderInfos);
getOrdersResponse = {
snapshotID: snapshotID,
snapshotTimestamp: getOrdersResponse.snapshotTimestamp,
ordersInfos: orderInfos,
ordersInfos: allOrderInfos,
};

@@ -402,2 +397,30 @@ return [2 /*return*/, getOrdersResponse];

/**
* Get page of 0x signed orders stored on the Mesh node at the specified snapshot
* @param page Page index at which to retrieve orders
* @param perPage number of signedOrders to fetch per paginated request
* @param snapshotID The DB snapshot at which to fetch orders. If omitted, a new snapshot is created
* @returns the snapshotID, snapshotTimestamp and all orders, their hashes and fillableTakerAssetAmounts
*/
WSClient.prototype.getOrdersForPageAsync = function (page, perPage, snapshotID) {
if (perPage === void 0) { perPage = 200; }
return __awaiter(this, void 0, void 0, function () {
var finalSnapshotID, rawGetOrdersResponse, getOrdersResponse;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
finalSnapshotID = snapshotID === undefined ? '' : snapshotID;
return [4 /*yield*/, this._wsProvider.send('mesh_getOrders', [
page,
perPage,
finalSnapshotID,
])];
case 1:
rawGetOrdersResponse = _a.sent();
getOrdersResponse = WSClient._convertRawGetOrdersResponse(rawGetOrdersResponse);
return [2 /*return*/, getOrdersResponse];
}
});
});
};
/**
* Subscribe to the 'orders' topic and receive order events from Mesh. This method returns a

@@ -404,0 +427,0 @@ * subscriptionId that can be used to `unsubscribe()` from this subscription.

{
"name": "@0x/mesh-rpc-client",
"version": "8.2.0",
"version": "9.0.0-wss-support",
"engines": {

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc