Skip to content
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
5 changes: 4 additions & 1 deletion src/api/borrow.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { UiPoolDataProvider } from "@aave/contract-helpers"
import { formatReserves, formatUserSummary } from "@aave/math-utils"
import { useQuery } from "@tanstack/react-query"
import { isTestnetRpcUrl } from "api/provider"
import { isPaseoRpcUrl, isTestnetRpcUrl } from "api/provider"
import { useRpcProvider } from "providers/rpcProvider"
import { useMemo } from "react"
import {
Expand All @@ -18,6 +18,9 @@ export const useBorrowContractAddresses = () => {

return useMemo(() => {
if (!isLoaded) return null
if (isPaseoRpcUrl(evm.connection.url)) {
return AaveV3HydrationMainnet
}
const isTestnet = isTestnetRpcUrl(evm.connection.url)
return isTestnet ? AaveV3HydrationTestnet : AaveV3HydrationMainnet
}, [evm, isLoaded])
Expand Down
6 changes: 4 additions & 2 deletions src/api/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export type TFeatureFlags = {
dispatchPermit: boolean
} & { [key: string]: boolean }

export const PASEO_WS_URL = "paseo-rpc.play.hydration.cloud"
export const PASEO_WS_URL = "wss://paseo-rpc.play.hydration.cloud"

const defaultProvider: Omit<ProviderProps, "name" | "url"> = {
indexerUrl: "https://explorer.hydradx.cloud/graphql",
Expand Down Expand Up @@ -130,7 +130,7 @@ export const PROVIDERS: ProviderProps[] = [
},
{
name: "Paseo",
url: `wss://${PASEO_WS_URL}`,
url: PASEO_WS_URL,
indexerUrl: "https://explorer.hydradx.cloud/graphql",
squidUrl:
"https://galacticcouncil.squids.live/hydration-paseo-pools:prod/api/graphql",
Expand Down Expand Up @@ -163,6 +163,8 @@ export const isTestnetRpcUrl = (rpcUrl: string) => {
return dataEnv === "testnet"
}

export const isPaseoRpcUrl = (rpcUrl: string) => rpcUrl === PASEO_WS_URL

export async function getBestProvider(): Promise<PingResponse[]> {
const controller = new AbortController()
const signal = controller.signal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { OpenGovReferendum, TAccountVote } from "api/democracy"
import { groupBy } from "utils/rx"

type OpenGovReferendumWithVoted = OpenGovReferendum & {
readonly hasVoted: boolean
Expand All @@ -16,7 +17,7 @@ export const splitReferendaByVoted = (
},
)

const openGovGroup = Object.groupBy(openGovWithVoted, (referendum) =>
const openGovGroup = groupBy(openGovWithVoted, (referendum) =>
String(referendum.hasVoted),
)

Expand Down
4 changes: 3 additions & 1 deletion src/sections/lending/ui/reserve-overview/BorrowInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ export const BorrowInfo = ({
<a
target="_blank"
css={{ textDecoration: "underline" }}
href={currentMarketData.addresses.COLLECTOR}
href={currentNetworkConfig.explorerLinkBuilder({
address: currentMarketData.addresses.COLLECTOR,
})}
rel="noreferrer"
>
&nbsp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from "sections/lending/ui/table/borrow-assets/BorrowAssetsTable.utils"
import { useAccount } from "sections/web3-connect/Web3Connect.utils"
import { theme } from "theme"
import { groupBy } from "utils/rx"

export const BorrowAssetsTable = () => {
const { t } = useTranslation()
Expand All @@ -35,7 +36,7 @@ export const BorrowAssetsTable = () => {
const { account } = useAccount()

const { hollar = [], assets = [] } = useMemo(() => {
return Object.groupBy(data, (reserve) =>
return groupBy(data, (reserve) =>
displayGho({ symbol: reserve.symbol, currentMarket })
? "hollar"
: "assets",
Expand Down
14 changes: 12 additions & 2 deletions src/sections/lending/utils/marketsAndNetworksConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import {
} from "sections/lending/ui-config/networksConfig"
import { RotationProvider } from "./rotationProvider"
import { ProviderWithSend, wssToHttps } from "sections/lending/utils/utils"
import { isTestnetRpcUrl, useProviderRpcUrlStore } from "api/provider"
import {
isPaseoRpcUrl,
isTestnetRpcUrl,
useProviderRpcUrlStore,
} from "api/provider"
import { useProtocolDataContext } from "sections/lending/hooks/useProtocolDataContext"
import { useEffect } from "react"

Expand Down Expand Up @@ -69,7 +73,13 @@ export const availableMarkets = Object.keys(marketsData).filter((key) =>
) as CustomMarket[]

export const getInitialMarket = () => {
const isTestnet = isTestnetRpcUrl(getRpcUrls()[0])
const bestRpcUrl = getRpcUrls()[0]

if (isPaseoRpcUrl(bestRpcUrl)) {
return CustomMarket.hydration_v3
}

const isTestnet = isTestnetRpcUrl(bestRpcUrl)
return isTestnet
? CustomMarket.hydration_testnet_v3
: CustomMarket.hydration_v3
Expand Down