Skip to content

Commit

Permalink
fix: [dont revert, patch] point prod thorchain endpoints at ninerealms (
Browse files Browse the repository at this point in the history
#5485)

* fix: point prod thorchain endpoints at ninerealms

* fix: incorrect endpoints for .env.app
  • Loading branch information
woodenfurniture authored Oct 18, 2023
1 parent a5b77c8 commit 1110be5
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 33 deletions.
8 changes: 4 additions & 4 deletions .env.app
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ REACT_APP_UNCHAINED_BITCOINCASH_HTTP_URL=https://api.bitcoincash.shapeshift.com
REACT_APP_UNCHAINED_BITCOINCASH_WS_URL=wss://api.bitcoincash.shapeshift.com
REACT_APP_UNCHAINED_COSMOS_HTTP_URL=https://api.cosmos.shapeshift.com
REACT_APP_UNCHAINED_COSMOS_WS_URL=wss://api.cosmos.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_HTTP_URL=https://api.thorchain.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_WS_URL=wss://api.thorchain.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_HTTP_URL=https://rpc.ninerealms.com
REACT_APP_UNCHAINED_THORCHAIN_WS_URL=wss://rpc.ninerealms.com

# nodes
REACT_APP_ETHEREUM_NODE_URL=https://daemon.ethereum.shapeshift.com
Expand All @@ -42,7 +42,7 @@ REACT_APP_POLYGON_NODE_URL=https://daemon.polygon.shapeshift.com
REACT_APP_GNOSIS_NODE_URL=https://daemon.gnosis.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://daemon.arbitrum.shapeshift.com
REACT_APP_COSMOS_NODE_URL=https://daemon.cosmos.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://daemon.thorchain.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://thornode.ninerealms.com

# thorchain
REACT_APP_MIDGARD_URL=https://indexer.thorchain.shapeshift.com/v2
REACT_APP_MIDGARD_URL=https://midgard.ninerealms.com/v2
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ REACT_APP_POLYGON_NODE_URL=https://dev-daemon.polygon.shapeshift.com
REACT_APP_GNOSIS_NODE_URL=https://dev-daemon.gnosis.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://dev-daemon.arbitrum.shapeshift.com
REACT_APP_COSMOS_NODE_URL=https://dev-daemon.cosmos.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com/lcd

# thorchain
REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2
2 changes: 1 addition & 1 deletion .env.develop
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ REACT_APP_POLYGON_NODE_URL=https://dev-daemon.polygon.shapeshift.com
REACT_APP_GNOSIS_NODE_URL=https://dev-daemon.gnosis.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://dev-daemon.arbitrum.shapeshift.com
REACT_APP_COSMOS_NODE_URL=https://dev-daemon.cosmos.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com/lcd

# thorchain
REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2
2 changes: 1 addition & 1 deletion .env.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ REACT_APP_POLYGON_NODE_URL=https://dev-daemon.polygon.shapeshift.com
REACT_APP_GNOSIS_NODE_URL=https://dev-daemon.gnosis.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://dev-daemon.arbitrum.shapeshift.com
REACT_APP_COSMOS_NODE_URL=https://dev-daemon.cosmos.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com/lcd

# thorchain
REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2
8 changes: 4 additions & 4 deletions .env.private
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ REACT_APP_UNCHAINED_BITCOINCASH_HTTP_URL=https://api.bitcoincash.shapeshift.com
REACT_APP_UNCHAINED_BITCOINCASH_WS_URL=wss://api.bitcoincash.shapeshift.com
REACT_APP_UNCHAINED_COSMOS_HTTP_URL=https://api.cosmos.shapeshift.com
REACT_APP_UNCHAINED_COSMOS_WS_URL=wss://api.cosmos.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_HTTP_URL=https://api.thorchain.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_WS_URL=wss://api.thorchain.shapeshift.com
REACT_APP_UNCHAINED_THORCHAIN_HTTP_URL=https://rpc.ninerealms.com
REACT_APP_UNCHAINED_THORCHAIN_WS_URL=wss://rpc.ninerealms.com

# nodes
REACT_APP_ETHEREUM_NODE_URL=https://daemon.ethereum.shapeshift.com
Expand All @@ -40,7 +40,7 @@ REACT_APP_POLYGON_NODE_URL=https://daemon.polygon.shapeshift.com
REACT_APP_GNOSIS_NODE_URL=https://daemon.gnosis.shapeshift.com
REACT_APP_ARBITRUM_NODE_URL=https://daemon.arbitrum.shapeshift.com
REACT_APP_COSMOS_NODE_URL=https://daemon.cosmos.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://daemon.thorchain.shapeshift.com
REACT_APP_THORCHAIN_NODE_URL=https://thornode.ninerealms.com

# thorchain
REACT_APP_MIDGARD_URL=https://indexer.thorchain.shapeshift.com/v2
REACT_APP_MIDGARD_URL=https://midgard.ninerealms.com/v2
2 changes: 1 addition & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Cypress.on('uncaught:exception', err => {
// Ignore this exception
if (err.message.includes('Error: underlying network changed')) return false
// TODO: Work out why Cypress requests are failing
// Ignore this exception, it occurs because Cypress doesn't get a response form lcd/thorchain/pools
// Ignore this exception, it occurs because Cypress doesn't get a response form thorchain/pools
if (err.message.includes('[thorchainInitialize]: initialize failed to set supportedAssetIds'))
return false
// This can happen when an upstream node is down. Don't fail our CI because of it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const isSome = <T>(option: T | null | undefined): option is T =>
export const generateTradableThorAssetMap = async () => {
const thorService = axios.create(axiosConfig)
const response = await thorService.get<ThornodePoolResponse[]>(
'https://dev-daemon.thorchain.shapeshift.com/lcd/thorchain/pools',
'https://dev-daemon.thorchain.shapeshift.com/thorchain/pools',
)
switch (response.status) {
case 200:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const getThorchainStreamingSwap = async (
): Promise<ThornodeStreamingSwapResponseSuccess | undefined> => {
const thorTxHash = sellTxHash.replace(/^0x/, '')
const { data: streamingSwapData } = await axios.get<ThornodeStreamingSwapResponse>(
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/lcd/thorchain/swap/streaming/${thorTxHash}`,
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/thorchain/swap/streaming/${thorTxHash}`,
)

if (!streamingSwapData) return
Expand Down
2 changes: 1 addition & 1 deletion src/components/MultiHopTrade/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const isTradingActive = async (
// Check the HALTTHORCHAIN flag on the mimir endpoint instead
case sellAssetIsRune: {
const { data: mimir } = await axios.get<Record<string, unknown>>(
`${daemonUrl}/lcd/thorchain/mimir`,
`${daemonUrl}/thorchain/mimir`,
)
return Ok(Object.entries(mimir).some(([k, v]) => k === 'HALTTHORCHAIN' && v === 0))
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/swapper/swappers/ThorchainSwapper/ThorchainSwapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const thorchainSwapper: Swapper = {
filterAssetIdsBySellable: async (): Promise<AssetId[]> => {
let supportedSellAssetIds: AssetId[] = [thorchainAssetId]
const poolResponse = await thorService.get<ThornodePoolResponse[]>(
`${daemonUrl}/lcd/thorchain/pools`,
`${daemonUrl}/thorchain/pools`,
)
if (poolResponse.isOk()) {
const allPools = poolResponse.unwrap().data
Expand All @@ -64,7 +64,7 @@ export const thorchainSwapper: Swapper = {
let supportedSellAssetIds: AssetId[] = [thorchainAssetId]
let supportedBuyAssetIds: AssetId[] = [thorchainAssetId]
const poolResponse = await thorService.get<ThornodePoolResponse[]>(
`${daemonUrl}/lcd/thorchain/pools`,
`${daemonUrl}/thorchain/pools`,
)
if (poolResponse.isOk()) {
const allPools = poolResponse.unwrap().data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ describe('getTradeQuote', () => {
it('should get a thorchain quote for a thorchain trade', async () => {
;(thorService.get as unknown as jest.Mock<unknown>).mockImplementation(url => {
switch (url) {
case '/lcd/thorchain/pools':
case '/thorchain/pools':
return Promise.resolve(
Ok({ data: thornodePools } as unknown as AxiosResponse<ThornodePoolResponse>),
)
case '/lcd/thorchain/inbound_addresses':
case '/thorchain/inbound_addresses':
return Promise.resolve(
Ok({ data: mockInboundAddresses } as unknown as AxiosResponse<
InboundAddressResponse[]
>),
)
default: {
// '/lcd/thorchain/quote/swap/<swapQueryParams>' fallthrough
// '/thorchain/quote/swap/<swapQueryParams>' fallthrough
const mockThorQuote: { data: ThornodeQuoteResponseSuccess } = {
data: {
expected_amount_out: '10232161',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const getThorTradeQuote = async (

const daemonUrl = getConfig().REACT_APP_THORCHAIN_NODE_URL
const maybePoolsResponse = await thorService.get<ThornodePoolResponse[]>(
`${daemonUrl}/lcd/thorchain/pools`,
`${daemonUrl}/thorchain/pools`,
)

if (maybePoolsResponse.isErr()) return Err(maybePoolsResponse.unwrapErr())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const getInboundAddressDataForChain = async (
const assetChainSymbol = assetPoolId?.slice(0, assetPoolId.indexOf('.'))

return (
await thorService.get<InboundAddressResponse[]>(`${daemonUrl}/lcd/thorchain/inbound_addresses`)
await thorService.get<InboundAddressResponse[]>(`${daemonUrl}/thorchain/inbound_addresses`)
)
.andThen(({ data: inboundAddresses }) => {
const activeInboundAddresses = inboundAddresses.filter(a => !a.halted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ const _getQuote = async ({
...(streaming && { streaming_interval: streamingInterval }),
})
const maybeData = (
await thorService.get<ThornodeQuoteResponse>(
`${daemonUrl}/lcd/thorchain/quote/swap?${queryString}`,
)
await thorService.get<ThornodeQuoteResponse>(`${daemonUrl}/thorchain/quote/swap?${queryString}`)
).andThen(({ data }) => Ok(data))

if (maybeData.isErr()) return Err(maybeData.unwrapErr())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { createCache, makeSwapperAxiosServiceMonadic } from 'lib/swapper/utils'
// Important: maxAge should be small because inbound address info must be recent
const maxAge = 5 * 1000 // 5 seconds
const cachedUrls = [
'/lcd/thorchain/pools',
'/lcd/thorchain/inbound_addresses',
'/lcd/thorchain/pool/',
'/thorchain/pools',
'/thorchain/inbound_addresses',
'/thorchain/pool/',
'/v2/pools',
'/v2/pool/',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const getAccountAddresses = memoize(

export const getThorchainPools = async (): Promise<ThornodePoolResponse[]> => {
const { data: opportunitiesData } = await axios.get<ThornodePoolResponse[]>(
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/lcd/thorchain/pools`,
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/thorchain/pools`,
)

if (!opportunitiesData) return []
Expand All @@ -140,7 +140,7 @@ export const getAllThorchainSaversPositions = async (
if (!poolId) return []

const { data: opportunitiesData } = await axios.get<ThorchainSaverPositionResponse[]>(
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/lcd/thorchain/pool/${poolId}/savers`,
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/thorchain/pool/${poolId}/savers`,
)

if (!opportunitiesData) return []
Expand All @@ -151,7 +151,7 @@ export const getAllThorchainSaversPositions = async (
export const getThorchainTransactionStatus = async (txHash: string) => {
const thorTxHash = txHash.replace(/^0x/, '')
const { data: thorTxData, status } = await axios.get<ThornodeStatusResponse>(
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/lcd/thorchain/tx/status/${thorTxHash}`,
`${getConfig().REACT_APP_THORCHAIN_NODE_URL}/thorchain/tx/status/${thorTxHash}`,
// We don't want to throw on 404s, we're parsing these ourselves
{ validateStatus: () => true },
)
Expand Down Expand Up @@ -222,7 +222,7 @@ export const getMaybeThorchainSaversDepositQuote = async ({
const { data: quoteData } = await axios.get<ThorchainSaversDepositQuoteResponse>(
`${
getConfig().REACT_APP_THORCHAIN_NODE_URL
}/lcd/thorchain/quote/saver/deposit?asset=${poolId}&amount=${amountThorBaseUnit}&affiliate=${THORCHAIN_AFFILIATE_NAME}&affiliate_bps=${AFFILIATE_BPS}`,
}/thorchain/quote/saver/deposit?asset=${poolId}&amount=${amountThorBaseUnit}&affiliate=${THORCHAIN_AFFILIATE_NAME}&affiliate_bps=${AFFILIATE_BPS}`,
)

if (!quoteData || 'error' in quoteData)
Expand Down Expand Up @@ -266,7 +266,7 @@ export const getThorchainSaversWithdrawQuote = async ({
const { data: quoteData } = await axios.get<ThorchainSaversWithdrawQuoteResponse>(
`${
getConfig().REACT_APP_THORCHAIN_NODE_URL
}/lcd/thorchain/quote/saver/withdraw?asset=${poolId}&address=${asset_address}&withdraw_bps=${bps}`,
}/thorchain/quote/saver/withdraw?asset=${poolId}&address=${asset_address}&withdraw_bps=${bps}`,
)

if (!quoteData || 'error' in quoteData)
Expand Down

0 comments on commit 1110be5

Please sign in to comment.