Skip to content

Commit

Permalink
Merge branch 'main' into feat/addOpActiveEpochCount
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner authored Aug 5, 2024
2 parents 7626d69 + 4d2d588 commit 954b895
Show file tree
Hide file tree
Showing 145 changed files with 912 additions and 1,195 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Astral

- [Astral Block Explorer](https://explorer.subspace.network/) Astral Block Explorer
- [Astral Block Explorer](https://explorer.autonomys.xyz/) Astral Block Explorer
- [Astral Subsquid Playground](https://squid.gemini-3g.subspace.network/graphql) Astral Subspace SubSquid
- [Health Check](https://uptime.subspace.network/status/network) Subspace Network Status Page

Expand Down
6 changes: 3 additions & 3 deletions explorer/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { CodegenConfig } from '@graphql-codegen/cli'
import * as dotenv from 'dotenv'
import { defaultChain } from './src/constants/chains'
import { defaultIndexer } from './src/constants/indexers'

dotenv.config()

const config: CodegenConfig = {
generates: {
'./gql/rewardTypes.ts': {
schema: defaultChain.urls.squids.rewards,
schema: defaultIndexer.squids.rewards,
documents: ['./src/**/rewardsQuery.ts'],
plugins: ['typescript', 'typescript-operations'],
},
'./gql/oldSquidTypes.ts': {
schema: defaultChain.urls.squids.old,
schema: defaultIndexer.squids.old,
documents: ['./src/**/query.ts'],
plugins: ['typescript', 'typescript-operations'],
},
Expand Down
2 changes: 1 addition & 1 deletion explorer/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const nextConfig = {
remotePatterns: [
{
protocol: 'https',
hostname: 'docs.subspace.network',
hostname: 'docs.autonomys.xyz',
port: '',
pathname: '**',
},
Expand Down
4 changes: 2 additions & 2 deletions explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"dependencies": {
"@apollo/client": "^3.7.0",
"@apollo/experimental-nextjs-app-support": "^0.8.0",
"@autonomys/auto-consensus": "^0.1.8",
"@autonomys/auto-utils": "^0.1.8",
"@autonomys/auto-consensus": "^0.2.0",
"@autonomys/auto-utils": "^0.2.0",
"@headlessui/react": "^1.7.18",
"@headlessui/tailwindcss": "^0.2.0",
"@heroicons/react": "^2.1.1",
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/autoid/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AutoIdPage } from '@/components/AutoId'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
import type { ChainPageProps } from 'types/app'

export async function generateMetadata({ params: { chain } }: ChainPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Auto ID`
return {
...metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { QUERY_ACCOUNT_BY_ID } from 'components/Account/query'
import { AccountByIdQuery } from 'components/gql/graphql'
import { DocIcon, WalletIcon } from 'components/icons'
import { chains } from 'constants/chains'
import { TOKEN } from 'constants/general'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
Expand All @@ -19,15 +20,15 @@ export async function GET(
) {
if (!chain) notFound()

const chainMatch = chains.find((c) => c.urls.page === chain)
const chainMatch = indexers.find((c) => c.network === chain)

if (!accountId || !chainMatch) notFound()

const {
data: { accountById },
}: {
data: AccountByIdQuery
} = await fetch(chainMatch.urls.squids.old, {
} = await fetch(chainMatch.squids.old, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -59,7 +60,7 @@ function Screen({
accountId,
accountById,
}: {
chainMatch: (typeof chains)[number]
chainMatch: (typeof indexers)[number]
accountId: string
accountById: AccountByIdQuery['accountById']
}) {
Expand Down Expand Up @@ -125,24 +126,23 @@ function Screen({
}}
tw='absolute text-xl text-white p-4 ml-30 font-bold'
>
Total {numberWithCommas(bigNumberToNumber(account.total))} ({chainMatch.token.symbol})
Total {numberWithCommas(bigNumberToNumber(account.total))} ({TOKEN.symbol})
</span>
<span
style={{
fontFamily: 'Montserrat',
}}
tw='absolute text-xl text-white p-4 ml-30 mt-8 font-bold'
>
Reserved {numberWithCommas(bigNumberToNumber(account.reserved))} (
{chainMatch.token.symbol})
Reserved {numberWithCommas(bigNumberToNumber(account.reserved))} ({TOKEN.symbol})
</span>
<span
style={{
fontFamily: 'Montserrat',
}}
tw='absolute text-xl text-white p-4 ml-30 mt-16 font-bold'
>
Free {numberWithCommas(bigNumberToNumber(account.free))} ({chainMatch.token.symbol})
Free {numberWithCommas(bigNumberToNumber(account.free))} ({TOKEN.symbol})
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shortString } from '@/utils/string'
import { Account } from 'components/Account/Account'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
Expand All @@ -9,7 +9,7 @@ import type { AccountIdPageProps, ChainPageProps } from 'types/app'
export async function generateMetadata({
params: { chain, accountId },
}: ChainPageProps & AccountIdPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Account ${accountId ? shortString(accountId) : ''}`
return {
...metadata,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shortString } from '@/utils/string'
import { AccountRewardList } from 'components/Account/AccountRewardList'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
Expand All @@ -9,7 +9,7 @@ import type { AccountIdPageProps, ChainPageProps } from 'types/app'
export async function generateMetadata({
params: { chain, accountId },
}: ChainPageProps & AccountIdPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Account Rewards ${accountId ? shortString(accountId) : ''}`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/accounts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AccountList } from 'components/Account/AccountList'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { headers } from 'next/headers'
Expand All @@ -10,7 +10,7 @@ export async function generateMetadata({ params: { chain } }: ChainPageProps): P
const domain = headersList.get('x-forwarded-host') || ''
const protocol = headersList.get('x-forwarded-proto') || ''

const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Accounts`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/blocks/[blockId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Block } from 'components/Block/Block'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
Expand All @@ -8,7 +8,7 @@ import type { BlockIdPageProps, ChainPageProps } from 'types/app'
export async function generateMetadata({
params: { chain, blockId },
}: ChainPageProps & BlockIdPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Block ${blockId}`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/blocks/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BlockList } from 'components/Block/BlockList'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { headers } from 'next/headers'
Expand All @@ -10,7 +10,7 @@ export async function generateMetadata({ params: { chain } }: ChainPageProps): P
const domain = headersList.get('x-forwarded-host') || ''
const protocol = headersList.get('x-forwarded-proto') || ''

const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Blocks`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/events/[eventId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Event } from 'components/Event/Event'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
Expand All @@ -8,7 +8,7 @@ import type { ChainPageProps, EventIdPageProps } from 'types/app'
export async function generateMetadata({
params: { chain, eventId },
}: ChainPageProps & EventIdPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Event ${eventId}`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/events/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventList } from 'components/Event/EventList'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { headers } from 'next/headers'
Expand All @@ -10,7 +10,7 @@ export async function generateMetadata({ params: { chain } }: ChainPageProps): P
const domain = headersList.get('x-forwarded-host') || ''
const protocol = headersList.get('x-forwarded-proto') || ''

const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Events`
return {
...metadata,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shortString } from '@/utils/string'
import { Extrinsic } from 'components/Extrinsic/Extrinsic'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
Expand All @@ -9,7 +9,7 @@ import type { ChainPageProps, ExtrinsicIdPageProps } from 'types/app'
export async function generateMetadata({
params: { chain, extrinsicId },
}: ChainPageProps & ExtrinsicIdPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Extrinsic ${extrinsicId ? shortString(extrinsicId) : ''}`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/extrinsics/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExtrinsicList } from 'components/Extrinsic/ExtrinsicList'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { headers } from 'next/headers'
Expand All @@ -10,7 +10,7 @@ export async function generateMetadata({ params: { chain } }: ChainPageProps): P
const domain = headersList.get('x-forwarded-host') || ''
const protocol = headersList.get('x-forwarded-proto') || ''

const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Extrinsics`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/logs/[logId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Log } from 'components/Log/Log'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
Expand All @@ -8,7 +8,7 @@ import type { ChainPageProps, LogIdPageProps } from 'types/app'
export async function generateMetadata({
params: { chain, logId },
}: ChainPageProps & LogIdPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Log ${logId}`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/logs/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LogList } from 'components/Log/LogList'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { headers } from 'next/headers'
Expand All @@ -10,7 +10,7 @@ export async function generateMetadata({ params: { chain } }: ChainPageProps): P
const domain = headersList.get('x-forwarded-host') || ''
const protocol = headersList.get('x-forwarded-proto') || ''

const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Logs`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/consensus/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Home } from 'components/Home'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { headers } from 'next/headers'
Expand All @@ -11,7 +11,7 @@ export async function generateMetadata({ params: { chain } }: ChainPageProps): P
const domain = headersList.get('x-forwarded-host') || ''
const protocol = headersList.get('x-forwarded-proto') || ''

const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
return {
...metadata,
title: `${metadata.title} - ${chainTitle}`,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/domains/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { DomainPage } from 'components/Domain'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
import type { ChainPageProps } from 'types/app'

export async function generateMetadata({ params: { chain } }: ChainPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Domain`
return {
...metadata,
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/app/[chain]/farming/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { DownloadPage } from '@/components/Farming'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata, url } from 'constants/metadata'
import { Metadata } from 'next'
import { FC } from 'react'
import type { ChainPageProps } from 'types/app'

export async function generateMetadata({ params: { chain } }: ChainPageProps): Promise<Metadata> {
const chainTitle = chains.find((c) => c.urls.page === chain)?.title || 'Unknown chain'
const chainTitle = indexers.find((c) => c.network === chain)?.title || 'Unknown chain'
const title = `${metadata.title} - ${chainTitle} - Farming`
const images = {
url: url + '/images/share-farming.png',
Expand Down
8 changes: 4 additions & 4 deletions explorer/src/app/[chain]/image/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
WalletIcon,
} from 'components/icons'
import { ACCOUNT_MIN_VAL } from 'constants/account'
import { chains } from 'constants/chains'
import { indexers } from 'constants/indexers'
import { metadata } from 'constants/metadata'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
Expand All @@ -24,15 +24,15 @@ import { formatSpacePledged, numberWithCommas } from 'utils/number'
export async function GET(req: NextRequest, { params: { chain } }: ChainPageProps) {
if (!chain) notFound()

const chainMatch = chains.find((c) => c.urls.page === chain)
const chainMatch = indexers.find((c) => c.network === chain)

if (!chainMatch) notFound()

const {
data,
}: {
data: HomeQueryQuery
} = await fetch(chainMatch.urls.squids.old, {
} = await fetch(chainMatch.squids.old, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -60,7 +60,7 @@ function Screen({
chainMatch,
data,
}: {
chainMatch: (typeof chains)[number]
chainMatch: (typeof indexers)[number]
data: HomeQueryQuery
}) {
dayjs.extend(relativeTime)
Expand Down
Loading

0 comments on commit 954b895

Please sign in to comment.