aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api/src/api.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-08 06:38:50 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-08 06:39:33 +0800
commitf36a43a83f6c8ae32d36768da8c97858ef051446 (patch)
tree0037a7273a4c1e8b4e8b50d068e930b32d622381 /packages/sra-api/src/api.ts
parentf4c2fabbf8f8eccd5cd7c65035e78ad268a34b57 (diff)
downloaddexon-sol-tools-f36a43a83f6c8ae32d36768da8c97858ef051446.tar
dexon-sol-tools-f36a43a83f6c8ae32d36768da8c97858ef051446.tar.gz
dexon-sol-tools-f36a43a83f6c8ae32d36768da8c97858ef051446.tar.bz2
dexon-sol-tools-f36a43a83f6c8ae32d36768da8c97858ef051446.tar.lz
dexon-sol-tools-f36a43a83f6c8ae32d36768da8c97858ef051446.tar.xz
dexon-sol-tools-f36a43a83f6c8ae32d36768da8c97858ef051446.tar.zst
dexon-sol-tools-f36a43a83f6c8ae32d36768da8c97858ef051446.zip
Add orders endpoint
Diffstat (limited to 'packages/sra-api/src/api.ts')
-rw-r--r--packages/sra-api/src/api.ts127
1 files changed, 126 insertions, 1 deletions
diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts
index c93d57946..d80fb9b41 100644
--- a/packages/sra-api/src/api.ts
+++ b/packages/sra-api/src/api.ts
@@ -5,7 +5,7 @@ import { examples } from './examples';
import { md } from './md';
import { generateParameters } from './parameters';
import { generateResponses } from './responses';
-// We need to replace the `$ref`s to be openAPI compliant.
+// We need to replace the `$ref`s to be OpenAPI compliant.
const openApiSchemas = JSON.parse(JSON.stringify(schemas).replace(/(\/\w+)/g, match => `#/components/schemas${match}`));
export const api: OpenApiSpec = {
@@ -55,6 +55,131 @@ export const api: OpenApiSpec = {
),
},
},
+ '/v2/orders': {
+ get: {
+ description:
+ 'Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.',
+ operationId: 'getOrders',
+ parameters: generateParameters(
+ [
+ {
+ name: 'makerAssetProxyId',
+ in: 'query',
+ description: `The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: "0xf47261b0" for ERC20, "0x02571792" for ERC721).`,
+ example: '0xf47261b0',
+ schema: {
+ $ref: '#/components/schemas/hexSchema',
+ },
+ },
+ {
+ name: 'takerAssetProxyId',
+ in: 'query',
+ description: `The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: "0xf47261b0" for ERC20, "0x02571792" for ERC721).`,
+ example: '0x02571792',
+ schema: {
+ $ref: '#/components/schemas/hexSchema',
+ },
+ },
+ {
+ name: 'makerAssetAddress',
+ in: 'query',
+ description: `The contract address for the maker asset.`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ {
+ name: 'takerAssetAddress',
+ in: 'query',
+ description: `The contract address for the taker asset.`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ {
+ name: 'exchangeAddress',
+ in: 'query',
+ description: `Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ {
+ name: 'senderAddress',
+ in: 'query',
+ description: `Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ {
+ name: 'makerAssetData',
+ in: 'query',
+ description: `Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/hexSchema',
+ },
+ },
+ {
+ name: 'takerAssetData',
+ in: 'query',
+ description: `Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/hexSchema',
+ },
+ },
+ {
+ name: 'traderAssetData',
+ in: 'query',
+ description: `Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/hexSchema',
+ },
+ },
+ {
+ name: 'makerAddress',
+ in: 'query',
+ description: `Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ {
+ name: 'traderAddress',
+ in: 'query',
+ description: `Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ {
+ name: 'feeRecipientAddress',
+ in: 'query',
+ description: `Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ ],
+ true,
+ ),
+ responses: generateResponses(
+ 'relayerApiOrdersResponseSchema',
+ examples.relayerApiOrdersResponse,
+ `Returns a collection of 0x orders with meta-data as specified by query params`,
+ ),
+ },
+ },
},
components: {
schemas: openApiSchemas,