-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f395be9
commit 300a649
Showing
7 changed files
with
183 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { RfqOrder, Signature } from '@0x/protocol-utils'; | ||
import { BigNumber } from '@0x/utils'; | ||
|
||
import { AltRfqMakerAssetOfferings } from '../types'; | ||
|
||
export interface RfqClientV1PriceRequest { | ||
altRfqAssetOfferings: AltRfqMakerAssetOfferings | undefined; | ||
assetFillAmount: BigNumber; | ||
chainId: number; | ||
comparisonPrice: BigNumber | undefined; | ||
integratorId: string; | ||
intentOnFilling: boolean; | ||
makerToken: string; | ||
marketOperation: 'Sell' | 'Buy'; | ||
takerAddress: string; | ||
takerToken: string; | ||
txOrigin: string; | ||
} | ||
|
||
export interface RfqClientV1QuoteRequest extends RfqClientV1PriceRequest {} | ||
|
||
export interface RfqClientV1Price { | ||
expiry: BigNumber; | ||
kind: 'rfq' | 'otc'; | ||
makerAmount: BigNumber; | ||
makerToken: string; | ||
makerUri: string; | ||
takerAmount: BigNumber; | ||
takerToken: string; | ||
} | ||
|
||
export interface RfqClientV1PriceResponse { | ||
prices: RfqClientV1Price[]; | ||
} | ||
|
||
export interface RfqClientV1Quote { | ||
makerUri: string; | ||
order: RfqOrder; | ||
signature: Signature; | ||
} | ||
|
||
export interface RfqClientV1QuoteResponse { | ||
quotes: RfqClientV1Quote[]; | ||
} | ||
|
||
/** | ||
* IRfqClient is an interface that defines how to connect with an Rfq system. | ||
*/ | ||
export interface IRfqClient { | ||
/** | ||
* Fetches a list of "indicative quotes" or prices from a remote Rfq server | ||
*/ | ||
getV1PricesAsync(request: RfqClientV1PriceRequest): Promise<RfqClientV1PriceResponse>; | ||
|
||
/** | ||
* Fetches a list of "firm quotes" or signed quotes from a remote Rfq server. | ||
*/ | ||
getV1QuotesAsync(request: RfqClientV1QuoteRequest): Promise<RfqClientV1QuoteResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FillQuoteTransformerOrderType } from '@0x/protocol-utils'; | ||
|
||
import { SignedNativeOrder } from '../types'; | ||
|
||
import { RfqClientV1Quote } from './irfq_client'; | ||
|
||
/** | ||
* Converts a RfqClientRfqOrderFirmQuote to a SignedNativeOrder | ||
*/ | ||
export const toSignedNativeOrder = (quote: RfqClientV1Quote): SignedNativeOrder => { | ||
return { | ||
type: FillQuoteTransformerOrderType.Rfq, | ||
order: quote.order, | ||
signature: quote.signature, | ||
}; | ||
}; |