diff --git a/.gitignore b/.gitignore index 7e47123..9946fef 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ contracts/**/test_snapshots/ coverage/ # TypeScript build info cache -tsconfig.tsbuildinfo +*.tsbuildinfo # Playwright test results and reports test-results/ @@ -47,3 +47,22 @@ pnpm-lock.yaml .vscode/ .DS_Store Thumbs.db + +# Build output +dist/ + +# Monorepo / Turborepo cache +.turbo/ + +# Broader env file catch +*.local +.env + +# Storybook static output +storybook-static/ + +# Istanbul / NYC coverage output +.nyc_output/ + +# CI test reports +junit.xml diff --git a/hooks/use-contract.ts b/hooks/use-contract.ts index 3193a99..d1e575f 100644 --- a/hooks/use-contract.ts +++ b/hooks/use-contract.ts @@ -38,16 +38,19 @@ function showErrorToast(err: unknown, toastId?: string | number) { duration: 7000, ...(toastId ? { id: toastId } : {}), action: mapped.details - ? { - label: "Details", - onClick: () => { - const short = - mapped.details!.length > 200 - ? mapped.details!.slice(0, 200) + "…" - : mapped.details!; - toast.info(short, { duration: 10000 }); - }, - } + ? (() => { + const details = mapped.details; + return { + label: "Details", + onClick: () => { + const short = + details.length > 200 + ? details.slice(0, 200) + "…" + : details; + toast.info(short, { duration: 10000 }); + }, + }; + })() : undefined, }; toast.error(mapped.message, opts); diff --git a/hooks/use-webhooks.ts b/hooks/use-webhooks.ts index f073f62..8df9388 100644 --- a/hooks/use-webhooks.ts +++ b/hooks/use-webhooks.ts @@ -30,6 +30,12 @@ const STORAGE_KEY = 'flowstar_webhooks' const HISTORY_KEY = 'flowstar_webhook_history' const MAX_HISTORY = 50 +export interface WebhookPayload { + event: WebhookEventType | string + timestamp: string + data: Record +} + function loadWebhooks(): WebhookConfig[] { if (typeof window === 'undefined') return [] try { @@ -58,7 +64,7 @@ function saveHistory(history: WebhookDelivery[]) { async function deliverWithRetry( url: string, - payload: object, + payload: WebhookPayload, retries = 3 ): Promise<{ statusCode: number | null; success: boolean }> { for (let attempt = 0; attempt < retries; attempt++) { @@ -120,7 +126,7 @@ export function useWebhooks() { }, []) const fireEvent = useCallback( - async (eventType: WebhookEventType, data: object) => { + async (eventType: WebhookEventType, data: WebhookPayload) => { const active = webhooks.filter((h) => h.enabled && h.events.includes(eventType)) for (const hook of active) { const payload = { event: eventType, timestamp: new Date().toISOString(), data } diff --git a/lib/contract.ts b/lib/contract.ts index c74c38a..96cb3db 100644 --- a/lib/contract.ts +++ b/lib/contract.ts @@ -181,7 +181,8 @@ async function invoke( error?: { message: string } } if (pollJson.error) throw new Error(`Poll failed: ${pollJson.error.message}`) - pollStatus = pollJson.result!.status + if (!pollJson.result) continue + pollStatus = pollJson.result.status } if (pollStatus === 'FAILED') throw new Error('Transaction failed on-chain')