{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "withdraw",
  "type": "registry:block",
  "title": "Stridge Withdraw",
  "description": "Providers + withdraw flow only. Drops `components/stridge/providers.tsx` and the withdraw composition stubs.",
  "dependencies": [
    "@stridge/kit"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "components/stridge/providers.tsx",
      "content": "\"use client\";\n\nimport { StridgeProvider } from \"@stridge/kit\";\nimport type { ReactNode } from \"react\";\n\ninterface Props {\n    children: ReactNode;\n}\n\n/**\n * Fail fast at module load when the workspace's gateway key is missing — without it every\n * driver call dies later with an opaque 4xx and integrators waste time chasing a misconfigured\n * env var. Pull yours from `Developer → Gateway Kit → Connection` in the Stridge dashboard.\n *\n * Wrapped in a function so TypeScript narrows `gatewayKey` to `string` past the assertion —\n * a top-level `throw` doesn't propagate the narrowing to subsequent module statements.\n */\nfunction requireGatewayKey(): string {\n    const key = process.env.NEXT_PUBLIC_STRIDGE_GATEWAY_KEY;\n    if (!key) {\n        throw new Error(\n            \"NEXT_PUBLIC_STRIDGE_GATEWAY_KEY is not set — add it to .env.local before mounting <StridgeAppProvider>.\",\n        );\n    }\n    return key;\n}\n\nconst gatewayKey = requireGatewayKey();\n\n/**\n * Wrap your app's root layout with this provider once. Every flow (deposit, withdraw, …) reads\n * its config off here — fill in the `TODO`s with your gateway key, settlement destination, and\n * any per-flow tuning you need.\n */\nexport function StridgeAppProvider({ children }: Props) {\n    return (\n        <StridgeProvider\n            environment=\"staging\"\n            gatewayKey={gatewayKey}\n            asset={{ networkId: \"1\", symbol: \"USDC\" }}\n            flows={{\n                deposit: {\n                    destination: { address: \"0x0000000000000000000000000000000000000000\" },\n                },\n                withdraw: {\n                    owner: { address: \"0x0000000000000000000000000000000000000000\" },\n                },\n            }}\n        >\n            {children}\n        </StridgeProvider>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/providers.tsx"
    },
    {
      "path": "components/stridge/withdraw/withdraw.tsx",
      "content": "\"use client\";\n\nimport {\n    useWithdraw,\n    useWithdrawBindings,\n    useWithdrawState,\n    type WithdrawBalanceInput,\n    type WithdrawSuggestedRecipient,\n} from \"@stridge/kit\";\nimport type { WithdrawSubmitCallback } from \"@stridge/kit/types\";\nimport { Dialog } from \"@stridge/kit/ui\";\nimport { Withdraw } from \"@stridge/kit/withdraw/compound\";\n\nimport { StridgeWithdrawActivityDetail } from \"./activity-detail\";\nimport { StridgeWithdrawActivityList } from \"./activity-list\";\nimport { StridgeWithdrawError } from \"./error\";\nimport { StridgeWithdrawForm } from \"./form\";\nimport { StridgeWithdrawInProgress } from \"./in-progress\";\nimport { StridgeWithdrawSuccess } from \"./success\";\n\ninterface Props {\n    /**\n     * Withdrawable balance to display in the form. Either a bare amount in display units or\n     * `{ amount, amountUsd? }` for an explicit pre-computed USD value. Pass `undefined` while\n     * loading; the form renders a skeleton until a value arrives.\n     */\n    balance?: WithdrawBalanceInput;\n    /**\n     * Submit handler — fires once the kit has prepared a fresh UDA target for the withdrawal.\n     * The host's backend broadcasts a transfer of the brand currency to that UDA; the kit hands\n     * a `WithdrawSubmitActions` handle the host calls (`beginProcessing` / `setTxHash` /\n     * `succeed` / `fail` / `decline`) to advance the FSM. **Required** — a missing callback\n     * lands the user on the error screen instead of an infinite spinner.\n     */\n    onSubmit?: WithdrawSubmitCallback;\n    /**\n     * Trusted recipient address surfaced as a one-click prefill chip next to the recipient\n     * input. Omit to hide the chip.\n     */\n    suggestedRecipient?: WithdrawSuggestedRecipient;\n}\n\n/**\n * Default withdraw composition. Mount once inside `<StridgeAppProvider>`; open it with\n * `useWithdraw().open(...)`. The form step covers both the idle form and the in-flight\n * `submitting` state — the kit collapses them so the widget keeps identity across submit.\n *\n * Publishes the host's bindings (`balance` / `onSubmit` / `suggestedRecipient`) into the\n * orchestrator's bindings context so the form widget can read them reactively. **`onSubmit`\n * is required** — without it, submit lands on the error screen.\n *\n * Interleave your own elements between any two parts, or replace a single `<Withdraw.Step>`\n * child with your own panel.\n */\nexport function StridgeWithdraw({ balance, onSubmit, suggestedRecipient }: Props = {}) {\n    const state = useWithdrawState();\n    const { close } = useWithdraw();\n    useWithdrawBindings({\n        ...(balance !== undefined ? { balance } : {}),\n        ...(onSubmit ? { onSubmit } : {}),\n        ...(suggestedRecipient ? { suggestedRecipient } : {}),\n    });\n    return (\n        <Dialog\n            open={state.name !== \"closed\"}\n            onOpenChange={(next: boolean) => {\n                if (!next) close();\n            }}\n        >\n            <Dialog.Content>\n                <Withdraw.Boundary>\n                    <Withdraw.Guards>\n                        <Withdraw.Steps>\n                            <Withdraw.Step name=\"form\">\n                                <StridgeWithdrawForm />\n                            </Withdraw.Step>\n                            <Withdraw.Step name=\"inProgress\">\n                                <StridgeWithdrawInProgress />\n                            </Withdraw.Step>\n                            <Withdraw.Step name=\"success\">\n                                <StridgeWithdrawSuccess />\n                            </Withdraw.Step>\n                            <Withdraw.Step name=\"error\">\n                                <StridgeWithdrawError />\n                            </Withdraw.Step>\n                            <Withdraw.Step name=\"activityList\">\n                                <StridgeWithdrawActivityList />\n                            </Withdraw.Step>\n                            <Withdraw.Step name=\"activityDetail\">\n                                <StridgeWithdrawActivityDetail />\n                            </Withdraw.Step>\n                        </Withdraw.Steps>\n                    </Withdraw.Guards>\n                </Withdraw.Boundary>\n            </Dialog.Content>\n        </Dialog>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/withdraw/withdraw.tsx"
    },
    {
      "path": "components/stridge/withdraw/form.tsx",
      "content": "\"use client\";\n\nimport { WithdrawForm } from \"@stridge/kit/withdraw/widgets\";\n\n/**\n * Form screen — also covers the in-flight `submitting` state (kit collapses it into `form` so the\n * widget keeps identity across submit). The kit reads source / receive assets, quote, and form\n * state from the driver and bindings context; sub-parts read from there.\n */\nexport function StridgeWithdrawForm() {\n    return (\n        <WithdrawForm>\n            <WithdrawForm.Header />\n            <WithdrawForm.Body>\n                <WithdrawForm.RecipientField />\n                <WithdrawForm.AmountField />\n                <WithdrawForm.ReceiveSelectors />\n                <WithdrawForm.BreakdownCard />\n            </WithdrawForm.Body>\n            <WithdrawForm.Footer />\n        </WithdrawForm>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/withdraw/form.tsx"
    },
    {
      "path": "components/stridge/withdraw/in-progress.tsx",
      "content": "\"use client\";\n\nimport { WithdrawInProgress } from \"@stridge/kit/withdraw/widgets\";\n\n/**\n * Withdraw in-progress screen. `<WithdrawInProgress.SourceTxRow />` resolves its label from\n * the orchestrated widget's context — it carries the withdraw-tuned \"Withdrawal tx\" copy by\n * default. Pass `label` if you want to override.\n */\nexport function StridgeWithdrawInProgress() {\n    return (\n        <WithdrawInProgress>\n            <WithdrawInProgress.Header />\n            <WithdrawInProgress.Body>\n                <WithdrawInProgress.Hero />\n                <WithdrawInProgress.StatusPill />\n                <WithdrawInProgress.Details>\n                    <WithdrawInProgress.SourceTxRow />\n                    <WithdrawInProgress.SubmittedAtRow />\n                </WithdrawInProgress.Details>\n            </WithdrawInProgress.Body>\n        </WithdrawInProgress>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/withdraw/in-progress.tsx"
    },
    {
      "path": "components/stridge/withdraw/success.tsx",
      "content": "\"use client\";\n\nimport { WithdrawSuccess } from \"@stridge/kit/withdraw/widgets\";\n\n/**\n * Withdraw success screen. Each row self-gates when its data is absent; `<MoreDetails>` only\n * renders when at least one of its rows would. `<WithdrawSuccess.DepositTxRow />` resolves its\n * label from the orchestrated widget's context — \"Withdrawal tx\" by default; pass `label` to\n * override.\n */\nexport function StridgeWithdrawSuccess() {\n    return (\n        <WithdrawSuccess>\n            <WithdrawSuccess.Header />\n            <WithdrawSuccess.Body>\n                <WithdrawSuccess.Headline />\n                <WithdrawSuccess.Details>\n                    <WithdrawSuccess.FillStatusRow />\n                    <WithdrawSuccess.TotalTimeRow />\n                    <WithdrawSuccess.DestinationRow />\n                    <WithdrawSuccess.YouReceiveRow />\n                    <WithdrawSuccess.MoreDetails>\n                        <WithdrawSuccess.DepositTxRow />\n                        <WithdrawSuccess.CompletionTxRow />\n                        <WithdrawSuccess.SubmittedAtRow />\n                        <WithdrawSuccess.FilledAtRow />\n                    </WithdrawSuccess.MoreDetails>\n                </WithdrawSuccess.Details>\n            </WithdrawSuccess.Body>\n            <WithdrawSuccess.Actions />\n        </WithdrawSuccess>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/withdraw/success.tsx"
    },
    {
      "path": "components/stridge/withdraw/error.tsx",
      "content": "\"use client\";\n\nimport { WithdrawError } from \"@stridge/kit/withdraw/widgets\";\n\n/**\n * Withdraw error screen. Sub-parts self-gate — settlement-derived failures fill the rows +\n * `<MoreDetails>`, FSM-derived failures drop the empty rows. `<WithdrawError.DepositTxRow />`\n * resolves its label from the orchestrated widget's context — \"Withdrawal tx\" by default;\n * pass `label` to override.\n */\nexport function StridgeWithdrawError() {\n    return (\n        <WithdrawError>\n            <WithdrawError.Header />\n            <WithdrawError.Body>\n                <WithdrawError.Hero />\n                <WithdrawError.Details>\n                    <WithdrawError.FillStatusRow />\n                    <WithdrawError.DestinationRow />\n                    <WithdrawError.YouReceiveRow />\n                    <WithdrawError.MoreDetails>\n                        <WithdrawError.DepositTxRow />\n                        <WithdrawError.SubmittedAtRow />\n                        <WithdrawError.FailedAtRow />\n                    </WithdrawError.MoreDetails>\n                </WithdrawError.Details>\n                <WithdrawError.HelpInfo />\n            </WithdrawError.Body>\n            <WithdrawError.Actions />\n        </WithdrawError>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/withdraw/error.tsx"
    },
    {
      "path": "components/stridge/withdraw/activity-list.tsx",
      "content": "\"use client\";\n\nimport { WithdrawActivityList } from \"@stridge/kit/withdraw/widgets\";\n\n/**\n * Activity activity list step. Mounts the withdraw-orchestrated list wrapper with the\n * compound's default composition.\n */\nexport function StridgeWithdrawActivityList() {\n    return (\n        <WithdrawActivityList>\n            <WithdrawActivityList.Header />\n            <WithdrawActivityList.List />\n        </WithdrawActivityList>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/withdraw/activity-list.tsx"
    },
    {
      "path": "components/stridge/withdraw/activity-detail.tsx",
      "content": "\"use client\";\n\nimport { WithdrawActivityDetail } from \"@stridge/kit/withdraw/widgets\";\n\n/**\n * Activity activity per-settlement detail step. Mounts all three per-kind parts of the\n * withdraw-orchestrated detail wrapper; each gates internally on the resolved payload's\n * `kind`.\n */\nexport function StridgeWithdrawActivityDetail() {\n    return (\n        <WithdrawActivityDetail>\n            <WithdrawActivityDetail.Processing />\n            <WithdrawActivityDetail.Succeeded />\n            <WithdrawActivityDetail.Failed />\n        </WithdrawActivityDetail>\n    );\n}\n",
      "type": "registry:component",
      "target": "components/stridge/withdraw/activity-detail.tsx"
    }
  ]
}
