fix(e2e): drop dead /api/v2 prefix — Blockscout API is root-mounted
The public Blockscout API on api-explore*.lux.network serves at the root (/stats, /tokens, /transactions, /smart-contracts, /search); the /api/v2 prefix 404s. Verified live: the explorer frontend itself calls api-explore.lux.network/stats and /main-page/blocks (200), while /api/v2/* returns 404. Retarget all explorer API calls to the canonical root paths so stats/token/contract assertions exercise the real surface again. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -15,7 +15,7 @@ test.describe('Explorer API — Blockscout Stats', () => {
|
||||
|
||||
for (const { name, api } of explorers) {
|
||||
test(`${name} — stats endpoint returns blocks`, async ({ request }) => {
|
||||
const data = await httpGetJson(request, `${api}/api/v2/stats`) as Record<string, unknown>
|
||||
const data = await httpGetJson(request, `${api}/stats`) as Record<string, unknown>
|
||||
const blocks = Number(data.total_blocks || 0)
|
||||
console.log(` ${name}: ${blocks} blocks, ${data.total_transactions || 0} txs, ${data.total_addresses || 0} addrs`)
|
||||
expect(blocks).toBeGreaterThan(0)
|
||||
@@ -24,7 +24,7 @@ test.describe('Explorer API — Blockscout Stats', () => {
|
||||
|
||||
for (const { name, api } of explorers) {
|
||||
test(`${name} — search API accessible`, async ({ request }) => {
|
||||
const status = await httpStatus(request, `${api}/api/v2/search?q=0x0000000000000000000000000000000000000000`)
|
||||
const status = await httpStatus(request, `${api}/search?q=0x0000000000000000000000000000000000000000`)
|
||||
expect([200, 404]).toContain(status)
|
||||
})
|
||||
}
|
||||
@@ -106,8 +106,8 @@ test.describe('Explorer UI — Lux C-Chain Navigation', () => {
|
||||
test.describe('Explorer Cross-Chain — Consistent State', () => {
|
||||
test('Lux and Zoo explorers show non-zero blocks', async ({ request }) => {
|
||||
const [luxStats, zooStats] = await Promise.all([
|
||||
httpGetJson(request, `${urls.apiExploreLux}/api/v2/stats`) as Promise<Record<string, unknown>>,
|
||||
httpGetJson(request, `${urls.apiExploreZoo}/api/v2/stats`) as Promise<Record<string, unknown>>,
|
||||
httpGetJson(request, `${urls.apiExploreLux}/stats`) as Promise<Record<string, unknown>>,
|
||||
httpGetJson(request, `${urls.apiExploreZoo}/stats`) as Promise<Record<string, unknown>>,
|
||||
])
|
||||
const luxBlocks = Number(luxStats.total_blocks || 0)
|
||||
const zooBlocks = Number(zooStats.total_blocks || 0)
|
||||
|
||||
@@ -179,7 +179,7 @@ test.describe('DeFi — Explorer Transaction Recording', () => {
|
||||
})
|
||||
|
||||
test('explorer API returns block stats', async ({ request }) => {
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/api/v2/stats`) as Record<string, unknown>
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/stats`) as Record<string, unknown>
|
||||
const blocks = Number(data.total_blocks || 0)
|
||||
const txs = Number(data.total_transactions || 0)
|
||||
console.log(` Blocks: ${blocks}, Transactions: ${txs}`)
|
||||
@@ -187,7 +187,7 @@ test.describe('DeFi — Explorer Transaction Recording', () => {
|
||||
})
|
||||
|
||||
test('explorer API returns transactions', async ({ request }) => {
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/api/v2/transactions`) as { items: unknown[] }
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/transactions`) as { items: unknown[] }
|
||||
console.log(` Transactions returned: ${data.items?.length ?? 0}`)
|
||||
expect(data).toBeDefined()
|
||||
})
|
||||
@@ -195,7 +195,7 @@ test.describe('DeFi — Explorer Transaction Recording', () => {
|
||||
test('explorer API search works', async ({ request }) => {
|
||||
const status = await httpStatus(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/search?q=0x0000000000000000000000000000000000000000`,
|
||||
`${urls.apiExploreLux}/search?q=0x0000000000000000000000000000000000000000`,
|
||||
)
|
||||
expect([200, 404]).toContain(status)
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ test.describe('Stats — Explorer Block Count', () => {
|
||||
test('explorer block count matches RPC', async ({ request }) => {
|
||||
const [rpcBlock, explorerStats] = await Promise.all([
|
||||
ethBlockNumber(request, urls.rpc),
|
||||
httpGetJson(request, `${urls.apiExploreLux}/api/v2/stats`) as Promise<Record<string, unknown>>,
|
||||
httpGetJson(request, `${urls.apiExploreLux}/stats`) as Promise<Record<string, unknown>>,
|
||||
])
|
||||
const explorerBlocks = Number(explorerStats.total_blocks || 0)
|
||||
console.log(` RPC block: ${rpcBlock}, Explorer blocks: ${explorerBlocks}`)
|
||||
@@ -26,14 +26,14 @@ test.describe('Stats — Explorer Block Count', () => {
|
||||
})
|
||||
|
||||
test('explorer shows non-zero transaction count', async ({ request }) => {
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/api/v2/stats`) as Record<string, unknown>
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/stats`) as Record<string, unknown>
|
||||
const txCount = Number(data.total_transactions || 0)
|
||||
console.log(` Total transactions: ${txCount}`)
|
||||
expect(txCount).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
test('explorer shows non-zero address count', async ({ request }) => {
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/api/v2/stats`) as Record<string, unknown>
|
||||
const data = await httpGetJson(request, `${urls.apiExploreLux}/stats`) as Record<string, unknown>
|
||||
const addrCount = Number(data.total_addresses || 0)
|
||||
console.log(` Total addresses: ${addrCount}`)
|
||||
expect(addrCount).toBeGreaterThan(0)
|
||||
@@ -57,7 +57,7 @@ test.describe('Stats — Validator Count Consistency', () => {
|
||||
{ name: 'Pars', api: urls.apiExplorePars },
|
||||
]
|
||||
for (const { name, api } of explorers) {
|
||||
const data = await httpGetJson(request, `${api}/api/v2/stats`) as Record<string, unknown>
|
||||
const data = await httpGetJson(request, `${api}/stats`) as Record<string, unknown>
|
||||
const blocks = Number(data.total_blocks || 0)
|
||||
console.log(` ${name}: ${blocks} blocks`)
|
||||
expect(blocks).toBeGreaterThan(0)
|
||||
@@ -80,7 +80,7 @@ test.describe('Stats — Gas Tracker', () => {
|
||||
})
|
||||
|
||||
test('explorer gas tracker endpoint accessible', async ({ request }) => {
|
||||
const status = await httpStatus(request, `${urls.apiExploreLux}/api/v2/stats`)
|
||||
const status = await httpStatus(request, `${urls.apiExploreLux}/stats`)
|
||||
console.log(` Explorer stats endpoint: HTTP ${status}`)
|
||||
expect(status).toBe(200)
|
||||
})
|
||||
@@ -112,8 +112,8 @@ test.describe('Stats — Exchange Liquidity', () => {
|
||||
test.describe('Stats — Cross-Chain Comparison', () => {
|
||||
test('Lux and Zoo both have blocks and transactions', async ({ request }) => {
|
||||
const [luxStats, zooStats] = await Promise.all([
|
||||
httpGetJson(request, `${urls.apiExploreLux}/api/v2/stats`) as Promise<Record<string, unknown>>,
|
||||
httpGetJson(request, `${urls.apiExploreZoo}/api/v2/stats`) as Promise<Record<string, unknown>>,
|
||||
httpGetJson(request, `${urls.apiExploreLux}/stats`) as Promise<Record<string, unknown>>,
|
||||
httpGetJson(request, `${urls.apiExploreZoo}/stats`) as Promise<Record<string, unknown>>,
|
||||
])
|
||||
const luxBlocks = Number(luxStats.total_blocks || 0)
|
||||
const zooBlocks = Number(zooStats.total_blocks || 0)
|
||||
|
||||
@@ -41,7 +41,7 @@ test.describe('NFT — ERC-165 Interface Detection', () => {
|
||||
test('can query supportsInterface on C-Chain contracts', async ({ request }) => {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens?type=ERC-721`,
|
||||
`${urls.apiExploreLux}/tokens?type=ERC-721`,
|
||||
) as { items?: ExplorerToken[] }
|
||||
|
||||
if (data.items && data.items.length > 0) {
|
||||
@@ -77,7 +77,7 @@ test.describe('NFT — ERC-721 Discovery via Explorer', () => {
|
||||
test('explorer lists ERC-721 tokens', async ({ request }) => {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens?type=ERC-721`,
|
||||
`${urls.apiExploreLux}/tokens?type=ERC-721`,
|
||||
) as { items?: ExplorerToken[] }
|
||||
|
||||
const count = data.items?.length ?? 0
|
||||
@@ -106,7 +106,7 @@ test.describe('NFT — ERC-721 Discovery via Explorer', () => {
|
||||
test('ERC-721 token name() and symbol() are readable', async ({ request }) => {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens?type=ERC-721`,
|
||||
`${urls.apiExploreLux}/tokens?type=ERC-721`,
|
||||
) as { items?: ExplorerToken[] }
|
||||
|
||||
if (data.items && data.items.length > 0) {
|
||||
@@ -142,7 +142,7 @@ test.describe('NFT — ERC-1155 Discovery via Explorer', () => {
|
||||
test('explorer lists ERC-1155 tokens', async ({ request }) => {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens?type=ERC-1155`,
|
||||
`${urls.apiExploreLux}/tokens?type=ERC-1155`,
|
||||
) as { items?: ExplorerToken[] }
|
||||
|
||||
const count = data.items?.length ?? 0
|
||||
@@ -205,7 +205,7 @@ test.describe('NFT — Metadata via Explorer API', () => {
|
||||
test('explorer token API returns NFT metadata', async ({ request }) => {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens?type=ERC-721`,
|
||||
`${urls.apiExploreLux}/tokens?type=ERC-721`,
|
||||
) as { items?: ExplorerToken[] }
|
||||
|
||||
if (data.items && data.items.length > 0) {
|
||||
@@ -218,7 +218,7 @@ test.describe('NFT — Metadata via Explorer API', () => {
|
||||
try {
|
||||
const instances = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens/${addr}/instances`,
|
||||
`${urls.apiExploreLux}/tokens/${addr}/instances`,
|
||||
) as { items?: { id: string; metadata?: unknown }[] }
|
||||
const count = instances.items?.length ?? 0
|
||||
console.log(` Token instances for ${addr}: ${count}`)
|
||||
|
||||
@@ -179,7 +179,7 @@ test.describe('App Chains — Cross-Chain Block Comparison', () => {
|
||||
]
|
||||
for (const { name, api } of explorers) {
|
||||
try {
|
||||
const data = await httpGetJson(request, `${api}/api/v2/stats`) as Record<string, unknown>
|
||||
const data = await httpGetJson(request, `${api}/stats`) as Record<string, unknown>
|
||||
const blocks = Number(data.total_blocks || 0)
|
||||
const txs = Number(data.total_transactions || 0)
|
||||
console.log(` ${name}: ${blocks} blocks, ${txs} txs`)
|
||||
|
||||
@@ -59,12 +59,12 @@ test.describe('Governance — Contract Discovery via Explorer', () => {
|
||||
test('explorer search for governance contracts', async ({ request }) => {
|
||||
const status = await httpStatus(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/search?q=governor`,
|
||||
`${urls.apiExploreLux}/search?q=governor`,
|
||||
)
|
||||
if (status === 200) {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/search?q=governor`,
|
||||
`${urls.apiExploreLux}/search?q=governor`,
|
||||
) as { items?: { address: string; name: string; type: string }[] }
|
||||
const count = data.items?.length ?? 0
|
||||
console.log(` Governor contracts found: ${count}`)
|
||||
@@ -84,7 +84,7 @@ test.describe('Governance — Contract Discovery via Explorer', () => {
|
||||
// Look for governance tokens (typically ERC-20 with "GOV" or "LUX" in name)
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens?q=governance&type=ERC-20`,
|
||||
`${urls.apiExploreLux}/tokens?q=governance&type=ERC-20`,
|
||||
) as { items?: { address_hash?: string; address?: string; name: string; symbol: string }[] }
|
||||
const count = data.items?.length ?? 0
|
||||
console.log(` Governance tokens found: ${count}`)
|
||||
@@ -102,7 +102,7 @@ test.describe('Governance — On-Chain State', () => {
|
||||
test('can query ERC-20 token list for potential governance tokens', async ({ request }) => {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/tokens?type=ERC-20`,
|
||||
`${urls.apiExploreLux}/tokens?type=ERC-20`,
|
||||
) as { items?: { address_hash?: string; address?: string; name: string; symbol: string; total_supply: string }[] }
|
||||
const count = data.items?.length ?? 0
|
||||
console.log(` ERC-20 tokens indexed: ${count}`)
|
||||
@@ -117,7 +117,7 @@ test.describe('Governance — On-Chain State', () => {
|
||||
test('verified contracts list accessible', async ({ request }) => {
|
||||
const data = await httpGetJson(
|
||||
request,
|
||||
`${urls.apiExploreLux}/api/v2/smart-contracts`,
|
||||
`${urls.apiExploreLux}/smart-contracts`,
|
||||
) as { items?: { address: { hash: string }; name: string; verified_at: string }[] }
|
||||
const count = data.items?.length ?? 0
|
||||
console.log(` Verified contracts: ${count}`)
|
||||
|
||||
Reference in New Issue
Block a user