Skip to content

Commit

Permalink
Fix Etherscan links (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpierre authored Jan 23, 2025
1 parent 9ec8311 commit ba05192
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/app/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const EnvSchema = v.pipe(
CHAIN_NAME: v.string(),
CHAIN_CURRENCY: vEnvCurrency(),
CHAIN_RPC_URL: v.pipe(v.string(), v.url()),
CHAIN_BLOCK_EXPLORER: v.optional(vEnvLink()),
CHAIN_BLOCK_EXPLORER: v.optional(vEnvLink(true)),
CHAIN_CONTRACT_ENS_REGISTRY: v.optional(vEnvAddressAndBlock()),
CHAIN_CONTRACT_ENS_RESOLVER: v.optional(vEnvAddressAndBlock()),
CHAIN_CONTRACT_MULTICALL: vAddress(),
Expand Down
7 changes: 5 additions & 2 deletions frontend/app/src/valibot-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function vPrefixedTroveId() {
}

// Env var link, e.g. Etherscan|https://etherscan.io
export function vEnvLink() {
export function vEnvLink(addFinalSlash = false) {
return v.pipe(
v.string(),
v.trim(),
Expand All @@ -69,7 +69,10 @@ export function vEnvLink() {
name: string;
url: string;
}>((value) => {
const [name, url] = value.split("|") as [string, string];
let [name, url] = value.split("|") as [string, string];
if (addFinalSlash && !url.endsWith("/")) {
url += "/";
}
return { name, url };
}),
);
Expand Down

0 comments on commit ba05192

Please sign in to comment.