Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(twap): avoid sending env as undefined to getOrder query #2864

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/api/gnosisProtocol/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,18 @@ export async function getQuote(params: FeeQuoteParams): Promise<OrderQuoteRespon
}

export async function getOrder(chainId: ChainId, orderId: string, env?: CowEnv): Promise<EnrichedOrder | null> {
return orderBookApi.getOrder(orderId, { chainId, env })
const contextOverride = {
chainId,
// To avoid passing `undefined` and unintentionally setting the `env` to `barn`
// we check if the `env` is `undefined` and if it is we don't include it in the contextOverride
...(env
? {
env,
}
: undefined),
}

return orderBookApi.getOrder(orderId, contextOverride)
Copy link
Collaborator Author

@alfetopito alfetopito Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix in the SDK too, should default to prod

}

export async function getOrders(
Expand Down
Loading