Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default [
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "warn",
"no-console": ["error", { allow: ["warn", "error", "info"] }],
},
},
{
Expand Down
8 changes: 4 additions & 4 deletions src/components/ContractDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@

const handleTransferAdmin = () => {
// Calls the transfer_admin function added to the contract
console.log("Initiating admin transfer transaction...");
logger.debug("Initiating admin transfer transaction...");

Check failure on line 20 in src/components/ContractDashboard.tsx

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Build, Test

Cannot find name 'logger'.
};

const handlePause = () => {
// Multi-sig pause escalation path
console.log("Initiating Level 1 emergency pause (2-of-3 required)...");
logger.debug("Initiating Level 1 emergency pause (2-of-3 required)...");

Check failure on line 25 in src/components/ContractDashboard.tsx

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Build, Test

Cannot find name 'logger'.
};

const handleVerify = () => {
// Invokes deterministic build and ABI signature checks via Stellar Expert
console.log("Verifying ABI signature and WASM hash on Stellar Expert...");
logger.debug("Verifying ABI signature and WASM hash on Stellar Expert...");

Check failure on line 30 in src/components/ContractDashboard.tsx

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Build, Test

Cannot find name 'logger'.
};

const handleUpgrade = () => {
// Automates proxy contract implementation swap
console.log("Simulating upgrade to next implementation...");
logger.debug("Simulating upgrade to next implementation...");

Check failure on line 35 in src/components/ContractDashboard.tsx

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Build, Test

Cannot find name 'logger'.
};

return (
Expand Down
6 changes: 6 additions & 0 deletions src/pages/BatchMultiCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@
>
Export as JSON
</button>
<button onClick={exportAsFoundry} disabled={calls.length === 0} style={{ fontSize: 12 }}>

Check failure on line 407 in src/pages/BatchMultiCall.tsx

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Build, Test

Cannot find name 'exportAsFoundry'.
Export as Foundry (.sol)
</button>
<button onClick={exportAsCli} disabled={calls.length === 0} style={{ fontSize: 12 }}>

Check failure on line 410 in src/pages/BatchMultiCall.tsx

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Build, Test

Cannot find name 'exportAsCli'. Did you mean 'exportAsCurl'?
Export as CLI (.sh)
</button>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/services/export.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import JSZip from "jszip";
import { SandboxFile } from "./webcontainer";
import { logger } from "../utils/logger";

export async function exportAsZip(
files: Map<string, SandboxFile>,
Expand Down Expand Up @@ -40,7 +41,7 @@ export function createShareableUrl(sandboxId: string): string {
export function copySandboxUrl(sandboxId: string): void {
const url = createShareableUrl(sandboxId);
navigator.clipboard.writeText(url).then(() => {
console.log("Sandbox URL copied to clipboard:", url);
logger.debug("Sandbox URL copied to clipboard:", url);
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/services/webcontainer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WebContainer } from "@webcontainer/api";
import { logger } from "../utils/logger";

export interface SandboxFile {
path: string;
Expand Down Expand Up @@ -77,7 +78,7 @@ EXPLORER_CONTRACT_ID=CABCD1234567890ABCD1234567890ABCD1234567890ABCD1234567890AB
export async function initWebContainer(): Promise<WebContainer> {
try {
const container = await WebContainer.boot();
console.log("WebContainer initialized");
logger.debug("WebContainer initialized");
return container;
} catch (error) {
console.error("Failed to initialize WebContainer:", error);
Expand Down
35 changes: 35 additions & 0 deletions src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Lightweight logger that is silent in production builds.
*
* Usage:
* import { logger } from '@/utils/logger';
* logger.debug('fetched', data); // only printed when import.meta.env.DEV === true
* logger.warn('something odd'); // always printed (maps to console.warn)
* logger.error('fatal', err); // always printed (maps to console.error)
*/

const isDev = import.meta.env.DEV;

Check failure on line 11 in src/utils/logger.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Build, Test

Property 'DEV' does not exist on type '{ readonly VITE_API_URL?: string | undefined; }'.

/* eslint-disable no-console */
export const logger = {
/** Debug-level messages — silenced in production. */
debug: (...args: unknown[]): void => {
if (isDev) console.log(...args);
},

/** Informational messages — silenced in production. */
info: (...args: unknown[]): void => {
if (isDev) console.info(...args);
},

/** Warnings — always visible. */
warn: (...args: unknown[]): void => {
console.warn(...args);
},

/** Errors — always visible. */
error: (...args: unknown[]): void => {
console.error(...args);
},
};
/* eslint-enable no-console */
Loading