-
Notifications
You must be signed in to change notification settings - Fork 465
Conversation
|
||
const ordersWithStringInts = responses.map(response => response.data); // not yet BigNumber | ||
|
||
const orders: SignedOrder[] = ordersWithStringInts.map(orderWithStringInts => { |
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.
Find a helper function do this for us. @steveklebanoff ?
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.
I have a feeliing they exist in @0x/connect
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.
@dekz Are you open to exporting typeConverters
or orderParsingUtils
from the @0x/orderbook
package?
Or is there somewhere else where this is already defined & exported?
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
@@ -161,10 +165,13 @@ export class SwapQuoter { | |||
this.orderbook = orderbook; | |||
this.expiryBufferMs = expiryBufferMs; | |||
this.permittedOrderFeeTypes = permittedOrderFeeTypes; | |||
this.rfqtTakerApiKeyWhitelist = options.rfqtTakerApiKeyWhitelist || []; | |||
this.rfqtMakerEndpoints = options.rfqtMakerEndpoints || []; |
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.
rfqtMakerEndpoints
seems to only be used to construct a QuoteRequestor
, does it need to be set as a public accessor?
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.
Are we asserting they are uris
?
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.
Addressed the rfqtMakerEndpoints
bit in 3c795d3.
We are not directly asserting that they are URI's. We're just passing them through to the quote requestor, and letting it fail silently if they're not valid.
]; | ||
if (options.intentOnFilling && options.apiKey) { | ||
if (!this.rfqtTakerApiKeyWhitelist.includes(options.apiKey)) { | ||
throw new Error('API key not permissioned for RFQ-T'); |
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.
Is this a throwable validation at this layer? Or should it fail silently and give a normal quote?
If someone gets delisted they're going to start getting Errors rather than quotes, seems quite disruptive.
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.
Yeah, agree that we should fallback to providing a regular quote in this case.
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.
Addressed in 5f4778c
|
||
const ordersWithStringInts = responses.map(response => response.data); // not yet BigNumber | ||
|
||
const orders: SignedOrder[] = ordersWithStringInts.map(orderWithStringInts => { |
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.
I have a feeliing they exist in @0x/connect
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
Addresses review comment #2541 (comment)
* test for returning a 200 with invalid data, and additonal logging for that case * Ensure RFQ-T response has asset data we expect * validate signed order schema * give more descriptive variable names and test an unsigned order * takeout unused var
SwapQuoter._getSwapQuoteAsync() was merging defaults into the options sent into SwapQuoteCalculator.calculateMarket{Buy,Sell}SwapQuoteAsync(), but it was using the unmerged options function parameter for the RFQ-T options and also for the gas price option.
We were able to get solid coverage of the new I feel this PR is ready for a final review. If you guys think any follow-up work is warranted, please be specific, and I'll be sure to track it. |
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.
LGTM, just some optional nits.
@@ -53,6 +54,8 @@ | |||
"@0x/orderbook": "^2.2.5", | |||
"@0x/utils": "^5.4.1", | |||
"@0x/web3-wrapper": "^7.0.7", | |||
"axios": "^0.19.2", | |||
"axios-mock-adapter": "^1.18.1", |
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.
devDep?
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.
No because clients that use the exported mock need these deps.
@@ -0,0 +1,37 @@ | |||
import axios from 'axios'; |
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.
should this be under test/utils
?
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.
No because it's exported for external use. Specifically, we're using it from within the 0x API tests.
takerAddress: string, | ||
options?: Partial<RfqtFirmQuoteRequestOpts>, | ||
): Promise<SignedOrder[]> { | ||
const { makerEndpointMaxResponseTimeMs } = _.merge({}, constants.DEFAULT_RFQT_FIRM_QUOTE_REQUEST_OPTS, options); |
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.
So you like lodash now, huh? 😆 If you're using it here, would prefer to use flatten
as well 🤓
I'm ok leaving as it though ❤️
packages/migrations/package.json
Outdated
@@ -11,7 +11,7 @@ | |||
"build": "tsc -b", | |||
"build:ci": "yarn build", | |||
"clean": "shx rm -rf lib ${npm_package_config_snapshot_name} ${npm_package_config_snapshot_name}-*.zip", | |||
"lint": "tslint --format stylish --project .", | |||
"lint": "tslint --format stylish --project . && prettier --check 'src/**/*.{ts,tsx,json,md}' --config ../../.prettierrc", |
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.
It seems like you agreed to keep prettier
as a separate script in the asset-swapper
package, can we do the same here?
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.
Addressed in 1da8f68
LGTM pending last nit: https://github.com/0xProject/0x-monorepo/pull/2541/files#r408991756 |
Let's go 💪 💪 💪 !!! |
Description
These changes support 0xProject/0x-api#162
Every commit is crafted to be completely independent and atomic. I suggest you review them one at a time, in order to give better context, rather than just reviewing all of the changes at once.
Testing instructions
While there aren't any tests here yet, this code is currently being exercised by a 0x-api test, which you can see in the RFQ-T commit at 0xProject/0x-api#162 , and which is using the
asset-swapper
, andcontract-addresses
packages from this branch.The deployment of ERC20BridgeSampler was necessary not just for the RFQ-T test but also for the vanilla
/swap/v0/quote
endpoint test as well. Before that deployment, themarket_operation_utils
code was reverting when calling into the sampler, resulting in a HTTP 400 response from the 0x API.Types of changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Checklist: