mirror of
https://github.com/luxfi/explore.git
synced 2026-07-27 03:13:50 +00:00
fix(explore): reconcile chainIds to live/canonical + migrate chain RPC to /v1 (v1.1.7)
chainId reconciliation (registry = live chains = genesis LP-018 map, one way): - Pars mainnet 7070 -> 494949 (live api.pars.network eth_chainId=0x78d65, net_version=494949); Pars testnet 7071 -> 494950, devnet 7072 -> 494951 (matches genesis configs/lp182_chain_id_map.go 4949xx scheme). - Lux devnet 96370 -> 96367 (live api.lux-dev.network reports 96367). - chainRegistry.spec.ts now asserts Pars 494949 (was stale-7070 assert). - Also fixed: configmap-mainnet Pars NETWORK_ID, configmap-testnet Pars NETWORK_ID, branded_build.sh, tools/send_test_txs.py, well-known/explore.json (regenerated from the fixed registry). RPC /ext/bc/<alias>/rpc -> /v1/bc/C/rpc (gateway canonical; each sovereign L1 serves its own C-Chain at /v1/bc/C/rpc). Verified returning blocks before switch: Lux/Zoo/Hanzo/Pars mainnet + Lux testnet. Kept on /ext (their /v1 not up yet): Lux devnet, brand testnets, local-node compose/test-tool URLs. P-chain proxy now dials /v1/bc/P. useChainHeights + luxnet/instance no longer strip /ext/bc/C/rpc; they use the env RPC URL / origin directly so C-chain height + luxnet SDK work under /v1. Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ NEXT_PUBLIC_NETWORK_ID=96369
|
||||
NEXT_PUBLIC_NETWORK_CURRENCY_NAME=LUX
|
||||
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=LUX
|
||||
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL=https://api.lux.network/ext/bc/C/rpc
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL=https://api.lux.network/v1/bc/C/rpc
|
||||
|
||||
# API
|
||||
NEXT_PUBLIC_API_HOST=api-explore.lux.network
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=wss
|
||||
NEXT_PUBLIC_APP_HOST=explore.lux.network
|
||||
NEXT_PUBLIC_APP_PROTOCOL=https
|
||||
NEXT_PUBLIC_IS_TESTNET=false
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL=https://api.lux.network/ext/bc/C/rpc
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL=https://api.lux.network/v1/bc/C/rpc
|
||||
|
||||
# Branding — intentionally left unset for multi-tenant.
|
||||
# Each chain uses text-based branding from chainRegistry.ts.
|
||||
|
||||
@@ -229,12 +229,34 @@ login page; chain switcher lists Lux/Zoo/Hanzo/SPC/Pars/Osage.
|
||||
`public/.well-known/explore.json` at build; now emits `<Brand> Network`, never
|
||||
"Subnet".
|
||||
|
||||
**chainId discrepancies flagged (NOT changed — owner to reconcile):**
|
||||
- Registry Pars mainnet = **7070**, but `api.pars.network` reports `eth_chainId`
|
||||
**494949** and `chainRegistry.spec.ts` deliberately asserts 7070 ("494949 is
|
||||
stale"). Repo is internally consistent on 7070; the live chain disagrees.
|
||||
- Registry Lux devnet = **96370**, but `api.lux-dev.network` reports **96367**
|
||||
(no test defends 96370; mainnet 96369 / testnet 96368 / devnet 96367).
|
||||
**chainId reconciliation + RPC → /v1 (v1.1.7):** registry now matches the LIVE
|
||||
chains AND the canonical genesis source of truth
|
||||
(`~/work/lux/genesis/configs/lp182_chain_id_map.go`, the LP-018 (family,env)→
|
||||
EVMChainID map). One value, one way.
|
||||
- **Pars mainnet 494949** (was the stale 7070) — `api.pars.network` reports
|
||||
`eth_chainId=0x78d65` / `net_version=494949`. Pars **testnet 494950**, **devnet
|
||||
494951** (were 7071/7072) — matches the LP-018 map's 4949xx theme. Note the LP-018
|
||||
map itself was ALSO stale on Pars mainnet (7070) and was corrected to 494949 in
|
||||
the genesis repo; testnet/devnet 494950/494951 were already canonical there.
|
||||
- **Lux devnet 96367** (was the stale 96370) — `api.lux-dev.network` reports
|
||||
96367. Canonical Lux: mainnet 96369 / testnet 96368 / devnet 96367.
|
||||
- `chainRegistry.spec.ts` now asserts Pars **494949** (was the stale-7070 assert).
|
||||
- Fixed in: `configs/app/chainRegistry.ts`, `chainRegistry.spec.ts`,
|
||||
`public/.well-known/explore.json`, `lib/web3/chains.ts` (comment),
|
||||
`deploy/k8s/explore-fe/configmap-{mainnet,testnet}.yaml`,
|
||||
`deploy/scripts/branded_build.sh`, `tools/send_test_txs.py`.
|
||||
- **Chain RPC migrated `/ext/bc/<alias>/rpc` → `/v1/bc/C/rpc`** (gateway canonical;
|
||||
every sovereign L1 exposes its own C-Chain at `/v1/bc/C/rpc`, so zoo/hanzo/pars
|
||||
drop their old brand-aliased `/ext/bc/{zoo,hanzo,pars}/rpc` paths — which were
|
||||
already 404ing). Verified returning blocks BEFORE switching: Lux/Zoo/Hanzo/Pars
|
||||
**mainnet** + Lux **testnet**. Deliberately still on `/ext` (their `/v1` gateway
|
||||
route is not up yet — do NOT switch until a block returns): Lux **devnet**,
|
||||
Zoo/Hanzo/Pars **testnet**, and the local-node compose + `send_test_txs.py`
|
||||
URLs (raw luxd serves `/ext` natively, no gateway). P-chain proxy
|
||||
(`pages/api/pchain.ts`) now dials `/v1/bc/P` (verified). `useChainHeights.ts`
|
||||
and `luxnet/instance.ts` no longer strip `/ext/bc/C/rpc`: they use the env RPC
|
||||
URL (or its origin) directly, so the C-chain height widget + luxnet SDK work
|
||||
under either path scheme.
|
||||
|
||||
### Chain-visibility + 10-VM/DEX handling (v1.0.14)
|
||||
Two orthogonal correctness fixes shipped in one build cycle.
|
||||
@@ -243,8 +265,9 @@ Two orthogonal correctness fixes shipped in one build cycle.
|
||||
`!isWhiteLabelMode() && vm === 'EVM'`, so unregistered/brand hosts stop
|
||||
rendering the Lux primary panels + cross-L1 list. Registered
|
||||
`explore.zoo.network`/`.ngo` + `explore.pars.network` as own-scoped L2s
|
||||
(brand parity with Hanzo), added **Osage** L1, and fixed Pars chainId →
|
||||
**7070**. Rule: **lux explorer = ALL chains; hanzo/zoo/pars = ONLY their own.**
|
||||
(brand parity with Hanzo), added **Osage** L1, and set Pars chainId (interim
|
||||
**7070**, since reconciled → **494949** in v1.1.7 above). Rule: **lux explorer =
|
||||
ALL chains; hanzo/zoo/pars = ONLY their own.**
|
||||
Proven by `configs/app/chainRegistry.spec.ts` (12 cases).
|
||||
- **10-VM / DEX handling:** the Lux primary network is a family of VM-specialized
|
||||
chains (C=EVM, X=UTXO, D=DEX, P=platform, + A/B/Q/T/Z/G/K/O/R/I/M), mirrored
|
||||
|
||||
@@ -66,9 +66,9 @@ describe('chain-visibility rule', () => {
|
||||
expect(switcherChainNames()).toEqual([ name ]);
|
||||
});
|
||||
|
||||
it('pars uses its deployed chainId 7070 (not the stale 494949)', () => {
|
||||
it('pars uses its live deployed chainId 494949 (api.pars.network eth_chainId=0x78d65 / net_version=494949)', () => {
|
||||
atHost('explore.pars.network');
|
||||
expect(getCurrentChain().chainId).toBe(7070);
|
||||
expect(getCurrentChain().chainId).toBe(494949);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ export const CHAINS: ReadonlyArray<ChainEntry> = [
|
||||
label: 'Pars Network',
|
||||
vm: 'L2',
|
||||
network: 'mainnet',
|
||||
chainId: 7070,
|
||||
chainId: 494949,
|
||||
hostnames: [ 'explore-pars.lux.network', 'explore.pars.network', 'explorer.pars.network' ],
|
||||
explorerUrl: 'https://explore-pars.lux.network',
|
||||
apiUrl: 'https://api-explore-pars.lux.network',
|
||||
@@ -388,7 +388,7 @@ export const CHAINS: ReadonlyArray<ChainEntry> = [
|
||||
label: 'Pars Network (Testnet)',
|
||||
vm: 'L2',
|
||||
network: 'testnet',
|
||||
chainId: 7071,
|
||||
chainId: 494950,
|
||||
hostnames: [ 'explore-pars-test.lux.network' ],
|
||||
explorerUrl: 'https://explore-pars-test.lux.network',
|
||||
apiUrl: 'https://api-explore-pars-test.lux.network',
|
||||
@@ -411,7 +411,7 @@ export const CHAINS: ReadonlyArray<ChainEntry> = [
|
||||
label: 'Contract Chain',
|
||||
vm: 'EVM',
|
||||
network: 'devnet',
|
||||
chainId: 96370,
|
||||
chainId: 96367,
|
||||
hostnames: [ 'explore-dev.lux.network', 'explore.lux-dev.network' ],
|
||||
explorerUrl: 'https://explore-dev.lux.network',
|
||||
apiUrl: 'https://api-explore-dev.lux.network',
|
||||
@@ -455,7 +455,7 @@ export const CHAINS: ReadonlyArray<ChainEntry> = [
|
||||
label: 'Pars Network (Devnet)',
|
||||
vm: 'L2',
|
||||
network: 'devnet',
|
||||
chainId: 7072,
|
||||
chainId: 494951,
|
||||
hostnames: [ 'explore-pars-dev.lux.network' ],
|
||||
explorerUrl: 'https://explore-pars-dev.lux.network',
|
||||
apiUrl: 'https://api-explore-pars-dev.lux.network',
|
||||
|
||||
@@ -18,7 +18,7 @@ data:
|
||||
NEXT_PUBLIC_IS_TESTNET: "false"
|
||||
NEXT_PUBLIC_API_HOST: api-explore.lux.network
|
||||
NEXT_PUBLIC_APP_HOST: explore.lux.network
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.lux.network/ext/bc/C/rpc
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.lux.network/v1/bc/C/rpc
|
||||
NEXT_PUBLIC_STATS_API_HOST: https://api-explore.lux.network
|
||||
NEXT_PUBLIC_VISUALIZE_API_HOST: https://api-explore.lux.network
|
||||
NEXT_PUBLIC_CONTRACT_INFO_API_HOST: https://api-explore.lux.network
|
||||
@@ -47,7 +47,7 @@ data:
|
||||
NEXT_PUBLIC_IS_TESTNET: "false"
|
||||
NEXT_PUBLIC_API_HOST: api-explore.zoo.network
|
||||
NEXT_PUBLIC_APP_HOST: explore.zoo.network
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.zoo.network/ext/bc/zoo/rpc
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.zoo.network/v1/bc/C/rpc
|
||||
NEXT_PUBLIC_STATS_API_HOST: https://api-explore.zoo.network
|
||||
NEXT_PUBLIC_VISUALIZE_API_HOST: https://api-explore.zoo.network
|
||||
NEXT_PUBLIC_CONTRACT_INFO_API_HOST: https://api-explore.zoo.network
|
||||
@@ -64,7 +64,7 @@ data:
|
||||
NEXT_PUBLIC_IS_TESTNET: "false"
|
||||
NEXT_PUBLIC_API_HOST: api-explore.hanzo.network
|
||||
NEXT_PUBLIC_APP_HOST: explore.hanzo.network
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.hanzo.network/ext/bc/hanzo/rpc
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.hanzo.network/v1/bc/C/rpc
|
||||
NEXT_PUBLIC_STATS_API_HOST: https://api-explore.hanzo.network
|
||||
NEXT_PUBLIC_VISUALIZE_API_HOST: https://api-explore.hanzo.network
|
||||
NEXT_PUBLIC_CONTRACT_INFO_API_HOST: https://api-explore.hanzo.network
|
||||
@@ -77,11 +77,11 @@ metadata:
|
||||
namespace: lux-mainnet
|
||||
labels: {app: explore-fe, brand: pars, network: mainnet}
|
||||
data:
|
||||
NEXT_PUBLIC_NETWORK_ID: "7070"
|
||||
NEXT_PUBLIC_NETWORK_ID: "494949"
|
||||
NEXT_PUBLIC_IS_TESTNET: "false"
|
||||
NEXT_PUBLIC_API_HOST: api-explore.pars.network
|
||||
NEXT_PUBLIC_APP_HOST: explore.pars.network
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.pars.network/ext/bc/pars/rpc
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.pars.network/v1/bc/C/rpc
|
||||
NEXT_PUBLIC_STATS_API_HOST: https://api-explore.pars.network
|
||||
NEXT_PUBLIC_VISUALIZE_API_HOST: https://api-explore.pars.network
|
||||
NEXT_PUBLIC_CONTRACT_INFO_API_HOST: https://api-explore.pars.network
|
||||
|
||||
@@ -13,7 +13,7 @@ data:
|
||||
NEXT_PUBLIC_IS_TESTNET: "true"
|
||||
NEXT_PUBLIC_API_HOST: api-explorer.lux-test.network
|
||||
NEXT_PUBLIC_APP_HOST: explorer.lux-test.network
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.lux-test.network/ext/bc/C/rpc
|
||||
NEXT_PUBLIC_NETWORK_RPC_URL: https://api.lux-test.network/v1/bc/C/rpc
|
||||
NEXT_PUBLIC_STATS_API_HOST: https://api-explorer.lux-test.network
|
||||
NEXT_PUBLIC_VISUALIZE_API_HOST: https://api-explorer.lux-test.network
|
||||
NEXT_PUBLIC_CONTRACT_INFO_API_HOST: https://api-explorer.lux-test.network
|
||||
@@ -60,7 +60,7 @@ metadata:
|
||||
namespace: lux-testnet
|
||||
labels: {app: explore-fe, brand: pars, network: testnet}
|
||||
data:
|
||||
NEXT_PUBLIC_NETWORK_ID: "7071"
|
||||
NEXT_PUBLIC_NETWORK_ID: "494950"
|
||||
NEXT_PUBLIC_IS_TESTNET: "true"
|
||||
NEXT_PUBLIC_API_HOST: api-explorer.pars-test.network
|
||||
NEXT_PUBLIC_APP_HOST: explorer.pars-test.network
|
||||
|
||||
@@ -50,7 +50,7 @@ spec:
|
||||
- name: NEXT_PUBLIC_IS_TESTNET
|
||||
value: "true"
|
||||
- name: NEXT_PUBLIC_NETWORK_RPC_URL
|
||||
value: "https://api.lux-test.network/ext/bc/C/rpc"
|
||||
value: "https://api.lux-test.network/v1/bc/C/rpc"
|
||||
- name: NEXT_PUBLIC_COLOR_THEME_DEFAULT
|
||||
value: "dark"
|
||||
- name: NEXT_PUBLIC_HOMEPAGE_CHARTS
|
||||
|
||||
@@ -41,7 +41,7 @@ NETWORK_SHORT_NAME=LUX
|
||||
NETWORK_ID=96369
|
||||
NETWORK_CURRENCY_NAME=LUX
|
||||
NETWORK_CURRENCY_SYMBOL=LUX
|
||||
NETWORK_RPC_URL=https://api.lux.network/ext/bc/C/rpc
|
||||
NETWORK_RPC_URL=https://api.lux.network/v1/bc/C/rpc
|
||||
API_HOST=api-explore.lux.network
|
||||
APP_HOST=explore.lux.network
|
||||
NETWORK_ORG_NAME=Lux Industries Inc.
|
||||
@@ -61,7 +61,7 @@ NETWORK_SHORT_NAME=LUX
|
||||
NETWORK_ID=96368
|
||||
NETWORK_CURRENCY_NAME=LUX
|
||||
NETWORK_CURRENCY_SYMBOL=LUX
|
||||
NETWORK_RPC_URL=https://api.lux-test.network/ext/bc/C/rpc
|
||||
NETWORK_RPC_URL=https://api.lux-test.network/v1/bc/C/rpc
|
||||
API_HOST=api-explorer.lux-test.network
|
||||
APP_HOST=explorer.lux-test.network
|
||||
NETWORK_ORG_NAME=Lux Industries Inc.
|
||||
@@ -81,7 +81,7 @@ NETWORK_SHORT_NAME=ZOO
|
||||
NETWORK_ID=200200
|
||||
NETWORK_CURRENCY_NAME=Zoo
|
||||
NETWORK_CURRENCY_SYMBOL=ZOO
|
||||
NETWORK_RPC_URL=https://api.zoo.network/ext/bc/zoo/rpc
|
||||
NETWORK_RPC_URL=https://api.zoo.network/v1/bc/C/rpc
|
||||
API_HOST=api-explore.zoo.network
|
||||
APP_HOST=explore.zoo.network
|
||||
NETWORK_ORG_NAME=Zoo Labs Foundation
|
||||
@@ -121,7 +121,7 @@ NETWORK_SHORT_NAME=AI
|
||||
NETWORK_ID=36963
|
||||
NETWORK_CURRENCY_NAME=AI
|
||||
NETWORK_CURRENCY_SYMBOL=AI
|
||||
NETWORK_RPC_URL=https://api.hanzo.network/ext/bc/hanzo/rpc
|
||||
NETWORK_RPC_URL=https://api.hanzo.network/v1/bc/C/rpc
|
||||
API_HOST=api-explore.hanzo.network
|
||||
APP_HOST=explore.hanzo.network
|
||||
NETWORK_ORG_NAME=Hanzo AI Inc.
|
||||
@@ -158,10 +158,10 @@ EOF
|
||||
cat <<'EOF'
|
||||
NETWORK_NAME=Pars Network
|
||||
NETWORK_SHORT_NAME=PARS
|
||||
NETWORK_ID=7070
|
||||
NETWORK_ID=494949
|
||||
NETWORK_CURRENCY_NAME=Pars
|
||||
NETWORK_CURRENCY_SYMBOL=PARS
|
||||
NETWORK_RPC_URL=https://api.pars.network/ext/bc/pars/rpc
|
||||
NETWORK_RPC_URL=https://api.pars.network/v1/bc/C/rpc
|
||||
API_HOST=api-explore.pars.network
|
||||
APP_HOST=explore.pars.network
|
||||
NETWORK_ORG_NAME=Pars DAO
|
||||
@@ -178,7 +178,7 @@ EOF
|
||||
cat <<'EOF'
|
||||
NETWORK_NAME=Pars Testnet
|
||||
NETWORK_SHORT_NAME=PARS
|
||||
NETWORK_ID=7071
|
||||
NETWORK_ID=494950
|
||||
NETWORK_CURRENCY_NAME=Pars
|
||||
NETWORK_CURRENCY_SYMBOL=PARS
|
||||
NETWORK_RPC_URL=https://api.pars-test.network/ext/bc/pars/rpc
|
||||
|
||||
@@ -2,7 +2,6 @@ import Lux from 'luxnet';
|
||||
|
||||
import { getEnvValue } from 'configs/app/utils';
|
||||
|
||||
const CCHAIN_RPC_PATTERN = /\/ext\/bc\/C\/rpc$/;
|
||||
const HTTPS_PORT = 443;
|
||||
const HTTP_PORT = 80;
|
||||
|
||||
@@ -12,8 +11,10 @@ function parseRpcUrl(): { host: string; port: number; protocol: string } {
|
||||
throw new Error('NEXT_PUBLIC_NETWORK_RPC_URL is not configured');
|
||||
}
|
||||
|
||||
const base = rpcUrl.replace(CCHAIN_RPC_PATTERN, '');
|
||||
const url = new URL(base);
|
||||
// The luxnet SDK builds its own chain paths from scheme+host+port, so we
|
||||
// only need the origin of the RPC URL — independent of its path scheme
|
||||
// (canonical `/v1/bc/C/rpc`).
|
||||
const url = new URL(rpcUrl);
|
||||
const defaultPort = url.protocol === 'https:' ? HTTPS_PORT : HTTP_PORT;
|
||||
|
||||
return {
|
||||
|
||||
@@ -6,15 +6,12 @@ import { getEnvValue } from 'configs/app/utils';
|
||||
|
||||
const HEIGHTS_STALE_TIME_MS = 15_000;
|
||||
const HEIGHTS_QUERY_KEY = 'pchain:chainHeights' as const;
|
||||
const CCHAIN_RPC_PATTERN = /\/ext\/bc\/C\/rpc$/;
|
||||
|
||||
function getApiBase(): string {
|
||||
const rpcUrl = getEnvValue('NEXT_PUBLIC_NETWORK_RPC_URL') ?? '';
|
||||
return rpcUrl.replace(CCHAIN_RPC_PATTERN, '');
|
||||
}
|
||||
|
||||
async function fetchChainHeights(): Promise<{ pChain: number; cChain: number }> {
|
||||
const base = getApiBase();
|
||||
// NEXT_PUBLIC_NETWORK_RPC_URL IS the C-chain EVM RPC endpoint (canonical
|
||||
// `/v1/bc/C/rpc` on the gateway). Dial it directly — no path rewriting — so
|
||||
// the C-chain height works regardless of the gateway path scheme.
|
||||
const cChainRpcUrl = getEnvValue('NEXT_PUBLIC_NETWORK_RPC_URL') ?? '';
|
||||
|
||||
const [ pRes, cRes ] = await Promise.allSettled([
|
||||
// P-chain: use server-side proxy to bypass CORS
|
||||
@@ -23,7 +20,7 @@ async function fetchChainHeights(): Promise<{ pChain: number; cChain: number }>
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ jsonrpc: '2.0', method: 'platform.getHeight', params: {}, id: 1 }),
|
||||
}),
|
||||
fetch(`${ base }/ext/bc/C/rpc`, {
|
||||
fetch(cChainRpcUrl, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: 2 }),
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ export const essentialDappsChains: Array<Chain> | undefined = (() => {
|
||||
// Sibling networks of the current brand, sourced from the multi-tenant chain
|
||||
// registry so the wallet-connect flow presents / can add EVERY registered
|
||||
// network for this brand — e.g. Lux mainnet (96369), testnet (96368) and
|
||||
// devnet (96370) — instead of only the single env-configured chain. This is
|
||||
// devnet (96367) — instead of only the single env-configured chain. This is
|
||||
// the "native all-chains" connect: the list is derived from the registry
|
||||
// (the same source of truth as the header chain switcher), never hardcoded to
|
||||
// one chain. Each sibling's read RPC is its brand explorer's Blockscout
|
||||
|
||||
@@ -41,7 +41,7 @@ export function app(isPrivateMode = false): CspDev.DirectiveDescriptor {
|
||||
...Object.values(config.apis).filter(Boolean).map((api) => api.endpoint),
|
||||
...Object.values(config.apis).filter(Boolean).map((api) => api.socketEndpoint),
|
||||
|
||||
// chain RPC server (full URLs + base origins for SDK calls to other paths like /ext/bc/P)
|
||||
// chain RPC server (full URLs + base origins for SDK calls to other paths like /v1/bc/P)
|
||||
...config.chain.rpcUrls,
|
||||
...config.chain.rpcUrls.map((url) => {
|
||||
try {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@luxfi/explore",
|
||||
"version": "1.1.6",
|
||||
"version": "1.1.7",
|
||||
"private": false,
|
||||
"homepage": "https://github.com/luxfi/explore#readme",
|
||||
"engines": {
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
// Server-side proxy for P-chain JSON-RPC calls.
|
||||
// Bypasses CORS issues with the KrakenD gateway which returns 404 on OPTIONS preflight for /ext/bc/P.
|
||||
// Bypasses CORS issues with the KrakenD gateway which returns 404 on OPTIONS preflight for /v1/bc/P.
|
||||
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
|
||||
@@ -8,8 +8,8 @@ import { getEnvValue } from 'configs/app/utils';
|
||||
const TIMEOUT_MS = 10_000;
|
||||
|
||||
// Derive the node's API origin from the chain RPC URL. The RPC URL points at a
|
||||
// specific EVM chain (e.g. `…/ext/bc/C/rpc` or `…/ext/bc/hanzo/rpc`); the P-chain
|
||||
// lives at `<origin>/ext/bc/P`, so we must reduce to the scheme+host origin and
|
||||
// specific EVM chain (canonical `…/v1/bc/C/rpc`); the P-chain
|
||||
// lives at `<origin>/v1/bc/P`, so we must reduce to the scheme+host origin and
|
||||
// never naively concatenate onto the full RPC path (which produced a malformed
|
||||
// URL → HTML 404 → "Unexpected non-whitespace character after JSON" for every
|
||||
// non-C-chain brand).
|
||||
@@ -38,7 +38,7 @@ const handler = async(req: NextApiRequest, res: NextApiResponse): Promise<void>
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${ base }/ext/bc/P`, {
|
||||
const response = await fetch(`${ base }/v1/bc/P`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(req.body),
|
||||
@@ -55,7 +55,7 @@ const handler = async(req: NextApiRequest, res: NextApiResponse): Promise<void>
|
||||
} catch {
|
||||
res.status(502).json({
|
||||
error: 'P-chain request failed',
|
||||
message: `Upstream returned non-JSON (HTTP ${ response.status }) from ${ base }/ext/bc/P`,
|
||||
message: `Upstream returned non-JSON (HTTP ${ response.status }) from ${ base }/v1/bc/P`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"name": "Lux Testnet"
|
||||
},
|
||||
{
|
||||
"id": 96370,
|
||||
"id": 96367,
|
||||
"name": "Lux Devnet"
|
||||
},
|
||||
{
|
||||
@@ -31,7 +31,7 @@
|
||||
"name": "SPC Network"
|
||||
},
|
||||
{
|
||||
"id": 7070,
|
||||
"id": 494949,
|
||||
"name": "Pars Network"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ CHAINS = {
|
||||
"local_port": 19650,
|
||||
"namespace": "lux-devnet",
|
||||
"chains": [
|
||||
("C-chain", "C", 96370),
|
||||
("C-chain", "C", 96367),
|
||||
("Zoo", "2dNppzzx7WC1cagAzVRjVP4Qf5n9BRLgVsd2L6BwDbocAVVqBz", 200202),
|
||||
("Hanzo", "8saqkhsUrijPci3RXQnNaaLLkYXBErauhwUsZZwdj8erxeaZv", 36964),
|
||||
("SPC", "AbticcB4ymCPL914ZBMozSSjFwVGw8xFKM35aiJDTAs6aed4M", 36912),
|
||||
|
||||
Reference in New Issue
Block a user