From 551527d7dabffff4e4c862e86205eac3212abe0c Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Thu, 28 May 2026 10:56:41 -0700 Subject: [PATCH] =?UTF-8?q?SPIKE:=20CAP-71=20support=20=E2=80=94=20env-var?= =?UTF-8?q?=20custom=20network=20+=20drop=20stale=20@ts-expect-error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two minimal lab-source changes required to render Protocol 27 / CAP-71 transactions: 1. src/store/createStore.ts: parameterize defaultCustomNetwork via three new NEXT_PUBLIC_CUSTOM_{HORIZON_URL,RPC_URL,PASSPHRASE} env vars (falls back to the existing :8000 defaults). Quickstart's bundled lab is started with NEXT_PUBLIC_DEFAULT_NETWORK=custom but currently has no way to also supply the URLs; the only options were a hard-coded localhost:8000 (which only works inside the container) or asking the user to enter them in the network UI before any deep link works. With this PR the bundled lab can be parameterized at start time. 2. src/app/(sidebar)/transactions-explorer/tx/[tx]/components/TransactionDetails.tsx: drop a stale '@ts-expect-error' directive. With CAP-71-aware XDR types the tx.envelopeXdr.value().tx().innerTx().value().tx() expression now typechecks naturally; the directive becomes 'unused' and fails the Next.js production build. Companion fork PRs: - sisuresh/js-stellar-base#... (XDR regen at .x@5187e69 with cap_0071+cap_0083 + inline-const post-process) - sisuresh/js-stellar-sdk#... (browser dist rebuilt against patched stellar-base) - sisuresh/js-stellar-xdr-json#... (wasm decoder at rs-stellar-xdr@a749b69b features=[cap_0071]) Used to render a live CAP-71-01 (WITH_DELEGATES) transaction end-to-end through a local Quickstart Protocol 27 build. --- .../tx/[tx]/components/TransactionDetails.tsx | 3 +-- src/store/createStore.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/(sidebar)/transactions-explorer/tx/[tx]/components/TransactionDetails.tsx b/src/app/(sidebar)/transactions-explorer/tx/[tx]/components/TransactionDetails.tsx index e8dc6bcf1..77232a358 100644 --- a/src/app/(sidebar)/transactions-explorer/tx/[tx]/components/TransactionDetails.tsx +++ b/src/app/(sidebar)/transactions-explorer/tx/[tx]/components/TransactionDetails.tsx @@ -50,8 +50,7 @@ export function TransactionDetails({ const [xdrJson, setXdrJson] = useState | null>(null); const [xdr, setXdr] = useState(""); const innerTx = tx.feeBump - ? // @ts-expect-error fee bump tx has innerTx. - tx.envelopeXdr.value().tx().innerTx().value().tx() + ? tx.envelopeXdr.value().tx().innerTx().value().tx() : tx.envelopeXdr.value().tx(); const sourceAccount = StrKey.encodeEd25519PublicKey( innerTx.sourceAccount().value(), diff --git a/src/store/createStore.ts b/src/store/createStore.ts index afb14644a..cc70ca955 100644 --- a/src/store/createStore.ts +++ b/src/store/createStore.ts @@ -214,11 +214,15 @@ interface CreateStoreOptions { // lab that runs on quickstart. This can be enabled by passing // `NEXT_PUBLIC_DEFAULT_NETWORK=custom` as an env var. const defaultCustomNetwork = { - id: "custom", + id: "custom" as const, label: "Custom", - horizonUrl: "http://localhost:8000", - rpcUrl: "http://localhost:8000/rpc", - passphrase: "Standalone Network ; February 2017", + horizonUrl: + process.env.NEXT_PUBLIC_CUSTOM_HORIZON_URL ?? "http://localhost:8000", + rpcUrl: + process.env.NEXT_PUBLIC_CUSTOM_RPC_URL ?? "http://localhost:8000/rpc", + passphrase: + process.env.NEXT_PUBLIC_CUSTOM_PASSPHRASE ?? + "Standalone Network ; February 2017", }; const initNetwork =