aboutsummaryrefslogtreecommitdiffstats
path: root/packages/types
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-09-25 18:47:31 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-09-25 19:12:12 +0800
commitb85db17e75e818b5b554cc2b8068aba980d95804 (patch)
tree8e612ecbcf7dab56efc74f9b7bdde2be079f33b0 /packages/types
parent408f5731880d61877964275301ad10d522aad6a7 (diff)
downloaddexon-0x-contracts-b85db17e75e818b5b554cc2b8068aba980d95804.tar.gz
dexon-0x-contracts-b85db17e75e818b5b554cc2b8068aba980d95804.tar.zst
dexon-0x-contracts-b85db17e75e818b5b554cc2b8068aba980d95804.zip
Move SRA types from @0xproject/connect to @0xproject/sra-types
Diffstat (limited to 'packages/types')
-rw-r--r--packages/types/CHANGELOG.json4
-rw-r--r--packages/types/src/index.ts128
2 files changed, 132 insertions, 0 deletions
diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json
index 8b1346347..9cdb3bc1f 100644
--- a/packages/types/CHANGELOG.json
+++ b/packages/types/CHANGELOG.json
@@ -5,6 +5,10 @@
{
"note": "Add ObjectMap type",
"pr": 1037
+ },
+ {
+ "note": "Add SRA types from connect",
+ "pr": 1085
}
]
},
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 25803e8c8..d27060ee5 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -243,3 +243,131 @@ export enum StatusCodes {
export interface ObjectMap<T> {
[key: string]: T;
}
+
+/**
+ * baseAssetData: The address of assetData designated as the baseToken in the currency pair calculation of price
+ * quoteAssetData: The address of assetData designated as the quoteToken in the currency pair calculation of price
+ * limit: Maximum number of bids and asks in orderbook snapshot
+ */
+export interface OrdersChannelSubscriptionOpts {
+ baseAssetData: string;
+ quoteAssetData: string;
+ limit: number;
+}
+
+export type OrdersChannelMessage = UpdateOrdersChannelMessage | UnknownOrdersChannelMessage;
+
+export enum OrdersChannelMessageTypes {
+ Update = 'update',
+ Unknown = 'unknown',
+}
+
+export interface UpdateOrdersChannelMessage {
+ type: OrdersChannelMessageTypes.Update;
+ requestId: string;
+ payload: APIOrder[];
+}
+
+export interface UnknownOrdersChannelMessage {
+ type: OrdersChannelMessageTypes.Unknown;
+ requestId: string;
+ payload: undefined;
+}
+
+export enum WebsocketConnectionEventType {
+ Close = 'close',
+ Error = 'error',
+ Message = 'message',
+}
+
+export enum WebsocketClientEventType {
+ Connect = 'connect',
+ ConnectFailed = 'connectFailed',
+}
+
+export type OrdersResponse = PaginatedCollection<APIOrder>;
+
+export interface APIOrder {
+ order: SignedOrder;
+ metaData: object;
+}
+
+export interface AssetPairsRequestOpts {
+ assetDataA?: string;
+ assetDataB?: string;
+}
+
+export type AssetPairsResponse = PaginatedCollection<AssetPairsItem>;
+
+export interface AssetPairsItem {
+ assetDataA: Asset;
+ assetDataB: Asset;
+}
+
+export interface Asset {
+ assetData: string;
+ minAmount: BigNumber;
+ maxAmount: BigNumber;
+ precision: number;
+}
+
+export interface OrdersRequestOpts {
+ makerAssetProxyId?: string;
+ takerAssetProxyId?: string;
+ makerAssetAddress?: string;
+ takerAssetAddress?: string;
+ exchangeAddress?: string;
+ senderAddress?: string;
+ makerAssetData?: string;
+ takerAssetData?: string;
+ makerAddress?: string;
+ takerAddress?: string;
+ traderAddress?: string;
+ feeRecipientAddress?: string;
+}
+
+export interface OrderbookRequest {
+ baseAssetData: string;
+ quoteAssetData: string;
+}
+
+export interface OrderbookResponse {
+ bids: PaginatedCollection<APIOrder>;
+ asks: PaginatedCollection<APIOrder>;
+}
+
+export interface PaginatedCollection<T> {
+ total: number;
+ page: number;
+ perPage: number;
+ records: T[];
+}
+
+export interface OrderConfigRequest {
+ makerAddress: string;
+ takerAddress: string;
+ makerAssetAmount: BigNumber;
+ takerAssetAmount: BigNumber;
+ makerAssetData: string;
+ takerAssetData: string;
+ exchangeAddress: string;
+ expirationTimeSeconds: BigNumber;
+}
+
+export interface OrderConfigResponse {
+ makerFee: BigNumber;
+ takerFee: BigNumber;
+ feeRecipientAddress: string;
+ senderAddress: string;
+}
+
+export type FeeRecipientsResponse = PaginatedCollection<string>;
+
+export interface RequestOpts {
+ networkId?: number;
+}
+
+export interface PagedRequestOpts {
+ page?: number;
+ perPage?: number;
+}