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: zrx base URLs #5955

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ vi.mock('../utils/helpers/helpers', async () => {
const actual = await vi.importActual('../utils/helpers/helpers')
return {
...actual,
baseUrlFromChainId: vi.fn(() => 'https://0x.shapeshift.com/ethereum'),
baseUrlFromChainId: vi.fn(() => 'https://0x.shapeshift.com/ethereum/'),
}
})
vi.mock('@shapeshiftoss/chain-adapters', () => {
Expand Down Expand Up @@ -70,7 +70,7 @@ vi.mock('context/PluginProvider/chainAdapterSingleton', () => {
const mockOk = Ok
const mockErr = Err
describe('getZrxTradeQuote', () => {
const zrxService = zrxServiceFactory({ baseUrl: 'https://0x.shapeshift.com/ethereum' })
const zrxService = zrxServiceFactory({ baseUrl: 'https://0x.shapeshift.com/ethereum/' })

it('returns quote with fee data', async () => {
const { quoteInput } = setupQuote()
Expand Down
12 changes: 6 additions & 6 deletions src/lib/swapper/swappers/ZrxSwapper/utils/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import { zrxSupportedChainIds } from '../../types'
export const baseUrlFromChainId = (chainId: ZrxSupportedChainId): string => {
switch (chainId) {
case KnownChainIds.EthereumMainnet:
return 'https:/0x.shapeshift.com/ethereum'
return 'https://0x.shapeshift.com/ethereum/'
case KnownChainIds.AvalancheMainnet:
return 'https:/0x.shapeshift.com/avalanche'
return 'https://0x.shapeshift.com/avalanche/'
case KnownChainIds.OptimismMainnet:
return 'https:/0x.shapeshift.com/optimism'
return 'https://0x.shapeshift.com/optimism/'
case KnownChainIds.BnbSmartChainMainnet:
return 'https:/0x.shapeshift.com/bnbsmartchain'
return 'https://0x.shapeshift.com/bnbsmartchain/'
case KnownChainIds.PolygonMainnet:
return 'https:/0x.shapeshift.com/polygon'
return 'https://0x.shapeshift.com/polygon/'
case KnownChainIds.ArbitrumMainnet:
return 'https:/0x.shapeshift.com/arbitrum'
Comment on lines -20 to -30
Copy link
Member

Choose a reason for hiding this comment

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

Oh man, I stared at this code for so long but didn't notice the single forward slash - good find @gomesalexandre!

return 'https://0x.shapeshift.com/arbitrum/'
default:
assertUnreachable(chainId)
}
Expand Down