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
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contracts/**/test_snapshots/
coverage/

# TypeScript build info cache
tsconfig.tsbuildinfo
*.tsbuildinfo

# Playwright test results and reports
test-results/
Expand All @@ -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
23 changes: 13 additions & 10 deletions hooks/use-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 8 additions & 2 deletions hooks/use-webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>
}

function loadWebhooks(): WebhookConfig[] {
if (typeof window === 'undefined') return []
try {
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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 }
Expand Down
3 changes: 2 additions & 1 deletion lib/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down