-
Notifications
You must be signed in to change notification settings - Fork 235
fix: unify the response data from /swap/v0/price and /meta_transaction/v0/price #228
Changes from all commits
abad175
4442cf7
f602397
d06c39c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -369,6 +369,22 @@ export interface Price { | |
price: BigNumber; | ||
} | ||
|
||
interface BasePriceResponse { | ||
price: BigNumber; | ||
buyAmount: BigNumber; | ||
sellAmount: BigNumber; | ||
sellTokenAddress: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This uses the token address to be in line with the quote endpoint. However, the prices endpoint returns symbols. Either symbol or token address would work as long as it's consistent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kimpers are you referring to https://api.0x.org/swap/v0/prices ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah exactly. It would be nice to have consistency across the board, if we go with token address here maybe we should add it there as well or vice versa. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree it should be consistently address since we cannot guarantee symbol. |
||
buyTokenAddress: string; | ||
sources: GetSwapQuoteResponseLiquiditySource[]; | ||
} | ||
|
||
export interface GetSwapPriceResponse extends BasePriceResponse { | ||
value: BigNumber; | ||
gasPrice: BigNumber; | ||
gas: BigNumber; | ||
protocolFee: BigNumber; | ||
} | ||
|
||
export type GetTokenPricesResponse = Price[]; | ||
|
||
export interface GetMetaTransactionQuoteResponse { | ||
|
@@ -381,11 +397,7 @@ export interface GetMetaTransactionQuoteResponse { | |
sources: GetSwapQuoteResponseLiquiditySource[]; | ||
} | ||
|
||
export interface GetMetaTransactionPriceResponse { | ||
price: BigNumber; | ||
buyAmount: BigNumber; | ||
sellAmount: BigNumber; | ||
} | ||
export interface GetMetaTransactionPriceResponse extends BasePriceResponse {} | ||
|
||
// takerAddress, sellAmount, buyAmount, swapQuote, price | ||
export interface CalculateMetaTransactionPriceResponse { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed that the metatx endpoint would only return the argument you pass to it, whereas the swap endpoint always returns
buyAmount
andsellAmount
.