protocol/packages/connect/docs/reference.mdx
2019-11-17 18:03:13 -05:00

685 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Type aliases
### AssetPairsResponse
Ƭ **AssetPairsResponse**: *[PaginatedCollection](#interface-paginatedcollection)*[AssetPairsItem](#interface-assetpairsitem)**
*Defined in [types/src/index.ts:416](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L416)*
___
### FeeRecipientsResponse
Ƭ **FeeRecipientsResponse**: *[PaginatedCollection](#interface-paginatedcollection)*string**
*Defined in [types/src/index.ts:484](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L484)*
___
### OrdersResponse
Ƭ **OrdersResponse**: *[PaginatedCollection](#interface-paginatedcollection)*[APIOrder](#interface-apiorder)**
*Defined in [types/src/index.ts:404](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L404)*
___
# Interface: APIOrder
## Properties
### metaData
• **metaData**: *object*
*Defined in [types/src/index.ts:408](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L408)*
___
### order
• **order**: *[SignedOrder](#class-signedorder)*
*Defined in [types/src/index.ts:407](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L407)*
<hr />
# Class: HttpClient
This class includes all the functionality related to interacting with a set of HTTP endpoints
that implement the standard relayer API v2
## Constructors
\+ **new HttpClient**(`url`: string): *[HttpClient](#class-httpclient)*
*Defined in [connect/src/http_client.ts:43](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L43)*
Instantiates a new HttpClient instance
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`url` | string | The relayer API base HTTP url you would like to interact with |
**Returns:** *[HttpClient](#class-httpclient)*
An instance of HttpClient
## Methods
### getAssetPairsAsync
▸ **getAssetPairsAsync**(`requestOpts?`: `AssetPairsRequestOpts` & `PagedRequestOpts`): *`Promise<AssetPairsResponse>`*
*Defined in [connect/src/http_client.ts:58](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L58)*
Retrieve assetData pair info from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `AssetPairsRequestOpts` & `PagedRequestOpts` | Options specifying assetData information to retrieve, page information. |
**Returns:** *`Promise<AssetPairsResponse>`*
The resulting AssetPairsResponse that match the request
___
### getFeeRecipientsAsync
▸ **getFeeRecipientsAsync**(`requestOpts?`: [PagedRequestOpts](#interface-pagedrequestopts)): *`Promise<FeeRecipientsResponse>`*
*Defined in [connect/src/http_client.ts:140](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L140)*
Retrieve the list of fee recipient addresses used by the relayer.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | [PagedRequestOpts](#interface-pagedrequestopts) | Options specifying page information. |
**Returns:** *`Promise<FeeRecipientsResponse>`*
The resulting FeeRecipientsResponse
___
### getOrderAsync
▸ **getOrderAsync**(`orderHash`: string): *`Promise<APIOrder>`*
*Defined in [connect/src/http_client.ts:94](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L94)*
Retrieve a specific order from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`orderHash` | string | An orderHash generated from the desired order |
**Returns:** *`Promise<APIOrder>`*
The APIOrder that matches the supplied orderHash
___
### getOrderConfigAsync
▸ **getOrderConfigAsync**(`request`: `OrderConfigRequest`): *`Promise<OrderConfigResponse>`*
*Defined in [connect/src/http_client.ts:126](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L126)*
Retrieve fee information from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`request` | `OrderConfigRequest` | A OrderConfigRequest instance describing the specific fees to retrieve |
**Returns:** *`Promise<OrderConfigResponse>`*
The resulting OrderConfigResponse that matches the request
___
### getOrderbookAsync
▸ **getOrderbookAsync**(`request`: `OrderbookRequest`, `requestOpts?`: [PagedRequestOpts](#interface-pagedrequestopts)): *`Promise<OrderbookResponse>`*
*Defined in [connect/src/http_client.ts:106](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L106)*
Retrieve an orderbook from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`request` | `OrderbookRequest` | An OrderbookRequest instance describing the specific orderbook to retrieve |
`requestOpts?` | [PagedRequestOpts](#interface-pagedrequestopts) | Options specifying page information. |
**Returns:** *`Promise<OrderbookResponse>`*
The resulting OrderbookResponse that matches the request
___
### getOrdersAsync
▸ **getOrdersAsync**(`requestOpts?`: `OrdersRequestOpts` & `PagedRequestOpts`): *`Promise<OrdersResponse>`*
*Defined in [connect/src/http_client.ts:77](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L77)*
Retrieve orders from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `OrdersRequestOpts` & `PagedRequestOpts` | Options specifying orders to retrieve and page information, page information. |
**Returns:** *`Promise<OrdersResponse>`*
The resulting OrdersResponse that match the request
___
### submitOrderAsync
▸ **submitOrderAsync**(`signedOrder`: `SignedOrder`): *`Promise<void>`*
*Defined in [connect/src/http_client.ts:155](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/http_client.ts#L155)*
Submit a signed order to the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`signedOrder` | `SignedOrder` | A SignedOrder instance to submit |
**Returns:** *`Promise<void>`*
<hr />
# Interface: PagedRequestOpts
## Properties
### `Optional` page
• **page**? : *undefined | number*
*Defined in [types/src/index.ts:491](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L491)*
___
### `Optional` perPage
• **perPage**? : *undefined | number*
*Defined in [types/src/index.ts:492](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L492)*
<hr />
# Interface: PaginatedCollection <**T**>
## Type parameters
▪ **T**
## Properties
### page
• **page**: *number*
*Defined in [types/src/index.ts:459](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L459)*
___
### perPage
• **perPage**: *number*
*Defined in [types/src/index.ts:460](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L460)*
___
### records
• **records**: *`T`[]*
*Defined in [types/src/index.ts:461](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L461)*
___
### total
• **total**: *number*
*Defined in [types/src/index.ts:458](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L458)*
<hr />
# Interface: SignedOrder
## Properties
### chainId
• **chainId**: *number*
*Inherited from [Order](#interface-order).[chainId](#chainid)*
*Defined in [types/src/index.ts:14](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L14)*
___
### exchangeAddress
• **exchangeAddress**: *string*
*Inherited from [Order](#interface-order).[exchangeAddress](#exchangeaddress)*
*Defined in [types/src/index.ts:15](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L15)*
___
### expirationTimeSeconds
• **expirationTimeSeconds**: *`BigNumber`*
*Inherited from [Order](#interface-order).[expirationTimeSeconds](#expirationtimeseconds)*
*Defined in [types/src/index.ts:24](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L24)*
___
### feeRecipientAddress
• **feeRecipientAddress**: *string*
*Inherited from [Order](#interface-order).[feeRecipientAddress](#feerecipientaddress)*
*Defined in [types/src/index.ts:18](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L18)*
___
### makerAddress
• **makerAddress**: *string*
*Inherited from [Order](#interface-order).[makerAddress](#makeraddress)*
*Defined in [types/src/index.ts:16](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L16)*
___
### makerAssetAmount
• **makerAssetAmount**: *`BigNumber`*
*Inherited from [Order](#interface-order).[makerAssetAmount](#makerassetamount)*
*Defined in [types/src/index.ts:20](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L20)*
___
### makerAssetData
• **makerAssetData**: *string*
*Inherited from [Order](#interface-order).[makerAssetData](#makerassetdata)*
*Defined in [types/src/index.ts:26](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L26)*
___
### makerFee
• **makerFee**: *`BigNumber`*
*Inherited from [Order](#interface-order).[makerFee](#makerfee)*
*Defined in [types/src/index.ts:22](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L22)*
___
### makerFeeAssetData
• **makerFeeAssetData**: *string*
*Inherited from [Order](#interface-order).[makerFeeAssetData](#makerfeeassetdata)*
*Defined in [types/src/index.ts:28](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L28)*
___
### salt
• **salt**: *`BigNumber`*
*Inherited from [Order](#interface-order).[salt](#salt)*
*Defined in [types/src/index.ts:25](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L25)*
___
### senderAddress
• **senderAddress**: *string*
*Inherited from [Order](#interface-order).[senderAddress](#senderaddress)*
*Defined in [types/src/index.ts:19](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L19)*
___
### signature
• **signature**: *string*
*Defined in [types/src/index.ts:33](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L33)*
___
### takerAddress
• **takerAddress**: *string*
*Inherited from [Order](#interface-order).[takerAddress](#takeraddress)*
*Defined in [types/src/index.ts:17](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L17)*
___
### takerAssetAmount
• **takerAssetAmount**: *`BigNumber`*
*Inherited from [Order](#interface-order).[takerAssetAmount](#takerassetamount)*
*Defined in [types/src/index.ts:21](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L21)*
___
### takerAssetData
• **takerAssetData**: *string*
*Inherited from [Order](#interface-order).[takerAssetData](#takerassetdata)*
*Defined in [types/src/index.ts:27](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L27)*
___
### takerFee
• **takerFee**: *`BigNumber`*
*Inherited from [Order](#interface-order).[takerFee](#takerfee)*
*Defined in [types/src/index.ts:23](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L23)*
___
### takerFeeAssetData
• **takerFeeAssetData**: *string*
*Inherited from [Order](#interface-order).[takerFeeAssetData](#takerfeeassetdata)*
*Defined in [types/src/index.ts:29](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/types/src/index.ts#L29)*
<hr />
<hr />
<hr />
## Object literals
### `Const` ordersChannelFactory
#### ▪ **ordersChannelFactory**: *object*
*Defined in [connect/src/orders_channel_factory.ts:7](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/orders_channel_factory.ts#L7)*
#### createWebSocketOrdersChannelAsync
▸ **createWebSocketOrdersChannelAsync**(`url`: string, `handler`: [OrdersChannelHandler](#interface-orderschannelhandler)): *`Promise<OrdersChannel>`*
*Defined in [connect/src/orders_channel_factory.ts:15](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/connect/src/orders_channel_factory.ts#L15)*
Instantiates a new WebSocketOrdersChannel instance
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`url` | string | The relayer API base WS url you would like to interact with |
`handler` | [OrdersChannelHandler](#interface-orderschannelhandler) | An OrdersChannelHandler instance that responds to various channel updates |
**Returns:** *`Promise<OrdersChannel>`*
An OrdersChannel Promise
<hr />