CI/CD / render (push) Waiting to run
The primary-network chains answer to either case; one spelling beats two. /v1/chain/c/rpc, /v1/chain/p, /v1/chain/x across the estate. Co-authored-by: Hanzo AI <[email protected]>
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
import { ethChainId, API_DOMAINS, CHAIN_IDS } from './helpers'
|
|
|
|
// Verify mainnet/testnet/devnet are INDEPENDENT: each C-Chain reports its own
|
|
// distinct EVM chainId over the canonical flat /v1 public RPC surface. A deploy
|
|
// to one network must never change another's chainId.
|
|
//
|
|
// mainnet api.lux.network /v1/chain/c/rpc -> 96369 (0x17871)
|
|
// testnet api.lux-test.network /v1/chain/c/rpc -> 96368 (0x17870)
|
|
// devnet api.lux-dev.network /v1/chain/c/rpc -> 96367 (0x1786f)
|
|
|
|
const NETWORKS = (['mainnet', 'testnet', 'devnet'] as const).map(net => ({
|
|
net,
|
|
rpc: `${API_DOMAINS[net]}/v1/chain/c/rpc`,
|
|
expected: CHAIN_IDS[net].lux,
|
|
}))
|
|
|
|
test.describe('Network Independence — mainnet/testnet/devnet', () => {
|
|
for (const { net, rpc, expected } of NETWORKS) {
|
|
test(`${net} C-Chain reports chainId ${expected}`, async ({ request }) => {
|
|
const cid = await ethChainId(request, rpc)
|
|
console.log(` ${net}: chainId ${cid} (0x${cid.toString(16)}) @ ${rpc}`)
|
|
expect(cid).toBe(expected)
|
|
})
|
|
}
|
|
|
|
test('all three networks report distinct chainIds', async ({ request }) => {
|
|
const ids = await Promise.all(NETWORKS.map(n => ethChainId(request, n.rpc)))
|
|
console.log(` chainIds: ${ids.join(', ')}`)
|
|
expect(new Set(ids).size).toBe(ids.length)
|
|
})
|
|
})
|