@0x/mesh-rpc-client
Advanced tools
Comparing version 8.2.0 to 9.0.0-wss-support
@@ -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. |
@@ -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" |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
119131
17
2240
2
1
3