Skip to content

feat: probe contract recipient for withdraw() entry point - #520

Open
ZacLou wants to merge 3 commits into
conduit-protocol:mainfrom
ZacLou:feat/contract-recipient-withdraw-probe-458
Open

feat: probe contract recipient for withdraw() entry point#520
ZacLou wants to merge 3 commits into
conduit-protocol:mainfrom
ZacLou:feat/contract-recipient-withdraw-probe-458

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses #458

Problem

The create form warned users about contract recipients but didn't actually probe for a withdraw entry point. Users had to guess whether the contract could pull funds.

Solution

  1. lib/contract-recipient-probe.ts (new) — checkContractHasWithdraw() function that simulates a read-only withdraw() call via simulateReadOnly(). Returns true if the simulation succeeds, false if it fails (function not found, wrong signature, etc.)

  2. app/create/page.tsx — after the recipient existence check passes for a contract address, the form now:

    • Transitions to contract-checking status
    • Probes the contract for withdraw() capability
    • Sets contract-no-withdraw status if the probe fails
    • Falls back to valid if the probe itself errors (network issue)
  3. UI — two new status displays:

    • contract-checking: blue status text 'Checking if this contract can call withdraw()...'
    • contract-no-withdraw: orange warning about potential stranded funds
  4. Submit guard — blocks submission when contract-no-withdraw is active

Files changed

  • lib/contract-recipient-probe.ts (new)
  • app/create/page.tsx (probe logic + UI)

ZacLou and others added 2 commits September 5, 2026 21:43
…otocol#458)

When the recipient is a contract address, the create form now simulates
a read-only withdraw() call to check if the contract exposes that
function. If the simulation fails, the user sees a warning that funds
may become stranded and submit is blocked.

- New lib/contract-recipient-probe.ts with checkContractHasWithdraw()
- Two new recipient statuses: 'contract-checking', 'contract-no-withdraw'
- UI shows progress and warning for the probe result
- Submit blocked when probe finds no withdraw() capability
- Falls back to 'valid' if the probe itself fails (network error)

Addresses conduit-protocol#458
@ZacLou
ZacLou force-pushed the feat/contract-recipient-withdraw-probe-458 branch from 678821a to 258c03c Compare September 5, 2026 13:44
@ZacLou

ZacLou commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main and fixed the merge-artifact in app/create/__tests__/page.test.tsx that caused the lint parse error.

Note: the Unit tests job is still failing, but the failures are pre-existing on upstream/main (same 25 failures in WalletContext.test.tsx and app/settings/__tests__/page.test.tsx). The PR-specific tests in app/create/__tests__/page.test.tsx pass (12/12).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants